Skip to content

Commit 73e9a82

Browse files
committed
chore: skip updating attester and sync voting assignments if error from the poll channels
1 parent f8eb05f commit 73e9a82

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

anchor/validator_store/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl<T: SlotClock, E: EthSpec> AnchorValidatorStore<T, E> {
303303
// Determine the appropriate version based on block type
304304
let block_version = block.fork_name_unchecked().into();
305305

306-
// Create the validator voting assignmentsrmation
306+
// Create the validator duty information
307307
let validator_duty = ValidatorDuty {
308308
r#type: BEACON_ROLE_PROPOSER,
309309
pub_key: validator.public_key,
@@ -750,7 +750,7 @@ struct VotingContext {
750750
beacon_vote: BeaconVote,
751751
}
752752

753-
/// Cached validator voting assignmentsrmation for a slot.
753+
/// Cached validator voting assignments for a slot.
754754
///
755755
/// This struct caches voting assignments computed at slot start and reuses it at 1/3 slot,
756756
/// eliminating redundant computation. It supports two different counting patterns:

anchor/validator_store/src/metadata_service.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,16 @@ impl<E: EthSpec, T: SlotClock + 'static> MetadataService<E, T> {
9090

9191
// Wait for BOTH DutiesService polls to complete for this slot.
9292
// This guarantees duties are cached before we read them.
93-
let _ = attesters_poll_rx.wait_for(|&s| s >= slot).await;
94-
let _ = sync_poll_rx.wait_for(|&s| s >= slot).await;
93+
// If poll channels are closed, skip this slot to avoid signing with stale
94+
// data.
95+
if attesters_poll_rx.wait_for(|&s| s >= slot).await.is_err() {
96+
error!(%slot, "Attesters poll channel closed, skipping slot");
97+
continue;
98+
}
99+
if sync_poll_rx.wait_for(|&s| s >= slot).await.is_err() {
100+
error!(%slot, "Sync poll channel closed, skipping slot");
101+
continue;
102+
}
95103

96104
if let Err(err) = self_clone_phase1.update_voting_assignments() {
97105
error!(err, "Failed to update validator voting assignments");

0 commit comments

Comments
 (0)