mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11: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:
@@ -20,8 +20,8 @@ use strum::IntoStaticStr;
|
||||
use superstruct::superstruct;
|
||||
pub use types::{
|
||||
Address, BeaconBlockRef, ConsolidationRequest, EthSpec, ExecutionBlockHash, ExecutionPayload,
|
||||
ExecutionPayloadHeader, ExecutionPayloadRef, FixedVector, ForkName, Hash256, Transactions,
|
||||
Uint256, VariableList, Withdrawal, Withdrawals,
|
||||
ExecutionPayloadHeader, ExecutionPayloadRef, ForkName, Hash256, Transactions, Uint256,
|
||||
Withdrawal, Withdrawals,
|
||||
};
|
||||
use types::{
|
||||
ExecutionPayloadBellatrix, ExecutionPayloadCapella, ExecutionPayloadDeneb,
|
||||
|
||||
@@ -103,9 +103,10 @@ pub static LIGHTHOUSE_JSON_CLIENT_VERSION: LazyLock<JsonClientVersionV1> =
|
||||
|
||||
/// Contains methods to convert arbitrary bytes to an ETH2 deposit contract object.
|
||||
pub mod deposit_log {
|
||||
use bls::{PublicKeyBytes, SignatureBytes};
|
||||
use ssz::Decode;
|
||||
use state_processing::per_block_processing::signature_sets::deposit_pubkey_signature_message;
|
||||
use types::{ChainSpec, DepositData, Hash256, PublicKeyBytes, SignatureBytes};
|
||||
use types::{ChainSpec, DepositData, Hash256};
|
||||
|
||||
pub use eth2::lighthouse::DepositLog;
|
||||
|
||||
@@ -1466,10 +1467,13 @@ mod test {
|
||||
use super::auth::JwtKey;
|
||||
use super::*;
|
||||
use crate::test_utils::{DEFAULT_JWT_SECRET, MockServer};
|
||||
use fixed_bytes::FixedBytesExtended;
|
||||
use ssz_types::VariableList;
|
||||
use std::future::Future;
|
||||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
use types::{FixedBytesExtended, MainnetEthSpec, Unsigned};
|
||||
use typenum::Unsigned;
|
||||
use types::MainnetEthSpec;
|
||||
|
||||
struct Tester {
|
||||
server: MockServer<MainnetEthSpec>,
|
||||
|
||||
@@ -1101,10 +1101,10 @@ impl TryFrom<JsonClientVersionV1> for ClientVersionV1 {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use bls::{PublicKeyBytes, SignatureBytes};
|
||||
use ssz::Encode;
|
||||
use types::{
|
||||
ConsolidationRequest, DepositRequest, MainnetEthSpec, PublicKeyBytes, RequestType,
|
||||
SignatureBytes, WithdrawalRequest,
|
||||
ConsolidationRequest, DepositRequest, MainnetEthSpec, RequestType, WithdrawalRequest,
|
||||
};
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -9,6 +9,7 @@ use crate::payload_cache::PayloadCache;
|
||||
use arc_swap::ArcSwapOption;
|
||||
use auth::{Auth, JwtKey, strip_prefix};
|
||||
pub use block_hash::calculate_execution_block_hash;
|
||||
use bls::{PublicKeyBytes, Signature};
|
||||
use builder_client::BuilderHttpClient;
|
||||
pub use engine_api::EngineCapabilities;
|
||||
use engine_api::Error as ApiError;
|
||||
@@ -55,7 +56,7 @@ use types::{
|
||||
use types::{
|
||||
BeaconStateError, BlindedPayload, ChainSpec, Epoch, ExecPayload, ExecutionPayloadBellatrix,
|
||||
ExecutionPayloadCapella, ExecutionPayloadElectra, ExecutionPayloadFulu, ExecutionPayloadGloas,
|
||||
FullPayload, ProposerPreparationData, PublicKeyBytes, Signature, Slot,
|
||||
FullPayload, ProposerPreparationData, Slot,
|
||||
};
|
||||
|
||||
mod block_hash;
|
||||
|
||||
@@ -8,6 +8,7 @@ use crate::engines::ForkchoiceState;
|
||||
use alloy_consensus::TxEnvelope;
|
||||
use alloy_rpc_types_eth::Transaction as AlloyTransaction;
|
||||
use eth2::types::BlobsBundle;
|
||||
use fixed_bytes::FixedBytesExtended;
|
||||
use kzg::{Kzg, KzgCommitment, KzgProof};
|
||||
use parking_lot::Mutex;
|
||||
use rand::{Rng, SeedableRng, rngs::StdRng};
|
||||
@@ -22,8 +23,8 @@ use tree_hash_derive::TreeHash;
|
||||
use types::{
|
||||
Blob, ChainSpec, EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadBellatrix,
|
||||
ExecutionPayloadCapella, ExecutionPayloadDeneb, ExecutionPayloadElectra, ExecutionPayloadFulu,
|
||||
ExecutionPayloadGloas, ExecutionPayloadHeader, FixedBytesExtended, ForkName, Hash256,
|
||||
KzgProofs, Transaction, Transactions, Uint256,
|
||||
ExecutionPayloadGloas, ExecutionPayloadHeader, ForkName, Hash256, KzgProofs, Transaction,
|
||||
Transactions, Uint256,
|
||||
};
|
||||
|
||||
use super::DEFAULT_TERMINAL_BLOCK;
|
||||
@@ -41,7 +42,7 @@ pub enum Block<E: EthSpec> {
|
||||
PoS(ExecutionPayload<E>),
|
||||
}
|
||||
|
||||
pub fn mock_el_extra_data<E: EthSpec>() -> types::VariableList<u8, E::MaxExtraDataBytes> {
|
||||
pub fn mock_el_extra_data<E: EthSpec>() -> VariableList<u8, E::MaxExtraDataBytes> {
|
||||
"block gen was here".as_bytes().to_vec().try_into().unwrap()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use crate::test_utils::{DEFAULT_BUILDER_PAYLOAD_VALUE_WEI, DEFAULT_JWT_SECRET};
|
||||
use crate::{Config, ExecutionLayer, PayloadAttributes, PayloadParameters};
|
||||
use bls::{PublicKeyBytes, SecretKey, Signature};
|
||||
use bytes::Bytes;
|
||||
use eth2::beacon_response::ForkVersionedResponse;
|
||||
use eth2::types::PublishBlockRequest;
|
||||
@@ -15,6 +16,7 @@ use fork_choice::ForkchoiceUpdateParameters;
|
||||
use parking_lot::RwLock;
|
||||
use sensitive_url::SensitiveUrl;
|
||||
use ssz::Encode;
|
||||
use ssz_types::VariableList;
|
||||
use std::collections::HashMap;
|
||||
use std::fmt::Debug;
|
||||
use std::future::Future;
|
||||
@@ -26,6 +28,7 @@ use tempfile::NamedTempFile;
|
||||
use tokio_stream::StreamExt;
|
||||
use tracing::{debug, error, info, warn};
|
||||
use tree_hash::TreeHash;
|
||||
use types::ExecutionBlockHash;
|
||||
use types::builder_bid::{
|
||||
BuilderBid, BuilderBidBellatrix, BuilderBidCapella, BuilderBidDeneb, BuilderBidElectra,
|
||||
BuilderBidFulu, BuilderBidGloas, SignedBuilderBid,
|
||||
@@ -33,10 +36,8 @@ use types::builder_bid::{
|
||||
use types::{
|
||||
Address, BeaconState, ChainSpec, Epoch, EthSpec, ExecPayload, ExecutionPayload,
|
||||
ExecutionPayloadHeaderRefMut, ExecutionRequests, ForkName, ForkVersionDecode, Hash256,
|
||||
PublicKeyBytes, Signature, SignedBlindedBeaconBlock, SignedRoot,
|
||||
SignedValidatorRegistrationData, Slot, Uint256,
|
||||
SignedBlindedBeaconBlock, SignedRoot, SignedValidatorRegistrationData, Slot, Uint256,
|
||||
};
|
||||
use types::{ExecutionBlockHash, SecretKey};
|
||||
use warp::reply::{self, Reply};
|
||||
use warp::{Filter, Rejection};
|
||||
|
||||
@@ -72,7 +73,7 @@ impl Operation {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn mock_builder_extra_data<E: EthSpec>() -> types::VariableList<u8, E::MaxExtraDataBytes> {
|
||||
pub fn mock_builder_extra_data<E: EthSpec>() -> VariableList<u8, E::MaxExtraDataBytes> {
|
||||
"mock_builder".as_bytes().to_vec().try_into().unwrap()
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,10 @@ use crate::{
|
||||
*,
|
||||
};
|
||||
use alloy_primitives::B256 as H256;
|
||||
use fixed_bytes::FixedBytesExtended;
|
||||
use kzg::Kzg;
|
||||
use tempfile::NamedTempFile;
|
||||
use types::{FixedBytesExtended, MainnetEthSpec};
|
||||
use types::MainnetEthSpec;
|
||||
|
||||
pub struct MockExecutionLayer<E: EthSpec> {
|
||||
pub server: MockServer<E>,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use alloy_consensus::TxEnvelope;
|
||||
use alloy_rlp::Decodable;
|
||||
use types::{EthSpec, ExecutionPayloadRef, Hash256, Unsigned, VersionedHash};
|
||||
use typenum::Unsigned;
|
||||
use types::{EthSpec, ExecutionPayloadRef, Hash256, VersionedHash};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
|
||||
Reference in New Issue
Block a user