diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index a6be3dde8c..2f25c7728a 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -134,7 +134,7 @@ use tracing::{Span, debug, debug_span, error, info, info_span, instrument, trace use tree_hash::TreeHash; use types::blob_sidecar::FixedBlobSidecarList; use types::data_column_sidecar::ColumnIndex; -use types::payload::BlockProductionVersion; +use types::execution::BlockProductionVersion; use types::*; pub type ForkChoiceError = fork_choice::Error; diff --git a/beacon_node/beacon_chain/src/errors.rs b/beacon_node/beacon_chain/src/errors.rs index 7fa6a0b510..816e75fd24 100644 --- a/beacon_node/beacon_chain/src/errors.rs +++ b/beacon_node/beacon_chain/src/errors.rs @@ -219,7 +219,7 @@ pub enum BeaconChainError { UnableToPublish, UnableToBuildColumnSidecar(String), AvailabilityCheckError(AvailabilityCheckError), - LightClientUpdateError(LightClientUpdateError), + LightClientError(LightClientError), LightClientBootstrapError(String), UnsupportedFork, MilhouseError(MilhouseError), @@ -274,7 +274,7 @@ easy_from_to!(BlockReplayError, BeaconChainError); easy_from_to!(InconsistentFork, BeaconChainError); easy_from_to!(AvailabilityCheckError, BeaconChainError); easy_from_to!(EpochCacheError, BeaconChainError); -easy_from_to!(LightClientUpdateError, BeaconChainError); +easy_from_to!(LightClientError, BeaconChainError); easy_from_to!(MilhouseError, BeaconChainError); easy_from_to!(AttestationError, BeaconChainError); diff --git a/beacon_node/beacon_chain/src/execution_payload.rs b/beacon_node/beacon_chain/src/execution_payload.rs index f0cab06ca3..9459b1acd7 100644 --- a/beacon_node/beacon_chain/src/execution_payload.rs +++ b/beacon_node/beacon_chain/src/execution_payload.rs @@ -26,7 +26,7 @@ use std::sync::Arc; use tokio::task::JoinHandle; use tracing::{Instrument, debug, debug_span, warn}; use tree_hash::TreeHash; -use types::payload::BlockProductionVersion; +use types::execution::BlockProductionVersion; use types::*; pub type PreparePayloadResult = Result, BlockProductionError>; diff --git a/beacon_node/beacon_chain/src/naive_aggregation_pool.rs b/beacon_node/beacon_chain/src/naive_aggregation_pool.rs index beefc2d678..e8f1108657 100644 --- a/beacon_node/beacon_chain/src/naive_aggregation_pool.rs +++ b/beacon_node/beacon_chain/src/naive_aggregation_pool.rs @@ -4,8 +4,8 @@ use itertools::Itertools; use smallvec::SmallVec; use std::collections::HashMap; use tree_hash::{MerkleHasher, TreeHash, TreeHashType}; +use types::SlotData; use types::consts::altair::SYNC_COMMITTEE_SUBNET_COUNT; -use types::slot_data::SlotData; use types::sync_committee_contribution::SyncContributionData; use types::{ Attestation, AttestationData, AttestationRef, CommitteeIndex, EthSpec, Hash256, Slot, diff --git a/beacon_node/beacon_chain/src/observed_aggregates.rs b/beacon_node/beacon_chain/src/observed_aggregates.rs index b2c5cb4b38..7ecd581e85 100644 --- a/beacon_node/beacon_chain/src/observed_aggregates.rs +++ b/beacon_node/beacon_chain/src/observed_aggregates.rs @@ -7,10 +7,10 @@ use std::collections::HashMap; use std::marker::PhantomData; use tree_hash::TreeHash; use tree_hash_derive::TreeHash; +use types::SlotData; use types::consts::altair::{ SYNC_COMMITTEE_SUBNET_COUNT, TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE, }; -use types::slot_data::SlotData; use types::{ Attestation, AttestationData, AttestationRef, EthSpec, Hash256, Slot, SyncCommitteeContribution, }; diff --git a/beacon_node/beacon_chain/src/observed_attesters.rs b/beacon_node/beacon_chain/src/observed_attesters.rs index d5433f49d1..277bf38ffc 100644 --- a/beacon_node/beacon_chain/src/observed_attesters.rs +++ b/beacon_node/beacon_chain/src/observed_attesters.rs @@ -20,7 +20,7 @@ use std::collections::{HashMap, HashSet}; use std::hash::Hash; use std::marker::PhantomData; use typenum::Unsigned; -use types::slot_data::SlotData; +use types::SlotData; use types::{Epoch, EthSpec, Hash256, Slot}; /// The maximum capacity of the `AutoPruningEpochContainer`. diff --git a/beacon_node/beacon_chain/src/sync_committee_verification.rs b/beacon_node/beacon_chain/src/sync_committee_verification.rs index e74e284e58..aacbb8cfec 100644 --- a/beacon_node/beacon_chain/src/sync_committee_verification.rs +++ b/beacon_node/beacon_chain/src/sync_committee_verification.rs @@ -48,8 +48,8 @@ use strum::AsRefStr; use tree_hash::TreeHash; use tree_hash_derive::TreeHash; use types::ChainSpec; +use types::SlotData; use types::consts::altair::SYNC_COMMITTEE_SUBNET_COUNT; -use types::slot_data::SlotData; use types::sync_committee::SyncCommitteeError; use types::{ BeaconStateError, EthSpec, Hash256, SignedContributionAndProof, Slot, diff --git a/beacon_node/beacon_chain/src/test_utils.rs b/beacon_node/beacon_chain/src/test_utils.rs index 6d17d6d85c..0a226d0f76 100644 --- a/beacon_node/beacon_chain/src/test_utils.rs +++ b/beacon_node/beacon_chain/src/test_utils.rs @@ -68,8 +68,8 @@ use task_executor::{ShutdownReason, test_utils::TestRuntime}; use tree_hash::TreeHash; use typenum::U4294967296; use types::data_column_custody_group::CustodyIndex; +use types::execution::BlockProductionVersion; use types::indexed_attestation::IndexedAttestationBase; -use types::payload::BlockProductionVersion; use types::test_utils::TestRandom; pub use types::test_utils::generate_deterministic_keypairs; use types::*; diff --git a/beacon_node/execution_layer/src/lib.rs b/beacon_node/execution_layer/src/lib.rs index 554668dd8a..37b514f480 100644 --- a/beacon_node/execution_layer/src/lib.rs +++ b/beacon_node/execution_layer/src/lib.rs @@ -47,8 +47,8 @@ use tracing::{Instrument, debug, debug_span, error, info, instrument, warn}; use tree_hash::TreeHash; use types::beacon_block_body::KzgCommitments; use types::builder_bid::BuilderBid; +use types::execution::BlockProductionVersion; use types::non_zero_usize::new_non_zero_usize; -use types::payload::BlockProductionVersion; use types::{ AbstractExecPayload, BlobsList, ExecutionPayloadDeneb, ExecutionRequests, KzgProofs, SignedBlindedBeaconBlock, diff --git a/beacon_node/http_api/src/beacon/states.rs b/beacon_node/http_api/src/beacon/states.rs index 6d06bcc77d..828efb86a7 100644 --- a/beacon_node/http_api/src/beacon/states.rs +++ b/beacon_node/http_api/src/beacon/states.rs @@ -12,9 +12,7 @@ use eth2::types::{ ValidatorsRequestBody, }; use std::sync::Arc; -use types::{ - AttestationShufflingId, CommitteeCache, Error as BeaconStateError, EthSpec, RelativeEpoch, -}; +use types::{AttestationShufflingId, BeaconStateError, CommitteeCache, EthSpec, RelativeEpoch}; use warp::filters::BoxedFilter; use warp::{Filter, Reply}; use warp_utils::query::multi_key_query; diff --git a/beacon_node/http_api/src/produce_block.rs b/beacon_node/http_api/src/produce_block.rs index 3bd0cec7e3..ee92702fb7 100644 --- a/beacon_node/http_api/src/produce_block.rs +++ b/beacon_node/http_api/src/produce_block.rs @@ -16,7 +16,7 @@ use lighthouse_tracing::{SPAN_PRODUCE_BLOCK_V2, SPAN_PRODUCE_BLOCK_V3}; use ssz::Encode; use std::sync::Arc; use tracing::instrument; -use types::{payload::BlockProductionVersion, *}; +use types::{execution::BlockProductionVersion, *}; use warp::{ Reply, hyper::{Body, Response}, diff --git a/beacon_node/http_api/src/sync_committees.rs b/beacon_node/http_api/src/sync_committees.rs index b9fa24ad6a..6e2f4c9585 100644 --- a/beacon_node/http_api/src/sync_committees.rs +++ b/beacon_node/http_api/src/sync_committees.rs @@ -17,8 +17,8 @@ use std::collections::HashMap; use tokio::sync::mpsc::UnboundedSender; use tracing::{debug, error, warn}; use types::{ - BeaconStateError, Epoch, EthSpec, SignedContributionAndProof, SyncCommitteeMessage, SyncDuty, - SyncSubnetId, slot_data::SlotData, + BeaconStateError, Epoch, EthSpec, SignedContributionAndProof, SlotData, SyncCommitteeMessage, + SyncDuty, SyncSubnetId, }; /// The struct that is returned to the requesting HTTP client. diff --git a/beacon_node/http_api/tests/tests.rs b/beacon_node/http_api/tests/tests.rs index 72e2186959..8a79541363 100644 --- a/beacon_node/http_api/tests/tests.rs +++ b/beacon_node/http_api/tests/tests.rs @@ -44,7 +44,7 @@ use std::convert::TryInto; use std::sync::Arc; use tokio::time::Duration; use tree_hash::TreeHash; -use types::application_domain::ApplicationDomain; +use types::ApplicationDomain; use types::{ Domain, EthSpec, ExecutionBlockHash, Hash256, MainnetEthSpec, RelativeEpoch, SelectionProof, SignedRoot, SingleAttestation, Slot, attestation::AttestationBase, diff --git a/beacon_node/operation_pool/src/lib.rs b/beacon_node/operation_pool/src/lib.rs index 00361450a5..81423d6abd 100644 --- a/beacon_node/operation_pool/src/lib.rs +++ b/beacon_node/operation_pool/src/lib.rs @@ -39,8 +39,8 @@ use typenum::Unsigned; use types::{ AbstractExecPayload, Attestation, AttestationData, AttesterSlashing, BeaconState, BeaconStateError, ChainSpec, Epoch, EthSpec, ProposerSlashing, SignedBeaconBlock, - SignedBlsToExecutionChange, SignedVoluntaryExit, Slot, SyncAggregate, - SyncCommitteeContribution, Validator, sync_aggregate::Error as SyncAggregateError, + SignedBlsToExecutionChange, SignedVoluntaryExit, Slot, SyncAggregate, SyncAggregateError, + SyncCommitteeContribution, Validator, }; type SyncContributions = RwLock>>>; diff --git a/consensus/state_processing/src/common/altair.rs b/consensus/state_processing/src/common/altair.rs index 4380154133..dae6b0302d 100644 --- a/consensus/state_processing/src/common/altair.rs +++ b/consensus/state_processing/src/common/altair.rs @@ -28,7 +28,7 @@ pub fn get_base_reward( validator_effective_balance: u64, base_reward_per_increment: BaseRewardPerIncrement, spec: &ChainSpec, -) -> Result { +) -> Result { validator_effective_balance .safe_div(spec.effective_balance_increment)? .safe_mul(base_reward_per_increment.as_u64()) diff --git a/consensus/state_processing/src/common/get_attesting_indices.rs b/consensus/state_processing/src/common/get_attesting_indices.rs index dc7be7c251..ff9f60c5ea 100644 --- a/consensus/state_processing/src/common/get_attesting_indices.rs +++ b/consensus/state_processing/src/common/get_attesting_indices.rs @@ -107,7 +107,7 @@ pub mod attesting_indices_electra { for committee_index in committee_indices { let beacon_committee = committees .get(committee_index as usize) - .ok_or(Error::NoCommitteeFound(committee_index))?; + .ok_or(BeaconStateError::NoCommitteeFound(committee_index))?; // This check is new to the spec's `process_attestation` in Electra. if committee_index >= committee_count_per_slot { diff --git a/consensus/state_processing/src/genesis.rs b/consensus/state_processing/src/genesis.rs index 1575fce22f..861fccb374 100644 --- a/consensus/state_processing/src/genesis.rs +++ b/consensus/state_processing/src/genesis.rs @@ -195,7 +195,7 @@ pub fn is_valid_genesis_state(state: &BeaconState, spec: &ChainSp pub fn process_activations( state: &mut BeaconState, spec: &ChainSpec, -) -> Result<(), Error> { +) -> Result<(), BeaconStateError> { let (validators, balances, _) = state.validators_and_balances_and_progressive_balances_mut(); let mut validators_iter = validators.iter_cow(); while let Some((index, validator)) = validators_iter.next_cow() { @@ -203,7 +203,7 @@ pub fn process_activations( let balance = balances .get(index) .copied() - .ok_or(Error::BalancesOutOfBounds(index))?; + .ok_or(BeaconStateError::BalancesOutOfBounds(index))?; validator.effective_balance = std::cmp::min( balance.safe_sub(balance.safe_rem(spec.effective_balance_increment)?)?, spec.max_effective_balance, diff --git a/consensus/state_processing/src/per_block_processing.rs b/consensus/state_processing/src/per_block_processing.rs index 07149ff2ee..cd1c1b9849 100644 --- a/consensus/state_processing/src/per_block_processing.rs +++ b/consensus/state_processing/src/per_block_processing.rs @@ -322,7 +322,7 @@ pub fn process_randao>( pub fn process_eth1_data( state: &mut BeaconState, eth1_data: &Eth1Data, -) -> Result<(), Error> { +) -> Result<(), BeaconStateError> { if let Some(new_eth1_data) = get_new_eth1_data(state, eth1_data)? { *state.eth1_data_mut() = new_eth1_data; } diff --git a/consensus/state_processing/src/per_block_processing/deneb.rs b/consensus/state_processing/src/per_block_processing/deneb.rs index a57c080c03..911e7e037e 100644 --- a/consensus/state_processing/src/per_block_processing/deneb.rs +++ b/consensus/state_processing/src/per_block_processing/deneb.rs @@ -1,5 +1,5 @@ use ethereum_hashing::hash_fixed; -use types::{KzgCommitment, VERSIONED_HASH_VERSION_KZG, VersionedHash}; +use types::{VersionedHash, kzg_ext::KzgCommitment, kzg_ext::consts::VERSIONED_HASH_VERSION_KZG}; pub fn kzg_commitment_to_versioned_hash(kzg_commitment: &KzgCommitment) -> VersionedHash { let mut hashed_commitment = hash_fixed(&kzg_commitment.0); diff --git a/consensus/types/src/lib.rs b/consensus/types/src/lib.rs index 5a89fcb1d4..5ac1315f29 100644 --- a/consensus/types/src/lib.rs +++ b/consensus/types/src/lib.rs @@ -114,10 +114,6 @@ pub mod blob_sidecar { }; } -pub mod payload { - pub use crate::execution::BlockProductionVersion; -} - pub mod execution_requests { pub use crate::execution::{ ConsolidationRequests, DepositRequests, ExecutionRequests, RequestType, WithdrawalRequests, @@ -135,10 +131,6 @@ pub mod data_column_custody_group { }; } -pub mod sync_aggregate { - pub use crate::sync_committee::SyncAggregateError as Error; -} - pub mod light_client_update { pub use crate::light_client::consts::{ CURRENT_SYNC_COMMITTEE_INDEX, CURRENT_SYNC_COMMITTEE_INDEX_ELECTRA, FINALIZED_ROOT_INDEX, @@ -153,10 +145,6 @@ pub mod sync_committee_contribution { }; } -pub mod slot_data { - pub use crate::core::SlotData; -} - pub mod signed_aggregate_and_proof { pub use crate::attestation::SignedAggregateAndProofRefMut; } @@ -166,12 +154,3 @@ pub mod payload_attestation { PayloadAttestation, PayloadAttestationData, PayloadAttestationMessage, }; } - -pub mod application_domain { - pub use crate::core::ApplicationDomain; -} - -// Temporary re-exports to maintain backwards compatibility for Lighthouse. -pub use crate::kzg_ext::consts::VERSIONED_HASH_VERSION_KZG; -pub use crate::light_client::LightClientError as LightClientUpdateError; -pub use crate::state::BeaconStateError as Error; diff --git a/testing/execution_engine_integration/src/test_rig.rs b/testing/execution_engine_integration/src/test_rig.rs index 8c64c7cf37..24d75f5a11 100644 --- a/testing/execution_engine_integration/src/test_rig.rs +++ b/testing/execution_engine_integration/src/test_rig.rs @@ -21,7 +21,7 @@ use std::sync::Arc; use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH}; use task_executor::TaskExecutor; use tokio::time::sleep; -use types::payload::BlockProductionVersion; +use types::execution::BlockProductionVersion; use types::{ Address, ChainSpec, EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadHeader, ForkName, Hash256, MainnetEthSpec, Slot, Uint256,