Skip to content

Commit

Permalink
Add debug info to ParticipationCountMismatch error
Browse files Browse the repository at this point in the history
  • Loading branch information
Tumas committed May 14, 2024
1 parent 980101e commit d20d4f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion helper_functions/src/electra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ pub fn get_attesting_indices<P: Preset>(
// This works the same as `assert len(attestation.aggregation_bits) == participants_count`
ensure!(
committee_offset == attestation.aggregation_bits.len(),
Error::ParticipantsCountMismatch,
Error::ParticipantsCountMismatch {
aggregation_bitlist_length: attestation.aggregation_bits.len(),
participants_count: committee_offset
},
);

Ok(output)
Expand Down
7 changes: 5 additions & 2 deletions helper_functions/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ pub(crate) enum Error {
FailedToSelectProposer,
#[error("no validators are active")]
NoActiveValidators,
#[error("aggregation bitlist length does not match participants count")]
ParticipantsCountMismatch,
#[error("aggregation bitlist length {aggregation_bitlist_length} does not match participants count {participants_count}")]
ParticipantsCountMismatch {
aggregation_bitlist_length: usize,
participants_count: usize,
},
#[error("permutated prefix maximum overflowed")]
PermutatedPrefixMaximumOverflow,
#[error("{0} is invalid")]
Expand Down

0 comments on commit d20d4f6

Please sign in to comment.