Skip to content

Commit 72ef42b

Browse files
committed
fix descent from split check
1 parent 9d2ebf7 commit 72ef42b

File tree

2 files changed

+11
-25
lines changed

2 files changed

+11
-25
lines changed

beacon_node/beacon_chain/src/attestation_verification.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,12 +1368,19 @@ fn verify_attestation_is_finalized_checkpoint_or_descendant<T: BeaconChainTypes>
13681368
chain: &BeaconChain<T>,
13691369
) -> bool {
13701370
// If we have a split block newer than finalization then we also ban attestations which are not
1371-
// descended from that split block.
1371+
// descended from that split block. It's important not to try checking `is_descendant` if
1372+
// finality is ahead of the split and the split block has been pruned, as `is_descendant` will
1373+
// return `false` in this case.
13721374
let fork_choice = chain.canonical_head.fork_choice_read_lock();
1373-
let split = chain.store.get_split_info();
13741375
let attestation_block_root = attestation_data.beacon_block_root;
1375-
let is_descendant_from_split_block =
1376-
split.slot == 0 || fork_choice.is_descendant(split.block_root, attestation_block_root);
1376+
let finalized_slot = fork_choice
1377+
.finalized_checkpoint()
1378+
.epoch
1379+
.start_slot(T::EthSpec::slots_per_epoch());
1380+
let split = chain.store.get_split_info();
1381+
let is_descendant_from_split_block = split.slot == 0
1382+
|| split.slot <= finalized_slot
1383+
|| fork_choice.is_descendant(split.block_root, attestation_block_root);
13771384

13781385
fork_choice.is_finalized_checkpoint_or_descendant(attestation_block_root)
13791386
&& is_descendant_from_split_block

beacon_node/network/src/network_beacon_processor/gossip_methods.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2893,27 +2893,6 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
28932893
);
28942894
self.propagate_validation_result(message_id, peer_id, MessageAcceptance::Ignore);
28952895
}
2896-
AttnError::NotFinalizedDescendant {
2897-
attestation_block_root,
2898-
attestation_slot,
2899-
} => {
2900-
error!(
2901-
self.log,
2902-
"Could not verify the attestation for gossip. Rejecting the attestation";
2903-
"attestation_block_root" => ?attestation_block_root,
2904-
"slot" => ?attestation_slot,
2905-
"type" => ?attestation_type,
2906-
"peer_id" => %peer_id,
2907-
);
2908-
// There's no reason for an honest and non-buggy client to be gossiping
2909-
// attestations that blatantly conflict with finalization.
2910-
self.gossip_penalize_peer(
2911-
peer_id,
2912-
PeerAction::LowToleranceError,
2913-
"gossip_attestation_invalid",
2914-
);
2915-
self.propagate_validation_result(message_id, peer_id, MessageAcceptance::Reject);
2916-
}
29172896
}
29182897

29192898
debug!(

0 commit comments

Comments
 (0)