From 144978f8f8359ffc5b89baf5c5e0136d313a2886 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Thu, 2 Dec 2021 09:01:36 +1100 Subject: [PATCH] Remove duplicate slot_clock method (#2842) --- beacon_node/beacon_chain/src/execution_payload.rs | 3 ++- common/slot_clock/src/lib.rs | 10 ---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/beacon_node/beacon_chain/src/execution_payload.rs b/beacon_node/beacon_chain/src/execution_payload.rs index 8b3d0d23d..cdf1d7b6a 100644 --- a/beacon_node/beacon_chain/src/execution_payload.rs +++ b/beacon_node/beacon_chain/src/execution_payload.rs @@ -168,7 +168,8 @@ pub fn validate_execution_payload_for_gossip( if is_merge_complete || execution_payload != &<_>::default() { let expected_timestamp = chain .slot_clock - .compute_timestamp_at_slot(block.slot()) + .start_of(block.slot()) + .map(|d| d.as_secs()) .ok_or(BlockError::BeaconChainError( BeaconChainError::UnableToComputeTimeAtSlot, ))?; diff --git a/common/slot_clock/src/lib.rs b/common/slot_clock/src/lib.rs index 18b7fd322..9fa24a022 100644 --- a/common/slot_clock/src/lib.rs +++ b/common/slot_clock/src/lib.rs @@ -102,14 +102,4 @@ pub trait SlotClock: Send + Sync + Sized + Clone { fn sync_committee_contribution_production_delay(&self) -> Duration { self.slot_duration() * 2 / 3 } - - /// An implementation of the method described in the consensus spec here: - /// - /// https://github.com/ethereum/consensus-specs/blob/dev/specs/merge/beacon-chain.md#compute_timestamp_at_slot - fn compute_timestamp_at_slot(&self, slot: Slot) -> Option { - let slots_since_genesis = slot.as_u64().checked_sub(self.genesis_slot().as_u64())?; - slots_since_genesis - .checked_mul(self.slot_duration().as_secs()) - .and_then(|since_genesis| self.genesis_duration().as_secs().checked_add(since_genesis)) - } }