primitives: rm alloy Header reexport (#12515)

This commit is contained in:
Thomas Coratger
2024-11-13 17:41:25 +01:00
committed by GitHub
parent e6f3191c62
commit 001f3899fd
134 changed files with 493 additions and 439 deletions

View File

@ -25,6 +25,7 @@ reth-trie-common.workspace = true
# ethereum
alloy-primitives.workspace = true
alloy-genesis.workspace = true
alloy-consensus.workspace = true
# codecs
modular-bitfield.workspace = true
@ -57,29 +58,27 @@ proptest-arbitrary-interop.workspace = true
[features]
test-utils = [
"arbitrary",
"reth-primitives/test-utils",
"reth-primitives-traits/test-utils",
"reth-codecs/test-utils",
"reth-db-models/test-utils",
"reth-trie-common/test-utils",
"reth-prune-types/test-utils",
"reth-stages-types/test-utils"
"arbitrary",
"reth-primitives/test-utils",
"reth-primitives-traits/test-utils",
"reth-codecs/test-utils",
"reth-db-models/test-utils",
"reth-trie-common/test-utils",
"reth-prune-types/test-utils",
"reth-stages-types/test-utils",
]
arbitrary = [
"reth-primitives/arbitrary",
"reth-db-models/arbitrary",
"dep:arbitrary",
"dep:proptest",
"reth-primitives-traits/arbitrary",
"reth-trie-common/arbitrary",
"alloy-primitives/arbitrary",
"parity-scale-codec/arbitrary",
"reth-codecs/arbitrary",
"reth-prune-types/arbitrary",
"reth-stages-types/arbitrary"
]
optimism = [
"reth-primitives/optimism",
"reth-codecs/optimism"
"reth-primitives/arbitrary",
"reth-db-models/arbitrary",
"dep:arbitrary",
"dep:proptest",
"reth-primitives-traits/arbitrary",
"reth-trie-common/arbitrary",
"alloy-primitives/arbitrary",
"parity-scale-codec/arbitrary",
"reth-codecs/arbitrary",
"reth-prune-types/arbitrary",
"reth-stages-types/arbitrary",
"alloy-consensus/arbitrary",
]
optimism = ["reth-primitives/optimism", "reth-codecs/optimism"]

View File

@ -1,8 +1,8 @@
//! Block related models and types.
use alloy_consensus::Header;
use alloy_primitives::B256;
use reth_codecs::{add_arbitrary_tests, Compact};
use reth_primitives::Header;
use serde::{Deserialize, Serialize};
/// The storage representation of a block's ommers.

View File

@ -4,12 +4,11 @@ use crate::{
table::{Compress, Decode, Decompress, Encode},
DatabaseError,
};
use alloy_consensus::Header;
use alloy_genesis::GenesisAccount;
use alloy_primitives::{Address, Bytes, Log, B256, U256};
use reth_codecs::{add_arbitrary_tests, Compact};
use reth_primitives::{
Account, Bytecode, Header, Receipt, StorageEntry, TransactionSignedNoHash, TxType,
};
use reth_primitives::{Account, Bytecode, Receipt, StorageEntry, TransactionSignedNoHash, TxType};
use reth_prune_types::{PruneCheckpoint, PruneSegment};
use reth_stages_types::StageCheckpoint;
use reth_trie_common::{StoredNibbles, StoredNibblesSubKey, *};

View File

@ -26,6 +26,7 @@ reth-trie-common.workspace = true
# ethereum
alloy-primitives.workspace = true
alloy-consensus.workspace = true
# mdbx
reth-libmdbx = { workspace = true, optional = true, features = [
@ -90,31 +91,29 @@ mdbx = [
"dep:rustc-hash",
]
test-utils = [
"dep:tempfile",
"arbitrary",
"parking_lot",
"reth-primitives/test-utils",
"reth-primitives-traits/test-utils",
"reth-db-api/test-utils",
"reth-nippy-jar/test-utils",
"reth-trie-common/test-utils",
"reth-prune-types/test-utils",
"reth-stages-types/test-utils"
"dep:tempfile",
"arbitrary",
"parking_lot",
"reth-primitives/test-utils",
"reth-primitives-traits/test-utils",
"reth-db-api/test-utils",
"reth-nippy-jar/test-utils",
"reth-trie-common/test-utils",
"reth-prune-types/test-utils",
"reth-stages-types/test-utils",
]
bench = []
arbitrary = [
"reth-primitives/arbitrary",
"reth-db-api/arbitrary",
"reth-primitives-traits/arbitrary",
"reth-trie-common/arbitrary",
"alloy-primitives/arbitrary",
"reth-prune-types/arbitrary",
"reth-stages-types/arbitrary"
]
optimism = [
"reth-primitives/optimism",
"reth-db-api/optimism"
"reth-primitives/arbitrary",
"reth-db-api/arbitrary",
"reth-primitives-traits/arbitrary",
"reth-trie-common/arbitrary",
"alloy-primitives/arbitrary",
"reth-prune-types/arbitrary",
"reth-stages-types/arbitrary",
"alloy-consensus/arbitrary",
]
optimism = ["reth-primitives/optimism", "reth-db-api/optimism"]
disable-lock = []
[[bench]]

View File

@ -497,6 +497,7 @@ mod tests {
test_utils::*,
AccountChangeSets,
};
use alloy_consensus::Header;
use alloy_primitives::{Address, B256, U256};
use reth_db_api::{
cursor::{DbDupCursorRO, DbDupCursorRW, ReverseWalker, Walker},
@ -504,7 +505,7 @@ mod tests {
table::{Encode, Table},
};
use reth_libmdbx::Error;
use reth_primitives::{Account, Header, StorageEntry};
use reth_primitives::{Account, StorageEntry};
use reth_primitives_traits::IntegerList;
use reth_storage_errors::db::{DatabaseWriteError, DatabaseWriteOperation};
use std::str::FromStr;

View File

@ -4,9 +4,9 @@ use crate::{
static_file::mask::{ColumnSelectorOne, ColumnSelectorTwo, HeaderMask},
HeaderTerminalDifficulties, RawValue, Receipts, Transactions,
};
use alloy_consensus::Header;
use alloy_primitives::BlockHash;
use reth_db_api::table::Table;
use reth_primitives::Header;
// HEADER MASKS
add_static_file_mask!(HeaderMask, Header, 0b001);

View File

@ -19,6 +19,7 @@ pub use raw::{RawDupSort, RawKey, RawTable, RawValue, TableRawRow};
#[cfg(feature = "mdbx")]
pub(crate) mod utils;
use alloy_consensus::Header;
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256};
use reth_db_api::{
models::{
@ -30,7 +31,7 @@ use reth_db_api::{
},
table::{Decode, DupSort, Encode, Table},
};
use reth_primitives::{Account, Bytecode, Header, Receipt, StorageEntry, TransactionSignedNoHash};
use reth_primitives::{Account, Bytecode, Receipt, StorageEntry, TransactionSignedNoHash};
use reth_primitives_traits::IntegerList;
use reth_prune_types::{PruneCheckpoint, PruneSegment};
use reth_stages_types::StageCheckpoint;

View File

@ -38,6 +38,7 @@ reth-node-types.workspace = true
alloy-eips.workspace = true
alloy-primitives.workspace = true
alloy-rpc-types-engine.workspace = true
alloy-consensus.workspace = true
revm.workspace = true
# optimism
@ -65,7 +66,6 @@ strum.workspace = true
# test-utils
reth-ethereum-engine-primitives = { workspace = true, optional = true }
alloy-consensus = { workspace = true, optional = true }
# parallel utils
rayon.workspace = true
@ -88,44 +88,43 @@ alloy-consensus.workspace = true
[features]
optimism = [
"reth-primitives/optimism",
"reth-execution-types/optimism",
"reth-optimism-primitives",
"reth-codecs/optimism",
"reth-db/optimism",
"reth-db-api/optimism",
"revm/optimism"
"reth-primitives/optimism",
"reth-execution-types/optimism",
"reth-optimism-primitives",
"reth-codecs/optimism",
"reth-db/optimism",
"reth-db-api/optimism",
"revm/optimism",
]
serde = [
"reth-execution-types/serde",
"reth-trie-db/serde",
"reth-trie/serde",
"alloy-consensus?/serde",
"alloy-eips/serde",
"alloy-primitives/serde",
"alloy-rpc-types-engine/serde",
"dashmap/serde",
"notify/serde",
"parking_lot/serde",
"rand/serde",
"revm/serde",
"reth-codecs/serde"
"reth-execution-types/serde",
"reth-trie-db/serde",
"reth-trie/serde",
"alloy-consensus/serde",
"alloy-eips/serde",
"alloy-primitives/serde",
"alloy-rpc-types-engine/serde",
"dashmap/serde",
"notify/serde",
"parking_lot/serde",
"rand/serde",
"revm/serde",
"reth-codecs/serde",
]
test-utils = [
"reth-db/test-utils",
"reth-nippy-jar/test-utils",
"reth-trie/test-utils",
"reth-chain-state/test-utils",
"reth-ethereum-engine-primitives",
"alloy-consensus",
"reth-chainspec/test-utils",
"reth-evm/test-utils",
"reth-network-p2p/test-utils",
"reth-primitives/test-utils",
"reth-codecs/test-utils",
"reth-db-api/test-utils",
"reth-trie-db/test-utils",
"revm/test-utils",
"reth-prune-types/test-utils",
"reth-stages-types/test-utils"
"reth-db/test-utils",
"reth-nippy-jar/test-utils",
"reth-trie/test-utils",
"reth-chain-state/test-utils",
"reth-ethereum-engine-primitives",
"reth-chainspec/test-utils",
"reth-evm/test-utils",
"reth-network-p2p/test-utils",
"reth-primitives/test-utils",
"reth-codecs/test-utils",
"reth-db-api/test-utils",
"reth-trie-db/test-utils",
"revm/test-utils",
"reth-prune-types/test-utils",
"reth-stages-types/test-utils",
]

View File

@ -9,6 +9,7 @@ use crate::{
StageCheckpointReader, StateProviderBox, StateProviderFactory, StateReader,
StaticFileProviderFactory, TransactionVariant, TransactionsProvider, WithdrawalsProvider,
};
use alloy_consensus::Header;
use alloy_eips::{
eip4895::{Withdrawal, Withdrawals},
BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag,
@ -26,8 +27,8 @@ use reth_evm::ConfigureEvmEnv;
use reth_execution_types::ExecutionOutcome;
use reth_node_types::NodeTypesWithDB;
use reth_primitives::{
Account, Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders,
SealedHeader, StorageEntry, TransactionMeta, TransactionSigned, TransactionSignedNoHash,
Account, Block, BlockWithSenders, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader,
StorageEntry, TransactionMeta, TransactionSigned, TransactionSignedNoHash,
};
use reth_prune_types::{PruneCheckpoint, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId};

View File

@ -6,6 +6,7 @@ use crate::{
StageCheckpointReader, StateReader, StaticFileProviderFactory, TransactionVariant,
TransactionsProvider, WithdrawalsProvider,
};
use alloy_consensus::Header;
use alloy_eips::{
eip4895::{Withdrawal, Withdrawals},
BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag, HashOrNumber,
@ -18,8 +19,8 @@ use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices};
use reth_evm::ConfigureEvmEnv;
use reth_execution_types::{BundleStateInit, ExecutionOutcome, RevertsInit};
use reth_primitives::{
Account, Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders,
SealedHeader, StorageEntry, TransactionMeta, TransactionSigned, TransactionSignedNoHash,
Account, Block, BlockWithSenders, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader,
StorageEntry, TransactionMeta, TransactionSigned, TransactionSignedNoHash,
};
use reth_prune_types::{PruneCheckpoint, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId};

View File

@ -7,6 +7,7 @@ use crate::{
PruneCheckpointReader, StageCheckpointReader, StateProviderBox, StaticFileProviderFactory,
TransactionVariant, TransactionsProvider, WithdrawalsProvider,
};
use alloy_consensus::Header;
use alloy_eips::{
eip4895::{Withdrawal, Withdrawals},
BlockHashOrNumber,
@ -20,7 +21,7 @@ use reth_errors::{RethError, RethResult};
use reth_evm::ConfigureEvmEnv;
use reth_node_types::NodeTypesWithDB;
use reth_primitives::{
Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader,
Block, BlockWithSenders, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader,
StaticFileSegment, TransactionMeta, TransactionSigned, TransactionSignedNoHash,
};
use reth_prune_types::{PruneCheckpoint, PruneModes, PruneSegment};

View File

@ -15,6 +15,7 @@ use crate::{
StaticFileProviderFactory, StatsReader, StorageReader, StorageTrieWriter, TransactionVariant,
TransactionsProvider, TransactionsProviderExt, TrieWriter, WithdrawalsProvider,
};
use alloy_consensus::Header;
use alloy_eips::{
eip4895::{Withdrawal, Withdrawals},
BlockHashOrNumber,
@ -42,9 +43,9 @@ use reth_execution_types::{Chain, ExecutionOutcome};
use reth_network_p2p::headers::downloader::SyncTarget;
use reth_node_types::NodeTypes;
use reth_primitives::{
Account, Block, BlockBody, BlockWithSenders, Bytecode, GotExpected, Header, Receipt,
SealedBlock, SealedBlockWithSenders, SealedHeader, StaticFileSegment, StorageEntry,
TransactionMeta, TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash,
Account, Block, BlockBody, BlockWithSenders, Bytecode, GotExpected, Receipt, SealedBlock,
SealedBlockWithSenders, SealedHeader, StaticFileSegment, StorageEntry, TransactionMeta,
TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash,
};
use reth_prune_types::{PruneCheckpoint, PruneModes, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId};

View File

@ -7,6 +7,7 @@ use crate::{
StageCheckpointReader, StateProviderBox, StateProviderFactory, StaticFileProviderFactory,
TransactionVariant, TransactionsProvider, TreeViewer, WithdrawalsProvider,
};
use alloy_consensus::Header;
use alloy_eips::{
eip4895::{Withdrawal, Withdrawals},
BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag,
@ -23,8 +24,8 @@ use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices};
use reth_evm::ConfigureEvmEnv;
use reth_node_types::NodeTypesWithDB;
use reth_primitives::{
Account, Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders,
SealedHeader, TransactionMeta, TransactionSigned, TransactionSignedNoHash,
Account, Block, BlockWithSenders, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader,
TransactionMeta, TransactionSigned, TransactionSignedNoHash,
};
use reth_prune_types::{PruneCheckpoint, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId};

View File

@ -6,13 +6,14 @@ use crate::{
to_range, BlockHashReader, BlockNumReader, HeaderProvider, ReceiptProvider,
TransactionsProvider,
};
use alloy_consensus::Header;
use alloy_eips::BlockHashOrNumber;
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
use reth_chainspec::ChainInfo;
use reth_db::static_file::{HeaderMask, ReceiptMask, StaticFileCursor, TransactionMask};
use reth_db_api::models::CompactU256;
use reth_primitives::{
Header, Receipt, SealedHeader, TransactionMeta, TransactionSigned, TransactionSignedNoHash,
Receipt, SealedHeader, TransactionMeta, TransactionSigned, TransactionSignedNoHash,
};
use reth_storage_errors::provider::{ProviderError, ProviderResult};
use std::{

View File

@ -7,6 +7,7 @@ use crate::{
ReceiptProvider, StageCheckpointReader, StatsReader, TransactionVariant, TransactionsProvider,
TransactionsProviderExt, WithdrawalsProvider,
};
use alloy_consensus::Header;
use alloy_eips::{
eip4895::{Withdrawal, Withdrawals},
BlockHashOrNumber,
@ -33,7 +34,7 @@ use reth_primitives::{
find_fixed_range, HighestStaticFiles, SegmentHeader, SegmentRangeInclusive,
DEFAULT_BLOCKS_PER_STATIC_FILE,
},
Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader,
Block, BlockWithSenders, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader,
StaticFileSegment, TransactionMeta, TransactionSigned, TransactionSignedNoHash,
};
use reth_stages_types::{PipelineTarget, StageId};

View File

@ -56,7 +56,7 @@ impl Deref for LoadedJar {
mod tests {
use super::*;
use crate::{test_utils::create_test_provider_factory, HeaderProvider};
use alloy_consensus::Transaction;
use alloy_consensus::{Header, Transaction};
use alloy_primitives::{BlockHash, TxNumber, B256, U256};
use rand::seq::SliceRandom;
use reth_db::{
@ -66,7 +66,7 @@ mod tests {
use reth_db_api::transaction::DbTxMut;
use reth_primitives::{
static_file::{find_fixed_range, SegmentRangeInclusive, DEFAULT_BLOCKS_PER_STATIC_FILE},
Header, Receipt, TransactionSignedNoHash,
Receipt, TransactionSignedNoHash,
};
use reth_storage_api::{ReceiptProvider, TransactionsProvider};
use reth_testing_utils::generators::{self, random_header_range};

View File

@ -2,6 +2,7 @@ use super::{
manager::StaticFileProviderInner, metrics::StaticFileProviderMetrics, StaticFileProvider,
};
use crate::providers::static_file::metrics::StaticFileProviderOperation;
use alloy_consensus::Header;
use alloy_primitives::{BlockHash, BlockNumber, TxNumber, U256};
use parking_lot::{lock_api::RwLockWriteGuard, RawRwLock, RwLock};
use reth_codecs::Compact;
@ -9,7 +10,7 @@ use reth_db_api::models::CompactU256;
use reth_nippy_jar::{NippyJar, NippyJarError, NippyJarWriter};
use reth_primitives::{
static_file::{SegmentHeader, SegmentRangeInclusive},
Header, Receipt, StaticFileSegment, TransactionSignedNoHash,
Receipt, StaticFileSegment, TransactionSignedNoHash,
};
use reth_storage_errors::provider::{ProviderError, ProviderResult};
use std::{

View File

@ -5,14 +5,15 @@ use alloy_primitives::{
b256, hex_literal::hex, map::HashMap, Address, BlockNumber, Bytes, Log, TxKind, B256, U256,
};
use alloy_consensus::Header;
use alloy_eips::eip4895::{Withdrawal, Withdrawals};
use alloy_primitives::PrimitiveSignature as Signature;
use reth_db::tables;
use reth_db_api::{database::Database, models::StoredBlockBodyIndices};
use reth_node_types::NodeTypes;
use reth_primitives::{
Account, BlockBody, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader,
Transaction, TransactionSigned, TxType,
Account, BlockBody, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, Transaction,
TransactionSigned, TxType,
};
use reth_trie::root::{state_root_unhashed, storage_root_unhashed};
use revm::{db::BundleState, primitives::AccountInfo};

View File

@ -5,7 +5,7 @@ use crate::{
ReceiptProviderIdExt, StateProvider, StateProviderBox, StateProviderFactory, StateReader,
StateRootProvider, TransactionVariant, TransactionsProvider, WithdrawalsProvider,
};
use alloy_consensus::constants::EMPTY_ROOT_HASH;
use alloy_consensus::{constants::EMPTY_ROOT_HASH, Header};
use alloy_eips::{
eip4895::{Withdrawal, Withdrawals},
BlockHashOrNumber, BlockId, BlockNumberOrTag,
@ -23,7 +23,7 @@ use reth_evm::ConfigureEvmEnv;
use reth_execution_types::ExecutionOutcome;
use reth_node_types::NodeTypes;
use reth_primitives::{
Account, Block, BlockWithSenders, Bytecode, GotExpected, Header, Receipt, SealedBlock,
Account, Block, BlockWithSenders, Bytecode, GotExpected, Receipt, SealedBlock,
SealedBlockWithSenders, SealedHeader, TransactionMeta, TransactionSigned,
TransactionSignedNoHash,
};

View File

@ -4,6 +4,7 @@ use std::{
sync::Arc,
};
use alloy_consensus::Header;
use alloy_eips::{
eip4895::{Withdrawal, Withdrawals},
BlockHashOrNumber, BlockId, BlockNumberOrTag,
@ -21,9 +22,8 @@ use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices};
use reth_errors::ProviderError;
use reth_evm::ConfigureEvmEnv;
use reth_primitives::{
Account, Block, BlockWithSenders, Bytecode, Header, Receipt, SealedBlock,
SealedBlockWithSenders, SealedHeader, TransactionMeta, TransactionSigned,
TransactionSignedNoHash,
Account, Block, BlockWithSenders, Bytecode, Receipt, SealedBlock, SealedBlockWithSenders,
SealedHeader, TransactionMeta, TransactionSigned, TransactionSignedNoHash,
};
use reth_prune_types::{PruneCheckpoint, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId};

View File

@ -3,6 +3,7 @@ use crate::{
writer::static_file::StaticFileWriter,
BlockExecutionWriter, BlockWriter, HistoryWriter, StateChangeWriter, StateWriter, TrieWriter,
};
use alloy_consensus::Header;
use alloy_primitives::{BlockNumber, B256, U256};
use reth_chain_state::ExecutedBlock;
use reth_db::{
@ -13,7 +14,7 @@ use reth_db::{
};
use reth_errors::{ProviderError, ProviderResult};
use reth_execution_types::ExecutionOutcome;
use reth_primitives::{Header, SealedBlock, StaticFileSegment, TransactionSignedNoHash};
use reth_primitives::{SealedBlock, StaticFileSegment, TransactionSignedNoHash};
use reth_stages_types::{StageCheckpoint, StageId};
use reth_storage_api::{
DBProvider, HeaderProvider, ReceiptWriter, StageCheckpointWriter, TransactionsProviderExt,

View File

@ -2,11 +2,12 @@ use crate::{
BlockNumReader, HeaderProvider, ReceiptProvider, ReceiptProviderIdExt, TransactionVariant,
TransactionsProvider, WithdrawalsProvider,
};
use alloy_consensus::Header;
use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumberOrTag};
use alloy_primitives::{BlockNumber, B256};
use reth_db_models::StoredBlockBodyIndices;
use reth_primitives::{
Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader,
Block, BlockWithSenders, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader,
};
use reth_storage_errors::provider::ProviderResult;
use std::ops::RangeInclusive;

View File

@ -1,6 +1,7 @@
use alloy_consensus::Header;
use alloy_eips::BlockHashOrNumber;
use alloy_primitives::{BlockHash, BlockNumber, U256};
use reth_primitives::{Header, SealedHeader};
use reth_primitives::SealedHeader;
use reth_storage_errors::provider::ProviderResult;
use std::ops::RangeBounds;