Skip to content
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

fix get attesting indices #5742

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions consensus/state_processing/src/common/get_attesting_indices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,15 @@ pub mod attesting_indices_electra {
.map(|committee| (committee.index, committee))
.collect();

let committee_count_per_slot = committees.len() as u64;
let mut participant_count = 0;
for index in committee_indices {
if let Some(&beacon_committee) = committees_map.get(&index) {
if aggregation_bits.len() != beacon_committee.committee.len() {
// This check is new to the spec's `process_attestation` in Electra.
if index >= committee_count_per_slot {
return Err(BeaconStateError::InvalidBitfield);
}
participant_count.safe_add_assign(beacon_committee.committee.len() as u64)?;
let committee_attesters = beacon_committee
.committee
.iter()
Expand All @@ -138,8 +142,11 @@ pub mod attesting_indices_electra {
} else {
return Err(Error::NoCommitteeFound);
}
}

// TODO(electra) what should we do when theres no committee found for a given index?
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also i removed this todo because it looks like we error in this case already (L139) which looks right to me

// This check is new to the spec's `process_attestation` in Electra.
if participant_count as usize != aggregation_bits.len() {
return Err(BeaconStateError::InvalidBitfield);
}

let mut indices = output.into_iter().collect_vec();
Expand Down
Loading