From 7938a438f4e495bb1a88d10b74f15c81aa4ed06f Mon Sep 17 00:00:00 2001 From: dapplion <35266934+dapplion@users.noreply.github.com> Date: Sat, 24 Feb 2024 16:56:44 +0800 Subject: [PATCH] Rename VList to List and use Vector --- beacon_node/beacon_chain/src/eth1_chain.rs | 6 +- beacon_node/store/src/hdiff.rs | 4 +- .../altair/participation_flag_updates.rs | 4 +- .../epoch_processing_summary.rs | 16 ++-- .../src/per_epoch_processing/resets.rs | 4 +- .../state_processing/src/upgrade/altair.rs | 8 +- .../state_processing/src/upgrade/capella.rs | 4 +- consensus/types/src/beacon_block_body.rs | 1 - consensus/types/src/beacon_state.rs | 76 +++++++++---------- .../src/beacon_state/committee_cache/tests.rs | 2 +- .../types/src/beacon_state/compact_state.rs | 6 +- consensus/types/src/beacon_state/tests.rs | 4 +- consensus/types/src/blob_sidecar.rs | 3 +- consensus/types/src/execution_payload.rs | 3 +- .../types/src/execution_payload_header.rs | 2 - consensus/types/src/historical_batch.rs | 4 +- consensus/types/src/lib.rs | 4 +- consensus/types/src/light_client_bootstrap.rs | 3 +- .../types/src/light_client_finality_update.rs | 3 +- consensus/types/src/light_client_update.rs | 9 +-- consensus/types/src/sync_committee.rs | 3 +- testing/ef_tests/src/cases/ssz_generic.rs | 8 +- 22 files changed, 83 insertions(+), 94 deletions(-) diff --git a/beacon_node/beacon_chain/src/eth1_chain.rs b/beacon_node/beacon_chain/src/eth1_chain.rs index ba2cd92e281..1ea60dfd3da 100644 --- a/beacon_node/beacon_chain/src/eth1_chain.rs +++ b/beacon_node/beacon_chain/src/eth1_chain.rs @@ -1021,7 +1021,7 @@ mod test { mod collect_valid_votes { use super::*; - use types::VList; + use types::List; fn get_eth1_data_vec(n: u64, block_number_offset: u64) -> Vec<(Eth1Data, BlockNumber)> { (0..n) @@ -1069,7 +1069,7 @@ mod test { let votes_to_consider = get_eth1_data_vec(slots, 0); - *state.eth1_data_votes_mut() = VList::new( + *state.eth1_data_votes_mut() = List::new( votes_to_consider[0..slots as usize / 4] .iter() .map(|(eth1_data, _)| eth1_data) @@ -1100,7 +1100,7 @@ mod test { .expect("should have some eth1 data") .clone(); - *state.eth1_data_votes_mut() = VList::new( + *state.eth1_data_votes_mut() = List::new( vec![duplicate_eth1_data.clone(); 4] .iter() .map(|(eth1_data, _)| eth1_data) diff --git a/beacon_node/store/src/hdiff.rs b/beacon_node/store/src/hdiff.rs index b831df5da04..cbc9266c30b 100644 --- a/beacon_node/store/src/hdiff.rs +++ b/beacon_node/store/src/hdiff.rs @@ -6,7 +6,7 @@ use ssz::{Decode, Encode}; use ssz_derive::{Decode, Encode}; use std::io::{Read, Write}; use std::str::FromStr; -use types::{BeaconState, ChainSpec, EthSpec, Slot, VList}; +use types::{BeaconState, ChainSpec, EthSpec, List, Slot}; use zstd::{Decoder, Encoder}; #[derive(Debug)] @@ -91,7 +91,7 @@ impl HDiffBuffer { pub fn into_state(self, spec: &ChainSpec) -> Result, Error> { let mut state = BeaconState::from_ssz_bytes(&self.state, spec).unwrap(); - *state.balances_mut() = VList::new(self.balances).unwrap(); + *state.balances_mut() = List::new(self.balances).unwrap(); Ok(state) } } diff --git a/consensus/state_processing/src/per_epoch_processing/altair/participation_flag_updates.rs b/consensus/state_processing/src/per_epoch_processing/altair/participation_flag_updates.rs index d06baa72f93..e058a776476 100644 --- a/consensus/state_processing/src/per_epoch_processing/altair/participation_flag_updates.rs +++ b/consensus/state_processing/src/per_epoch_processing/altair/participation_flag_updates.rs @@ -2,7 +2,7 @@ use crate::EpochProcessingError; use types::beacon_state::BeaconState; use types::eth_spec::EthSpec; use types::participation_flags::ParticipationFlags; -use types::VList; +use types::List; pub fn process_participation_flag_updates( state: &mut BeaconState, @@ -10,6 +10,6 @@ pub fn process_participation_flag_updates( *state.previous_epoch_participation_mut()? = std::mem::take(state.current_epoch_participation_mut()?); *state.current_epoch_participation_mut()? = - VList::repeat(ParticipationFlags::default(), state.validators().len())?; + List::repeat(ParticipationFlags::default(), state.validators().len())?; Ok(()) } diff --git a/consensus/state_processing/src/per_epoch_processing/epoch_processing_summary.rs b/consensus/state_processing/src/per_epoch_processing/epoch_processing_summary.rs index f270ecc84a7..e0f5976f958 100644 --- a/consensus/state_processing/src/per_epoch_processing/epoch_processing_summary.rs +++ b/consensus/state_processing/src/per_epoch_processing/epoch_processing_summary.rs @@ -3,8 +3,8 @@ use crate::metrics; use std::sync::Arc; use types::{ consts::altair::{TIMELY_HEAD_FLAG_INDEX, TIMELY_SOURCE_FLAG_INDEX, TIMELY_TARGET_FLAG_INDEX}, - BeaconStateError, Epoch, EthSpec, ParticipationFlags, ProgressiveBalancesCache, SyncCommittee, - VList, Validator, + BeaconStateError, Epoch, EthSpec, List, ParticipationFlags, ProgressiveBalancesCache, + SyncCommittee, Validator, }; /// Provides a summary of validator participation during the epoch. @@ -25,20 +25,20 @@ pub enum EpochProcessingSummary { #[derive(PartialEq, Debug)] pub struct ParticipationEpochSummary { /// Copy of the validator registry prior to mutation. - validators: VList, + validators: List, /// Copy of the participation flags for the previous epoch. - previous_epoch_participation: VList, + previous_epoch_participation: List, /// Copy of the participation flags for the current epoch. - current_epoch_participation: VList, + current_epoch_participation: List, previous_epoch: Epoch, current_epoch: Epoch, } impl ParticipationEpochSummary { pub fn new( - validators: VList, - previous_epoch_participation: VList, - current_epoch_participation: VList, + validators: List, + previous_epoch_participation: List, + current_epoch_participation: List, previous_epoch: Epoch, current_epoch: Epoch, ) -> Self { diff --git a/consensus/state_processing/src/per_epoch_processing/resets.rs b/consensus/state_processing/src/per_epoch_processing/resets.rs index 8664bd98aae..367b91a9ac6 100644 --- a/consensus/state_processing/src/per_epoch_processing/resets.rs +++ b/consensus/state_processing/src/per_epoch_processing/resets.rs @@ -2,7 +2,7 @@ use super::errors::EpochProcessingError; use safe_arith::SafeArith; use types::beacon_state::BeaconState; use types::eth_spec::EthSpec; -use types::{Unsigned, VList}; +use types::{List, Unsigned}; pub fn process_eth1_data_reset( state: &mut BeaconState, @@ -13,7 +13,7 @@ pub fn process_eth1_data_reset( .safe_rem(T::SlotsPerEth1VotingPeriod::to_u64())? == 0 { - *state.eth1_data_votes_mut() = VList::empty(); + *state.eth1_data_votes_mut() = List::empty(); } Ok(()) } diff --git a/consensus/state_processing/src/upgrade/altair.rs b/consensus/state_processing/src/upgrade/altair.rs index 343bff4d2b3..53bc90f9024 100644 --- a/consensus/state_processing/src/upgrade/altair.rs +++ b/consensus/state_processing/src/upgrade/altair.rs @@ -4,13 +4,13 @@ use std::mem; use std::sync::Arc; use types::{ BeaconState, BeaconStateAltair, BeaconStateError as Error, ChainSpec, EpochCache, EthSpec, - Fork, ParticipationFlags, PendingAttestation, RelativeEpoch, SyncCommittee, VList, + Fork, List, ParticipationFlags, PendingAttestation, RelativeEpoch, SyncCommittee, }; /// Translate the participation information from the epoch prior to the fork into Altair's format. pub fn translate_participation( state: &mut BeaconState, - pending_attestations: &VList, E::MaxPendingAttestations>, + pending_attestations: &List, E::MaxPendingAttestations>, spec: &ChainSpec, ) -> Result<(), Error> { // Previous epoch committee cache is required for `get_attesting_indices`. @@ -51,8 +51,8 @@ pub fn upgrade_to_altair( let pre = pre_state.as_base_mut()?; let default_epoch_participation = - VList::new(vec![ParticipationFlags::default(); pre.validators.len()])?; - let inactivity_scores = VList::new(vec![0; pre.validators.len()])?; + List::new(vec![ParticipationFlags::default(); pre.validators.len()])?; + let inactivity_scores = List::new(vec![0; pre.validators.len()])?; let temp_sync_committee = Arc::new(SyncCommittee::temporary()); diff --git a/consensus/state_processing/src/upgrade/capella.rs b/consensus/state_processing/src/upgrade/capella.rs index db00374de9c..51e29d10f3c 100644 --- a/consensus/state_processing/src/upgrade/capella.rs +++ b/consensus/state_processing/src/upgrade/capella.rs @@ -1,7 +1,7 @@ use std::mem; use types::{ BeaconState, BeaconStateCapella, BeaconStateError as Error, ChainSpec, EpochCache, EthSpec, - Fork, VList, + Fork, List, }; /// Transform a `Merge` state into an `Capella` state. @@ -61,7 +61,7 @@ pub fn upgrade_to_capella( // Capella next_withdrawal_index: 0, next_withdrawal_validator_index: 0, - historical_summaries: VList::default(), + historical_summaries: List::default(), // Caches total_active_balance: pre.total_active_balance, progressive_balances_cache: mem::take(&mut pre.progressive_balances_cache), diff --git a/consensus/types/src/beacon_block_body.rs b/consensus/types/src/beacon_block_body.rs index 1e5fccd45ea..38155a4a6a5 100644 --- a/consensus/types/src/beacon_block_body.rs +++ b/consensus/types/src/beacon_block_body.rs @@ -4,7 +4,6 @@ use derivative::Derivative; use merkle_proof::{MerkleTree, MerkleTreeError}; use serde::{Deserialize, Serialize}; use ssz_derive::{Decode, Encode}; -use ssz_types::{FixedVector, VariableList}; use std::marker::PhantomData; use superstruct::superstruct; use test_random_derive::TestRandom; diff --git a/consensus/types/src/beacon_state.rs b/consensus/types/src/beacon_state.rs index 7f498cf863f..c088cd717e4 100644 --- a/consensus/types/src/beacon_state.rs +++ b/consensus/types/src/beacon_state.rs @@ -35,7 +35,7 @@ use crate::epoch_cache::EpochCache; use crate::historical_summary::HistoricalSummary; pub use eth_spec::*; pub use iter::BlockRootsIter; -pub use milhouse::{interface::Interface, List as VList, List, Vector as FixedVector}; +pub use milhouse::{interface::Interface, List, Vector}; #[macro_use] mod committee_cache; @@ -51,8 +51,8 @@ mod tests; pub const CACHED_EPOCHS: usize = 3; const MAX_RANDOM_BYTE: u64 = (1 << 8) - 1; -pub type Validators = VList::ValidatorRegistryLimit>; -pub type Balances = VList::ValidatorRegistryLimit>; +pub type Validators = List::ValidatorRegistryLimit>; +pub type Balances = List::ValidatorRegistryLimit>; #[derive(Debug, PartialEq, Clone)] pub enum Error { @@ -328,12 +328,12 @@ where #[metastruct(exclude_from(tree_lists))] pub latest_block_header: BeaconBlockHeader, #[test_random(default)] - pub block_roots: FixedVector, + pub block_roots: Vector, #[test_random(default)] - pub state_roots: FixedVector, + pub state_roots: Vector, // Frozen in Capella, replaced by historical_summaries #[test_random(default)] - pub historical_roots: VList, + pub historical_roots: List, // Ethereum 1.0 chain data #[metastruct(exclude_from(tree_lists))] @@ -341,7 +341,7 @@ where #[test_random(default)] // FIXME(sproul): excluded due to `rebase_on` issue #[metastruct(exclude_from(tree_lists))] - pub eth1_data_votes: VList, + pub eth1_data_votes: List, #[superstruct(getter(copy))] #[metastruct(exclude_from(tree_lists))] #[serde(with = "serde_utils::quoted_u64")] @@ -349,39 +349,39 @@ where // Registry #[test_random(default)] - pub validators: VList, + pub validators: List, #[serde(with = "ssz_types::serde_utils::quoted_u64_var_list")] #[compare_fields(as_iter)] #[test_random(default)] - pub balances: VList, + pub balances: List, // Randomness #[test_random(default)] - pub randao_mixes: FixedVector, + pub randao_mixes: Vector, // Slashings #[test_random(default)] #[serde(with = "ssz_types::serde_utils::quoted_u64_fixed_vec")] - pub slashings: FixedVector, + pub slashings: Vector, // Attestations (genesis fork only) // FIXME(sproul): excluded from tree lists due to ResetListDiff #[superstruct(only(Base))] #[test_random(default)] #[metastruct(exclude_from(tree_lists))] - pub previous_epoch_attestations: VList, T::MaxPendingAttestations>, + pub previous_epoch_attestations: List, T::MaxPendingAttestations>, #[superstruct(only(Base))] #[test_random(default)] #[metastruct(exclude_from(tree_lists))] - pub current_epoch_attestations: VList, T::MaxPendingAttestations>, + pub current_epoch_attestations: List, T::MaxPendingAttestations>, // Participation (Altair and later) #[superstruct(only(Altair, Merge, Capella, Deneb))] #[test_random(default)] - pub previous_epoch_participation: VList, + pub previous_epoch_participation: List, #[superstruct(only(Altair, Merge, Capella, Deneb))] #[test_random(default)] - pub current_epoch_participation: VList, + pub current_epoch_participation: List, // Finality #[test_random(default)] @@ -401,7 +401,7 @@ where #[serde(with = "ssz_types::serde_utils::quoted_u64_var_list")] #[superstruct(only(Altair, Merge, Capella, Deneb))] #[test_random(default)] - pub inactivity_scores: VList, + pub inactivity_scores: List, // Light-client sync committees #[superstruct(only(Altair, Merge, Capella, Deneb))] @@ -443,7 +443,7 @@ where // Deep history valid from Capella onwards. #[superstruct(only(Capella, Deneb))] #[test_random(default)] - pub historical_summaries: VList, + pub historical_summaries: List, // Caching (not in the spec) #[serde(skip_serializing, skip_deserializing)] @@ -510,28 +510,28 @@ impl BeaconState { // History latest_block_header: BeaconBlock::::empty(spec).temporary_block_header(), - block_roots: FixedVector::default(), - state_roots: FixedVector::default(), - historical_roots: VList::default(), + block_roots: Vector::default(), + state_roots: Vector::default(), + historical_roots: List::default(), // Eth1 eth1_data, - eth1_data_votes: VList::default(), + eth1_data_votes: List::default(), eth1_deposit_index: 0, // Validator registry - validators: VList::default(), // Set later. - balances: VList::default(), // Set later. + validators: List::default(), // Set later. + balances: List::default(), // Set later. // Randomness - randao_mixes: FixedVector::default(), + randao_mixes: Vector::default(), // Slashings - slashings: FixedVector::default(), + slashings: Vector::default(), // Attestations - previous_epoch_attestations: VList::default(), - current_epoch_attestations: VList::default(), + previous_epoch_attestations: List::default(), + current_epoch_attestations: List::default(), // Finality justification_bits: BitVector::new(), @@ -1169,7 +1169,7 @@ impl BeaconState { /// Fill `randao_mixes` with pub fn fill_randao_mixes_with(&mut self, index_root: Hash256) -> Result<(), Error> { - *self.randao_mixes_mut() = FixedVector::from_elem(index_root)?; + *self.randao_mixes_mut() = Vector::from_elem(index_root)?; Ok(()) } @@ -1303,7 +1303,7 @@ impl BeaconState { } /// Get a reference to the entire `slashings` vector. - pub fn get_all_slashings(&self) -> &FixedVector { + pub fn get_all_slashings(&self) -> &Vector { self.slashings() } @@ -1370,9 +1370,9 @@ impl BeaconState { ( &mut Validators, &mut Balances, - &VList, - &VList, - &mut VList, + &List, + &List, + &mut List, &mut ProgressiveBalancesCache, &mut ExitCache, &mut EpochCache, @@ -1677,7 +1677,7 @@ impl BeaconState { epoch: Epoch, previous_epoch: Epoch, current_epoch: Epoch, - ) -> Result<&mut VList, Error> { + ) -> Result<&mut List, Error> { if epoch == current_epoch { match self { BeaconState::Base(_) => Err(BeaconStateError::IncorrectStateVariant), @@ -1928,19 +1928,19 @@ impl BeaconState { || self.slashings().has_pending_updates() || self .previous_epoch_attestations() - .map_or(false, VList::has_pending_updates) + .map_or(false, List::has_pending_updates) || self .current_epoch_attestations() - .map_or(false, VList::has_pending_updates) + .map_or(false, List::has_pending_updates) || self .previous_epoch_participation() - .map_or(false, VList::has_pending_updates) + .map_or(false, List::has_pending_updates) || self .current_epoch_participation() - .map_or(false, VList::has_pending_updates) + .map_or(false, List::has_pending_updates) || self .inactivity_scores() - .map_or(false, VList::has_pending_updates) + .map_or(false, List::has_pending_updates) } /// Completely drops the `progressive_balances_cache` cache, replacing it with a new, empty cache. diff --git a/consensus/types/src/beacon_state/committee_cache/tests.rs b/consensus/types/src/beacon_state/committee_cache/tests.rs index eea6233e357..346ddc1a745 100644 --- a/consensus/types/src/beacon_state/committee_cache/tests.rs +++ b/consensus/types/src/beacon_state/committee_cache/tests.rs @@ -92,7 +92,7 @@ async fn shuffles_for_the_right_epoch() { .map(|i| Hash256::from_low_u64_be(i as u64)) .collect(); - *state.randao_mixes_mut() = FixedVector::try_from_iter(distinct_hashes).unwrap(); + *state.randao_mixes_mut() = Vector::try_from_iter(distinct_hashes).unwrap(); let previous_seed = state .get_seed(state.previous_epoch(), Domain::BeaconAttester, spec) diff --git a/consensus/types/src/beacon_state/compact_state.rs b/consensus/types/src/beacon_state/compact_state.rs index 8c42a926a92..4ebc4ce028d 100644 --- a/consensus/types/src/beacon_state/compact_state.rs +++ b/consensus/types/src/beacon_state/compact_state.rs @@ -1,6 +1,6 @@ use crate::{ BeaconState, BeaconStateAltair, BeaconStateBase, BeaconStateCapella, BeaconStateDeneb, - BeaconStateError as Error, BeaconStateMerge, EthSpec, PublicKeyBytes, VList, Validator, + BeaconStateError as Error, BeaconStateMerge, EthSpec, List, PublicKeyBytes, Validator, ValidatorMutable, }; use itertools::process_results; @@ -30,7 +30,7 @@ macro_rules! full_to_compact { eth1_deposit_index: $s.eth1_deposit_index, // Validator registry - validators: VList::try_from_iter( + validators: List::try_from_iter( $s.validators.into_iter().map(|validator| validator.mutable.clone()) ).expect("fix this"), balances: $s.balances.clone(), @@ -95,7 +95,7 @@ macro_rules! compact_to_full { mutable: mutable.clone(), } }) - }), |iter| VList::try_from_iter(iter))??, + }), |iter| List::try_from_iter(iter))??, balances: $inner.balances, // Shuffling diff --git a/consensus/types/src/beacon_state/tests.rs b/consensus/types/src/beacon_state/tests.rs index 5bf6d38db65..734e23b2421 100644 --- a/consensus/types/src/beacon_state/tests.rs +++ b/consensus/types/src/beacon_state/tests.rs @@ -4,7 +4,7 @@ use beacon_chain::test_utils::{BeaconChainHarness, EphemeralHarnessType}; use beacon_chain::types::{ test_utils::TestRandom, BeaconState, BeaconStateAltair, BeaconStateBase, BeaconStateCapella, BeaconStateDeneb, BeaconStateError, BeaconStateMerge, ChainSpec, Domain, Epoch, EthSpec, - FixedVector, Hash256, Keypair, MainnetEthSpec, MinimalEthSpec, RelativeEpoch, Slot, + Hash256, Keypair, MainnetEthSpec, MinimalEthSpec, RelativeEpoch, Slot, Vector, }; use ssz::Encode; use std::ops::Mul; @@ -250,7 +250,7 @@ mod committees { let distinct_hashes = (0..T::epochs_per_historical_vector()).map(|i| Hash256::from_low_u64_be(i as u64)); - *new_head_state.randao_mixes_mut() = FixedVector::try_from_iter(distinct_hashes).unwrap(); + *new_head_state.randao_mixes_mut() = Vector::try_from_iter(distinct_hashes).unwrap(); new_head_state .force_build_committee_cache(RelativeEpoch::Previous, spec) diff --git a/consensus/types/src/blob_sidecar.rs b/consensus/types/src/blob_sidecar.rs index c249d8b4d83..c5bcfe6e4e5 100644 --- a/consensus/types/src/blob_sidecar.rs +++ b/consensus/types/src/blob_sidecar.rs @@ -1,7 +1,7 @@ use crate::test_utils::TestRandom; use crate::{ beacon_block_body::BLOB_KZG_COMMITMENTS_INDEX, BeaconBlockHeader, BeaconStateError, Blob, - EthSpec, Hash256, SignedBeaconBlockHeader, Slot, + EthSpec, FixedVector, Hash256, SignedBeaconBlockHeader, Slot, VariableList, }; use crate::{KzgProofs, SignedBeaconBlock}; use bls::Signature; @@ -16,7 +16,6 @@ use safe_arith::{ArithError, SafeArith}; use serde::{Deserialize, Serialize}; use ssz::Encode; use ssz_derive::{Decode, Encode}; -use ssz_types::{FixedVector, VariableList}; use std::fmt::Debug; use std::hash::Hash; use std::sync::Arc; diff --git a/consensus/types/src/execution_payload.rs b/consensus/types/src/execution_payload.rs index ea591eb7490..8881d6bd766 100644 --- a/consensus/types/src/execution_payload.rs +++ b/consensus/types/src/execution_payload.rs @@ -6,8 +6,7 @@ use ssz_derive::{Decode, Encode}; use test_random_derive::TestRandom; use tree_hash_derive::TreeHash; -// FIXME(sproul): try milhouse FixedVector -use ssz_types::FixedVector; +// FIXME(sproul): try milhouse Vector pub type Transaction = VariableList; pub type Transactions = VariableList< diff --git a/consensus/types/src/execution_payload_header.rs b/consensus/types/src/execution_payload_header.rs index 915d5aab347..4dd114384fa 100644 --- a/consensus/types/src/execution_payload_header.rs +++ b/consensus/types/src/execution_payload_header.rs @@ -8,8 +8,6 @@ use tree_hash::TreeHash; use tree_hash_derive::TreeHash; use BeaconStateError; -use ssz_types::{FixedVector, VariableList}; - #[superstruct( variants(Merge, Capella, Deneb), variant_attributes( diff --git a/consensus/types/src/historical_batch.rs b/consensus/types/src/historical_batch.rs index 7eb129e1b69..ac95b77fb1f 100644 --- a/consensus/types/src/historical_batch.rs +++ b/consensus/types/src/historical_batch.rs @@ -24,9 +24,9 @@ use tree_hash_derive::TreeHash; #[arbitrary(bound = "T: EthSpec")] pub struct HistoricalBatch { #[test_random(default)] - pub block_roots: FixedVector, + pub block_roots: Vector, #[test_random(default)] - pub state_roots: FixedVector, + pub state_roots: Vector, } #[cfg(test)] diff --git a/consensus/types/src/lib.rs b/consensus/types/src/lib.rs index 6edd4a731d9..c14504b468c 100644 --- a/consensus/types/src/lib.rs +++ b/consensus/types/src/lib.rs @@ -221,6 +221,6 @@ pub use bls::{ Signature, SignatureBytes, }; pub use kzg::{KzgCommitment, KzgProof, VERSIONED_HASH_VERSION_KZG}; -pub use milhouse::{self, Vector as FixedVector}; -pub use ssz_types::{typenum, typenum::Unsigned, BitList, BitVector, VariableList}; +pub use milhouse::{self, List, Vector}; +pub use ssz_types::{typenum, typenum::Unsigned, BitList, BitVector, FixedVector, VariableList}; pub use superstruct::superstruct; diff --git a/consensus/types/src/light_client_bootstrap.rs b/consensus/types/src/light_client_bootstrap.rs index e966fb16a6c..f88d88135de 100644 --- a/consensus/types/src/light_client_bootstrap.rs +++ b/consensus/types/src/light_client_bootstrap.rs @@ -1,12 +1,11 @@ use super::{BeaconState, EthSpec, Hash256, SyncCommittee}; use crate::{ - light_client_update::*, test_utils::TestRandom, ForkName, ForkVersionDeserialize, + light_client_update::*, test_utils::TestRandom, FixedVector, ForkName, ForkVersionDeserialize, LightClientHeader, }; use serde::{Deserialize, Deserializer, Serialize}; use serde_json::Value; use ssz_derive::{Decode, Encode}; -use ssz_types::FixedVector; use std::sync::Arc; use test_random_derive::TestRandom; diff --git a/consensus/types/src/light_client_finality_update.rs b/consensus/types/src/light_client_finality_update.rs index 3e1f22b958e..2447f224753 100644 --- a/consensus/types/src/light_client_finality_update.rs +++ b/consensus/types/src/light_client_finality_update.rs @@ -1,12 +1,11 @@ use super::{EthSpec, Hash256, SignedBeaconBlock, SignedBlindedBeaconBlock, Slot, SyncAggregate}; use crate::{ - light_client_update::*, test_utils::TestRandom, BeaconState, ChainSpec, ForkName, + light_client_update::*, test_utils::TestRandom, BeaconState, ChainSpec, FixedVector, ForkName, ForkVersionDeserialize, LightClientHeader, }; use serde::{Deserialize, Deserializer, Serialize}; use serde_json::Value; use ssz_derive::{Decode, Encode}; -use ssz_types::FixedVector; use test_random_derive::TestRandom; use tree_hash::TreeHash; diff --git a/consensus/types/src/light_client_update.rs b/consensus/types/src/light_client_update.rs index 32cee21ca92..45f82ecbbdd 100644 --- a/consensus/types/src/light_client_update.rs +++ b/consensus/types/src/light_client_update.rs @@ -1,16 +1,13 @@ use super::{BeaconBlockHeader, EthSpec, Hash256, Slot, SyncAggregate, SyncCommittee}; use crate::{ - beacon_state, test_utils::TestRandom, BeaconBlock, BeaconState, ChainSpec, ForkName, - ForkVersionDeserialize, LightClientHeader, + beacon_state, test_utils::TestRandom, BeaconBlock, BeaconState, ChainSpec, FixedVector, + ForkName, ForkVersionDeserialize, LightClientHeader, }; use safe_arith::ArithError; use serde::{Deserialize, Deserializer, Serialize}; use serde_json::Value; use ssz_derive::{Decode, Encode}; -use ssz_types::{ - typenum::{U5, U6}, - FixedVector, -}; +use ssz_types::typenum::{U5, U6}; use std::sync::Arc; use test_random_derive::TestRandom; use tree_hash::TreeHash; diff --git a/consensus/types/src/sync_committee.rs b/consensus/types/src/sync_committee.rs index a7804c35f4f..b42a000bb00 100644 --- a/consensus/types/src/sync_committee.rs +++ b/consensus/types/src/sync_committee.rs @@ -1,10 +1,9 @@ use crate::test_utils::TestRandom; -use crate::{EthSpec, SyncSubnetId}; +use crate::{EthSpec, FixedVector, SyncSubnetId}; use bls::PublicKeyBytes; use safe_arith::{ArithError, SafeArith}; use serde::{Deserialize, Serialize}; use ssz_derive::{Decode, Encode}; -use ssz_types::FixedVector; use std::collections::HashMap; use test_random_derive::TestRandom; use tree_hash_derive::TreeHash; diff --git a/testing/ef_tests/src/cases/ssz_generic.rs b/testing/ef_tests/src/cases/ssz_generic.rs index 4f45e248a83..1ea48bdf564 100644 --- a/testing/ef_tests/src/cases/ssz_generic.rs +++ b/testing/ef_tests/src/cases/ssz_generic.rs @@ -9,7 +9,7 @@ use ssz_derive::{Decode, Encode}; use std::path::{Path, PathBuf}; use tree_hash_derive::TreeHash; use types::typenum::*; -use types::{BitList, BitVector, FixedVector, ForkName, VariableList}; +use types::{BitList, BitVector, ForkName, VariableList, Vector}; #[derive(Debug, Clone, Deserialize)] struct Metadata { @@ -135,7 +135,7 @@ impl Case for SszGeneric { type_dispatch!( ssz_generic_test, (&self.path), - FixedVector, + Vector, <>, [elem_ty => primitive_type] [length => typenum] @@ -270,8 +270,8 @@ struct ComplexTestStruct { #[serde(deserialize_with = "byte_list_from_hex_str")] D: VariableList, E: VarTestStruct, - F: FixedVector, - G: FixedVector, + F: Vector, + G: Vector, } #[derive(Debug, Clone, PartialEq, Decode, Encode, TreeHash, Deserialize)]