mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +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:
@@ -14,11 +14,13 @@ portable = ["types/portable"]
|
||||
|
||||
[dependencies]
|
||||
bincode = { workspace = true }
|
||||
bls = { workspace = true }
|
||||
byteorder = { workspace = true }
|
||||
educe = { workspace = true }
|
||||
ethereum_ssz = { workspace = true }
|
||||
ethereum_ssz_derive = { workspace = true }
|
||||
filesystem = { workspace = true }
|
||||
fixed_bytes = { workspace = true }
|
||||
flate2 = { version = "1.0.14", features = ["zlib"], default-features = false }
|
||||
lmdb-rkv = { git = "https://github.com/sigp/lmdb-rs", rev = "f33845c6469b94265319aac0ed5085597862c27e", optional = true }
|
||||
lmdb-rkv-sys = { git = "https://github.com/sigp/lmdb-rs", rev = "f33845c6469b94265319aac0ed5085597862c27e", optional = true }
|
||||
@@ -38,6 +40,7 @@ strum = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
tree_hash = { workspace = true }
|
||||
tree_hash_derive = { workspace = true }
|
||||
typenum = { workspace = true }
|
||||
types = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
use crate::{Error, database::IndexedAttestationId};
|
||||
use bls::AggregateSignature;
|
||||
use ssz_derive::{Decode, Encode};
|
||||
use ssz_types::VariableList;
|
||||
use std::borrow::Cow;
|
||||
use std::sync::{
|
||||
Arc,
|
||||
@@ -7,7 +9,7 @@ use std::sync::{
|
||||
};
|
||||
use tree_hash::TreeHash as _;
|
||||
use tree_hash_derive::TreeHash;
|
||||
use types::{AggregateSignature, EthSpec, Hash256, IndexedAttestation, VariableList};
|
||||
use types::{EthSpec, Hash256, IndexedAttestation};
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct AttesterRecord {
|
||||
|
||||
@@ -7,6 +7,7 @@ use crate::{
|
||||
AttesterRecord, AttesterSlashingStatus, CompactAttesterRecord, Config, Database, Error,
|
||||
ProposerSlashingStatus, metrics,
|
||||
};
|
||||
use bls::AggregateSignature;
|
||||
use byteorder::{BigEndian, ByteOrder};
|
||||
use interface::{Environment, OpenDatabases, RwTransaction};
|
||||
use lru::LruCache;
|
||||
@@ -14,15 +15,16 @@ use parking_lot::Mutex;
|
||||
use serde::de::DeserializeOwned;
|
||||
use ssz::{Decode, Encode};
|
||||
use ssz_derive::{Decode, Encode};
|
||||
use ssz_types::VariableList;
|
||||
use std::borrow::{Borrow, Cow};
|
||||
use std::marker::PhantomData;
|
||||
use std::sync::Arc;
|
||||
use tracing::info;
|
||||
use tree_hash::TreeHash;
|
||||
use types::{
|
||||
AggregateSignature, AttestationData, ChainSpec, Epoch, EthSpec, Hash256, IndexedAttestation,
|
||||
AttestationData, ChainSpec, Epoch, EthSpec, Hash256, IndexedAttestation,
|
||||
IndexedAttestationBase, IndexedAttestationElectra, ProposerSlashing, SignedBeaconBlockHeader,
|
||||
Slot, VariableList,
|
||||
Slot,
|
||||
};
|
||||
|
||||
/// Current database schema version, to check compatibility of on-disk DB with software.
|
||||
@@ -860,7 +862,8 @@ impl<E: EthSpec> SlasherDB<E> {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use types::{Checkpoint, ForkName, MainnetEthSpec, Unsigned};
|
||||
use typenum::Unsigned;
|
||||
use types::{Checkpoint, ForkName, MainnetEthSpec};
|
||||
|
||||
type E = MainnetEthSpec;
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
use bls::{AggregateSignature, Signature};
|
||||
use fixed_bytes::FixedBytesExtended;
|
||||
use std::collections::HashSet;
|
||||
use std::sync::Arc;
|
||||
use types::{
|
||||
AggregateSignature, AttestationData, AttesterSlashing, AttesterSlashingBase,
|
||||
AttesterSlashingElectra, BeaconBlockHeader, ChainSpec, Checkpoint, Epoch, EthSpec,
|
||||
FixedBytesExtended, Hash256, IndexedAttestation, MainnetEthSpec, Signature,
|
||||
SignedBeaconBlockHeader, Slot,
|
||||
AttestationData, AttesterSlashing, AttesterSlashingBase, AttesterSlashingElectra,
|
||||
BeaconBlockHeader, ChainSpec, Checkpoint, Epoch, EthSpec, Hash256, IndexedAttestation,
|
||||
MainnetEthSpec, SignedBeaconBlockHeader, Slot,
|
||||
indexed_attestation::{IndexedAttestationBase, IndexedAttestationElectra},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user