primitives: rm alloy Withdrawal reexport (#12296)

This commit is contained in:
Thomas Coratger
2024-11-04 09:21:17 +01:00
committed by GitHub
parent 9814041603
commit 56b76871ed
19 changed files with 36 additions and 37 deletions

View File

@ -275,6 +275,7 @@ pub fn validate_against_parent_4844(
mod tests { mod tests {
use super::*; use super::*;
use alloy_consensus::{TxEip4844, EMPTY_OMMER_ROOT_HASH, EMPTY_ROOT_HASH}; use alloy_consensus::{TxEip4844, EMPTY_OMMER_ROOT_HASH, EMPTY_ROOT_HASH};
use alloy_eips::eip4895::Withdrawal;
use alloy_primitives::{ use alloy_primitives::{
hex_literal::hex, Address, BlockHash, BlockNumber, Bytes, Parity, Sealable, U256, hex_literal::hex, Address, BlockHash, BlockNumber, Bytes, Parity, Sealable, U256,
}; };
@ -283,7 +284,7 @@ mod tests {
use reth_chainspec::ChainSpecBuilder; use reth_chainspec::ChainSpecBuilder;
use reth_primitives::{ use reth_primitives::{
proofs, Account, BlockBody, BlockHashOrNumber, Signature, Transaction, TransactionSigned, proofs, Account, BlockBody, BlockHashOrNumber, Signature, Transaction, TransactionSigned,
Withdrawal, Withdrawals, Withdrawals,
}; };
use reth_storage_api::{ use reth_storage_api::{
errors::provider::ProviderResult, AccountReader, HeaderProvider, WithdrawalsProvider, errors::provider::ProviderResult, AccountReader, HeaderProvider, WithdrawalsProvider,

View File

@ -1,9 +1,10 @@
//! State changes that are not related to transactions. //! State changes that are not related to transactions.
use alloy_eips::eip4895::Withdrawal;
use alloy_primitives::{map::HashMap, Address, U256}; use alloy_primitives::{map::HashMap, Address, U256};
use reth_chainspec::EthereumHardforks; use reth_chainspec::EthereumHardforks;
use reth_consensus_common::calc; use reth_consensus_common::calc;
use reth_primitives::{Block, Withdrawal, Withdrawals}; use reth_primitives::{Block, Withdrawals};
/// Collect all balance changes at the end of the block. /// Collect all balance changes at the end of the block.
/// ///

View File

@ -34,7 +34,7 @@ pub mod block;
pub use block::{body::BlockBody, Block}; pub use block::{body::BlockBody, Block};
mod withdrawal; mod withdrawal;
pub use withdrawal::{Withdrawal, Withdrawals}; pub use withdrawal::Withdrawals;
mod error; mod error;
pub use error::{GotExpected, GotExpectedBoxed}; pub use error::{GotExpected, GotExpectedBoxed};

View File

@ -1,13 +1,10 @@
//! [EIP-4895](https://eips.ethereum.org/EIPS/eip-4895) Withdrawal types. //! [EIP-4895](https://eips.ethereum.org/EIPS/eip-4895) Withdrawal types.
use alloc::vec::Vec; use alloc::vec::Vec;
use alloy_eips::eip4895::Withdrawal;
use alloy_rlp::{RlpDecodableWrapper, RlpEncodableWrapper}; use alloy_rlp::{RlpDecodableWrapper, RlpEncodableWrapper};
use derive_more::{AsRef, Deref, DerefMut, From, IntoIterator}; use derive_more::{AsRef, Deref, DerefMut, From, IntoIterator};
use reth_codecs::{add_arbitrary_tests, Compact}; use reth_codecs::{add_arbitrary_tests, Compact};
/// Re-export from `alloy_eips`.
#[doc(inline)]
pub use alloy_eips::eip4895::Withdrawal;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Represents a collection of Withdrawals. /// Represents a collection of Withdrawals.

View File

@ -45,7 +45,7 @@ pub use receipt::{
}; };
pub use reth_primitives_traits::{ pub use reth_primitives_traits::{
logs_bloom, Account, Bytecode, GotExpected, GotExpectedBoxed, Header, HeaderError, Log, logs_bloom, Account, Bytecode, GotExpected, GotExpectedBoxed, Header, HeaderError, Log,
LogData, SealedHeader, StorageEntry, Withdrawal, Withdrawals, LogData, SealedHeader, StorageEntry, Withdrawals,
}; };
pub use static_file::StaticFileSegment; pub use static_file::StaticFileSegment;

View File

@ -1,11 +1,9 @@
//! Helper function for calculating Merkle proofs and hashes. //! Helper function for calculating Merkle proofs and hashes.
use crate::{ use crate::{Header, Receipt, ReceiptWithBloom, ReceiptWithBloomRef, TransactionSigned};
Header, Receipt, ReceiptWithBloom, ReceiptWithBloomRef, TransactionSigned, Withdrawal,
};
use alloc::vec::Vec; use alloc::vec::Vec;
use alloy_consensus::EMPTY_OMMER_ROOT_HASH; use alloy_consensus::EMPTY_OMMER_ROOT_HASH;
use alloy_eips::eip2718::Encodable2718; use alloy_eips::{eip2718::Encodable2718, eip4895::Withdrawal};
use alloy_primitives::{keccak256, B256}; use alloy_primitives::{keccak256, B256};
use reth_trie_common::root::{ordered_trie_root, ordered_trie_root_with_encoder}; use reth_trie_common::root::{ordered_trie_root, ordered_trie_root_with_encoder};

View File

@ -9,7 +9,7 @@ use crate::{
StageCheckpointReader, StateProviderBox, StateProviderFactory, StateReader, StageCheckpointReader, StateProviderBox, StateProviderFactory, StateReader,
StaticFileProviderFactory, TransactionVariant, TransactionsProvider, WithdrawalsProvider, StaticFileProviderFactory, TransactionVariant, TransactionsProvider, WithdrawalsProvider,
}; };
use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag}; use alloy_eips::{eip4895::Withdrawal, BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag};
use alloy_primitives::{Address, BlockHash, BlockNumber, Sealable, TxHash, TxNumber, B256, U256}; use alloy_primitives::{Address, BlockHash, BlockNumber, Sealable, TxHash, TxNumber, B256, U256};
use alloy_rpc_types_engine::ForkchoiceState; use alloy_rpc_types_engine::ForkchoiceState;
use reth_chain_state::{ use reth_chain_state::{
@ -25,7 +25,7 @@ use reth_node_types::NodeTypesWithDB;
use reth_primitives::{ use reth_primitives::{
Account, Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders, Account, Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders,
SealedHeader, StorageEntry, TransactionMeta, TransactionSigned, TransactionSignedNoHash, SealedHeader, StorageEntry, TransactionMeta, TransactionSigned, TransactionSignedNoHash,
Withdrawal, Withdrawals, Withdrawals,
}; };
use reth_prune_types::{PruneCheckpoint, PruneSegment}; use reth_prune_types::{PruneCheckpoint, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId}; use reth_stages_types::{StageCheckpoint, StageId};

View File

@ -6,7 +6,9 @@ use crate::{
StageCheckpointReader, StateReader, StaticFileProviderFactory, TransactionVariant, StageCheckpointReader, StateReader, StaticFileProviderFactory, TransactionVariant,
TransactionsProvider, WithdrawalsProvider, TransactionsProvider, WithdrawalsProvider,
}; };
use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag, HashOrNumber}; use alloy_eips::{
eip4895::Withdrawal, BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag, HashOrNumber,
};
use alloy_primitives::{Address, BlockHash, BlockNumber, Sealable, TxHash, TxNumber, B256, U256}; use alloy_primitives::{Address, BlockHash, BlockNumber, Sealable, TxHash, TxNumber, B256, U256};
use reth_chain_state::{BlockState, CanonicalInMemoryState, MemoryOverlayStateProviderRef}; use reth_chain_state::{BlockState, CanonicalInMemoryState, MemoryOverlayStateProviderRef};
use reth_chainspec::{ChainInfo, EthereumHardforks}; use reth_chainspec::{ChainInfo, EthereumHardforks};
@ -17,7 +19,7 @@ use reth_execution_types::{BundleStateInit, ExecutionOutcome, RevertsInit};
use reth_primitives::{ use reth_primitives::{
Account, Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders, Account, Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders,
SealedHeader, StorageEntry, TransactionMeta, TransactionSigned, TransactionSignedNoHash, SealedHeader, StorageEntry, TransactionMeta, TransactionSigned, TransactionSignedNoHash,
Withdrawal, Withdrawals, Withdrawals,
}; };
use reth_prune_types::{PruneCheckpoint, PruneSegment}; use reth_prune_types::{PruneCheckpoint, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId}; use reth_stages_types::{StageCheckpoint, StageId};

View File

@ -7,7 +7,7 @@ use crate::{
PruneCheckpointReader, StageCheckpointReader, StateProviderBox, StaticFileProviderFactory, PruneCheckpointReader, StageCheckpointReader, StateProviderBox, StaticFileProviderFactory,
TransactionVariant, TransactionsProvider, WithdrawalsProvider, TransactionVariant, TransactionsProvider, WithdrawalsProvider,
}; };
use alloy_eips::BlockHashOrNumber; use alloy_eips::{eip4895::Withdrawal, BlockHashOrNumber};
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256}; use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
use core::fmt; use core::fmt;
use reth_chainspec::{ChainInfo, EthereumHardforks}; use reth_chainspec::{ChainInfo, EthereumHardforks};
@ -18,8 +18,7 @@ use reth_evm::ConfigureEvmEnv;
use reth_node_types::NodeTypesWithDB; use reth_node_types::NodeTypesWithDB;
use reth_primitives::{ use reth_primitives::{
Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader,
StaticFileSegment, TransactionMeta, TransactionSigned, TransactionSignedNoHash, Withdrawal, StaticFileSegment, TransactionMeta, TransactionSigned, TransactionSignedNoHash, Withdrawals,
Withdrawals,
}; };
use reth_prune_types::{PruneCheckpoint, PruneModes, PruneSegment}; use reth_prune_types::{PruneCheckpoint, PruneModes, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId}; use reth_stages_types::{StageCheckpoint, StageId};

View File

@ -15,7 +15,7 @@ use crate::{
StaticFileProviderFactory, StatsReader, StorageReader, StorageTrieWriter, TransactionVariant, StaticFileProviderFactory, StatsReader, StorageReader, StorageTrieWriter, TransactionVariant,
TransactionsProvider, TransactionsProviderExt, TrieWriter, WithdrawalsProvider, TransactionsProvider, TransactionsProviderExt, TrieWriter, WithdrawalsProvider,
}; };
use alloy_eips::BlockHashOrNumber; use alloy_eips::{eip4895::Withdrawal, BlockHashOrNumber};
use alloy_primitives::{keccak256, Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256}; use alloy_primitives::{keccak256, Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
use itertools::{izip, Itertools}; use itertools::{izip, Itertools};
use rayon::slice::ParallelSliceMut; use rayon::slice::ParallelSliceMut;
@ -43,7 +43,7 @@ use reth_primitives::{
Account, Block, BlockBody, BlockWithSenders, Bytecode, GotExpected, Header, Receipt, Account, Block, BlockBody, BlockWithSenders, Bytecode, GotExpected, Header, Receipt,
SealedBlock, SealedBlockWithSenders, SealedHeader, StaticFileSegment, StorageEntry, SealedBlock, SealedBlockWithSenders, SealedHeader, StaticFileSegment, StorageEntry,
TransactionMeta, TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash, TransactionMeta, TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash,
Withdrawal, Withdrawals, Withdrawals,
}; };
use reth_prune_types::{PruneCheckpoint, PruneModes, PruneSegment}; use reth_prune_types::{PruneCheckpoint, PruneModes, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId}; use reth_stages_types::{StageCheckpoint, StageId};

View File

@ -7,7 +7,7 @@ use crate::{
StageCheckpointReader, StateProviderBox, StateProviderFactory, StaticFileProviderFactory, StageCheckpointReader, StateProviderBox, StateProviderFactory, StaticFileProviderFactory,
TransactionVariant, TransactionsProvider, TreeViewer, WithdrawalsProvider, TransactionVariant, TransactionsProvider, TreeViewer, WithdrawalsProvider,
}; };
use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag}; use alloy_eips::{eip4895::Withdrawal, BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag};
use alloy_primitives::{Address, BlockHash, BlockNumber, Sealable, TxHash, TxNumber, B256, U256}; use alloy_primitives::{Address, BlockHash, BlockNumber, Sealable, TxHash, TxNumber, B256, U256};
use reth_blockchain_tree_api::{ use reth_blockchain_tree_api::{
error::{CanonicalError, InsertBlockError}, error::{CanonicalError, InsertBlockError},
@ -21,8 +21,7 @@ use reth_evm::ConfigureEvmEnv;
use reth_node_types::NodeTypesWithDB; use reth_node_types::NodeTypesWithDB;
use reth_primitives::{ use reth_primitives::{
Account, Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders, Account, Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders,
SealedHeader, TransactionMeta, TransactionSigned, TransactionSignedNoHash, Withdrawal, SealedHeader, TransactionMeta, TransactionSigned, TransactionSignedNoHash, Withdrawals,
Withdrawals,
}; };
use reth_prune_types::{PruneCheckpoint, PruneSegment}; use reth_prune_types::{PruneCheckpoint, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId}; use reth_stages_types::{StageCheckpoint, StageId};

View File

@ -7,7 +7,7 @@ use crate::{
ReceiptProvider, StageCheckpointReader, StatsReader, TransactionVariant, TransactionsProvider, ReceiptProvider, StageCheckpointReader, StatsReader, TransactionVariant, TransactionsProvider,
TransactionsProviderExt, WithdrawalsProvider, TransactionsProviderExt, WithdrawalsProvider,
}; };
use alloy_eips::BlockHashOrNumber; use alloy_eips::{eip4895::Withdrawal, BlockHashOrNumber};
use alloy_primitives::{keccak256, Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256}; use alloy_primitives::{keccak256, Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
use dashmap::DashMap; use dashmap::DashMap;
use notify::{RecommendedWatcher, RecursiveMode, Watcher}; use notify::{RecommendedWatcher, RecursiveMode, Watcher};
@ -31,8 +31,7 @@ use reth_primitives::{
DEFAULT_BLOCKS_PER_STATIC_FILE, DEFAULT_BLOCKS_PER_STATIC_FILE,
}, },
Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader,
StaticFileSegment, TransactionMeta, TransactionSigned, TransactionSignedNoHash, Withdrawal, StaticFileSegment, TransactionMeta, TransactionSigned, TransactionSignedNoHash, Withdrawals,
Withdrawals,
}; };
use reth_stages_types::{PipelineTarget, StageId}; use reth_stages_types::{PipelineTarget, StageId};
use reth_storage_api::DBProvider; use reth_storage_api::DBProvider;

View File

@ -6,12 +6,13 @@ use alloy_primitives::{
TxKind, B256, U256, TxKind, B256, U256,
}; };
use alloy_eips::eip4895::Withdrawal;
use reth_db::tables; use reth_db::tables;
use reth_db_api::{database::Database, models::StoredBlockBodyIndices}; use reth_db_api::{database::Database, models::StoredBlockBodyIndices};
use reth_node_types::NodeTypes; use reth_node_types::NodeTypes;
use reth_primitives::{ use reth_primitives::{
Account, BlockBody, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, Account, BlockBody, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader,
Signature, Transaction, TransactionSigned, TxType, Withdrawal, Withdrawals, Signature, Transaction, TransactionSigned, TxType, Withdrawals,
}; };
use reth_trie::root::{state_root_unhashed, storage_root_unhashed}; use reth_trie::root::{state_root_unhashed, storage_root_unhashed};
use revm::{db::BundleState, primitives::AccountInfo}; use revm::{db::BundleState, primitives::AccountInfo};

View File

@ -6,7 +6,7 @@ use crate::{
StateRootProvider, TransactionVariant, TransactionsProvider, WithdrawalsProvider, StateRootProvider, TransactionVariant, TransactionsProvider, WithdrawalsProvider,
}; };
use alloy_consensus::constants::EMPTY_ROOT_HASH; use alloy_consensus::constants::EMPTY_ROOT_HASH;
use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumberOrTag}; use alloy_eips::{eip4895::Withdrawal, BlockHashOrNumber, BlockId, BlockNumberOrTag};
use alloy_primitives::{ use alloy_primitives::{
keccak256, keccak256,
map::{HashMap, HashSet}, map::{HashMap, HashSet},
@ -23,7 +23,7 @@ use reth_node_types::NodeTypes;
use reth_primitives::{ use reth_primitives::{
Account, Block, BlockWithSenders, Bytecode, GotExpected, Header, Receipt, SealedBlock, Account, Block, BlockWithSenders, Bytecode, GotExpected, Header, Receipt, SealedBlock,
SealedBlockWithSenders, SealedHeader, TransactionMeta, TransactionSigned, SealedBlockWithSenders, SealedHeader, TransactionMeta, TransactionSigned,
TransactionSignedNoHash, Withdrawal, Withdrawals, TransactionSignedNoHash, Withdrawals,
}; };
use reth_stages_types::{StageCheckpoint, StageId}; use reth_stages_types::{StageCheckpoint, StageId};
use reth_storage_api::{ use reth_storage_api::{

View File

@ -4,7 +4,7 @@ use std::{
sync::Arc, sync::Arc,
}; };
use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumberOrTag}; use alloy_eips::{eip4895::Withdrawal, BlockHashOrNumber, BlockId, BlockNumberOrTag};
use alloy_primitives::{ use alloy_primitives::{
map::{HashMap, HashSet}, map::{HashMap, HashSet},
Address, BlockHash, BlockNumber, Bytes, StorageKey, StorageValue, TxHash, TxNumber, B256, U256, Address, BlockHash, BlockNumber, Bytes, StorageKey, StorageValue, TxHash, TxNumber, B256, U256,
@ -20,7 +20,7 @@ use reth_evm::ConfigureEvmEnv;
use reth_primitives::{ use reth_primitives::{
Account, Block, BlockWithSenders, Bytecode, Header, Receipt, SealedBlock, Account, Block, BlockWithSenders, Bytecode, Header, Receipt, SealedBlock,
SealedBlockWithSenders, SealedHeader, TransactionMeta, TransactionSigned, SealedBlockWithSenders, SealedHeader, TransactionMeta, TransactionSigned,
TransactionSignedNoHash, Withdrawal, Withdrawals, TransactionSignedNoHash, Withdrawals,
}; };
use reth_prune_types::{PruneCheckpoint, PruneSegment}; use reth_prune_types::{PruneCheckpoint, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId}; use reth_stages_types::{StageCheckpoint, StageId};

View File

@ -1,5 +1,5 @@
use alloy_eips::BlockHashOrNumber; use alloy_eips::{eip4895::Withdrawal, BlockHashOrNumber};
use reth_primitives::{Withdrawal, Withdrawals}; use reth_primitives::Withdrawals;
use reth_storage_errors::provider::ProviderResult; use reth_storage_errors::provider::ProviderResult;
/// Client trait for fetching [Withdrawal] related data. /// Client trait for fetching [Withdrawal] related data.

View File

@ -3,7 +3,7 @@
#![cfg_attr(not(test), warn(unused_crate_dependencies))] #![cfg_attr(not(test), warn(unused_crate_dependencies))]
use alloy_eips::eip7685::Requests; use alloy_eips::{eip4895::Withdrawal, eip7685::Requests};
use alloy_sol_macro::sol; use alloy_sol_macro::sol;
use alloy_sol_types::SolCall; use alloy_sol_types::SolCall;
#[cfg(feature = "optimism")] #[cfg(feature = "optimism")]
@ -30,7 +30,7 @@ use reth_primitives::{
revm_primitives::{ revm_primitives::{
address, Address, BlockEnv, Bytes, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, U256, address, Address, BlockEnv, Bytes, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, U256,
}, },
BlockWithSenders, Receipt, Withdrawal, BlockWithSenders, Receipt,
}; };
use std::{fmt::Display, sync::Arc}; use std::{fmt::Display, sync::Arc};

View File

@ -17,6 +17,7 @@ reth-primitives = { workspace = true, features = ["secp256k1"] }
alloy-genesis.workspace = true alloy-genesis.workspace = true
alloy-primitives.workspace = true alloy-primitives.workspace = true
alloy-consensus.workspace = true alloy-consensus.workspace = true
alloy-eips.workspace = true
rand.workspace = true rand.workspace = true
secp256k1 = { workspace = true, features = ["rand"] } secp256k1 = { workspace = true, features = ["rand"] }

View File

@ -1,6 +1,7 @@
//! Generators for different data structures like block headers, block bodies and ranges of those. //! Generators for different data structures like block headers, block bodies and ranges of those.
use alloy_consensus::{Transaction as _, TxLegacy}; use alloy_consensus::{Transaction as _, TxLegacy};
use alloy_eips::eip4895::Withdrawal;
use alloy_primitives::{Address, BlockNumber, Bytes, Parity, Sealable, TxKind, B256, U256}; use alloy_primitives::{Address, BlockNumber, Bytes, Parity, Sealable, TxKind, B256, U256};
pub use rand::Rng; pub use rand::Rng;
use rand::{ use rand::{
@ -8,7 +9,7 @@ use rand::{
}; };
use reth_primitives::{ use reth_primitives::{
proofs, sign_message, Account, BlockBody, Header, Log, Receipt, SealedBlock, SealedHeader, proofs, sign_message, Account, BlockBody, Header, Log, Receipt, SealedBlock, SealedHeader,
StorageEntry, Transaction, TransactionSigned, Withdrawal, Withdrawals, StorageEntry, Transaction, TransactionSigned, Withdrawals,
}; };
use secp256k1::{Keypair, Secp256k1}; use secp256k1::{Keypair, Secp256k1};
use std::{ use std::{