Skip to content

Commit

Permalink
chore: use alloy TransactionMeta (#13632)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Jan 3, 2025
1 parent 5b050fe commit afdffad
Show file tree
Hide file tree
Showing 22 changed files with 40 additions and 64 deletions.
4 changes: 2 additions & 2 deletions crates/chain-state/src/in_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
CanonStateNotification, CanonStateNotificationSender, CanonStateNotifications,
ChainInfoTracker, MemoryOverlayStateProvider,
};
use alloy_consensus::BlockHeader;
use alloy_consensus::{transaction::TransactionMeta, BlockHeader};
use alloy_eips::{eip2718::Encodable2718, BlockHashOrNumber, BlockNumHash};
use alloy_primitives::{map::HashMap, Address, TxHash, B256};
use parking_lot::RwLock;
Expand All @@ -13,7 +13,7 @@ use reth_execution_types::{Chain, ExecutionOutcome};
use reth_metrics::{metrics::Gauge, Metrics};
use reth_primitives::{
BlockWithSenders, EthPrimitives, NodePrimitives, Receipts, SealedBlock, SealedBlockFor,
SealedBlockWithSenders, SealedHeader, TransactionMeta,
SealedBlockWithSenders, SealedHeader,
};
use reth_primitives_traits::{Block, BlockBody as _, SignedTransaction};
use reth_storage_api::StateProviderBox;
Expand Down
3 changes: 1 addition & 2 deletions crates/optimism/rpc/src/eth/block.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
//! Loads and formats OP block RPC response.
use alloy_consensus::BlockHeader;
use alloy_consensus::{transaction::TransactionMeta, BlockHeader};
use alloy_rpc_types_eth::BlockId;
use op_alloy_network::Network;
use op_alloy_rpc_types::OpTransactionReceipt;
use reth_chainspec::ChainSpecProvider;
use reth_node_api::BlockBody;
use reth_optimism_chainspec::OpChainSpec;
use reth_optimism_primitives::{OpReceipt, OpTransactionSigned};
use reth_primitives::TransactionMeta;
use reth_primitives_traits::SignedTransaction;
use reth_provider::{BlockReader, HeaderProvider};
use reth_rpc_eth_api::{
Expand Down
2 changes: 1 addition & 1 deletion crates/optimism/rpc/src/eth/receipt.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Loads and formats OP receipt RPC response.
use alloy_consensus::transaction::TransactionMeta;
use alloy_eips::eip2718::Encodable2718;
use alloy_rpc_types_eth::{Log, TransactionReceipt};
use op_alloy_consensus::{OpDepositReceipt, OpDepositReceiptWithBloom, OpReceiptEnvelope};
Expand All @@ -9,7 +10,6 @@ use reth_optimism_chainspec::OpChainSpec;
use reth_optimism_evm::RethL1BlockInfo;
use reth_optimism_forks::OpHardforks;
use reth_optimism_primitives::{OpReceipt, OpTransactionSigned};
use reth_primitives::TransactionMeta;
use reth_provider::{ChainSpecProvider, ReceiptProvider, TransactionsProvider};
use reth_rpc_eth_api::{helpers::LoadReceipt, FromEthApiError, RpcReceipt};
use reth_rpc_eth_types::{receipt::build_receipt, EthApiError};
Expand Down
2 changes: 2 additions & 0 deletions crates/primitives-traits/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ pub mod signed;

pub mod error;

pub use alloy_consensus::transaction::{TransactionInfo, TransactionMeta};

use crate::{InMemorySize, MaybeCompact, MaybeSerde};
use core::{fmt, hash::Hash};

Expand Down
7 changes: 5 additions & 2 deletions crates/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,14 @@ pub use reth_primitives_traits::{
};
pub use static_file::StaticFileSegment;

pub use alloy_consensus::{transaction::PooledTransaction, ReceiptWithBloom};
pub use alloy_consensus::{
transaction::{PooledTransaction, TransactionMeta},
ReceiptWithBloom,
};
pub use transaction::{
util::secp256k1::{public_key_to_address, recover_signer_unchecked, sign_message},
InvalidTransactionError, PooledTransactionsElementEcRecovered, RecoveredTx, Transaction,
TransactionMeta, TransactionSigned, TransactionSignedEcRecovered, TxType,
TransactionSigned, TransactionSignedEcRecovered, TxType,
};

// Re-exports
Expand Down
20 changes: 0 additions & 20 deletions crates/primitives/src/transaction/meta.rs

This file was deleted.

2 changes: 0 additions & 2 deletions crates/primitives/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use alloy_primitives::{
use alloy_rlp::{Decodable, Encodable, Error as RlpError, Header};
use core::hash::{Hash, Hasher};
use derive_more::{AsRef, Deref};
pub use meta::TransactionMeta;
use once_cell as _;
#[cfg(not(feature = "std"))]
use once_cell::sync::{Lazy as LazyLock, OnceCell as OnceLock};
Expand Down Expand Up @@ -49,7 +48,6 @@ pub mod signature;
pub mod util;

pub(crate) mod access_list;
mod meta;
mod pooled;
mod tx_type;

Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-eth-api/src/helpers/receipt.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Loads a receipt from database. Helper trait for `eth_` block and transaction RPC methods, that
//! loads receipt data w.r.t. network.
use alloy_consensus::transaction::TransactionMeta;
use futures::Future;
use reth_primitives::TransactionMeta;
use reth_provider::{ProviderReceipt, ProviderTx, ReceiptProvider, TransactionsProvider};

use crate::{EthApiTypes, RpcNodeCoreExt, RpcReceipt};
Expand Down
17 changes: 7 additions & 10 deletions crates/rpc/rpc-eth-api/src/helpers/transaction.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
//! Database access for `eth_` transaction RPC methods. Loads transaction and receipt data w.r.t.
//! network.
use alloy_consensus::{BlockHeader, Transaction};
use super::{EthApiSpec, EthSigner, LoadBlock, LoadReceipt, LoadState, SpawnBlocking};
use crate::{
helpers::estimate::EstimateCall, FromEthApiError, FullEthApiTypes, IntoEthApiError,
RpcNodeCore, RpcNodeCoreExt, RpcReceipt, RpcTransaction,
};
use alloy_consensus::{transaction::TransactionMeta, BlockHeader, Transaction};
use alloy_dyn_abi::TypedData;
use alloy_eips::{eip2718::Encodable2718, BlockId};
use alloy_network::TransactionBuilder;
use alloy_primitives::{Address, Bytes, TxHash, B256};
use alloy_rpc_types_eth::{transaction::TransactionRequest, BlockNumberOrTag, TransactionInfo};
use futures::Future;
use reth_node_api::BlockBody;
use reth_primitives::{
transaction::SignedTransactionIntoRecoveredExt, SealedBlockWithSenders, TransactionMeta,
};
use reth_primitives::{transaction::SignedTransactionIntoRecoveredExt, SealedBlockWithSenders};
use reth_primitives_traits::SignedTransaction;
use reth_provider::{
BlockNumReader, BlockReaderIdExt, ProviderBlock, ProviderReceipt, ProviderTx, ReceiptProvider,
Expand All @@ -22,12 +25,6 @@ use reth_rpc_types_compat::transaction::{from_recovered, from_recovered_with_blo
use reth_transaction_pool::{PoolTransaction, TransactionOrigin, TransactionPool};
use std::sync::Arc;

use super::{EthApiSpec, EthSigner, LoadBlock, LoadReceipt, LoadState, SpawnBlocking};
use crate::{
helpers::estimate::EstimateCall, FromEthApiError, FullEthApiTypes, IntoEthApiError,
RpcNodeCore, RpcNodeCoreExt, RpcReceipt, RpcTransaction,
};

/// Transaction related functions for the [`EthApiServer`](crate::EthApiServer) trait in
/// the `eth_` namespace.
///
Expand Down
4 changes: 2 additions & 2 deletions crates/rpc/rpc-eth-types/src/receipt.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//! RPC receipt response builder, extends a layer one receipt with layer two data.
use super::{EthApiError, EthResult};
use alloy_consensus::{ReceiptEnvelope, TxReceipt};
use alloy_consensus::{transaction::TransactionMeta, ReceiptEnvelope, TxReceipt};
use alloy_primitives::{Address, TxKind};
use alloy_rpc_types_eth::{Log, ReceiptWithBloom, TransactionReceipt};
use reth_primitives::{Receipt, TransactionMeta, TransactionSigned, TxType};
use reth_primitives::{Receipt, TransactionSigned, TxType};
use reth_primitives_traits::SignedTransaction;

/// Builds an [`TransactionReceipt`] obtaining the inner receipt envelope from the given closure.
Expand Down
3 changes: 1 addition & 2 deletions crates/rpc/rpc/src/eth/helpers/block.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
//! Contains RPC handler implementations specific to blocks.
use alloy_consensus::BlockHeader;
use alloy_consensus::{transaction::TransactionMeta, BlockHeader};
use alloy_rpc_types_eth::{BlockId, TransactionReceipt};
use reth_primitives::TransactionMeta;
use reth_primitives_traits::{BlockBody, SignedTransaction};
use reth_provider::BlockReader;
use reth_rpc_eth_api::{
Expand Down
3 changes: 2 additions & 1 deletion crates/rpc/rpc/src/eth/helpers/receipt.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Builds an RPC receipt response w.r.t. data layout of network.
use reth_primitives::{Receipt, TransactionMeta, TransactionSigned};
use alloy_consensus::transaction::TransactionMeta;
use reth_primitives::{Receipt, TransactionSigned};
use reth_provider::{BlockReader, ReceiptProvider, TransactionsProvider};
use reth_rpc_eth_api::{helpers::LoadReceipt, FromEthApiError, RpcNodeCoreExt, RpcReceipt};
use reth_rpc_eth_types::{EthApiError, EthReceiptBuilder};
Expand Down
5 changes: 2 additions & 3 deletions crates/storage/provider/src/providers/blockchain_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
StageCheckpointReader, StateProviderBox, StateProviderFactory, StateReader,
StaticFileProviderFactory, TransactionVariant, TransactionsProvider, WithdrawalsProvider,
};
use alloy_consensus::Header;
use alloy_consensus::{transaction::TransactionMeta, Header};
use alloy_eips::{
eip4895::{Withdrawal, Withdrawals},
BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag,
Expand All @@ -28,8 +28,7 @@ use reth_execution_types::ExecutionOutcome;
use reth_node_types::{BlockTy, HeaderTy, NodeTypesWithDB, ReceiptTy, TxTy};
use reth_primitives::{
Account, Block, BlockWithSenders, EthPrimitives, NodePrimitives, Receipt, SealedBlock,
SealedBlockFor, SealedBlockWithSenders, SealedHeader, StorageEntry, TransactionMeta,
TransactionSigned,
SealedBlockFor, SealedBlockWithSenders, SealedHeader, StorageEntry, TransactionSigned,
};
use reth_primitives_traits::BlockBody as _;
use reth_prune_types::{PruneCheckpoint, PruneSegment};
Expand Down
3 changes: 1 addition & 2 deletions crates/storage/provider/src/providers/consistent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
StageCheckpointReader, StateReader, StaticFileProviderFactory, TransactionVariant,
TransactionsProvider, WithdrawalsProvider,
};
use alloy_consensus::BlockHeader;
use alloy_consensus::{transaction::TransactionMeta, BlockHeader};
use alloy_eips::{
eip2718::Encodable2718,
eip4895::{Withdrawal, Withdrawals},
Expand All @@ -21,7 +21,6 @@ use reth_execution_types::{BundleStateInit, ExecutionOutcome, RevertsInit};
use reth_node_types::{BlockTy, HeaderTy, ReceiptTy, TxTy};
use reth_primitives::{
Account, BlockWithSenders, SealedBlockFor, SealedBlockWithSenders, SealedHeader, StorageEntry,
TransactionMeta,
};
use reth_primitives_traits::BlockBody;
use reth_prune_types::{PruneCheckpoint, PruneSegment};
Expand Down
2 changes: 1 addition & 1 deletion crates/storage/provider/src/providers/database/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::{
PruneCheckpointReader, StageCheckpointReader, StateProviderBox, StaticFileProviderFactory,
TransactionVariant, TransactionsProvider, WithdrawalsProvider,
};
use alloy_consensus::transaction::TransactionMeta;
use alloy_eips::{
eip4895::{Withdrawal, Withdrawals},
BlockHashOrNumber,
Expand All @@ -20,7 +21,6 @@ use reth_errors::{RethError, RethResult};
use reth_node_types::{BlockTy, HeaderTy, NodeTypesWithDB, ReceiptTy, TxTy};
use reth_primitives::{
BlockWithSenders, SealedBlockFor, SealedBlockWithSenders, SealedHeader, StaticFileSegment,
TransactionMeta,
};
use reth_prune_types::{PruneCheckpoint, PruneModes, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId};
Expand Down
3 changes: 1 addition & 2 deletions crates/storage/provider/src/providers/database/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::{
StorageReader, StorageTrieWriter, TransactionVariant, TransactionsProvider,
TransactionsProviderExt, TrieWriter, WithdrawalsProvider,
};
use alloy_consensus::{BlockHeader, Header};
use alloy_consensus::{transaction::TransactionMeta, BlockHeader, Header};
use alloy_eips::{
eip2718::Encodable2718,
eip4895::{Withdrawal, Withdrawals},
Expand Down Expand Up @@ -53,7 +53,6 @@ use reth_node_types::{BlockTy, BodyTy, HeaderTy, NodeTypes, ReceiptTy, TxTy};
use reth_primitives::{
Account, BlockExt, BlockWithSenders, Bytecode, GotExpected, NodePrimitives, SealedBlock,
SealedBlockFor, SealedBlockWithSenders, SealedHeader, StaticFileSegment, StorageEntry,
TransactionMeta,
};
use reth_primitives_traits::{Block as _, BlockBody as _, SignedTransaction};
use reth_prune_types::{PruneCheckpoint, PruneModes, PruneSegment};
Expand Down
4 changes: 2 additions & 2 deletions crates/storage/provider/src/providers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
StageCheckpointReader, StateProviderBox, StateProviderFactory, StaticFileProviderFactory,
TransactionVariant, TransactionsProvider, TreeViewer, WithdrawalsProvider,
};
use alloy_consensus::Header;
use alloy_consensus::{transaction::TransactionMeta, Header};
use alloy_eips::{
eip4895::{Withdrawal, Withdrawals},
BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag,
Expand All @@ -31,7 +31,7 @@ use reth_node_types::{
};
use reth_primitives::{
Account, BlockWithSenders, EthPrimitives, Receipt, SealedBlock, SealedBlockFor,
SealedBlockWithSenders, SealedHeader, TransactionMeta,
SealedBlockWithSenders, SealedHeader,
};
use reth_prune_types::{PruneCheckpoint, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId};
Expand Down
3 changes: 2 additions & 1 deletion crates/storage/provider/src/providers/static_file/jar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::{
to_range, BlockHashReader, BlockNumReader, HeaderProvider, ReceiptProvider,
TransactionsProvider,
};
use alloy_consensus::transaction::TransactionMeta;
use alloy_eips::{eip2718::Encodable2718, BlockHashOrNumber};
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
use reth_chainspec::ChainInfo;
Expand All @@ -17,7 +18,7 @@ use reth_db::{
table::{Decompress, Value},
};
use reth_node_types::NodePrimitives;
use reth_primitives::{transaction::recover_signers, SealedHeader, TransactionMeta};
use reth_primitives::{transaction::recover_signers, SealedHeader};
use reth_primitives_traits::SignedTransaction;
use reth_storage_errors::provider::{ProviderError, ProviderResult};
use std::{
Expand Down
4 changes: 2 additions & 2 deletions crates/storage/provider/src/providers/static_file/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
ReceiptProvider, StageCheckpointReader, StatsReader, TransactionVariant, TransactionsProvider,
TransactionsProviderExt, WithdrawalsProvider,
};
use alloy_consensus::Header;
use alloy_consensus::{transaction::TransactionMeta, Header};
use alloy_eips::{
eip2718::Encodable2718,
eip4895::{Withdrawal, Withdrawals},
Expand Down Expand Up @@ -39,7 +39,7 @@ use reth_primitives::{
},
transaction::recover_signers,
BlockWithSenders, Receipt, SealedBlockFor, SealedBlockWithSenders, SealedHeader,
StaticFileSegment, TransactionMeta, TransactionSigned,
StaticFileSegment, TransactionSigned,
};
use reth_primitives_traits::SignedTransaction;
use reth_stages_types::{PipelineTarget, StageId};
Expand Down
4 changes: 2 additions & 2 deletions crates/storage/provider/src/test_utils/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
ReceiptProviderIdExt, StateProvider, StateProviderBox, StateProviderFactory, StateReader,
StateRootProvider, TransactionVariant, TransactionsProvider, WithdrawalsProvider,
};
use alloy_consensus::{constants::EMPTY_ROOT_HASH, Header};
use alloy_consensus::{constants::EMPTY_ROOT_HASH, transaction::TransactionMeta, Header};
use alloy_eips::{
eip4895::{Withdrawal, Withdrawals},
BlockHashOrNumber, BlockId, BlockNumberOrTag,
Expand All @@ -23,7 +23,7 @@ use reth_execution_types::ExecutionOutcome;
use reth_node_types::NodeTypes;
use reth_primitives::{
Account, Block, BlockWithSenders, Bytecode, EthPrimitives, GotExpected, Receipt, SealedBlock,
SealedBlockWithSenders, SealedHeader, TransactionMeta, TransactionSigned,
SealedBlockWithSenders, SealedHeader, TransactionSigned,
};
use reth_primitives_traits::SignedTransaction;
use reth_stages_types::{StageCheckpoint, StageId};
Expand Down
5 changes: 2 additions & 3 deletions crates/storage/storage-api/src/noop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::{
StateProviderBox, StateProviderFactory, StateRootProvider, StorageRootProvider,
TransactionVariant, TransactionsProvider, WithdrawalsProvider,
};
use alloy_consensus::transaction::TransactionMeta;
use alloy_eips::{
eip4895::{Withdrawal, Withdrawals},
BlockHashOrNumber, BlockId, BlockNumberOrTag,
Expand All @@ -18,9 +19,7 @@ use alloy_primitives::{
};
use reth_chainspec::{ChainInfo, ChainSpecProvider, EthChainSpec, MAINNET};
use reth_db_models::{AccountBeforeTx, StoredBlockBodyIndices};
use reth_primitives::{
BlockWithSenders, EthPrimitives, SealedBlockFor, SealedBlockWithSenders, TransactionMeta,
};
use reth_primitives::{BlockWithSenders, EthPrimitives, SealedBlockFor, SealedBlockWithSenders};
use reth_primitives_traits::{Account, Bytecode, NodePrimitives, SealedHeader};
use reth_prune_types::{PruneCheckpoint, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId};
Expand Down
2 changes: 1 addition & 1 deletion crates/storage/storage-api/src/transactions.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{BlockNumReader, BlockReader};
use alloy_consensus::transaction::TransactionMeta;
use alloy_eips::BlockHashOrNumber;
use alloy_primitives::{Address, BlockNumber, TxHash, TxNumber};
use reth_primitives::TransactionMeta;
use reth_primitives_traits::SignedTransaction;
use reth_storage_errors::provider::{ProviderError, ProviderResult};
use std::ops::{Range, RangeBounds, RangeInclusive};
Expand Down

0 comments on commit afdffad

Please sign in to comment.