Refactor timestamp_now (#9094)

#9077


  Where possible replaces all instances of `validator_monitor::timestamp_now` with `chain.slot_clock.now_duration().unwrap_or_default()`.
Where chain/slot_clock is not available, instead replace it with a convenience function `slot_clock::timestamp_now`.
Remove the `validator_monitor::timestamp_now` function.


Co-Authored-By: Mac L <mjladson@pm.me>
This commit is contained in:
Mac L
2026-04-09 12:41:02 +04:00
committed by GitHub
parent fb5a0434d7
commit 7c2dcfc0d6
12 changed files with 60 additions and 60 deletions

View File

@@ -49,7 +49,6 @@ use crate::sync::block_lookups::{
use crate::sync::custody_backfill_sync::CustodyBackFillSync;
use crate::sync::network_context::{PeerGroup, RpcResponseResult};
use beacon_chain::block_verification_types::AsBlock;
use beacon_chain::validator_monitor::timestamp_now;
use beacon_chain::{
AvailabilityProcessingStatus, BeaconChain, BeaconChainTypes, BlockError, EngineState,
};
@@ -851,7 +850,7 @@ impl<T: BeaconChainTypes> SyncManager<T> {
BlockComponent::Block(DownloadResult {
value: block.block_cloned(),
block_root,
seen_timestamp: timestamp_now(),
seen_timestamp: self.chain.slot_clock.now_duration().unwrap_or_default(),
peer_group: PeerGroup::from_single(peer_id),
}),
);
@@ -869,7 +868,7 @@ impl<T: BeaconChainTypes> SyncManager<T> {
BlockComponent::Blob(DownloadResult {
value: blob,
block_root,
seen_timestamp: timestamp_now(),
seen_timestamp: self.chain.slot_clock.now_duration().unwrap_or_default(),
peer_group: PeerGroup::from_single(peer_id),
}),
);
@@ -889,7 +888,11 @@ impl<T: BeaconChainTypes> SyncManager<T> {
BlockComponent::DataColumn(DownloadResult {
value: data_column,
block_root,
seen_timestamp: timestamp_now(),
seen_timestamp: self
.chain
.slot_clock
.now_duration()
.unwrap_or_default(),
peer_group: PeerGroup::from_single(peer_id),
}),
);