mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 11:41:51 +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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user