mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
Add check for head/target consistency (#1702)
## Issue Addressed NA ## Proposed Changes Addresses an interesting DoS vector raised by @protolambda by verifying that the head and target are consistent when processing aggregate attestations. This check prevents us from loading very old target blocks and doing lots of work to skip them to the current slot. ## Additional Info NA
This commit is contained in:
@@ -278,6 +278,21 @@ fn aggregated_gossip_verification() {
|
||||
&& earliest_permissible_slot == current_slot - E::slots_per_epoch() - 1
|
||||
);
|
||||
|
||||
/*
|
||||
* This is not in the specification for aggregate attestations (only unaggregates), but we
|
||||
* check it anyway to avoid weird edge cases.
|
||||
*/
|
||||
let unknown_root = Hash256::from_low_u64_le(424242);
|
||||
assert_invalid!(
|
||||
"attestation with invalid target root",
|
||||
{
|
||||
let mut a = valid_aggregate.clone();
|
||||
a.message.aggregate.data.target.root = unknown_root;
|
||||
a
|
||||
},
|
||||
AttnError::InvalidTargetRoot { .. }
|
||||
);
|
||||
|
||||
/*
|
||||
* The following test ensures:
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user