mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-01 11:43:44 +00:00
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>
This commit is contained in:
@@ -11,6 +11,7 @@ libp2p-websocket = []
|
||||
[dependencies]
|
||||
alloy-primitives = { workspace = true }
|
||||
alloy-rlp = { workspace = true }
|
||||
bls = { workspace = true }
|
||||
bytes = { workspace = true }
|
||||
delay_map = { workspace = true }
|
||||
directory = { workspace = true }
|
||||
@@ -20,6 +21,7 @@ either = { workspace = true }
|
||||
eth2 = { workspace = true, features = ["lighthouse"] }
|
||||
ethereum_ssz = { workspace = true }
|
||||
ethereum_ssz_derive = { workspace = true }
|
||||
fixed_bytes = { workspace = true }
|
||||
fnv = { workspace = true }
|
||||
futures = { workspace = true }
|
||||
gossipsub = { workspace = true }
|
||||
@@ -49,6 +51,7 @@ tokio = { workspace = true }
|
||||
tokio-util = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
tracing-subscriber = { workspace = true }
|
||||
typenum = { workspace = true }
|
||||
types = { workspace = true }
|
||||
unsigned-varint = { version = "0.8", features = ["codec"] }
|
||||
|
||||
|
||||
@@ -1231,7 +1231,8 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::rpc::methods::{MetaData, MetaDataV3};
|
||||
use libp2p::identity::secp256k1;
|
||||
use types::{BitVector, MinimalEthSpec, SubnetId};
|
||||
use ssz_types::BitVector;
|
||||
use types::{MinimalEthSpec, SubnetId};
|
||||
|
||||
type E = MinimalEthSpec;
|
||||
|
||||
|
||||
@@ -2978,7 +2978,8 @@ mod tests {
|
||||
use proptest::prelude::*;
|
||||
use std::collections::HashSet;
|
||||
use tokio::runtime::Runtime;
|
||||
use types::{DataColumnSubnetId, Unsigned};
|
||||
use typenum::Unsigned;
|
||||
use types::DataColumnSubnetId;
|
||||
use types::{EthSpec, MainnetEthSpec as E};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
||||
@@ -908,11 +908,12 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::rpc::protocol::*;
|
||||
use crate::types::{EnrAttestationBitfield, EnrSyncCommitteeBitfield};
|
||||
use bls::Signature;
|
||||
use fixed_bytes::FixedBytesExtended;
|
||||
use types::{
|
||||
BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockBellatrix, BeaconBlockHeader,
|
||||
DataColumnsByRootIdentifier, EmptyBlock, Epoch, FixedBytesExtended, FullPayload,
|
||||
KzgCommitment, KzgProof, Signature, SignedBeaconBlockHeader, Slot,
|
||||
blob_sidecar::BlobIdentifier, data_column_sidecar::Cell,
|
||||
DataColumnsByRootIdentifier, EmptyBlock, Epoch, FullPayload, KzgCommitment, KzgProof,
|
||||
SignedBeaconBlockHeader, Slot, blob_sidecar::BlobIdentifier, data_column_sidecar::Cell,
|
||||
};
|
||||
|
||||
type Spec = types::MainnetEthSpec;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use super::methods::*;
|
||||
use crate::rpc::codec::SSZSnappyInboundCodec;
|
||||
use bls::Signature;
|
||||
use futures::future::BoxFuture;
|
||||
use futures::prelude::{AsyncRead, AsyncWrite};
|
||||
use futures::{FutureExt, StreamExt};
|
||||
@@ -20,7 +21,7 @@ use types::{
|
||||
EmptyBlock, Epoch, EthSpec, EthSpecId, ForkContext, ForkName, LightClientBootstrap,
|
||||
LightClientBootstrapAltair, LightClientFinalityUpdate, LightClientFinalityUpdateAltair,
|
||||
LightClientOptimisticUpdate, LightClientOptimisticUpdateAltair, LightClientUpdate,
|
||||
MainnetEthSpec, MinimalEthSpec, Signature, SignedBeaconBlock,
|
||||
MainnetEthSpec, MinimalEthSpec, SignedBeaconBlock,
|
||||
};
|
||||
|
||||
// Note: Hardcoding the `EthSpec` type for `SignedBeaconBlock` as min/max values is
|
||||
|
||||
@@ -3,7 +3,8 @@ mod pubsub;
|
||||
mod subnet;
|
||||
mod topics;
|
||||
|
||||
use types::{BitVector, EthSpec};
|
||||
use ssz_types::BitVector;
|
||||
use types::EthSpec;
|
||||
|
||||
pub type EnrAttestationBitfield<E> = BitVector<<E as EthSpec>::SubnetBitfieldLength>;
|
||||
pub type EnrSyncCommitteeBitfield<E> = BitVector<<E as EthSpec>::SyncCommitteeSubnetCount>;
|
||||
|
||||
@@ -2,7 +2,8 @@ use gossipsub::{IdentTopic as Topic, TopicHash};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashSet;
|
||||
use strum::AsRefStr;
|
||||
use types::{ChainSpec, DataColumnSubnetId, EthSpec, ForkName, SubnetId, SyncSubnetId, Unsigned};
|
||||
use typenum::Unsigned;
|
||||
use types::{ChainSpec, DataColumnSubnetId, EthSpec, ForkName, SubnetId, SyncSubnetId};
|
||||
|
||||
use crate::Subnet;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#![cfg(test)]
|
||||
use fixed_bytes::FixedBytesExtended;
|
||||
use lighthouse_network::Enr;
|
||||
use lighthouse_network::Multiaddr;
|
||||
use lighthouse_network::service::Network as LibP2PService;
|
||||
@@ -9,10 +10,7 @@ use std::sync::Weak;
|
||||
use tokio::runtime::Runtime;
|
||||
use tracing::{Instrument, debug, error, info_span};
|
||||
use tracing_subscriber::EnvFilter;
|
||||
use types::{
|
||||
ChainSpec, EnrForkId, Epoch, EthSpec, FixedBytesExtended, ForkContext, ForkName, Hash256,
|
||||
MinimalEthSpec,
|
||||
};
|
||||
use types::{ChainSpec, EnrForkId, Epoch, EthSpec, ForkContext, ForkName, Hash256, MinimalEthSpec};
|
||||
|
||||
type E = MinimalEthSpec;
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
use crate::common;
|
||||
use crate::common::spec_with_all_forks_enabled;
|
||||
use crate::common::{Protocol, build_tracing_subscriber};
|
||||
use bls::Signature;
|
||||
use fixed_bytes::FixedBytesExtended;
|
||||
use lighthouse_network::rpc::{RequestType, methods::*};
|
||||
use lighthouse_network::service::api_types::AppRequestId;
|
||||
use lighthouse_network::{NetworkEvent, ReportSource, Response};
|
||||
@@ -16,8 +18,8 @@ use tracing::{Instrument, debug, error, info_span, warn};
|
||||
use types::{
|
||||
BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockBellatrix, BeaconBlockHeader,
|
||||
BlobSidecar, ChainSpec, DataColumnSidecar, DataColumnsByRootIdentifier, EmptyBlock, Epoch,
|
||||
EthSpec, FixedBytesExtended, ForkName, Hash256, KzgCommitment, KzgProof, MinimalEthSpec,
|
||||
Signature, SignedBeaconBlock, SignedBeaconBlockHeader, Slot,
|
||||
EthSpec, ForkName, Hash256, KzgCommitment, KzgProof, MinimalEthSpec, SignedBeaconBlock,
|
||||
SignedBeaconBlockHeader, Slot,
|
||||
};
|
||||
|
||||
type E = MinimalEthSpec;
|
||||
|
||||
Reference in New Issue
Block a user