-
Notifications
You must be signed in to change notification settings - Fork 886
Reject attestations to blocks prior to the split #7084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
b911048
efaab87
21478e5
9d2ebf7
72ef42b
b8d2a8c
f121c4a
fb9e049
5c56a83
0a53a24
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -858,6 +858,9 @@ impl<'a, T: BeaconChainTypes> IndexedUnaggregatedAttestation<'a, T> { | |
// Check the attestation target root is consistent with the head root. | ||
verify_attestation_target_root::<T::EthSpec>(&head_block, attestation)?; | ||
|
||
// Do not process an attestation that doesn't descend from the finalized root. | ||
verify_attestation_is_finalized_checkpoint_or_descendant(attestation, chain)?; | ||
|
||
Ok(()) | ||
} | ||
|
||
|
@@ -1361,6 +1364,29 @@ pub fn verify_committee_index<E: EthSpec>(attestation: AttestationRef<E>) -> Res | |
Ok(()) | ||
} | ||
|
||
fn verify_attestation_is_finalized_checkpoint_or_descendant<T: BeaconChainTypes>( | ||
attestation: AttestationRef<T::EthSpec>, | ||
chain: &BeaconChain<T>, | ||
) -> Result<(), Error> { | ||
// If we have a split block newer than finalization then we also ban attestations which are not | ||
// descended from that split block. | ||
let fork_choice = chain.canonical_head.fork_choice_read_lock(); | ||
let split = chain.store.get_split_info(); | ||
let attestation_block_root = attestation.data().beacon_block_root; | ||
let is_descendant_from_split_block = | ||
split.slot == 0 || fork_choice.is_descendant(split.block_root, attestation_block_root); | ||
|
||
if fork_choice.is_finalized_checkpoint_or_descendant(attestation_block_root) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it might be better to fold these checks into So I think we can add these checks in the case where There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the check in |
||
&& is_descendant_from_split_block | ||
{ | ||
Ok(()) | ||
} else { | ||
Err(Error::HeadBlockFinalized { | ||
attestation_block_root, | ||
}) | ||
} | ||
} | ||
|
||
/// Assists in readability. | ||
type CommitteesPerSlot = u64; | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.