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:
Mac L
2025-12-09 11:13:41 +04:00
committed by GitHub
parent 77d58437da
commit f3fd1f210b
213 changed files with 556 additions and 259 deletions

View File

@@ -4,11 +4,10 @@ use beacon_chain::attestation_simulator::produce_unaggregated_attestation;
use beacon_chain::test_utils::{AttestationStrategy, BeaconChainHarness, BlockStrategy};
use beacon_chain::validator_monitor::UNAGGREGATED_ATTESTATION_LAG_SLOTS;
use beacon_chain::{StateSkipConfig, WhenSlotSkipped, metrics};
use bls::{AggregateSignature, Keypair};
use std::sync::{Arc, LazyLock};
use tree_hash::TreeHash;
use types::{
AggregateSignature, Attestation, EthSpec, Keypair, MainnetEthSpec, RelativeEpoch, Slot,
};
use types::{Attestation, EthSpec, MainnetEthSpec, RelativeEpoch, Slot};
pub const VALIDATOR_COUNT: usize = 16;

View File

@@ -13,15 +13,17 @@ use beacon_chain::{
single_attestation_to_attestation, test_spec,
},
};
use bls::{AggregateSignature, Keypair, SecretKey};
use fixed_bytes::FixedBytesExtended;
use genesis::{DEFAULT_ETH1_BLOCK_HASH, interop_genesis_state};
use int_to_bytes::int_to_bytes32;
use state_processing::per_slot_processing;
use std::sync::{Arc, LazyLock};
use tree_hash::TreeHash;
use typenum::Unsigned;
use types::{
Address, AggregateSignature, Attestation, AttestationRef, ChainSpec, Epoch, EthSpec,
FixedBytesExtended, ForkName, Hash256, Keypair, MainnetEthSpec, SecretKey, SelectionProof,
SignedAggregateAndProof, SingleAttestation, Slot, SubnetId, Unsigned,
Address, Attestation, AttestationRef, ChainSpec, Epoch, EthSpec, ForkName, Hash256,
MainnetEthSpec, SelectionProof, SignedAggregateAndProof, SingleAttestation, Slot, SubnetId,
signed_aggregate_and_proof::SignedAggregateAndProofRefMut,
test_utils::generate_deterministic_keypair,
};

View File

@@ -7,6 +7,7 @@ use beacon_chain::{
AvailabilityProcessingStatus, BlockError, ChainConfig, InvalidSignature, NotifyExecutionLayer,
block_verification_types::AsBlock,
};
use bls::{Keypair, Signature};
use logging::create_test_tracing_subscriber;
use std::sync::{Arc, LazyLock};
use types::{blob_sidecar::FixedBlobSidecarList, *};

View File

@@ -13,6 +13,8 @@ use beacon_chain::{
BeaconSnapshot, BlockError, ChainConfig, ChainSegmentResult, IntoExecutionPendingBlock,
InvalidSignature, NotifyExecutionLayer,
};
use bls::{AggregateSignature, Keypair, Signature};
use fixed_bytes::FixedBytesExtended;
use logging::create_test_tracing_subscriber;
use slasher::{Config as SlasherConfig, Slasher};
use state_processing::{

View File

@@ -9,6 +9,7 @@ use beacon_chain::{
AvailabilityProcessingStatus, BlockError, ChainConfig, InvalidSignature, NotifyExecutionLayer,
block_verification_types::AsBlock,
};
use bls::{Keypair, Signature};
use logging::create_test_tracing_subscriber;
use std::sync::{Arc, LazyLock};
use types::*;

View File

@@ -9,6 +9,7 @@ use beacon_chain::{
AttestationStrategy, BeaconChainHarness, BlockStrategy, DiskHarnessType, test_spec,
},
};
use bls::Keypair;
use state_processing::per_block_processing::errors::{
AttesterSlashingInvalid, BlockOperationError, ExitInvalid, ProposerSlashingInvalid,
};

View File

@@ -7,8 +7,9 @@ use beacon_chain::test_utils::{
use beacon_chain::{
BlockError, ChainConfig, StateSkipConfig, WhenSlotSkipped,
test_utils::{AttestationStrategy, BlockStrategy, RelativeSyncCommittee},
types::{Epoch, EthSpec, Keypair, MinimalEthSpec},
types::{Epoch, EthSpec, MinimalEthSpec},
};
use bls::Keypair;
use eth2::types::{StandardAttestationRewards, TotalAttestationRewards, ValidatorId};
use state_processing::{BlockReplayError, BlockReplayer};
use std::array::IntoIter;

View File

@@ -4,6 +4,7 @@ use beacon_chain::{
persisted_custody::PersistedCustody,
test_utils::{BeaconChainHarness, DiskHarnessType, test_spec},
};
use bls::Keypair;
use logging::create_test_tracing_subscriber;
use operation_pool::PersistedOperationPool;
use ssz::Encode;
@@ -16,7 +17,7 @@ use store::{
};
use strum::IntoEnumIterator;
use tempfile::{TempDir, tempdir};
use types::{ChainSpec, Hash256, Keypair, MainnetEthSpec, Slot};
use types::{ChainSpec, Hash256, MainnetEthSpec, Slot};
type E = MainnetEthSpec;
type Store<E> = Arc<HotColdDB<E, BeaconNodeBackend<E>, BeaconNodeBackend<E>>>;

View File

@@ -25,11 +25,14 @@ use beacon_chain::{
historical_blocks::HistoricalBlockError,
migrate::MigratorConfig,
};
use bls::{Keypair, Signature, SignatureBytes};
use fixed_bytes::FixedBytesExtended;
use logging::create_test_tracing_subscriber;
use maplit::hashset;
use rand::Rng;
use rand::rngs::StdRng;
use slot_clock::{SlotClock, TestingSlotClock};
use ssz_types::VariableList;
use state_processing::{BlockReplayer, state_advance::complete_state_advance};
use std::collections::HashMap;
use std::collections::HashSet;

View File

@@ -2,6 +2,8 @@
use beacon_chain::sync_committee_verification::{Error as SyncCommitteeError, SyncCommitteeData};
use beacon_chain::test_utils::{BeaconChainHarness, EphemeralHarnessType, RelativeSyncCommittee};
use bls::{AggregateSignature, Keypair, SecretKey};
use fixed_bytes::FixedBytesExtended;
use int_to_bytes::int_to_bytes32;
use safe_arith::SafeArith;
use state_processing::{
@@ -11,10 +13,11 @@ use state_processing::{
use std::sync::LazyLock;
use store::{SignedContributionAndProof, SyncCommitteeMessage};
use tree_hash::TreeHash;
use typenum::Unsigned;
use types::consts::altair::SYNC_COMMITTEE_SUBNET_COUNT;
use types::{
AggregateSignature, Epoch, EthSpec, FixedBytesExtended, Hash256, Keypair, MainnetEthSpec,
SecretKey, Slot, SyncContributionData, SyncSelectionProof, SyncSubnetId, Unsigned,
Epoch, EthSpec, Hash256, MainnetEthSpec, Slot, SyncContributionData, SyncSelectionProof,
SyncSubnetId,
};
pub type E = MainnetEthSpec;

View File

@@ -8,13 +8,14 @@ use beacon_chain::{
OP_POOL_DB_KEY,
},
};
use bls::Keypair;
use operation_pool::PersistedOperationPool;
use state_processing::EpochProcessingError;
use state_processing::{per_slot_processing, per_slot_processing::Error as SlotProcessingError};
use std::sync::LazyLock;
use types::{
BeaconState, BeaconStateError, BlockImportSource, Checkpoint, EthSpec, Hash256, Keypair,
MinimalEthSpec, RelativeEpoch, Slot,
BeaconState, BeaconStateError, BlockImportSource, Checkpoint, EthSpec, Hash256, MinimalEthSpec,
RelativeEpoch, Slot,
};
type E = MinimalEthSpec;

View File

@@ -2,8 +2,9 @@ use beacon_chain::test_utils::{
AttestationStrategy, BeaconChainHarness, BlockStrategy, EphemeralHarnessType,
};
use beacon_chain::validator_monitor::{MISSED_BLOCK_LAG_SLOTS, ValidatorMonitorConfig};
use bls::{Keypair, PublicKeyBytes};
use std::sync::LazyLock;
use types::{Epoch, EthSpec, Hash256, Keypair, MainnetEthSpec, PublicKeyBytes, Slot};
use types::{Epoch, EthSpec, Hash256, MainnetEthSpec, Slot};
// Should ideally be divisible by 3.
pub const VALIDATOR_COUNT: usize = 48;