mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-19 05:48:31 +00:00
Add check for aggregate target (#2306)
## Issue Addressed
NA
## Proposed Changes
- Ensure that the [target consistency check](b356f52c5c) is always performed on aggregates.
- Add a regression test.
## Additional Info
NA
This commit is contained in:
@@ -276,6 +276,23 @@ fn aggregated_gossip_verification() {
|
||||
&& earliest_permissible_slot == current_slot - E::slots_per_epoch() - 1
|
||||
);
|
||||
|
||||
/*
|
||||
* The following test ensures:
|
||||
*
|
||||
* The aggregate attestation's epoch matches its target -- i.e. `aggregate.data.target.epoch ==
|
||||
* compute_epoch_at_slot(attestation.data.slot)`
|
||||
*
|
||||
*/
|
||||
|
||||
assert_invalid!(
|
||||
"attestation with invalid target epoch",
|
||||
{
|
||||
let mut a = valid_aggregate.clone();
|
||||
a.message.aggregate.data.target.epoch += 1;
|
||||
a
|
||||
},
|
||||
AttnError::InvalidTargetEpoch { .. }
|
||||
);
|
||||
/*
|
||||
* This is not in the specification for aggregate attestations (only unaggregates), but we
|
||||
* check it anyway to avoid weird edge cases.
|
||||
|
||||
Reference in New Issue
Block a user