Skip to content

Commit 880f322

Browse files
committed
Pass slot to randao reveal
1 parent 5abbdb6 commit 880f322

4 files changed

Lines changed: 11 additions & 5 deletions

File tree

testing/web3signer_tests/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,9 +591,9 @@ mod tests {
591591
.await
592592
.assert_signatures_match("randao_reveal", |pubkey, validator_store| async move {
593593
validator_store
594-
.randao_reveal(pubkey, Epoch::new(0))
594+
.randao_reveal(pubkey, Slot::new(0))
595595
.await
596-
.unwrap()
596+
.expect("randao reveal should sign")
597597
})
598598
.await
599599
.assert_signatures_match("beacon_block_base", |pubkey, validator_store| {

validator_client/lighthouse_validator_store/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,9 +702,10 @@ impl<T: SlotClock + 'static, E: EthSpec> ValidatorStore for LighthouseValidatorS
702702
async fn randao_reveal(
703703
&self,
704704
validator_pubkey: PublicKeyBytes,
705-
signing_epoch: Epoch,
705+
slot: Slot,
706706
) -> Result<Signature, Error> {
707707
let signing_method = self.doppelganger_checked_signing_method(validator_pubkey)?;
708+
let signing_epoch = slot.epoch(E::slots_per_epoch());
708709
let signing_context = self.signing_context(Domain::Randao, signing_epoch);
709710

710711
let signature = signing_method

validator_client/validator_services/src/block_service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ impl<S: ValidatorStore + 'static, T: SlotClock + 'static> BlockService<S, T> {
409409

410410
let randao_reveal = match self
411411
.validator_store
412-
.randao_reveal(validator_pubkey, slot.epoch(S::E::slots_per_epoch()))
412+
.randao_reveal(validator_pubkey, slot)
413413
.await
414414
{
415415
Ok(signature) => signature.into(),

validator_client/validator_store/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,15 @@ pub trait ValidatorStore: Send + Sync {
8888
/// - Else return `None` to indicate no preference between builder and local payloads.
8989
fn determine_builder_boost_factor(&self, validator_pubkey: &PublicKeyBytes) -> Option<u64>;
9090

91+
/// Produce a RANDAO reveal for a block proposal at `slot`.
92+
///
93+
/// The RANDAO message signs the epoch containing `slot`, but callers pass
94+
/// the proposer slot so validator store implementations keep the full duty
95+
/// context.
9196
fn randao_reveal(
9297
&self,
9398
validator_pubkey: PublicKeyBytes,
94-
signing_epoch: Epoch,
99+
slot: Slot,
95100
) -> impl Future<Output = Result<Signature, Error<Self::Error>>> + Send;
96101

97102
fn set_validator_index(&self, validator_pubkey: &PublicKeyBytes, index: u64);

0 commit comments

Comments
 (0)