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

@@ -2,7 +2,8 @@
use crate::test_utils::*;
use crate::*;
use types::{AttestationData, Checkpoint, Epoch, FixedBytesExtended, Slot};
use fixed_bytes::FixedBytesExtended;
use types::{AttestationData, Checkpoint, Epoch, Slot};
pub fn build_checkpoint(epoch_num: u64) -> Checkpoint {
Checkpoint {

View File

@@ -1,11 +1,12 @@
use eip_3076::{Interchange, InterchangeData, InterchangeMetadata, SignedAttestation, SignedBlock};
use fixed_bytes::FixedBytesExtended;
use slashing_protection::SUPPORTED_INTERCHANGE_FORMAT_VERSION;
use slashing_protection::interchange_test::{MultiTestCase, TestCase};
use slashing_protection::test_utils::{DEFAULT_GENESIS_VALIDATORS_ROOT, pubkey};
use std::fs::{self, File};
use std::io::Write;
use std::path::Path;
use types::{Epoch, FixedBytesExtended, Hash256, Slot};
use types::{Epoch, Hash256, Slot};
fn metadata(genesis_validators_root: Hash256) -> InterchangeMetadata {
InterchangeMetadata {

View File

@@ -2,7 +2,8 @@
use super::*;
use crate::test_utils::*;
use types::{BeaconBlockHeader, FixedBytesExtended, Slot};
use fixed_bytes::FixedBytesExtended;
use types::{BeaconBlockHeader, Slot};
pub fn block(slot: u64) -> BeaconBlockHeader {
BeaconBlockHeader {

View File

@@ -2,8 +2,8 @@
use crate::test_utils::pubkey;
use crate::*;
use fixed_bytes::FixedBytesExtended;
use tempfile::tempdir;
use types::FixedBytesExtended;
#[test]
fn export_non_existent_key() {

View File

@@ -2,11 +2,13 @@ use crate::{
SigningRoot, SlashingDatabase,
test_utils::{DEFAULT_GENESIS_VALIDATORS_ROOT, pubkey},
};
use bls::PublicKeyBytes;
use eip_3076::{Interchange, SignedAttestation, SignedBlock};
use fixed_bytes::FixedBytesExtended;
use serde::{Deserialize, Serialize};
use std::collections::HashSet;
use tempfile::tempdir;
use types::{Epoch, FixedBytesExtended, Hash256, PublicKeyBytes, Slot};
use types::{Epoch, Hash256, Slot};
#[derive(Debug, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]

View File

@@ -19,10 +19,11 @@ pub use crate::slashing_database::{
InterchangeError, InterchangeImportOutcome, SUPPORTED_INTERCHANGE_FORMAT_VERSION,
SlashingDatabase,
};
use bls::PublicKeyBytes;
use rusqlite::Error as SQLError;
use std::fmt::Display;
use std::io::{Error as IOError, ErrorKind};
use types::{Hash256, PublicKeyBytes};
use types::Hash256;
/// The filename within the `validators` directory that contains the slashing protection DB.
pub const SLASHING_PROTECTION_FILENAME: &str = "slashing_protection.sqlite";
@@ -133,7 +134,7 @@ impl Display for NotSafe {
#[cfg(test)]
mod test {
use types::FixedBytesExtended;
use fixed_bytes::FixedBytesExtended;
use super::*;

View File

@@ -1,6 +1,7 @@
use crate::signed_attestation::InvalidAttestation;
use crate::signed_block::InvalidBlock;
use crate::{NotSafe, Safe, SignedAttestation, SignedBlock, SigningRoot, signing_root_from_row};
use bls::PublicKeyBytes;
use eip_3076::{
Interchange, InterchangeData, InterchangeMetadata, SignedAttestation as InterchangeAttestation,
SignedBlock as InterchangeBlock,
@@ -12,7 +13,7 @@ use std::fs::File;
use std::path::Path;
use std::time::Duration;
use tracing::instrument;
use types::{AttestationData, BeaconBlockHeader, Epoch, Hash256, PublicKeyBytes, SignedRoot, Slot};
use types::{AttestationData, BeaconBlockHeader, Epoch, Hash256, SignedRoot, Slot};
type Pool = r2d2::Pool<SqliteConnectionManager>;