Skip to content

Commit

Permalink
better errors
Browse files Browse the repository at this point in the history
  • Loading branch information
realbigsean committed May 8, 2024
1 parent df82181 commit 41b0c69
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pub mod attesting_indices_electra {
if let Some(&beacon_committee) = committees_map.get(&index) {
// This check is new to the spec's `process_attestation` in Electra.
if index >= committee_count_per_slot {
return Err(BeaconStateError::InvalidBitfield);
return Err(BeaconStateError::InvalidCommitteeIndex(index));
}
participant_count.safe_add_assign(beacon_committee.committee.len() as u64)?;
let committee_attesters = beacon_committee
Expand All @@ -140,7 +140,7 @@ pub mod attesting_indices_electra {

committee_offset.safe_add(beacon_committee.committee.len())?;
} else {
return Err(Error::NoCommitteeFound);
return Err(Error::NoCommitteeFound(index));
}
}

Expand Down
3 changes: 2 additions & 1 deletion consensus/types/src/beacon_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ pub enum Error {
IndexNotSupported(usize),
InvalidFlagIndex(usize),
MerkleTreeError(merkle_proof::MerkleTreeError),
NoCommitteeFound,
NoCommitteeFound(CommitteeIndex),
InvalidCommitteeIndex(CommitteeIndex),
}

/// Control whether an epoch-indexed field can be indexed at the next epoch or not.
Expand Down

0 comments on commit 41b0c69

Please sign in to comment.