mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 18:04:18 +00:00
Avoid looking up pre-finalization blocks (#2909)
## Issue Addressed
This PR fixes the unnecessary `WARN Single block lookup failed` messages described here:
https://github.com/sigp/lighthouse/pull/2866#issuecomment-1008442640
## Proposed Changes
Add a new cache to the `BeaconChain` that tracks the block roots of blocks from before finalization. These could be blocks from the canonical chain (which might need to be read from disk), or old pre-finalization blocks that have been forked out.
The cache also stores a set of block roots for in-progress single block lookups, which duplicates some of the information from sync's `single_block_lookups` hashmap:
a836e180f9/beacon_node/network/src/sync/manager.rs (L192-L196)
On a live node you can confirm that the cache is working by grepping logs for the message: `Rejected attestation to finalized block`.
This commit is contained in:
@@ -1701,6 +1701,26 @@ impl<T: BeaconChainTypes> Worker<T> {
|
||||
"attn_too_many_skipped_slots",
|
||||
);
|
||||
}
|
||||
AttnError::HeadBlockFinalized { beacon_block_root } => {
|
||||
debug!(
|
||||
self.log,
|
||||
"Rejected attestation to finalized block";
|
||||
"block_root" => ?beacon_block_root,
|
||||
"attestation_slot" => failed_att.attestation().data.slot,
|
||||
);
|
||||
|
||||
// We have to reject the message as it isn't a descendant of the finalized
|
||||
// checkpoint.
|
||||
self.propagate_validation_result(message_id, peer_id, MessageAcceptance::Reject);
|
||||
|
||||
// The peer that sent us this could be a lagger, or a spammer, or this failure could
|
||||
// be due to us processing attestations extremely slowly. Don't be too harsh.
|
||||
self.gossip_penalize_peer(
|
||||
peer_id,
|
||||
PeerAction::HighToleranceError,
|
||||
"attn_to_finalized_block",
|
||||
);
|
||||
}
|
||||
AttnError::BeaconChainError(BeaconChainError::DBError(Error::HotColdDBError(
|
||||
HotColdDBError::AttestationStateIsFinalized { .. },
|
||||
))) => {
|
||||
|
||||
Reference in New Issue
Block a user