Skip to content

Commit

Permalink
primitives: rm alloy Withdrawals reexport (paradigmxyz#12421)
Browse files Browse the repository at this point in the history
Co-authored-by: Matthias Seitz <[email protected]>
  • Loading branch information
tcoratger and mattsse authored Nov 9, 2024
1 parent ae257f5 commit 59ebeba
Show file tree
Hide file tree
Showing 32 changed files with 104 additions and 71 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions crates/blockchain-tree/src/blockchain_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1375,7 +1375,7 @@ where
mod tests {
use super::*;
use alloy_consensus::{TxEip1559, EMPTY_ROOT_HASH};
use alloy_eips::eip1559::INITIAL_BASE_FEE;
use alloy_eips::{eip1559::INITIAL_BASE_FEE, eip4895::Withdrawals};
use alloy_genesis::{Genesis, GenesisAccount};
use alloy_primitives::{keccak256, Address, PrimitiveSignature as Signature, Sealable, B256};
use assert_matches::assert_matches;
Expand All @@ -1390,7 +1390,6 @@ mod tests {
proofs::{calculate_receipt_root, calculate_transaction_root},
revm_primitives::AccountInfo,
Account, BlockBody, Header, Transaction, TransactionSigned, TransactionSignedEcRecovered,
Withdrawals,
};
use reth_provider::{
test_utils::{
Expand Down
9 changes: 5 additions & 4 deletions crates/consensus/common/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,17 +275,18 @@ pub fn validate_against_parent_4844(
mod tests {
use super::*;
use alloy_consensus::{TxEip4844, EMPTY_OMMER_ROOT_HASH, EMPTY_ROOT_HASH};
use alloy_eips::{eip4895::Withdrawal, BlockHashOrNumber};
use alloy_eips::{
eip4895::{Withdrawal, Withdrawals},
BlockHashOrNumber,
};
use alloy_primitives::{
hex_literal::hex, Address, BlockHash, BlockNumber, Bytes, PrimitiveSignature as Signature,
Sealable, U256,
};
use mockall::mock;
use rand::Rng;
use reth_chainspec::ChainSpecBuilder;
use reth_primitives::{
proofs, Account, BlockBody, Transaction, TransactionSigned, Withdrawals,
};
use reth_primitives::{proofs, Account, BlockBody, Transaction, TransactionSigned};
use reth_storage_api::{
errors::provider::ProviderResult, AccountReader, HeaderProvider, WithdrawalsProvider,
};
Expand Down
4 changes: 2 additions & 2 deletions crates/ethereum/engine-primitives/src/payload.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Contains types required for building a payload.
use alloy_eips::{eip4844::BlobTransactionSidecar, eip7685::Requests};
use alloy_eips::{eip4844::BlobTransactionSidecar, eip4895::Withdrawals, eip7685::Requests};
use alloy_primitives::{Address, B256, U256};
use alloy_rlp::Encodable;
use alloy_rpc_types_engine::{
Expand All @@ -9,7 +9,7 @@ use alloy_rpc_types_engine::{
};
use reth_chain_state::ExecutedBlock;
use reth_payload_primitives::{BuiltPayload, PayloadBuilderAttributes};
use reth_primitives::{SealedBlock, Withdrawals};
use reth_primitives::SealedBlock;
use reth_rpc_types_compat::engine::payload::{
block_to_payload_v1, block_to_payload_v3, convert_block_to_payload_field_v2,
};
Expand Down
4 changes: 2 additions & 2 deletions crates/optimism/payload/src/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use alloy_eips::{
eip1559::BaseFeeParams, eip2718::Decodable2718, eip4844::BlobTransactionSidecar,
eip7685::Requests,
eip4895::Withdrawals, eip7685::Requests,
};
use alloy_primitives::{keccak256, Address, Bytes, B256, B64, U256};
use alloy_rlp::Encodable;
Expand All @@ -16,7 +16,7 @@ use reth_chainspec::EthereumHardforks;
use reth_optimism_chainspec::OpChainSpec;
use reth_payload_builder::EthPayloadBuilderAttributes;
use reth_payload_primitives::{BuiltPayload, PayloadBuilderAttributes};
use reth_primitives::{transaction::WithEncoded, SealedBlock, TransactionSigned, Withdrawals};
use reth_primitives::{transaction::WithEncoded, SealedBlock, TransactionSigned};
use reth_rpc_types_compat::engine::payload::{
block_to_payload_v1, block_to_payload_v3, convert_block_to_payload_field_v2,
};
Expand Down
4 changes: 2 additions & 2 deletions crates/payload/basic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

use crate::metrics::PayloadBuilderMetrics;
use alloy_consensus::constants::EMPTY_WITHDRAWALS;
use alloy_eips::merge::SLOT_DURATION;
use alloy_eips::{eip4895::Withdrawals, merge::SLOT_DURATION};
use alloy_primitives::{Bytes, B256, U256};
use futures_core::ready;
use futures_util::FutureExt;
Expand All @@ -20,7 +20,7 @@ use reth_payload_builder::{KeepPayloadJobAlive, PayloadId, PayloadJob, PayloadJo
use reth_payload_primitives::{
BuiltPayload, PayloadBuilderAttributes, PayloadBuilderError, PayloadKind,
};
use reth_primitives::{constants::RETH_CLIENT_VERSION, proofs, SealedHeader, Withdrawals};
use reth_primitives::{constants::RETH_CLIENT_VERSION, proofs, SealedHeader};
use reth_provider::{BlockReaderIdExt, CanonStateNotification, StateProviderFactory};
use reth_revm::cached::CachedReads;
use reth_tasks::TaskSpawner;
Expand Down
3 changes: 2 additions & 1 deletion crates/payload/basic/src/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ use crate::{
PayloadConfig,
};

use alloy_eips::eip4895::Withdrawals;
use alloy_primitives::{Address, B256, U256};
use reth_payload_builder::PayloadId;
use reth_payload_primitives::BuiltPayload;
use reth_primitives::{SealedBlock, Withdrawals};
use reth_primitives::SealedBlock;

use alloy_eips::eip7685::Requests;
use std::{error::Error, fmt};
Expand Down
7 changes: 5 additions & 2 deletions crates/payload/primitives/src/traits.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
use crate::{PayloadBuilderError, PayloadEvents, PayloadKind, PayloadTypes};
use alloy_eips::{eip4895::Withdrawal, eip7685::Requests};
use alloy_eips::{
eip4895::{Withdrawal, Withdrawals},
eip7685::Requests,
};
use alloy_primitives::{Address, B256, U256};
use alloy_rpc_types_engine::{PayloadAttributes as EthPayloadAttributes, PayloadId};
use reth_chain_state::ExecutedBlock;
use reth_primitives::{SealedBlock, Withdrawals};
use reth_primitives::SealedBlock;
use tokio::sync::oneshot;

/// A type that can request, subscribe to and resolve payloads.
Expand Down
2 changes: 1 addition & 1 deletion crates/primitives-traits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub mod block;
pub use block::{body::BlockBody, Block, FullBlock};

mod withdrawal;
pub use withdrawal::{Withdrawal, Withdrawals};
pub use withdrawal::Withdrawal;

mod error;
pub use error::{GotExpected, GotExpectedBoxed};
Expand Down
3 changes: 0 additions & 3 deletions crates/primitives-traits/src/withdrawal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
#[doc(inline)]
pub use alloy_eips::eip4895::Withdrawal;

/// Represents a collection of Withdrawals.
pub type Withdrawals = alloy_eips::eip4895::Withdrawals;

#[cfg(test)]
mod tests {
use super::*;
Expand Down
9 changes: 4 additions & 5 deletions crates/primitives/src/block.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use crate::{
GotExpected, Header, SealedHeader, TransactionSigned, TransactionSignedEcRecovered, Withdrawals,
};
use crate::{GotExpected, Header, SealedHeader, TransactionSigned, TransactionSignedEcRecovered};
use alloc::vec::Vec;
use alloy_eips::eip2718::Encodable2718;
use alloy_eips::{eip2718::Encodable2718, eip4895::Withdrawals};
use alloy_primitives::{Address, Bytes, Sealable, B256};
use alloy_rlp::{Decodable, Encodable, RlpDecodable, RlpEncodable};
use derive_more::{Deref, DerefMut};
Expand Down Expand Up @@ -655,8 +653,9 @@ impl<'a> arbitrary::Arbitrary<'a> for BlockBody {
pub(super) mod serde_bincode_compat {
use alloc::{borrow::Cow, vec::Vec};
use alloy_consensus::serde_bincode_compat::Header;
use alloy_eips::eip4895::Withdrawals;
use alloy_primitives::Address;
use reth_primitives_traits::{serde_bincode_compat::SealedHeader, Withdrawals};
use reth_primitives_traits::serde_bincode_compat::SealedHeader;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde_with::{DeserializeAs, SerializeAs};

Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub use receipt::{
};
pub use reth_primitives_traits::{
logs_bloom, Account, Bytecode, GotExpected, GotExpectedBoxed, Header, HeaderError, Log,
LogData, SealedHeader, StorageEntry, Withdrawals,
LogData, SealedHeader, StorageEntry,
};
pub use static_file::StaticFileSegment;

Expand Down
3 changes: 2 additions & 1 deletion crates/rpc/rpc-engine-api/tests/it/payload.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
//! Some payload tests
use alloy_eips::eip4895::Withdrawals;
use alloy_primitives::{Bytes, Sealable, U256};
use alloy_rlp::{Decodable, Error as RlpError};
use alloy_rpc_types_engine::{
ExecutionPayload, ExecutionPayloadBodyV1, ExecutionPayloadSidecar, ExecutionPayloadV1,
PayloadError,
};
use assert_matches::assert_matches;
use reth_primitives::{proofs, Block, SealedBlock, SealedHeader, TransactionSigned, Withdrawals};
use reth_primitives::{proofs, Block, SealedBlock, SealedHeader, TransactionSigned};
use reth_rpc_types_compat::engine::payload::{
block_to_payload, block_to_payload_v1, convert_to_payload_body_v1, try_into_sealed_block,
try_payload_v1_to_block,
Expand Down
6 changes: 3 additions & 3 deletions crates/rpc/rpc-types-compat/src/block.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//! Compatibility functions for rpc `Block` type.
use crate::{transaction::from_recovered_with_block_context, TransactionCompat};
use alloy_consensus::Sealed;
use alloy_eips::eip4895::Withdrawals;
use alloy_primitives::{B256, U256};
use alloy_rlp::Encodable;
use alloy_rpc_types_eth::{
Block, BlockError, BlockTransactions, BlockTransactionsKind, Header, TransactionInfo,
};
use reth_primitives::{Block as PrimitiveBlock, BlockWithSenders, Withdrawals};

use crate::{transaction::from_recovered_with_block_context, TransactionCompat};
use reth_primitives::{Block as PrimitiveBlock, BlockWithSenders};

/// Converts the given primitive block into a [`Block`] response with the given
/// [`BlockTransactionsKind`]
Expand Down
3 changes: 2 additions & 1 deletion crates/rpc/rpc-types-compat/src/engine/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use alloy_consensus::{constants::MAXIMUM_EXTRA_DATA_SIZE, EMPTY_OMMER_ROOT_HASH};
use alloy_eips::{
eip2718::{Decodable2718, Encodable2718},
eip4895::Withdrawals,
eip7685::Requests,
};
use alloy_primitives::{B256, U256};
Expand All @@ -14,7 +15,7 @@ use alloy_rpc_types_engine::{
};
use reth_primitives::{
proofs::{self},
Block, BlockBody, Header, SealedBlock, TransactionSigned, Withdrawals,
Block, BlockBody, Header, SealedBlock, TransactionSigned,
};

/// Converts [`ExecutionPayloadV1`] to [`Block`]
Expand Down
18 changes: 10 additions & 8 deletions crates/storage/db-models/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ reth-primitives-traits.workspace = true

# ethereum
alloy-primitives.workspace = true
alloy-eips.workspace = true

# codecs
modular-bitfield.workspace = true
Expand All @@ -42,14 +43,15 @@ test-fuzz.workspace = true

[features]
test-utils = [
"reth-primitives-traits/test-utils",
"arbitrary",
"reth-codecs/test-utils"
"reth-primitives-traits/test-utils",
"arbitrary",
"reth-codecs/test-utils",
]
arbitrary = [
"reth-primitives-traits/arbitrary",
"dep:arbitrary",
"dep:proptest",
"alloy-primitives/arbitrary",
"reth-codecs/arbitrary"
"reth-primitives-traits/arbitrary",
"dep:arbitrary",
"dep:proptest",
"alloy-primitives/arbitrary",
"alloy-eips/arbitrary",
"reth-codecs/arbitrary",
]
2 changes: 1 addition & 1 deletion crates/storage/db-models/src/blocks.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::ops::Range;

use alloy_eips::eip4895::Withdrawals;
use alloy_primitives::TxNumber;
use reth_codecs::{add_arbitrary_tests, Compact};
use reth_primitives_traits::Withdrawals;
use serde::{Deserialize, Serialize};

/// Total number of transactions.
Expand Down
12 changes: 6 additions & 6 deletions crates/storage/provider/src/providers/blockchain_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ use crate::{
StageCheckpointReader, StateProviderBox, StateProviderFactory, StateReader,
StaticFileProviderFactory, TransactionVariant, TransactionsProvider, WithdrawalsProvider,
};
use alloy_eips::{eip4895::Withdrawal, BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag};
use alloy_eips::{
eip4895::{Withdrawal, Withdrawals},
BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag,
};
use alloy_primitives::{Address, BlockHash, BlockNumber, Sealable, TxHash, TxNumber, B256, U256};
use alloy_rpc_types_engine::ForkchoiceState;
use reth_chain_state::{
Expand All @@ -25,7 +28,6 @@ use reth_node_types::NodeTypesWithDB;
use reth_primitives::{
Account, Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders,
SealedHeader, StorageEntry, TransactionMeta, TransactionSigned, TransactionSignedNoHash,
Withdrawals,
};
use reth_prune_types::{PruneCheckpoint, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId};
Expand Down Expand Up @@ -768,7 +770,7 @@ mod tests {
BlockWriter, CanonChainTracker, ProviderFactory, StaticFileProviderFactory,
StaticFileWriter,
};
use alloy_eips::{BlockHashOrNumber, BlockNumHash, BlockNumberOrTag};
use alloy_eips::{eip4895::Withdrawals, BlockHashOrNumber, BlockNumHash, BlockNumberOrTag};
use alloy_primitives::{BlockNumber, TxNumber, B256};
use itertools::Itertools;
use rand::Rng;
Expand All @@ -786,9 +788,7 @@ mod tests {
use reth_db_api::{cursor::DbCursorRO, transaction::DbTx};
use reth_errors::ProviderError;
use reth_execution_types::{Chain, ExecutionOutcome};
use reth_primitives::{
Receipt, SealedBlock, StaticFileSegment, TransactionSignedNoHash, Withdrawals,
};
use reth_primitives::{Receipt, SealedBlock, StaticFileSegment, TransactionSignedNoHash};
use reth_storage_api::{
BlockHashReader, BlockIdReader, BlockNumReader, BlockReader, BlockReaderIdExt, BlockSource,
ChangeSetReader, DatabaseProviderFactory, HeaderProvider, ReceiptProvider,
Expand Down
4 changes: 2 additions & 2 deletions crates/storage/provider/src/providers/consistent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ use crate::{
TransactionsProvider, WithdrawalsProvider,
};
use alloy_eips::{
eip4895::Withdrawal, BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag, HashOrNumber,
eip4895::{Withdrawal, Withdrawals},
BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag, HashOrNumber,
};
use alloy_primitives::{Address, BlockHash, BlockNumber, Sealable, TxHash, TxNumber, B256, U256};
use reth_chain_state::{BlockState, CanonicalInMemoryState, MemoryOverlayStateProviderRef};
Expand All @@ -19,7 +20,6 @@ use reth_execution_types::{BundleStateInit, ExecutionOutcome, RevertsInit};
use reth_primitives::{
Account, Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders,
SealedHeader, StorageEntry, TransactionMeta, TransactionSigned, TransactionSignedNoHash,
Withdrawals,
};
use reth_prune_types::{PruneCheckpoint, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId};
Expand Down
7 changes: 5 additions & 2 deletions crates/storage/provider/src/providers/database/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ use crate::{
PruneCheckpointReader, StageCheckpointReader, StateProviderBox, StaticFileProviderFactory,
TransactionVariant, TransactionsProvider, WithdrawalsProvider,
};
use alloy_eips::{eip4895::Withdrawal, BlockHashOrNumber};
use alloy_eips::{
eip4895::{Withdrawal, Withdrawals},
BlockHashOrNumber,
};
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
use core::fmt;
use reth_chainspec::{ChainInfo, EthereumHardforks};
Expand All @@ -18,7 +21,7 @@ use reth_evm::ConfigureEvmEnv;
use reth_node_types::NodeTypesWithDB;
use reth_primitives::{
Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader,
StaticFileSegment, TransactionMeta, TransactionSigned, TransactionSignedNoHash, Withdrawals,
StaticFileSegment, TransactionMeta, TransactionSigned, TransactionSignedNoHash,
};
use reth_prune_types::{PruneCheckpoint, PruneModes, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId};
Expand Down
6 changes: 4 additions & 2 deletions crates/storage/provider/src/providers/database/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ use crate::{
StaticFileProviderFactory, StatsReader, StorageReader, StorageTrieWriter, TransactionVariant,
TransactionsProvider, TransactionsProviderExt, TrieWriter, WithdrawalsProvider,
};
use alloy_eips::{eip4895::Withdrawal, BlockHashOrNumber};
use alloy_eips::{
eip4895::{Withdrawal, Withdrawals},
BlockHashOrNumber,
};
use alloy_primitives::{keccak256, Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
use itertools::{izip, Itertools};
use rayon::slice::ParallelSliceMut;
Expand All @@ -42,7 +45,6 @@ use reth_primitives::{
Account, Block, BlockBody, BlockWithSenders, Bytecode, GotExpected, Header, Receipt,
SealedBlock, SealedBlockWithSenders, SealedHeader, StaticFileSegment, StorageEntry,
TransactionMeta, TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash,
Withdrawals,
};
use reth_prune_types::{PruneCheckpoint, PruneModes, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId};
Expand Down
Loading

0 comments on commit 59ebeba

Please sign in to comment.