From 773d118ed73e0e385b164095a3172c08a563c8e3 Mon Sep 17 00:00:00 2001 From: Daniel Knopik Date: Tue, 7 Oct 2025 15:01:53 +0200 Subject: [PATCH] fix: Use correct slot for validator registration signature message --- anchor/validator_store/src/lib.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/anchor/validator_store/src/lib.rs b/anchor/validator_store/src/lib.rs index f80a2c8a5..4c06487bc 100644 --- a/anchor/validator_store/src/lib.rs +++ b/anchor/validator_store/src/lib.rs @@ -1086,16 +1086,20 @@ impl ValidatorStore for AnchorValidatorStore { let (validator, cluster) = self.get_validator_and_cluster(validator_registration_data.pubkey)?; - // SSV always uses the start of the current epoch, so we need to convert to that - let epoch = self + // Go-SSV always uses the start of the current epoch for the timestamp in + // `ValidatorRegistrationData`, so we need to convert to that. However, it uses the duty + // slot (which is passed in) for the signature message, so we need to pass that to + // `collect_signature`. + let duty_slot = self .slot_clock .slot_of(Duration::from_secs(validator_registration_data.timestamp)) - .ok_or(SpecificError::SlotClock)? - .epoch(E::slots_per_epoch()); - let slot = epoch.start_slot(E::slots_per_epoch()); + .ok_or(SpecificError::SlotClock)?; + let epoch_start_slot = duty_slot + .epoch(E::slots_per_epoch()) + .start_slot(E::slots_per_epoch()); let duration = self .slot_clock - .start_of(slot) + .start_of(epoch_start_slot) .ok_or(SpecificError::SlotClock)?; let validator_registration_data = ValidatorRegistrationData { timestamp: duration.as_secs(), @@ -1112,7 +1116,7 @@ impl ValidatorStore for AnchorValidatorStore { &validator, &cluster, signing_root, - slot, + duty_slot, ) .await?;