Skip to content

Commit afdffad

Browse files
authored
chore: use alloy TransactionMeta (#13632)
1 parent 5b050fe commit afdffad

File tree

22 files changed

+40
-64
lines changed

22 files changed

+40
-64
lines changed

crates/chain-state/src/in_memory.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::{
44
CanonStateNotification, CanonStateNotificationSender, CanonStateNotifications,
55
ChainInfoTracker, MemoryOverlayStateProvider,
66
};
7-
use alloy_consensus::BlockHeader;
7+
use alloy_consensus::{transaction::TransactionMeta, BlockHeader};
88
use alloy_eips::{eip2718::Encodable2718, BlockHashOrNumber, BlockNumHash};
99
use alloy_primitives::{map::HashMap, Address, TxHash, B256};
1010
use parking_lot::RwLock;
@@ -13,7 +13,7 @@ use reth_execution_types::{Chain, ExecutionOutcome};
1313
use reth_metrics::{metrics::Gauge, Metrics};
1414
use reth_primitives::{
1515
BlockWithSenders, EthPrimitives, NodePrimitives, Receipts, SealedBlock, SealedBlockFor,
16-
SealedBlockWithSenders, SealedHeader, TransactionMeta,
16+
SealedBlockWithSenders, SealedHeader,
1717
};
1818
use reth_primitives_traits::{Block, BlockBody as _, SignedTransaction};
1919
use reth_storage_api::StateProviderBox;

crates/optimism/rpc/src/eth/block.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
//! Loads and formats OP block RPC response.
22
3-
use alloy_consensus::BlockHeader;
3+
use alloy_consensus::{transaction::TransactionMeta, BlockHeader};
44
use alloy_rpc_types_eth::BlockId;
55
use op_alloy_network::Network;
66
use op_alloy_rpc_types::OpTransactionReceipt;
77
use reth_chainspec::ChainSpecProvider;
88
use reth_node_api::BlockBody;
99
use reth_optimism_chainspec::OpChainSpec;
1010
use reth_optimism_primitives::{OpReceipt, OpTransactionSigned};
11-
use reth_primitives::TransactionMeta;
1211
use reth_primitives_traits::SignedTransaction;
1312
use reth_provider::{BlockReader, HeaderProvider};
1413
use reth_rpc_eth_api::{

crates/optimism/rpc/src/eth/receipt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! Loads and formats OP receipt RPC response.
22
3+
use alloy_consensus::transaction::TransactionMeta;
34
use alloy_eips::eip2718::Encodable2718;
45
use alloy_rpc_types_eth::{Log, TransactionReceipt};
56
use op_alloy_consensus::{OpDepositReceipt, OpDepositReceiptWithBloom, OpReceiptEnvelope};
@@ -9,7 +10,6 @@ use reth_optimism_chainspec::OpChainSpec;
910
use reth_optimism_evm::RethL1BlockInfo;
1011
use reth_optimism_forks::OpHardforks;
1112
use reth_optimism_primitives::{OpReceipt, OpTransactionSigned};
12-
use reth_primitives::TransactionMeta;
1313
use reth_provider::{ChainSpecProvider, ReceiptProvider, TransactionsProvider};
1414
use reth_rpc_eth_api::{helpers::LoadReceipt, FromEthApiError, RpcReceipt};
1515
use reth_rpc_eth_types::{receipt::build_receipt, EthApiError};

crates/primitives-traits/src/transaction/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ pub mod signed;
66

77
pub mod error;
88

9+
pub use alloy_consensus::transaction::{TransactionInfo, TransactionMeta};
10+
911
use crate::{InMemorySize, MaybeCompact, MaybeSerde};
1012
use core::{fmt, hash::Hash};
1113

crates/primitives/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,14 @@ pub use reth_primitives_traits::{
4343
};
4444
pub use static_file::StaticFileSegment;
4545

46-
pub use alloy_consensus::{transaction::PooledTransaction, ReceiptWithBloom};
46+
pub use alloy_consensus::{
47+
transaction::{PooledTransaction, TransactionMeta},
48+
ReceiptWithBloom,
49+
};
4750
pub use transaction::{
4851
util::secp256k1::{public_key_to_address, recover_signer_unchecked, sign_message},
4952
InvalidTransactionError, PooledTransactionsElementEcRecovered, RecoveredTx, Transaction,
50-
TransactionMeta, TransactionSigned, TransactionSignedEcRecovered, TxType,
53+
TransactionSigned, TransactionSignedEcRecovered, TxType,
5154
};
5255

5356
// Re-exports

crates/primitives/src/transaction/meta.rs

Lines changed: 0 additions & 20 deletions
This file was deleted.

crates/primitives/src/transaction/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use alloy_primitives::{
1919
use alloy_rlp::{Decodable, Encodable, Error as RlpError, Header};
2020
use core::hash::{Hash, Hasher};
2121
use derive_more::{AsRef, Deref};
22-
pub use meta::TransactionMeta;
2322
use once_cell as _;
2423
#[cfg(not(feature = "std"))]
2524
use once_cell::sync::{Lazy as LazyLock, OnceCell as OnceLock};
@@ -49,7 +48,6 @@ pub mod signature;
4948
pub mod util;
5049

5150
pub(crate) mod access_list;
52-
mod meta;
5351
mod pooled;
5452
mod tx_type;
5553

crates/rpc/rpc-eth-api/src/helpers/receipt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! Loads a receipt from database. Helper trait for `eth_` block and transaction RPC methods, that
22
//! loads receipt data w.r.t. network.
33
4+
use alloy_consensus::transaction::TransactionMeta;
45
use futures::Future;
5-
use reth_primitives::TransactionMeta;
66
use reth_provider::{ProviderReceipt, ProviderTx, ReceiptProvider, TransactionsProvider};
77

88
use crate::{EthApiTypes, RpcNodeCoreExt, RpcReceipt};

crates/rpc/rpc-eth-api/src/helpers/transaction.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
//! Database access for `eth_` transaction RPC methods. Loads transaction and receipt data w.r.t.
22
//! network.
33
4-
use alloy_consensus::{BlockHeader, Transaction};
4+
use super::{EthApiSpec, EthSigner, LoadBlock, LoadReceipt, LoadState, SpawnBlocking};
5+
use crate::{
6+
helpers::estimate::EstimateCall, FromEthApiError, FullEthApiTypes, IntoEthApiError,
7+
RpcNodeCore, RpcNodeCoreExt, RpcReceipt, RpcTransaction,
8+
};
9+
use alloy_consensus::{transaction::TransactionMeta, BlockHeader, Transaction};
510
use alloy_dyn_abi::TypedData;
611
use alloy_eips::{eip2718::Encodable2718, BlockId};
712
use alloy_network::TransactionBuilder;
813
use alloy_primitives::{Address, Bytes, TxHash, B256};
914
use alloy_rpc_types_eth::{transaction::TransactionRequest, BlockNumberOrTag, TransactionInfo};
1015
use futures::Future;
1116
use reth_node_api::BlockBody;
12-
use reth_primitives::{
13-
transaction::SignedTransactionIntoRecoveredExt, SealedBlockWithSenders, TransactionMeta,
14-
};
17+
use reth_primitives::{transaction::SignedTransactionIntoRecoveredExt, SealedBlockWithSenders};
1518
use reth_primitives_traits::SignedTransaction;
1619
use reth_provider::{
1720
BlockNumReader, BlockReaderIdExt, ProviderBlock, ProviderReceipt, ProviderTx, ReceiptProvider,
@@ -22,12 +25,6 @@ use reth_rpc_types_compat::transaction::{from_recovered, from_recovered_with_blo
2225
use reth_transaction_pool::{PoolTransaction, TransactionOrigin, TransactionPool};
2326
use std::sync::Arc;
2427

25-
use super::{EthApiSpec, EthSigner, LoadBlock, LoadReceipt, LoadState, SpawnBlocking};
26-
use crate::{
27-
helpers::estimate::EstimateCall, FromEthApiError, FullEthApiTypes, IntoEthApiError,
28-
RpcNodeCore, RpcNodeCoreExt, RpcReceipt, RpcTransaction,
29-
};
30-
3128
/// Transaction related functions for the [`EthApiServer`](crate::EthApiServer) trait in
3229
/// the `eth_` namespace.
3330
///

crates/rpc/rpc-eth-types/src/receipt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
//! RPC receipt response builder, extends a layer one receipt with layer two data.
22
33
use super::{EthApiError, EthResult};
4-
use alloy_consensus::{ReceiptEnvelope, TxReceipt};
4+
use alloy_consensus::{transaction::TransactionMeta, ReceiptEnvelope, TxReceipt};
55
use alloy_primitives::{Address, TxKind};
66
use alloy_rpc_types_eth::{Log, ReceiptWithBloom, TransactionReceipt};
7-
use reth_primitives::{Receipt, TransactionMeta, TransactionSigned, TxType};
7+
use reth_primitives::{Receipt, TransactionSigned, TxType};
88
use reth_primitives_traits::SignedTransaction;
99

1010
/// Builds an [`TransactionReceipt`] obtaining the inner receipt envelope from the given closure.

crates/rpc/rpc/src/eth/helpers/block.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
//! Contains RPC handler implementations specific to blocks.
22
3-
use alloy_consensus::BlockHeader;
3+
use alloy_consensus::{transaction::TransactionMeta, BlockHeader};
44
use alloy_rpc_types_eth::{BlockId, TransactionReceipt};
5-
use reth_primitives::TransactionMeta;
65
use reth_primitives_traits::{BlockBody, SignedTransaction};
76
use reth_provider::BlockReader;
87
use reth_rpc_eth_api::{

crates/rpc/rpc/src/eth/helpers/receipt.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Builds an RPC receipt response w.r.t. data layout of network.
22
3-
use reth_primitives::{Receipt, TransactionMeta, TransactionSigned};
3+
use alloy_consensus::transaction::TransactionMeta;
4+
use reth_primitives::{Receipt, TransactionSigned};
45
use reth_provider::{BlockReader, ReceiptProvider, TransactionsProvider};
56
use reth_rpc_eth_api::{helpers::LoadReceipt, FromEthApiError, RpcNodeCoreExt, RpcReceipt};
67
use reth_rpc_eth_types::{EthApiError, EthReceiptBuilder};

crates/storage/provider/src/providers/blockchain_provider.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::{
99
StageCheckpointReader, StateProviderBox, StateProviderFactory, StateReader,
1010
StaticFileProviderFactory, TransactionVariant, TransactionsProvider, WithdrawalsProvider,
1111
};
12-
use alloy_consensus::Header;
12+
use alloy_consensus::{transaction::TransactionMeta, Header};
1313
use alloy_eips::{
1414
eip4895::{Withdrawal, Withdrawals},
1515
BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag,
@@ -28,8 +28,7 @@ use reth_execution_types::ExecutionOutcome;
2828
use reth_node_types::{BlockTy, HeaderTy, NodeTypesWithDB, ReceiptTy, TxTy};
2929
use reth_primitives::{
3030
Account, Block, BlockWithSenders, EthPrimitives, NodePrimitives, Receipt, SealedBlock,
31-
SealedBlockFor, SealedBlockWithSenders, SealedHeader, StorageEntry, TransactionMeta,
32-
TransactionSigned,
31+
SealedBlockFor, SealedBlockWithSenders, SealedHeader, StorageEntry, TransactionSigned,
3332
};
3433
use reth_primitives_traits::BlockBody as _;
3534
use reth_prune_types::{PruneCheckpoint, PruneSegment};

crates/storage/provider/src/providers/consistent.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::{
66
StageCheckpointReader, StateReader, StaticFileProviderFactory, TransactionVariant,
77
TransactionsProvider, WithdrawalsProvider,
88
};
9-
use alloy_consensus::BlockHeader;
9+
use alloy_consensus::{transaction::TransactionMeta, BlockHeader};
1010
use alloy_eips::{
1111
eip2718::Encodable2718,
1212
eip4895::{Withdrawal, Withdrawals},
@@ -21,7 +21,6 @@ use reth_execution_types::{BundleStateInit, ExecutionOutcome, RevertsInit};
2121
use reth_node_types::{BlockTy, HeaderTy, ReceiptTy, TxTy};
2222
use reth_primitives::{
2323
Account, BlockWithSenders, SealedBlockFor, SealedBlockWithSenders, SealedHeader, StorageEntry,
24-
TransactionMeta,
2524
};
2625
use reth_primitives_traits::BlockBody;
2726
use reth_prune_types::{PruneCheckpoint, PruneSegment};

crates/storage/provider/src/providers/database/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use crate::{
77
PruneCheckpointReader, StageCheckpointReader, StateProviderBox, StaticFileProviderFactory,
88
TransactionVariant, TransactionsProvider, WithdrawalsProvider,
99
};
10+
use alloy_consensus::transaction::TransactionMeta;
1011
use alloy_eips::{
1112
eip4895::{Withdrawal, Withdrawals},
1213
BlockHashOrNumber,
@@ -20,7 +21,6 @@ use reth_errors::{RethError, RethResult};
2021
use reth_node_types::{BlockTy, HeaderTy, NodeTypesWithDB, ReceiptTy, TxTy};
2122
use reth_primitives::{
2223
BlockWithSenders, SealedBlockFor, SealedBlockWithSenders, SealedHeader, StaticFileSegment,
23-
TransactionMeta,
2424
};
2525
use reth_prune_types::{PruneCheckpoint, PruneModes, PruneSegment};
2626
use reth_stages_types::{StageCheckpoint, StageId};

crates/storage/provider/src/providers/database/provider.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::{
1919
StorageReader, StorageTrieWriter, TransactionVariant, TransactionsProvider,
2020
TransactionsProviderExt, TrieWriter, WithdrawalsProvider,
2121
};
22-
use alloy_consensus::{BlockHeader, Header};
22+
use alloy_consensus::{transaction::TransactionMeta, BlockHeader, Header};
2323
use alloy_eips::{
2424
eip2718::Encodable2718,
2525
eip4895::{Withdrawal, Withdrawals},
@@ -53,7 +53,6 @@ use reth_node_types::{BlockTy, BodyTy, HeaderTy, NodeTypes, ReceiptTy, TxTy};
5353
use reth_primitives::{
5454
Account, BlockExt, BlockWithSenders, Bytecode, GotExpected, NodePrimitives, SealedBlock,
5555
SealedBlockFor, SealedBlockWithSenders, SealedHeader, StaticFileSegment, StorageEntry,
56-
TransactionMeta,
5756
};
5857
use reth_primitives_traits::{Block as _, BlockBody as _, SignedTransaction};
5958
use reth_prune_types::{PruneCheckpoint, PruneModes, PruneSegment};

crates/storage/provider/src/providers/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::{
99
StageCheckpointReader, StateProviderBox, StateProviderFactory, StaticFileProviderFactory,
1010
TransactionVariant, TransactionsProvider, TreeViewer, WithdrawalsProvider,
1111
};
12-
use alloy_consensus::Header;
12+
use alloy_consensus::{transaction::TransactionMeta, Header};
1313
use alloy_eips::{
1414
eip4895::{Withdrawal, Withdrawals},
1515
BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag,
@@ -31,7 +31,7 @@ use reth_node_types::{
3131
};
3232
use reth_primitives::{
3333
Account, BlockWithSenders, EthPrimitives, Receipt, SealedBlock, SealedBlockFor,
34-
SealedBlockWithSenders, SealedHeader, TransactionMeta,
34+
SealedBlockWithSenders, SealedHeader,
3535
};
3636
use reth_prune_types::{PruneCheckpoint, PruneSegment};
3737
use reth_stages_types::{StageCheckpoint, StageId};

crates/storage/provider/src/providers/static_file/jar.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use crate::{
66
to_range, BlockHashReader, BlockNumReader, HeaderProvider, ReceiptProvider,
77
TransactionsProvider,
88
};
9+
use alloy_consensus::transaction::TransactionMeta;
910
use alloy_eips::{eip2718::Encodable2718, BlockHashOrNumber};
1011
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
1112
use reth_chainspec::ChainInfo;
@@ -17,7 +18,7 @@ use reth_db::{
1718
table::{Decompress, Value},
1819
};
1920
use reth_node_types::NodePrimitives;
20-
use reth_primitives::{transaction::recover_signers, SealedHeader, TransactionMeta};
21+
use reth_primitives::{transaction::recover_signers, SealedHeader};
2122
use reth_primitives_traits::SignedTransaction;
2223
use reth_storage_errors::provider::{ProviderError, ProviderResult};
2324
use std::{

crates/storage/provider/src/providers/static_file/manager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::{
77
ReceiptProvider, StageCheckpointReader, StatsReader, TransactionVariant, TransactionsProvider,
88
TransactionsProviderExt, WithdrawalsProvider,
99
};
10-
use alloy_consensus::Header;
10+
use alloy_consensus::{transaction::TransactionMeta, Header};
1111
use alloy_eips::{
1212
eip2718::Encodable2718,
1313
eip4895::{Withdrawal, Withdrawals},
@@ -39,7 +39,7 @@ use reth_primitives::{
3939
},
4040
transaction::recover_signers,
4141
BlockWithSenders, Receipt, SealedBlockFor, SealedBlockWithSenders, SealedHeader,
42-
StaticFileSegment, TransactionMeta, TransactionSigned,
42+
StaticFileSegment, TransactionSigned,
4343
};
4444
use reth_primitives_traits::SignedTransaction;
4545
use reth_stages_types::{PipelineTarget, StageId};

crates/storage/provider/src/test_utils/mock.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::{
55
ReceiptProviderIdExt, StateProvider, StateProviderBox, StateProviderFactory, StateReader,
66
StateRootProvider, TransactionVariant, TransactionsProvider, WithdrawalsProvider,
77
};
8-
use alloy_consensus::{constants::EMPTY_ROOT_HASH, Header};
8+
use alloy_consensus::{constants::EMPTY_ROOT_HASH, transaction::TransactionMeta, Header};
99
use alloy_eips::{
1010
eip4895::{Withdrawal, Withdrawals},
1111
BlockHashOrNumber, BlockId, BlockNumberOrTag,
@@ -23,7 +23,7 @@ use reth_execution_types::ExecutionOutcome;
2323
use reth_node_types::NodeTypes;
2424
use reth_primitives::{
2525
Account, Block, BlockWithSenders, Bytecode, EthPrimitives, GotExpected, Receipt, SealedBlock,
26-
SealedBlockWithSenders, SealedHeader, TransactionMeta, TransactionSigned,
26+
SealedBlockWithSenders, SealedHeader, TransactionSigned,
2727
};
2828
use reth_primitives_traits::SignedTransaction;
2929
use reth_stages_types::{StageCheckpoint, StageId};

crates/storage/storage-api/src/noop.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use crate::{
88
StateProviderBox, StateProviderFactory, StateRootProvider, StorageRootProvider,
99
TransactionVariant, TransactionsProvider, WithdrawalsProvider,
1010
};
11+
use alloy_consensus::transaction::TransactionMeta;
1112
use alloy_eips::{
1213
eip4895::{Withdrawal, Withdrawals},
1314
BlockHashOrNumber, BlockId, BlockNumberOrTag,
@@ -18,9 +19,7 @@ use alloy_primitives::{
1819
};
1920
use reth_chainspec::{ChainInfo, ChainSpecProvider, EthChainSpec, MAINNET};
2021
use reth_db_models::{AccountBeforeTx, StoredBlockBodyIndices};
21-
use reth_primitives::{
22-
BlockWithSenders, EthPrimitives, SealedBlockFor, SealedBlockWithSenders, TransactionMeta,
23-
};
22+
use reth_primitives::{BlockWithSenders, EthPrimitives, SealedBlockFor, SealedBlockWithSenders};
2423
use reth_primitives_traits::{Account, Bytecode, NodePrimitives, SealedHeader};
2524
use reth_prune_types::{PruneCheckpoint, PruneSegment};
2625
use reth_stages_types::{StageCheckpoint, StageId};

crates/storage/storage-api/src/transactions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::{BlockNumReader, BlockReader};
2+
use alloy_consensus::transaction::TransactionMeta;
23
use alloy_eips::BlockHashOrNumber;
34
use alloy_primitives::{Address, BlockNumber, TxHash, TxNumber};
4-
use reth_primitives::TransactionMeta;
55
use reth_primitives_traits::SignedTransaction;
66
use reth_storage_errors::provider::{ProviderError, ProviderResult};
77
use std::ops::{Range, RangeBounds, RangeInclusive};

0 commit comments

Comments
 (0)