Test spec invariant

This commit is contained in:
dapplion
2024-06-19 11:39:45 +02:00
parent 370d511223
commit cbb7c5d8f4
2 changed files with 4 additions and 1 deletions

View File

@@ -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]

View File

@@ -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,