diff --git a/beacon_node/beacon_chain/src/attestation_verification.rs b/beacon_node/beacon_chain/src/attestation_verification.rs index 3d722a534be..62e65d5f87a 100644 --- a/beacon_node/beacon_chain/src/attestation_verification.rs +++ b/beacon_node/beacon_chain/src/attestation_verification.rs @@ -1309,11 +1309,10 @@ pub fn obtain_indexed_attestation_and_committees_per_slot( attesting_indices_electra::get_indexed_attestation(&committees, att) .map(|attestation| (attestation, committees_per_slot)) .map_err(|e| { - let index = att.committee_index(); - if e == BlockOperationError::BeaconStateError(NoCommitteeFound(index)) { + if e == BlockOperationError::BeaconStateError(NoCommitteeFound) { Error::NoCommitteeForSlotAndIndex { slot: att.data.slot, - index, + index: att.committee_index(), } } else { Error::Invalid(e) diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index 331e04069fd..973dcaadb47 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -1612,28 +1612,11 @@ impl BeaconChain { /// Returns an aggregated `Attestation`, if any, that has a matching `attestation.data`. /// /// The attestation will be obtained from `self.naive_aggregation_pool`. - pub fn get_aggregated_attestation_base( + pub fn get_aggregated_attestation( &self, data: &AttestationData, ) -> Result>, Error> { - let attestation_key = crate::naive_aggregation_pool::AttestationKey::new_base(data); - if let Some(attestation) = self.naive_aggregation_pool.read().get(&attestation_key) { - self.filter_optimistic_attestation(attestation) - .map(Option::Some) - } else { - Ok(None) - } - } - - // TODO(electra): call this function from the new beacon API method - pub fn get_aggregated_attestation_electra( - &self, - data: &AttestationData, - committee_index: CommitteeIndex, - ) -> Result>, Error> { - let attestation_key = - crate::naive_aggregation_pool::AttestationKey::new_electra(data, committee_index); - if let Some(attestation) = self.naive_aggregation_pool.read().get(&attestation_key) { + if let Some(attestation) = self.naive_aggregation_pool.read().get(data) { self.filter_optimistic_attestation(attestation) .map(Option::Some) } else { @@ -1645,21 +1628,16 @@ impl BeaconChain { /// `attestation.data.tree_hash_root()`. /// /// The attestation will be obtained from `self.naive_aggregation_pool`. - /// - /// NOTE: This function will *only* work with pre-electra attestations and it only - /// exists to support the pre-electra validator API method. - pub fn get_pre_electra_aggregated_attestation_by_slot_and_root( + pub fn get_aggregated_attestation_by_slot_and_root( &self, slot: Slot, attestation_data_root: &Hash256, ) -> Result>, Error> { - let attestation_key = - crate::naive_aggregation_pool::AttestationKey::new_base_from_slot_and_root( - slot, - *attestation_data_root, - ); - - if let Some(attestation) = self.naive_aggregation_pool.read().get(&attestation_key) { + if let Some(attestation) = self + .naive_aggregation_pool + .read() + .get_by_slot_and_root(slot, attestation_data_root) + { self.filter_optimistic_attestation(attestation) .map(Option::Some) } else { diff --git a/beacon_node/beacon_chain/src/naive_aggregation_pool.rs b/beacon_node/beacon_chain/src/naive_aggregation_pool.rs index 6c4f7cdae72..a12521cd171 100644 --- a/beacon_node/beacon_chain/src/naive_aggregation_pool.rs +++ b/beacon_node/beacon_chain/src/naive_aggregation_pool.rs @@ -1,9 +1,7 @@ use crate::metrics; use crate::observed_aggregates::AsReference; -use itertools::Itertools; -use smallvec::SmallVec; use std::collections::HashMap; -use tree_hash::{MerkleHasher, TreeHash, TreeHashType}; +use tree_hash::TreeHash; use types::consts::altair::SYNC_COMMITTEE_SUBNET_COUNT; use types::slot_data::SlotData; use types::sync_committee_contribution::SyncContributionData; @@ -11,114 +9,9 @@ use types::{ Attestation, AttestationData, AttestationRef, EthSpec, Hash256, Slot, SyncCommitteeContribution, }; -type AttestationKeyRoot = Hash256; +type AttestationDataRoot = Hash256; type SyncDataRoot = Hash256; -/// Post-Electra, we need a new key for Attestations that includes the committee index -#[derive(Debug, Clone, PartialEq)] -pub struct AttestationKey { - data_root: Hash256, - committee_index: Option, - slot: Slot, -} - -// A custom implementation of `TreeHash` such that: -// AttestationKey(data, None).tree_hash_root() == data.tree_hash_root() -// AttestationKey(data, Some(index)).tree_hash_root() == (data, index).tree_hash_root() -// This is necessary because pre-Electra, the validator will ask for the tree_hash_root() -// of the `AttestationData` -impl TreeHash for AttestationKey { - fn tree_hash_type() -> TreeHashType { - TreeHashType::Container - } - - fn tree_hash_packed_encoding(&self) -> SmallVec<[u8; 32]> { - unreachable!("AttestationKey should never be packed.") - } - - fn tree_hash_packing_factor() -> usize { - unreachable!("AttestationKey should never be packed.") - } - - fn tree_hash_root(&self) -> Hash256 { - match self.committee_index { - None => self.data_root, // Return just the data root if no committee index is present - Some(index) => { - // Combine the hash of the data with the hash of the index - let mut hasher = MerkleHasher::with_leaves(2); - hasher - .write(self.data_root.as_bytes()) - .expect("should write data hash"); - hasher - .write(&index.to_le_bytes()) - .expect("should write index"); - hasher.finish().expect("should give tree hash") - } - } - } -} - -impl AttestationKey { - pub fn from_attestation_ref(attestation: AttestationRef) -> Result { - let slot = attestation.data().slot; - match attestation { - AttestationRef::Base(att) => Ok(Self { - data_root: att.data.tree_hash_root(), - committee_index: None, - slot, - }), - AttestationRef::Electra(att) => { - let committee_index = att - .committee_bits - .iter() - .enumerate() - .filter_map(|(i, bit)| if bit { Some(i) } else { None }) - .at_most_one() - .map_err(|_| Error::MoreThanOneCommitteeBitSet)? - .ok_or(Error::NoCommitteeBitSet)?; - - Ok(Self { - data_root: att.data.tree_hash_root(), - committee_index: Some(committee_index as u64), - slot, - }) - } - } - } - - pub fn new_base(data: &AttestationData) -> Self { - let slot = data.slot; - Self { - data_root: data.tree_hash_root(), - committee_index: None, - slot, - } - } - - pub fn new_electra(data: &AttestationData, committee_index: u64) -> Self { - let slot = data.slot; - Self { - data_root: data.tree_hash_root(), - committee_index: Some(committee_index), - slot, - } - } - - pub fn new_base_from_slot_and_root(slot: Slot, data_root: Hash256) -> Self { - Self { - data_root, - committee_index: None, - slot, - } - } -} - -impl SlotData for AttestationKey { - fn get_slot(&self) -> Slot { - self.slot - } -} - /// The number of slots that will be stored in the pool. /// /// For example, if `SLOTS_RETAINED == 3` and the pool is pruned at slot `6`, then all items @@ -156,10 +49,6 @@ pub enum Error { /// The given `aggregation_bits` field had more than one signature. The number of /// signatures found is included. MoreThanOneAggregationBitSet(usize), - /// The electra attestation has more than one committee bit set - MoreThanOneCommitteeBitSet, - /// The electra attestation has NO committee bit set - NoCommitteeBitSet, /// We have reached the maximum number of unique items that can be stored in a /// slot. This is a DoS protection function. ReachedMaxItemsPerSlot(usize), @@ -201,6 +90,9 @@ where /// Get a reference to the inner `HashMap`. fn get_map(&self) -> &HashMap; + /// Get a `Value` from `Self` based on `Key`, which is a hash of `Data`. + fn get_by_root(&self, root: &Self::Key) -> Option<&Self::Value>; + /// The number of items store in `Self`. fn len(&self) -> usize; @@ -220,13 +112,13 @@ where /// A collection of `Attestation` objects, keyed by their `attestation.data`. Enforces that all /// `attestation` are from the same slot. pub struct AggregatedAttestationMap { - map: HashMap>, + map: HashMap>, } impl AggregateMap for AggregatedAttestationMap { - type Key = AttestationKeyRoot; + type Key = AttestationDataRoot; type Value = Attestation; - type Data = AttestationKey; + type Data = AttestationData; /// Create an empty collection with the given `initial_capacity`. fn new(initial_capacity: usize) -> Self { @@ -241,43 +133,45 @@ impl AggregateMap for AggregatedAttestationMap { fn insert(&mut self, a: AttestationRef) -> Result { let _timer = metrics::start_timer(&metrics::ATTESTATION_PROCESSING_AGG_POOL_CORE_INSERT); - let aggregation_bit = match a { + let set_bits = match a { AttestationRef::Base(att) => att .aggregation_bits .iter() .enumerate() - .filter_map(|(i, bit)| if bit { Some(i) } else { None }) - .at_most_one() - .map_err(|iter| Error::MoreThanOneAggregationBitSet(iter.count()))? - .ok_or(Error::NoAggregationBitsSet)?, + .filter(|(_i, bit)| *bit) + .map(|(i, _bit)| i) + .collect::>(), AttestationRef::Electra(att) => att .aggregation_bits .iter() .enumerate() - .filter_map(|(i, bit)| if bit { Some(i) } else { None }) - .at_most_one() - .map_err(|iter| Error::MoreThanOneAggregationBitSet(iter.count()))? - .ok_or(Error::NoAggregationBitsSet)?, + .filter(|(_i, bit)| *bit) + .map(|(i, _bit)| i) + .collect::>(), }; - let attestation_key = AttestationKey::from_attestation_ref(a)?; - let attestation_data_root = attestation_key.tree_hash_root(); + let committee_index = set_bits + .first() + .copied() + .ok_or(Error::NoAggregationBitsSet)?; + + if set_bits.len() > 1 { + return Err(Error::MoreThanOneAggregationBitSet(set_bits.len())); + } + + let attestation_data_root = a.data().tree_hash_root(); if let Some(existing_attestation) = self.map.get_mut(&attestation_data_root) { if existing_attestation - .get_aggregation_bit(aggregation_bit) + .get_aggregation_bit(committee_index) .map_err(|_| Error::InconsistentBitfieldLengths)? { - Ok(InsertOutcome::SignatureAlreadyKnown { - committee_index: aggregation_bit, - }) + Ok(InsertOutcome::SignatureAlreadyKnown { committee_index }) } else { let _timer = metrics::start_timer(&metrics::ATTESTATION_PROCESSING_AGG_POOL_AGGREGATION); existing_attestation.aggregate(a); - Ok(InsertOutcome::SignatureAggregated { - committee_index: aggregation_bit, - }) + Ok(InsertOutcome::SignatureAggregated { committee_index }) } } else { if self.map.len() >= MAX_ATTESTATIONS_PER_SLOT { @@ -286,9 +180,7 @@ impl AggregateMap for AggregatedAttestationMap { self.map .insert(attestation_data_root, a.clone_as_attestation()); - Ok(InsertOutcome::NewItemInserted { - committee_index: aggregation_bit, - }) + Ok(InsertOutcome::NewItemInserted { committee_index }) } } @@ -303,6 +195,11 @@ impl AggregateMap for AggregatedAttestationMap { &self.map } + /// Returns an aggregated `Attestation` with the given `root`, if any. + fn get_by_root(&self, root: &Self::Key) -> Option<&Self::Value> { + self.map.get(root) + } + fn len(&self) -> usize { self.map.len() } @@ -409,6 +306,11 @@ impl AggregateMap for SyncContributionAggregateMap { &self.map } + /// Returns an aggregated `SyncCommitteeContribution` with the given `root`, if any. + fn get_by_root(&self, root: &SyncDataRoot) -> Option<&SyncCommitteeContribution> { + self.map.get(root) + } + fn len(&self) -> usize { self.map.len() } @@ -543,6 +445,13 @@ where .and_then(|map| map.get(data)) } + /// Returns an aggregated `T::Value` with the given `slot` and `root`, if any. + pub fn get_by_slot_and_root(&self, slot: Slot, root: &T::Key) -> Option { + self.maps + .get(&slot) + .and_then(|map| map.get_by_root(root).cloned()) + } + /// Iterate all items in all slots of `self`. pub fn iter(&self) -> impl Iterator { self.maps.values().flat_map(|map| map.get_map().values()) @@ -591,30 +500,19 @@ mod tests { use super::*; use ssz_types::BitList; use store::BitVector; - use tree_hash::TreeHash; use types::{ test_utils::{generate_deterministic_keypair, test_random_instance}, - Attestation, AttestationBase, AttestationElectra, Fork, Hash256, SyncCommitteeMessage, + Fork, Hash256, SyncCommitteeMessage, }; type E = types::MainnetEthSpec; - fn get_attestation_base(slot: Slot) -> Attestation { - let mut a: AttestationBase = test_random_instance(); - a.data.slot = slot; - a.aggregation_bits = BitList::with_capacity(4).expect("should create bitlist"); - Attestation::Base(a) - } - - fn get_attestation_electra(slot: Slot) -> Attestation { - let mut a: AttestationElectra = test_random_instance(); - a.data.slot = slot; - a.aggregation_bits = BitList::with_capacity(4).expect("should create bitlist"); - a.committee_bits = BitVector::new(); - a.committee_bits - .set(0, true) - .expect("should set committee bit"); - Attestation::Electra(a) + fn get_attestation(slot: Slot) -> Attestation { + let mut a: Attestation = test_random_instance(); + a.data_mut().slot = slot; + *a.aggregation_bits_base_mut().unwrap() = + BitList::with_capacity(4).expect("should create bitlist"); + a } fn get_sync_contribution(slot: Slot) -> SyncCommitteeContribution { @@ -657,16 +555,10 @@ mod tests { } fn unset_attestation_bit(a: &mut Attestation, i: usize) { - match a { - Attestation::Base(ref mut att) => att - .aggregation_bits - .set(i, false) - .expect("should unset aggregation bit"), - Attestation::Electra(ref mut att) => att - .aggregation_bits - .set(i, false) - .expect("should unset aggregation bit"), - } + a.aggregation_bits_base_mut() + .unwrap() + .set(i, false) + .expect("should unset aggregation bit") } fn unset_sync_contribution_bit(a: &mut SyncCommitteeContribution, i: usize) { @@ -687,8 +579,8 @@ mod tests { a.data().beacon_block_root == block_root } - fn key_from_attestation(a: &Attestation) -> AttestationKey { - AttestationKey::from_attestation_ref(a.to_ref()).expect("should create attestation key") + fn key_from_attestation(a: &Attestation) -> AttestationData { + a.data().clone() } fn mutate_sync_contribution_block_root( @@ -713,45 +605,6 @@ mod tests { SyncContributionData::from_contribution(a) } - #[test] - fn attestation_key_tree_hash_tests() { - let attestation_base = get_attestation_base(Slot::new(42)); - // for a base attestation, the tree_hash_root() of the key should be the same as the tree_hash_root() of the data - let attestation_key_base = AttestationKey::from_attestation_ref(attestation_base.to_ref()) - .expect("should create attestation key"); - assert_eq!( - attestation_key_base.tree_hash_root(), - attestation_base.data().tree_hash_root() - ); - let mut attestation_electra = get_attestation_electra(Slot::new(42)); - // for an electra attestation, the tree_hash_root() of the key should be different from the tree_hash_root() of the data - let attestation_key_electra = - AttestationKey::from_attestation_ref(attestation_electra.to_ref()) - .expect("should create attestation key"); - assert_ne!( - attestation_key_electra.tree_hash_root(), - attestation_electra.data().tree_hash_root() - ); - // for an electra attestation, the tree_hash_root() of the key should be dependent on which committee bit is set - let committe_bits = attestation_electra - .committee_bits_mut() - .expect("should get committee bits"); - committe_bits - .set(0, false) - .expect("should set committee bit"); - committe_bits - .set(1, true) - .expect("should set committee bit"); - let new_attestation_key_electra = - AttestationKey::from_attestation_ref(attestation_electra.to_ref()) - .expect("should create attestation key"); - // this new key should have a different tree_hash_root() than the previous key - assert_ne!( - attestation_key_electra.tree_hash_root(), - new_attestation_key_electra.tree_hash_root() - ); - } - macro_rules! test_suite { ( $mod_name: ident, @@ -947,21 +800,8 @@ mod tests { } test_suite! { - attestation_tests_base, - get_attestation_base, - sign_attestation, - unset_attestation_bit, - mutate_attestation_block_root, - mutate_attestation_slot, - attestation_block_root_comparator, - key_from_attestation, - AggregatedAttestationMap, - MAX_ATTESTATIONS_PER_SLOT - } - - test_suite! { - attestation_tests_electra, - get_attestation_electra, + attestation_tests, + get_attestation, sign_attestation, unset_attestation_bit, mutate_attestation_block_root, diff --git a/beacon_node/beacon_chain/src/test_utils.rs b/beacon_node/beacon_chain/src/test_utils.rs index bcf7582ebfd..edfff4bf81e 100644 --- a/beacon_node/beacon_chain/src/test_utils.rs +++ b/beacon_node/beacon_chain/src/test_utils.rs @@ -1374,7 +1374,7 @@ where // aggregate locally. let aggregate = self .chain - .get_aggregated_attestation_base(attestation.data()) + .get_aggregated_attestation(attestation.data()) .unwrap() .unwrap_or_else(|| { committee_attestations.iter().skip(1).fold( diff --git a/beacon_node/beacon_chain/tests/payload_invalidation.rs b/beacon_node/beacon_chain/tests/payload_invalidation.rs index 594872e2fff..8c9957db169 100644 --- a/beacon_node/beacon_chain/tests/payload_invalidation.rs +++ b/beacon_node/beacon_chain/tests/payload_invalidation.rs @@ -1228,7 +1228,10 @@ async fn attesting_to_optimistic_head() { let get_aggregated_by_slot_and_root = || { rig.harness .chain - .get_aggregated_attestation_base(attestation.data()) + .get_aggregated_attestation_by_slot_and_root( + attestation.data().slot, + &attestation.data().tree_hash_root(), + ) }; /* diff --git a/beacon_node/http_api/src/lib.rs b/beacon_node/http_api/src/lib.rs index 838f7233052..6cb8f6fe0b9 100644 --- a/beacon_node/http_api/src/lib.rs +++ b/beacon_node/http_api/src/lib.rs @@ -3191,7 +3191,7 @@ pub fn serve( task_spawner.blocking_json_task(Priority::P0, move || { not_synced_filter?; chain - .get_pre_electra_aggregated_attestation_by_slot_and_root( + .get_aggregated_attestation_by_slot_and_root( query.slot, &query.attestation_data_root, ) diff --git a/consensus/state_processing/src/common/get_attesting_indices.rs b/consensus/state_processing/src/common/get_attesting_indices.rs index 9848840e96d..595cc69f87c 100644 --- a/consensus/state_processing/src/common/get_attesting_indices.rs +++ b/consensus/state_processing/src/common/get_attesting_indices.rs @@ -113,15 +113,11 @@ 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) { - // This check is new to the spec's `process_attestation` in Electra. - if index >= committee_count_per_slot { - return Err(BeaconStateError::InvalidCommitteeIndex(index)); + if aggregation_bits.len() != beacon_committee.committee.len() { + return Err(BeaconStateError::InvalidBitfield); } - participant_count.safe_add_assign(beacon_committee.committee.len() as u64)?; let committee_attesters = beacon_committee .committee .iter() @@ -140,13 +136,10 @@ pub mod attesting_indices_electra { committee_offset.safe_add(beacon_committee.committee.len())?; } else { - return Err(Error::NoCommitteeFound(index)); + return Err(Error::NoCommitteeFound); } - } - // This check is new to the spec's `process_attestation` in Electra. - if participant_count as usize != aggregation_bits.len() { - return Err(BeaconStateError::InvalidBitfield); + // TODO(electra) what should we do when theres no committee found for a given index? } let mut indices = output.into_iter().collect_vec(); diff --git a/consensus/types/src/attestation.rs b/consensus/types/src/attestation.rs index 8c8a81b90f2..0f7e8468488 100644 --- a/consensus/types/src/attestation.rs +++ b/consensus/types/src/attestation.rs @@ -67,9 +67,9 @@ pub struct Attestation { #[superstruct(only(Electra), partial_getter(rename = "aggregation_bits_electra"))] pub aggregation_bits: BitList, pub data: AttestationData, + pub signature: AggregateSignature, #[superstruct(only(Electra))] pub committee_bits: BitVector, - pub signature: AggregateSignature, } impl Decode for Attestation { @@ -92,7 +92,6 @@ impl Decode for Attestation { } } -// TODO(electra): think about how to handle fork variants here impl TestRandom for Attestation { fn random_for_test(rng: &mut impl RngCore) -> Self { let aggregation_bits: BitList = BitList::random_for_test(rng); diff --git a/consensus/types/src/beacon_state.rs b/consensus/types/src/beacon_state.rs index d9c7a78537a..599c0bfc39c 100644 --- a/consensus/types/src/beacon_state.rs +++ b/consensus/types/src/beacon_state.rs @@ -159,8 +159,7 @@ pub enum Error { IndexNotSupported(usize), InvalidFlagIndex(usize), MerkleTreeError(merkle_proof::MerkleTreeError), - NoCommitteeFound(CommitteeIndex), - InvalidCommitteeIndex(CommitteeIndex), + NoCommitteeFound, } /// Control whether an epoch-indexed field can be indexed at the next epoch or not. diff --git a/consensus/types/src/eth_spec.rs b/consensus/types/src/eth_spec.rs index 14949e67531..cec4db2da51 100644 --- a/consensus/types/src/eth_spec.rs +++ b/consensus/types/src/eth_spec.rs @@ -408,8 +408,6 @@ impl EthSpec for MainnetEthSpec { pub struct MinimalEthSpec; impl EthSpec for MinimalEthSpec { - type MaxCommitteesPerSlot = U4; - type MaxValidatorsPerSlot = U8192; type SlotsPerEpoch = U8; type EpochsPerEth1VotingPeriod = U4; type SlotsPerHistoricalRoot = U64; @@ -434,6 +432,8 @@ impl EthSpec for MinimalEthSpec { SubnetBitfieldLength, SyncCommitteeSubnetCount, MaxValidatorsPerCommittee, + MaxCommitteesPerSlot, + MaxValidatorsPerSlot, GenesisEpoch, HistoricalRootsLimit, ValidatorRegistryLimit, diff --git a/testing/ef_tests/src/type_name.rs b/testing/ef_tests/src/type_name.rs index cbea78dabfc..30db5c0e4a9 100644 --- a/testing/ef_tests/src/type_name.rs +++ b/testing/ef_tests/src/type_name.rs @@ -111,8 +111,11 @@ type_name_generic!(LightClientUpdateDeneb, "LightClientUpdate"); type_name_generic!(PendingAttestation); type_name!(ProposerSlashing); type_name_generic!(SignedAggregateAndProof); -type_name_generic!(SignedAggregateAndProofBase, "SignedAggregateAndProof"); -type_name_generic!(SignedAggregateAndProofElectra, "SignedAggregateAndProof"); +type_name_generic!(SignedAggregateAndProofBase, "SignedAggregateAndProofBase"); +type_name_generic!( + SignedAggregateAndProofElectra, + "SignedAggregateAndProofElectra" +); type_name_generic!(SignedBeaconBlock); type_name!(SignedBeaconBlockHeader); type_name_generic!(SignedContributionAndProof); diff --git a/testing/ef_tests/tests/tests.rs b/testing/ef_tests/tests/tests.rs index fb8bdfcae71..85d9362aaeb 100644 --- a/testing/ef_tests/tests/tests.rs +++ b/testing/ef_tests/tests/tests.rs @@ -219,6 +219,7 @@ mod ssz_static { use types::historical_summary::HistoricalSummary; use types::{AttesterSlashingBase, AttesterSlashingElectra, LightClientBootstrapAltair, *}; + ssz_static_test!(aggregate_and_proof, AggregateAndProof<_>); ssz_static_test!(attestation, Attestation<_>); ssz_static_test!(attestation_data, AttestationData); ssz_static_test!(beacon_block, SszStaticWithSpecHandler, BeaconBlock<_>); @@ -248,7 +249,7 @@ mod ssz_static { ssz_static_test!(voluntary_exit, VoluntaryExit); #[test] - fn attester_slashing() { + fn signed_aggregate_and_proof() { SszStaticHandler::, MinimalEthSpec>::pre_electra() .run(); SszStaticHandler::, MainnetEthSpec>::pre_electra() @@ -259,36 +260,6 @@ mod ssz_static { .run(); } - #[test] - fn signed_aggregate_and_proof() { - SszStaticHandler::, MinimalEthSpec>::pre_electra( - ) - .run(); - SszStaticHandler::, MainnetEthSpec>::pre_electra( - ) - .run(); - SszStaticHandler::, MinimalEthSpec>::electra_only( - ) - .run(); - SszStaticHandler::, MainnetEthSpec>::electra_only( - ) - .run(); - } - - #[test] - fn aggregate_and_proof() { - SszStaticHandler::, MinimalEthSpec>::pre_electra() - .run(); - SszStaticHandler::, MainnetEthSpec>::pre_electra() - .run(); - SszStaticHandler::, MinimalEthSpec>::electra_only( - ) - .run(); - SszStaticHandler::, MainnetEthSpec>::electra_only( - ) - .run(); - } - // BeaconBlockBody has no internal indicator of which fork it is for, so we test it separately. #[test] fn beacon_block_body() { @@ -312,6 +283,22 @@ mod ssz_static { .run(); } + #[test] + fn signed_aggregate_and_proof() { + SszStaticHandler::, MinimalEthSpec>::pre_electra( + ) + .run(); + SszStaticHandler::, MainnetEthSpec>::pre_electra( + ) + .run(); + SszStaticHandler::, MinimalEthSpec>::electra_only( + ) + .run(); + SszStaticHandler::, MainnetEthSpec>::electra_only( + ) + .run(); + } + // Altair and later #[test] fn contribution_and_proof() {