Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ tracing-opentelemetry = "0.31.0"
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
tree_hash = "0.12.0"
tree_hash_derive = "0.12.0"
typenum = "1"
types = { path = "consensus/types" }
url = "2"
uuid = { version = "0.8", features = ["serde", "v4"] }
Expand Down
3 changes: 2 additions & 1 deletion account_manager/src/validator/slashing_protection.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use bls::PublicKeyBytes;
use clap::{Arg, ArgAction, ArgMatches, Command};
use environment::Environment;
use slashing_protection::{
Expand All @@ -7,7 +8,7 @@ use slashing_protection::{
use std::fs::File;
use std::path::PathBuf;
use std::str::FromStr;
use types::{Epoch, EthSpec, PublicKeyBytes, Slot};
use types::{Epoch, EthSpec, Slot};

pub const CMD: &str = "slashing-protection";
pub const IMPORT_CMD: &str = "import";
Expand Down
1 change: 1 addition & 0 deletions beacon_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ testing = [] # Enables testing-only CLI flags
[dependencies]
account_utils = { workspace = true }
beacon_chain = { workspace = true }
bls = { workspace = true }
clap = { workspace = true }
clap_utils = { workspace = true }
client = { path = "client" }
Expand Down
3 changes: 3 additions & 0 deletions beacon_node/beacon_chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ ethereum_serde_utils = { workspace = true }
ethereum_ssz = { workspace = true }
ethereum_ssz_derive = { workspace = true }
execution_layer = { workspace = true }
fixed_bytes = { workspace = true }
fork_choice = { workspace = true }
futures = { workspace = true }
genesis = { workspace = true }
Expand All @@ -39,6 +40,7 @@ logging = { workspace = true }
lru = { workspace = true }
merkle_proof = { workspace = true }
metrics = { workspace = true }
milhouse = { workspace = true }
once_cell = { workspace = true }
oneshot_broadcast = { path = "../../common/oneshot_broadcast/" }
operation_pool = { workspace = true }
Expand All @@ -65,6 +67,7 @@ tokio-stream = { workspace = true }
tracing = { workspace = true }
tree_hash = { workspace = true }
tree_hash_derive = { workspace = true }
typenum = { workspace = true }
types = { workspace = true }
zstd = { workspace = true }

Expand Down
5 changes: 3 additions & 2 deletions beacon_node/beacon_chain/src/attester_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
//! and penalties can be computed and the `state.current_justified_checkpoint` can be updated.

use crate::{BeaconChain, BeaconChainError, BeaconChainTypes};
use fixed_bytes::FixedBytesExtended;
use parking_lot::RwLock;
use state_processing::state_advance::{Error as StateAdvanceError, partial_state_advance};
use std::collections::HashMap;
use std::ops::Range;
use types::{
BeaconState, BeaconStateError, ChainSpec, Checkpoint, Epoch, EthSpec, FixedBytesExtended,
Hash256, RelativeEpoch, Slot,
BeaconState, BeaconStateError, ChainSpec, Checkpoint, Epoch, EthSpec, Hash256, RelativeEpoch,
Slot,
attestation::AttestationError,
beacon_state::{
compute_committee_index_in_epoch, compute_committee_range_in_epoch, epoch_committee_count,
Expand Down
6 changes: 3 additions & 3 deletions beacon_node/beacon_chain/src/beacon_block_streamer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -685,13 +685,13 @@ impl From<Error> for BeaconChainError {
mod tests {
use crate::beacon_block_streamer::{BeaconBlockStreamer, CheckCaches};
use crate::test_utils::{BeaconChainHarness, EphemeralHarnessType, test_spec};
use bls::Keypair;
use execution_layer::test_utils::Block;
use fixed_bytes::FixedBytesExtended;
use std::sync::Arc;
use std::sync::LazyLock;
use tokio::sync::mpsc;
use types::{
ChainSpec, Epoch, EthSpec, FixedBytesExtended, Hash256, Keypair, MinimalEthSpec, Slot,
};
use types::{ChainSpec, Epoch, EthSpec, Hash256, MinimalEthSpec, Slot};

const VALIDATOR_COUNT: usize = 48;

Expand Down
2 changes: 2 additions & 0 deletions beacon_node/beacon_chain/src/beacon_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ use crate::{
AvailabilityPendingExecutedBlock, BeaconChainError, BeaconForkChoiceStore, BeaconSnapshot,
CachedHead, metrics,
};
use bls::{PublicKey, PublicKeyBytes, Signature};
use eth2::beacon_response::ForkVersionedResponse;
use eth2::types::{
EventKind, SseBlobSidecar, SseBlock, SseDataColumnSidecar, SseExtendedPayloadAttributes,
Expand All @@ -82,6 +83,7 @@ use execution_layer::{
BlockProposalContents, BlockProposalContentsType, BuilderParams, ChainHealth, ExecutionLayer,
FailedCondition, PayloadAttributes, PayloadStatus,
};
use fixed_bytes::FixedBytesExtended;
use fork_choice::{
AttestationFromBlock, ExecutionStatus, ForkChoice, ForkchoiceUpdateParameters,
InvalidationOperation, PayloadVerificationStatus, ResetPayloadStatuses,
Expand Down
3 changes: 2 additions & 1 deletion beacon_node/beacon_chain/src/beacon_fork_choice_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use crate::{BeaconSnapshot, metrics};
use educe::Educe;
use fixed_bytes::FixedBytesExtended;
use fork_choice::ForkChoiceStore;
use proto_array::JustifiedBalances;
use safe_arith::ArithError;
Expand All @@ -17,7 +18,7 @@ use store::{Error as StoreError, HotColdDB, ItemStore};
use superstruct::superstruct;
use types::{
AbstractExecPayload, BeaconBlockRef, BeaconState, BeaconStateError, Checkpoint, Epoch, EthSpec,
FixedBytesExtended, Hash256, Slot,
Hash256, Slot,
};

#[derive(Debug)]
Expand Down
5 changes: 2 additions & 3 deletions beacon_node/beacon_chain/src/beacon_proposer_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ use state_processing::state_advance::partial_state_advance;
use std::num::NonZeroUsize;
use std::sync::Arc;
use tracing::instrument;
use typenum::Unsigned;
use types::non_zero_usize::new_non_zero_usize;
use types::{
BeaconState, BeaconStateError, ChainSpec, Epoch, EthSpec, Fork, Hash256, Slot, Unsigned,
};
use types::{BeaconState, BeaconStateError, ChainSpec, Epoch, EthSpec, Fork, Hash256, Slot};

/// The number of sets of proposer indices that should be cached.
const CACHE_SIZE: NonZeroUsize = new_non_zero_usize(16);
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/beacon_chain/src/block_times_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ impl BlockTimesCache {
#[cfg(test)]
mod test {
use super::*;
use types::FixedBytesExtended;
use fixed_bytes::FixedBytesExtended;

#[test]
fn observed_time_uses_minimum() {
Expand Down
3 changes: 2 additions & 1 deletion beacon_node/beacon_chain/src/block_verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ use crate::{
beacon_chain::{BeaconForkChoice, ForkChoiceError},
metrics,
};
use bls::{PublicKey, PublicKeyBytes};
use educe::Educe;
use eth2::types::{BlockGossip, EventKind};
use execution_layer::PayloadStatus;
Expand Down Expand Up @@ -97,7 +98,7 @@ use tracing::{Instrument, Span, debug, debug_span, error, info_span, instrument}
use types::{
BeaconBlockRef, BeaconState, BeaconStateError, BlobsList, ChainSpec, DataColumnSidecarList,
Epoch, EthSpec, ExecutionBlockHash, FullPayload, Hash256, InconsistentFork, KzgProofs,
PublicKey, PublicKeyBytes, RelativeEpoch, SignedBeaconBlock, SignedBeaconBlockHeader, Slot,
RelativeEpoch, SignedBeaconBlock, SignedBeaconBlockHeader, Slot,
data_column_sidecar::DataColumnSidecarError,
};

Expand Down
4 changes: 3 additions & 1 deletion beacon_node/beacon_chain/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ use crate::validator_pubkey_cache::ValidatorPubkeyCache;
use crate::{
BeaconChain, BeaconChainTypes, BeaconForkChoiceStore, BeaconSnapshot, ServerSentEventHandler,
};
use bls::Signature;
use execution_layer::ExecutionLayer;
use fixed_bytes::FixedBytesExtended;
use fork_choice::{ForkChoice, ResetPayloadStatuses};
use futures::channel::mpsc::Sender;
use kzg::Kzg;
Expand All @@ -43,7 +45,7 @@ use tracing::{debug, error, info};
use types::data_column_custody_group::CustodyIndex;
use types::{
BeaconBlock, BeaconState, BlobSidecarList, ChainSpec, ColumnIndex, DataColumnSidecarList,
Epoch, EthSpec, FixedBytesExtended, Hash256, Signature, SignedBeaconBlock, Slot,
Epoch, EthSpec, Hash256, SignedBeaconBlock, Slot,
};

/// An empty struct used to "witness" all the `BeaconChainTypes` traits. It has no user-facing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1261,15 +1261,14 @@ mod pending_components_tests {
use crate::PayloadVerificationOutcome;
use crate::block_verification_types::BlockImportData;
use crate::test_utils::{NumBlobs, generate_rand_block_and_blobs, test_spec};
use fixed_bytes::FixedBytesExtended;
use fork_choice::PayloadVerificationStatus;
use kzg::KzgCommitment;
use rand::SeedableRng;
use rand::rngs::StdRng;
use state_processing::ConsensusContext;
use types::test_utils::TestRandom;
use types::{
BeaconState, FixedBytesExtended, ForkName, MainnetEthSpec, SignedBeaconBlock, Slot,
};
use types::{BeaconState, ForkName, MainnetEthSpec, SignedBeaconBlock, Slot};

type E = MainnetEthSpec;

Expand Down
3 changes: 2 additions & 1 deletion beacon_node/beacon_chain/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ use crate::observed_aggregates::Error as ObservedAttestationsError;
use crate::observed_attesters::Error as ObservedAttestersError;
use crate::observed_block_producers::Error as ObservedBlockProducersError;
use crate::observed_data_sidecars::Error as ObservedDataSidecarsError;
use bls::PublicKeyBytes;
use execution_layer::PayloadStatus;
use fork_choice::ExecutionStatus;
use futures::channel::mpsc::TrySendError;
use milhouse::Error as MilhouseError;
use operation_pool::OpPoolError;
use safe_arith::ArithError;
use ssz_types::Error as SszTypesError;
Expand All @@ -28,7 +30,6 @@ use state_processing::{
};
use task_executor::ShutdownReason;
use tokio::task::JoinError;
use types::milhouse::Error as MilhouseError;
use types::*;

macro_rules! easy_from_to {
Expand Down
3 changes: 2 additions & 1 deletion beacon_node/beacon_chain/src/graffiti_calculator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,14 @@ async fn engine_version_cache_refresh_service<T: BeaconChainTypes>(
mod tests {
use crate::ChainConfig;
use crate::test_utils::{BeaconChainHarness, EphemeralHarnessType, test_spec};
use bls::Keypair;
use execution_layer::EngineCapabilities;
use execution_layer::test_utils::{DEFAULT_CLIENT_VERSION, DEFAULT_ENGINE_CAPABILITIES};
use std::sync::Arc;
use std::sync::LazyLock;
use std::time::Duration;
use tracing::info;
use types::{ChainSpec, GRAFFITI_BYTES_LEN, Graffiti, Keypair, MinimalEthSpec};
use types::{ChainSpec, GRAFFITI_BYTES_LEN, Graffiti, MinimalEthSpec};

const VALIDATOR_COUNT: usize = 48;
/// A cached set of keys.
Expand Down
3 changes: 2 additions & 1 deletion beacon_node/beacon_chain/src/historical_blocks.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::data_availability_checker::{AvailableBlock, AvailableBlockData};
use crate::{BeaconChain, BeaconChainTypes, WhenSlotSkipped, metrics};
use fixed_bytes::FixedBytesExtended;
use itertools::Itertools;
use state_processing::{
per_block_processing::ParallelSignatureSets,
Expand All @@ -12,7 +13,7 @@ use store::metadata::DataColumnInfo;
use store::{AnchorInfo, BlobInfo, DBColumn, Error as StoreError, KeyValueStore, KeyValueStoreOp};
use strum::IntoStaticStr;
use tracing::{debug, instrument};
use types::{FixedBytesExtended, Hash256, Slot};
use types::{Hash256, Slot};

/// Use a longer timeout on the pubkey cache.
///
Expand Down
7 changes: 3 additions & 4 deletions beacon_node/beacon_chain/src/naive_aggregation_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,12 +577,11 @@ where
#[cfg(test)]
mod tests {
use super::*;
use ssz_types::BitList;
use store::BitVector;
use fixed_bytes::FixedBytesExtended;
use ssz_types::{BitList, BitVector};
use tree_hash::TreeHash;
use types::{
Attestation, AttestationBase, AttestationElectra, FixedBytesExtended, Fork, Hash256,
SyncCommitteeMessage,
Attestation, AttestationBase, AttestationElectra, Fork, Hash256, SyncCommitteeMessage,
test_utils::{generate_deterministic_keypair, test_random_instance},
};

Expand Down
3 changes: 2 additions & 1 deletion beacon_node/beacon_chain/src/observed_aggregates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,8 @@ where
#[cfg(not(debug_assertions))]
mod tests {
use super::*;
use types::{AttestationBase, FixedBytesExtended, Hash256, test_utils::test_random_instance};
use fixed_bytes::FixedBytesExtended;
use types::{AttestationBase, Hash256, test_utils::test_random_instance};

type E = types::MainnetEthSpec;

Expand Down
5 changes: 3 additions & 2 deletions beacon_node/beacon_chain/src/observed_attesters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ use bitvec::vec::BitVec;
use std::collections::{HashMap, HashSet};
use std::hash::Hash;
use std::marker::PhantomData;
use typenum::Unsigned;
use types::slot_data::SlotData;
use types::{Epoch, EthSpec, Hash256, Slot, Unsigned};
use types::{Epoch, EthSpec, Hash256, Slot};

/// The maximum capacity of the `AutoPruningEpochContainer`.
///
Expand Down Expand Up @@ -619,7 +620,7 @@ impl SlotSubcommitteeIndex {
#[cfg(test)]
mod tests {
use super::*;
use types::FixedBytesExtended;
use fixed_bytes::FixedBytesExtended;

type E = types::MainnetEthSpec;

Expand Down
3 changes: 2 additions & 1 deletion beacon_node/beacon_chain/src/observed_block_producers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
use std::collections::hash_map::Entry;
use std::collections::{HashMap, HashSet};
use std::marker::PhantomData;
use types::{BeaconBlockRef, Epoch, EthSpec, Hash256, Slot, Unsigned};
use typenum::Unsigned;
use types::{BeaconBlockRef, Epoch, EthSpec, Hash256, Slot};

#[derive(Debug, PartialEq)]
pub enum Error {
Expand Down
3 changes: 2 additions & 1 deletion beacon_node/beacon_chain/src/observed_slashable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use crate::observed_block_producers::Error;
use std::collections::hash_map::Entry;
use std::collections::{HashMap, HashSet};
use std::marker::PhantomData;
use types::{EthSpec, Hash256, Slot, Unsigned};
use typenum::Unsigned;
use types::{EthSpec, Hash256, Slot};

#[derive(Eq, Hash, PartialEq, Debug, Default)]
pub struct ProposalKey {
Expand Down
1 change: 1 addition & 0 deletions beacon_node/beacon_chain/src/shuffling_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ impl BlockShufflingIds {
#[cfg(not(debug_assertions))]
#[cfg(test)]
mod test {
use fixed_bytes::FixedBytesExtended;
use types::*;

use crate::test_utils::EphemeralHarnessType;
Expand Down
4 changes: 2 additions & 2 deletions beacon_node/beacon_chain/src/single_attestation.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::attestation_verification::Error;
use ssz_types::{BitList, BitVector};
use types::{
Attestation, AttestationBase, AttestationElectra, BitList, BitVector, EthSpec, ForkName,
SingleAttestation,
Attestation, AttestationBase, AttestationElectra, EthSpec, ForkName, SingleAttestation,
};

pub fn single_attestation_to_attestation<E: EthSpec>(
Expand Down
3 changes: 2 additions & 1 deletion beacon_node/beacon_chain/src/sync_committee_verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use crate::observed_attesters::SlotSubcommitteeIndex;
use crate::{
BeaconChain, BeaconChainError, BeaconChainTypes, metrics, observed_aggregates::ObserveOutcome,
};
use bls::AggregateSignature;
use bls::{PublicKeyBytes, verify_signature_sets};
use educe::Educe;
use safe_arith::ArithError;
Expand All @@ -51,7 +52,7 @@ use types::consts::altair::SYNC_COMMITTEE_SUBNET_COUNT;
use types::slot_data::SlotData;
use types::sync_committee::SyncCommitteeError;
use types::{
AggregateSignature, BeaconStateError, EthSpec, Hash256, SignedContributionAndProof, Slot,
BeaconStateError, EthSpec, Hash256, SignedContributionAndProof, Slot,
SyncCommitteeContribution, SyncCommitteeMessage, SyncSelectionProof, SyncSubnetId,
sync_committee_contribution::Error as ContributionError,
};
Expand Down
Loading