mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 12:47:05 +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:
@@ -16,7 +16,9 @@
|
||||
//! of elements. To find the chunk index of a vector index: `cindex = vindex / chunk_size`.
|
||||
use self::UpdatePattern::*;
|
||||
use crate::*;
|
||||
use milhouse::{List, Vector};
|
||||
use ssz::{Decode, Encode};
|
||||
use typenum::Unsigned;
|
||||
use types::historical_summary::HistoricalSummary;
|
||||
|
||||
/// Description of how a `BeaconState` field is updated during state processing.
|
||||
@@ -784,6 +786,7 @@ impl From<milhouse::Error> for ChunkError {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use fixed_bytes::FixedBytesExtended;
|
||||
use types::MainnetEthSpec as TestSpec;
|
||||
use types::*;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use crate::hdiff::HierarchyConfig;
|
||||
use crate::superstruct;
|
||||
use crate::{DBColumn, Error, StoreItem};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ssz::{Decode, Encode};
|
||||
@@ -7,6 +6,7 @@ use ssz_derive::{Decode, Encode};
|
||||
use std::io::{Read, Write};
|
||||
use std::num::NonZeroUsize;
|
||||
use strum::{Display, EnumString, EnumVariantNames};
|
||||
use superstruct::superstruct;
|
||||
use types::EthSpec;
|
||||
use types::non_zero_usize::new_non_zero_usize;
|
||||
use zstd::{Decoder, Encoder};
|
||||
|
||||
@@ -3,6 +3,7 @@ use crate::hot_cold_store::{BytesKey, HotColdDBError};
|
||||
use crate::{
|
||||
ColumnIter, ColumnKeyIter, DBColumn, Error, KeyValueStoreOp, get_key_for_col, metrics,
|
||||
};
|
||||
use fixed_bytes::FixedBytesExtended;
|
||||
use leveldb::{
|
||||
compaction::Compaction,
|
||||
database::{
|
||||
@@ -16,7 +17,7 @@ use leveldb::{
|
||||
use std::collections::HashSet;
|
||||
use std::marker::PhantomData;
|
||||
use std::path::Path;
|
||||
use types::{EthSpec, FixedBytesExtended, Hash256};
|
||||
use types::{EthSpec, Hash256};
|
||||
|
||||
use super::interface::WriteOptions;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ use crate::{DBColumn, hdiff};
|
||||
use leveldb::error::Error as LevelDBError;
|
||||
use ssz::DecodeError;
|
||||
use state_processing::BlockReplayError;
|
||||
use types::{BeaconStateError, EpochCacheError, Hash256, InconsistentFork, Slot, milhouse};
|
||||
use types::{BeaconStateError, EpochCacheError, Hash256, InconsistentFork, Slot};
|
||||
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
use crate::{DBColumn, StoreConfig, StoreItem, metrics};
|
||||
use bls::PublicKeyBytes;
|
||||
use itertools::Itertools;
|
||||
use milhouse::List;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ssz::{Decode, Encode};
|
||||
use ssz_derive::{Decode, Encode};
|
||||
@@ -11,7 +12,7 @@ use std::str::FromStr;
|
||||
use std::sync::LazyLock;
|
||||
use superstruct::superstruct;
|
||||
use types::historical_summary::HistoricalSummary;
|
||||
use types::{BeaconState, ChainSpec, Epoch, EthSpec, Hash256, List, Slot, Validator};
|
||||
use types::{BeaconState, ChainSpec, Epoch, EthSpec, Hash256, Slot, Validator};
|
||||
|
||||
static EMPTY_PUBKEY: LazyLock<PublicKeyBytes> = LazyLock::new(PublicKeyBytes::empty);
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ use crate::{
|
||||
metrics::{self, COLD_METRIC, HOT_METRIC},
|
||||
parse_data_column_key,
|
||||
};
|
||||
use fixed_bytes::FixedBytesExtended;
|
||||
use itertools::{Itertools, process_results};
|
||||
use lru::LruCache;
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
@@ -38,6 +39,7 @@ use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use tracing::{debug, error, info, instrument, warn};
|
||||
use typenum::Unsigned;
|
||||
use types::data_column_sidecar::{ColumnIndex, DataColumnSidecar, DataColumnSidecarList};
|
||||
use types::*;
|
||||
use zstd::{Decoder, Encoder};
|
||||
|
||||
@@ -2,9 +2,9 @@ use crate::errors::HandleUnavailable;
|
||||
use crate::{Error, HotColdDB, ItemStore};
|
||||
use std::borrow::Cow;
|
||||
use std::marker::PhantomData;
|
||||
use typenum::Unsigned;
|
||||
use types::{
|
||||
BeaconState, BeaconStateError, BlindedPayload, EthSpec, Hash256, SignedBeaconBlock, Slot,
|
||||
typenum::Unsigned,
|
||||
};
|
||||
|
||||
/// Implemented for types that have ancestors (e.g., blocks, states) that may be iterated over.
|
||||
@@ -387,8 +387,8 @@ mod test {
|
||||
use crate::{MemoryStore, StoreConfig as Config};
|
||||
use beacon_chain::test_utils::BeaconChainHarness;
|
||||
use beacon_chain::types::MainnetEthSpec;
|
||||
use fixed_bytes::FixedBytesExtended;
|
||||
use std::sync::Arc;
|
||||
use types::FixedBytesExtended;
|
||||
|
||||
fn get_state<E: EthSpec>() -> BeaconState<E> {
|
||||
let harness = BeaconChainHarness::builder(E::default())
|
||||
|
||||
@@ -3,11 +3,12 @@ use crate::chunked_vector::{
|
||||
load_variable_list_from_db, load_vector_from_db,
|
||||
};
|
||||
use crate::{DBColumn, Error, KeyValueStore, KeyValueStoreOp};
|
||||
use ssz::{Decode, DecodeError, Encode};
|
||||
use milhouse::{List, Vector};
|
||||
use ssz::{BitVector, Decode, DecodeError, Encode};
|
||||
use ssz_derive::{Decode, Encode};
|
||||
use std::sync::Arc;
|
||||
use superstruct::superstruct;
|
||||
use types::historical_summary::HistoricalSummary;
|
||||
use types::superstruct;
|
||||
use types::*;
|
||||
|
||||
/// DEPRECATED Lightweight variant of the `BeaconState` that is stored in the database.
|
||||
|
||||
Reference in New Issue
Block a user