Skip to content

Commit

Permalink
Test spec invariant
Browse files Browse the repository at this point in the history
  • Loading branch information
dapplion committed Jun 19, 2024
1 parent 370d511 commit cbb7c5d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions consensus/types/src/eth_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,10 +545,12 @@ impl EthSpec for GnosisEthSpec {
#[cfg(test)]
mod test {
use crate::{EthSpec, GnosisEthSpec, MainnetEthSpec, MinimalEthSpec};
use ssz_types::typenum::Unsigned;

fn assert_valid_spec<E: EthSpec>() {
E::kzg_commitments_tree_depth();
E::block_body_tree_depth();
assert!(E::MaxValidatorsPerSlot::to_i32() >= E::MaxValidatorsPerCommittee::to_i32());
}

#[test]
Expand Down
3 changes: 2 additions & 1 deletion consensus/types/src/indexed_attestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ impl<E: EthSpec> IndexedAttestation<E> {
let extended_attesting_indices: VariableList<u64, E::MaxValidatorsPerSlot> =
VariableList::new(att.attesting_indices.to_vec())
.expect("MaxValidatorsPerSlot must be >= MaxValidatorsPerCommittee");
// TODO: Add test after unstable rebase https://github.com/sigp/lighthouse/blob/474c1b44863927c588dd05ab2ac0f934298398e1/consensus/types/src/eth_spec.rs#L541
// Note a unit test in consensus/types/src/eth_spec.rs asserts this invariant for
// all known specs

IndexedAttestationElectra {
attesting_indices: extended_attesting_indices,
Expand Down

0 comments on commit cbb7c5d

Please sign in to comment.