Skip to content

Commit f3fd1f2

Browse files
authored
Remove consensus/types re-exports (#8540)
There are certain crates which we re-export within `types` which creates a fragmented DevEx, where there are various ways to import the same crates. ```rust // consensus/types/src/lib.rs pub use bls::{ AggregatePublicKey, AggregateSignature, Error as BlsError, Keypair, PUBLIC_KEY_BYTES_LEN, PublicKey, PublicKeyBytes, SIGNATURE_BYTES_LEN, SecretKey, Signature, SignatureBytes, get_withdrawal_credentials, }; pub use context_deserialize::{ContextDeserialize, context_deserialize}; pub use fixed_bytes::FixedBytesExtended; pub use milhouse::{self, List, Vector}; pub use ssz_types::{BitList, BitVector, FixedVector, VariableList, typenum, typenum::Unsigned}; pub use superstruct::superstruct; ``` This PR removes these re-exports and makes it explicit that these types are imported from a non-`consensus/types` crate. Co-Authored-By: Mac L <mjladson@pm.me>
1 parent 77d5843 commit f3fd1f2

File tree

213 files changed

+556
-259
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

213 files changed

+556
-259
lines changed

Cargo.lock

Lines changed: 64 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ tracing-opentelemetry = "0.31.0"
259259
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
260260
tree_hash = "0.12.0"
261261
tree_hash_derive = "0.12.0"
262+
typenum = "1"
262263
types = { path = "consensus/types" }
263264
url = "2"
264265
uuid = { version = "0.8", features = ["serde", "v4"] }

account_manager/src/validator/slashing_protection.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use bls::PublicKeyBytes;
12
use clap::{Arg, ArgAction, ArgMatches, Command};
23
use environment::Environment;
34
use slashing_protection::{
@@ -7,7 +8,7 @@ use slashing_protection::{
78
use std::fs::File;
89
use std::path::PathBuf;
910
use std::str::FromStr;
10-
use types::{Epoch, EthSpec, PublicKeyBytes, Slot};
11+
use types::{Epoch, EthSpec, Slot};
1112

1213
pub const CMD: &str = "slashing-protection";
1314
pub const IMPORT_CMD: &str = "import";

beacon_node/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ testing = [] # Enables testing-only CLI flags
2020
[dependencies]
2121
account_utils = { workspace = true }
2222
beacon_chain = { workspace = true }
23+
bls = { workspace = true }
2324
clap = { workspace = true }
2425
clap_utils = { workspace = true }
2526
client = { path = "client" }

beacon_node/beacon_chain/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ ethereum_serde_utils = { workspace = true }
2626
ethereum_ssz = { workspace = true }
2727
ethereum_ssz_derive = { workspace = true }
2828
execution_layer = { workspace = true }
29+
fixed_bytes = { workspace = true }
2930
fork_choice = { workspace = true }
3031
futures = { workspace = true }
3132
genesis = { workspace = true }
@@ -39,6 +40,7 @@ logging = { workspace = true }
3940
lru = { workspace = true }
4041
merkle_proof = { workspace = true }
4142
metrics = { workspace = true }
43+
milhouse = { workspace = true }
4244
once_cell = { workspace = true }
4345
oneshot_broadcast = { path = "../../common/oneshot_broadcast/" }
4446
operation_pool = { workspace = true }
@@ -65,6 +67,7 @@ tokio-stream = { workspace = true }
6567
tracing = { workspace = true }
6668
tree_hash = { workspace = true }
6769
tree_hash_derive = { workspace = true }
70+
typenum = { workspace = true }
6871
types = { workspace = true }
6972
zstd = { workspace = true }
7073

beacon_node/beacon_chain/src/attester_cache.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010
//! and penalties can be computed and the `state.current_justified_checkpoint` can be updated.
1111
1212
use crate::{BeaconChain, BeaconChainError, BeaconChainTypes};
13+
use fixed_bytes::FixedBytesExtended;
1314
use parking_lot::RwLock;
1415
use state_processing::state_advance::{Error as StateAdvanceError, partial_state_advance};
1516
use std::collections::HashMap;
1617
use std::ops::Range;
1718
use types::{
18-
BeaconState, BeaconStateError, ChainSpec, Checkpoint, Epoch, EthSpec, FixedBytesExtended,
19-
Hash256, RelativeEpoch, Slot,
19+
BeaconState, BeaconStateError, ChainSpec, Checkpoint, Epoch, EthSpec, Hash256, RelativeEpoch,
20+
Slot,
2021
attestation::AttestationError,
2122
beacon_state::{
2223
compute_committee_index_in_epoch, compute_committee_range_in_epoch, epoch_committee_count,

beacon_node/beacon_chain/src/beacon_block_streamer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,13 +685,13 @@ impl From<Error> for BeaconChainError {
685685
mod tests {
686686
use crate::beacon_block_streamer::{BeaconBlockStreamer, CheckCaches};
687687
use crate::test_utils::{BeaconChainHarness, EphemeralHarnessType, test_spec};
688+
use bls::Keypair;
688689
use execution_layer::test_utils::Block;
690+
use fixed_bytes::FixedBytesExtended;
689691
use std::sync::Arc;
690692
use std::sync::LazyLock;
691693
use tokio::sync::mpsc;
692-
use types::{
693-
ChainSpec, Epoch, EthSpec, FixedBytesExtended, Hash256, Keypair, MinimalEthSpec, Slot,
694-
};
694+
use types::{ChainSpec, Epoch, EthSpec, Hash256, MinimalEthSpec, Slot};
695695

696696
const VALIDATOR_COUNT: usize = 48;
697697

beacon_node/beacon_chain/src/beacon_chain.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ use crate::{
7474
AvailabilityPendingExecutedBlock, BeaconChainError, BeaconForkChoiceStore, BeaconSnapshot,
7575
CachedHead, metrics,
7676
};
77+
use bls::{PublicKey, PublicKeyBytes, Signature};
7778
use eth2::beacon_response::ForkVersionedResponse;
7879
use eth2::types::{
7980
EventKind, SseBlobSidecar, SseBlock, SseDataColumnSidecar, SseExtendedPayloadAttributes,
@@ -82,6 +83,7 @@ use execution_layer::{
8283
BlockProposalContents, BlockProposalContentsType, BuilderParams, ChainHealth, ExecutionLayer,
8384
FailedCondition, PayloadAttributes, PayloadStatus,
8485
};
86+
use fixed_bytes::FixedBytesExtended;
8587
use fork_choice::{
8688
AttestationFromBlock, ExecutionStatus, ForkChoice, ForkchoiceUpdateParameters,
8789
InvalidationOperation, PayloadVerificationStatus, ResetPayloadStatuses,

beacon_node/beacon_chain/src/beacon_fork_choice_store.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
77
use crate::{BeaconSnapshot, metrics};
88
use educe::Educe;
9+
use fixed_bytes::FixedBytesExtended;
910
use fork_choice::ForkChoiceStore;
1011
use proto_array::JustifiedBalances;
1112
use safe_arith::ArithError;
@@ -17,7 +18,7 @@ use store::{Error as StoreError, HotColdDB, ItemStore};
1718
use superstruct::superstruct;
1819
use types::{
1920
AbstractExecPayload, BeaconBlockRef, BeaconState, BeaconStateError, Checkpoint, Epoch, EthSpec,
20-
FixedBytesExtended, Hash256, Slot,
21+
Hash256, Slot,
2122
};
2223

2324
#[derive(Debug)]

beacon_node/beacon_chain/src/beacon_proposer_cache.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ use state_processing::state_advance::partial_state_advance;
1818
use std::num::NonZeroUsize;
1919
use std::sync::Arc;
2020
use tracing::instrument;
21+
use typenum::Unsigned;
2122
use types::non_zero_usize::new_non_zero_usize;
22-
use types::{
23-
BeaconState, BeaconStateError, ChainSpec, Epoch, EthSpec, Fork, Hash256, Slot, Unsigned,
24-
};
23+
use types::{BeaconState, BeaconStateError, ChainSpec, Epoch, EthSpec, Fork, Hash256, Slot};
2524

2625
/// The number of sets of proposer indices that should be cached.
2726
const CACHE_SIZE: NonZeroUsize = new_non_zero_usize(16);

0 commit comments

Comments
 (0)