diff --git a/bin/reth/src/commands/debug_cmd/build_block.rs b/bin/reth/src/commands/debug_cmd/build_block.rs index 36559061d69f..edf85b3c5898 100644 --- a/bin/reth/src/commands/debug_cmd/build_block.rs +++ b/bin/reth/src/commands/debug_cmd/build_block.rs @@ -192,7 +192,7 @@ impl> Command { let pooled = transaction .clone() - .into_signed() + .into_tx() .try_into_pooled_eip4844(sidecar.clone()) .expect("should not fail to convert blob tx if it is already eip4844"); let encoded_length = pooled.encode_2718_len(); diff --git a/crates/blockchain-tree/src/blockchain_tree.rs b/crates/blockchain-tree/src/blockchain_tree.rs index af9d0199cf81..3964ea53b7e2 100644 --- a/crates/blockchain-tree/src/blockchain_tree.rs +++ b/crates/blockchain-tree/src/blockchain_tree.rs @@ -1592,8 +1592,7 @@ mod tests { body: Vec>, num_of_signer_txs: u64| -> SealedBlockWithSenders { - let signed_body = - body.clone().into_iter().map(|tx| tx.into_signed()).collect::>(); + let signed_body = body.clone().into_iter().map(|tx| tx.into_tx()).collect::>(); let transactions_root = calculate_transaction_root(&signed_body); let receipts = body .iter() diff --git a/crates/chain-state/src/test_utils.rs b/crates/chain-state/src/test_utils.rs index 58302608ebaa..2ce18ea6d74c 100644 --- a/crates/chain-state/src/test_utils.rs +++ b/crates/chain-state/src/test_utils.rs @@ -145,7 +145,7 @@ impl TestBlockBuilder { gas_limit: ETHEREUM_BLOCK_GAS_LIMIT, base_fee_per_gas: Some(INITIAL_BASE_FEE), transactions_root: calculate_transaction_root( - &transactions.clone().into_iter().map(|tx| tx.into_signed()).collect::>(), + &transactions.clone().into_iter().map(|tx| tx.into_tx()).collect::>(), ), receipts_root: calculate_receipt_root(&receipts), beneficiary: Address::random(), @@ -171,7 +171,7 @@ impl TestBlockBuilder { let block = SealedBlock::new( SealedHeader::seal(header), BlockBody { - transactions: transactions.into_iter().map(|tx| tx.into_signed()).collect(), + transactions: transactions.into_iter().map(|tx| tx.into_tx()).collect(), ommers: Vec::new(), withdrawals: Some(vec![].into()), }, diff --git a/crates/ethereum/payload/src/lib.rs b/crates/ethereum/payload/src/lib.rs index 144513856494..66ca1662b97e 100644 --- a/crates/ethereum/payload/src/lib.rs +++ b/crates/ethereum/payload/src/lib.rs @@ -285,7 +285,7 @@ where } // Configure the environment for the tx. - *evm.tx_mut() = evm_config.tx_env(tx.as_signed(), tx.signer()); + *evm.tx_mut() = evm_config.tx_env(tx.tx(), tx.signer()); let ResultAndState { result, state } = match evm.transact() { Ok(res) => res, @@ -354,7 +354,7 @@ where // append sender and transaction to the respective lists executed_senders.push(tx.signer()); - executed_txs.push(tx.into_signed()); + executed_txs.push(tx.into_tx()); } // check if we have a better block diff --git a/crates/net/network/benches/broadcast.rs b/crates/net/network/benches/broadcast.rs index 27a41278dbd7..bbbd00374968 100644 --- a/crates/net/network/benches/broadcast.rs +++ b/crates/net/network/benches/broadcast.rs @@ -64,7 +64,7 @@ pub fn broadcast_ingress_bench(c: &mut Criterion) { tx.sender(), ExtendedAccount::new(0, U256::from(100_000_000)), ); - txs.push(Arc::new(tx.transaction().clone().into_signed())); + txs.push(Arc::new(tx.transaction().clone().into_tx())); peer1.send_transactions(peer0_id, txs); } } diff --git a/crates/net/network/src/transactions/mod.rs b/crates/net/network/src/transactions/mod.rs index 67a033e70537..7c2a690877f0 100644 --- a/crates/net/network/src/transactions/mod.rs +++ b/crates/net/network/src/transactions/mod.rs @@ -1538,7 +1538,7 @@ impl PropagateTransaction { { let size = tx.encoded_length(); let transaction = tx.transaction.clone_into_consensus(); - let transaction = Arc::new(transaction.into_signed()); + let transaction = Arc::new(transaction.into_tx()); Self { size, transaction } } diff --git a/crates/net/network/tests/it/txgossip.rs b/crates/net/network/tests/it/txgossip.rs index c9911885ad87..f20ef6470833 100644 --- a/crates/net/network/tests/it/txgossip.rs +++ b/crates/net/network/tests/it/txgossip.rs @@ -80,7 +80,7 @@ async fn test_4844_tx_gossip_penalization() { } let signed_txs: Vec> = - txs.iter().map(|tx| Arc::new(tx.transaction().clone().into_signed())).collect(); + txs.iter().map(|tx| Arc::new(tx.transaction().clone().into_tx())).collect(); let network_handle = peer0.network(); diff --git a/crates/optimism/node/src/txpool.rs b/crates/optimism/node/src/txpool.rs index 9692e8cdb136..3283e278b3ef 100644 --- a/crates/optimism/node/src/txpool.rs +++ b/crates/optimism/node/src/txpool.rs @@ -58,7 +58,7 @@ impl TryFrom> for OpPooledTransaction { type Error = TransactionConversionError; fn try_from(value: RecoveredTx) -> Result { - let (tx, signer) = value.to_components(); + let (tx, signer) = value.into_parts(); let pooled: RecoveredTx = RecoveredTx::from_signed_transaction(tx.try_into()?, signer); Ok(pooled.into()) @@ -83,7 +83,7 @@ impl PoolTransaction for OpPooledTransaction { fn try_consensus_into_pooled( tx: RecoveredTx, ) -> Result, Self::TryFromConsensusError> { - let (tx, signer) = tx.to_components(); + let (tx, signer) = tx.into_parts(); Ok(RecoveredTx::from_signed_transaction(tx.try_into()?, signer)) } diff --git a/crates/optimism/payload/src/builder.rs b/crates/optimism/payload/src/builder.rs index 2a3f63880923..b87b01b37b2b 100644 --- a/crates/optimism/payload/src/builder.rs +++ b/crates/optimism/payload/src/builder.rs @@ -790,7 +790,7 @@ where )) })?; - *evm.tx_mut() = self.evm_config.tx_env(sequencer_tx.as_signed(), sequencer_tx.signer()); + *evm.tx_mut() = self.evm_config.tx_env(sequencer_tx.tx(), sequencer_tx.signer()); let ResultAndState { result, state } = match evm.transact() { Ok(res) => res, @@ -841,7 +841,7 @@ where // append sender and transaction to the respective lists info.executed_senders.push(sequencer_tx.signer()); - info.executed_transactions.push(sequencer_tx.into_signed()); + info.executed_transactions.push(sequencer_tx.into_tx()); } Ok(info) @@ -891,7 +891,7 @@ where } // Configure the environment for the tx. - *evm.tx_mut() = self.evm_config.tx_env(tx.as_signed(), tx.signer()); + *evm.tx_mut() = self.evm_config.tx_env(tx.tx(), tx.signer()); let ResultAndState { result, state } = match evm.transact() { Ok(res) => res, @@ -954,7 +954,7 @@ where // append sender and transaction to the respective lists info.executed_senders.push(tx.signer()); - info.executed_transactions.push(tx.into_signed()); + info.executed_transactions.push(tx.into_tx()); } Ok(None) diff --git a/crates/optimism/rpc/src/eth/transaction.rs b/crates/optimism/rpc/src/eth/transaction.rs index 05fbb0a95349..ba3b43d071f6 100644 --- a/crates/optimism/rpc/src/eth/transaction.rs +++ b/crates/optimism/rpc/src/eth/transaction.rs @@ -89,7 +89,7 @@ where ) -> Result { let from = tx.signer(); let hash = *tx.tx_hash(); - let OpTransactionSigned { transaction, signature, .. } = tx.into_signed(); + let OpTransactionSigned { transaction, signature, .. } = tx.into_tx(); let mut deposit_receipt_version = None; let mut deposit_nonce = None; diff --git a/crates/payload/util/src/transaction.rs b/crates/payload/util/src/transaction.rs index 71387946aef1..e6e41d7b1e9a 100644 --- a/crates/payload/util/src/transaction.rs +++ b/crates/payload/util/src/transaction.rs @@ -99,12 +99,12 @@ where fn next(&mut self, ctx: ()) -> Option> { while let Some(tx) = self.before.next(ctx) { if let Some(before_max_gas) = self.before_max_gas { - if self.before_gas + tx.as_signed().gas_limit() <= before_max_gas { - self.before_gas += tx.as_signed().gas_limit(); + if self.before_gas + tx.tx().gas_limit() <= before_max_gas { + self.before_gas += tx.tx().gas_limit(); return Some(tx); } - self.before.mark_invalid(tx.signer(), tx.as_signed().nonce()); - self.after.mark_invalid(tx.signer(), tx.as_signed().nonce()); + self.before.mark_invalid(tx.signer(), tx.tx().nonce()); + self.after.mark_invalid(tx.signer(), tx.tx().nonce()); } else { return Some(tx); } @@ -112,11 +112,11 @@ where while let Some(tx) = self.after.next(ctx) { if let Some(after_max_gas) = self.after_max_gas { - if self.after_gas + tx.as_signed().gas_limit() <= after_max_gas { - self.after_gas += tx.as_signed().gas_limit(); + if self.after_gas + tx.tx().gas_limit() <= after_max_gas { + self.after_gas += tx.tx().gas_limit(); return Some(tx); } - self.after.mark_invalid(tx.signer(), tx.as_signed().nonce()); + self.after.mark_invalid(tx.signer(), tx.tx().nonce()); } else { return Some(tx); } diff --git a/crates/primitives/src/transaction/mod.rs b/crates/primitives/src/transaction/mod.rs index e6e4d5f73ce7..a805c4c23804 100644 --- a/crates/primitives/src/transaction/mod.rs +++ b/crates/primitives/src/transaction/mod.rs @@ -1546,17 +1546,17 @@ impl RecoveredTx { } /// Returns a reference to [`TransactionSigned`] - pub const fn as_signed(&self) -> &T { + pub const fn tx(&self) -> &T { &self.signed_transaction } /// Transform back to [`TransactionSigned`] - pub fn into_signed(self) -> T { + pub fn into_tx(self) -> T { self.signed_transaction } /// Dissolve Self to its component - pub fn to_components(self) -> (T, Address) { + pub fn into_parts(self) -> (T, Address) { (self.signed_transaction, self.signer) } diff --git a/crates/primitives/src/transaction/pooled.rs b/crates/primitives/src/transaction/pooled.rs index a056562a645d..35013ba31d7d 100644 --- a/crates/primitives/src/transaction/pooled.rs +++ b/crates/primitives/src/transaction/pooled.rs @@ -12,7 +12,7 @@ pub type PooledTransactionsElementEcRecovered = Recovered impl PooledTransactionsElementEcRecovered { /// Transform back to [`RecoveredTx`] pub fn into_ecrecovered_transaction(self) -> RecoveredTx { - let (tx, signer) = self.to_components(); + let (tx, signer) = self.into_parts(); RecoveredTx::from_signed_transaction(tx.into(), signer) } diff --git a/crates/rpc/rpc-eth-api/src/helpers/call.rs b/crates/rpc/rpc-eth-api/src/helpers/call.rs index 1b20dd9d9fc2..2aecb500dd5e 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/call.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/call.rs @@ -682,7 +682,7 @@ pub trait Call: let env = EnvWithHandlerCfg::new_with_cfg_env( cfg_env_with_handler_cfg, block_env, - RpcNodeCore::evm_config(&this).tx_env(tx.as_signed(), tx.signer()), + RpcNodeCore::evm_config(&this).tx_env(tx.tx(), tx.signer()), ); let (res, _) = this.transact(&mut db, env)?; diff --git a/crates/rpc/rpc-eth-api/src/helpers/pending_block.rs b/crates/rpc/rpc-eth-api/src/helpers/pending_block.rs index 5f0512e3e76e..fd69422da68b 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/pending_block.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/pending_block.rs @@ -341,7 +341,7 @@ pub trait LoadPendingBlock: let env = Env::boxed( cfg.cfg_env.clone(), block_env.clone(), - Self::evm_config(self).tx_env(tx.as_signed(), tx.signer()), + Self::evm_config(self).tx_env(tx.tx(), tx.signer()), ); let mut evm = revm::Evm::builder().with_env(env).with_db(&mut db).build(); @@ -393,7 +393,7 @@ pub trait LoadPendingBlock: cumulative_gas_used += gas_used; // append transaction to the list of executed transactions - let (tx, sender) = tx.to_components(); + let (tx, sender) = tx.into_parts(); executed_txs.push(tx); senders.push(sender); results.push(result); diff --git a/crates/rpc/rpc-eth-api/src/helpers/trace.rs b/crates/rpc/rpc-eth-api/src/helpers/trace.rs index a5808b04ccbe..66c6b5a27a92 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/trace.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/trace.rs @@ -226,7 +226,7 @@ pub trait Trace: let env = EnvWithHandlerCfg::new_with_cfg_env( cfg_env_with_handler_cfg, block_env, - RpcNodeCore::evm_config(&this).tx_env(tx.as_signed(), tx.signer()), + RpcNodeCore::evm_config(&this).tx_env(tx.tx(), tx.signer()), ); let (res, _) = this.inspect(StateCacheDbRefMutWrapper(&mut db), env, &mut inspector)?; diff --git a/crates/rpc/rpc-types-compat/src/transaction.rs b/crates/rpc/rpc-types-compat/src/transaction.rs index b5515ce9e23d..065dfff04bf1 100644 --- a/crates/rpc/rpc-types-compat/src/transaction.rs +++ b/crates/rpc/rpc-types-compat/src/transaction.rs @@ -68,5 +68,5 @@ pub fn transaction_to_call_request( tx: RecoveredTx, ) -> TransactionRequest { let from = tx.signer(); - TransactionRequest::from_transaction_with_sender(tx.into_signed(), from) + TransactionRequest::from_transaction_with_sender(tx.into_tx(), from) } diff --git a/crates/rpc/rpc/src/debug.rs b/crates/rpc/rpc/src/debug.rs index 8421b371df0a..b88bac816f8b 100644 --- a/crates/rpc/rpc/src/debug.rs +++ b/crates/rpc/rpc/src/debug.rs @@ -273,7 +273,7 @@ where env: Env::boxed( cfg_env_with_handler_cfg.cfg_env.clone(), block_env, - this.eth_api().evm_config().tx_env(tx.as_signed(), tx.signer()), + this.eth_api().evm_config().tx_env(tx.tx(), tx.signer()), ), handler_cfg: cfg_env_with_handler_cfg.handler_cfg, }; diff --git a/crates/rpc/rpc/src/eth/helpers/types.rs b/crates/rpc/rpc/src/eth/helpers/types.rs index 82bb5877f755..48a6d0d8ab6c 100644 --- a/crates/rpc/rpc/src/eth/helpers/types.rs +++ b/crates/rpc/rpc/src/eth/helpers/types.rs @@ -44,7 +44,7 @@ where ) -> Result { let from = tx.signer(); let hash = tx.hash(); - let TransactionSigned { transaction, signature, .. } = tx.into_signed(); + let TransactionSigned { transaction, signature, .. } = tx.into_tx(); let inner: TxEnvelope = match transaction { reth_primitives::Transaction::Legacy(tx) => { diff --git a/crates/rpc/rpc/src/eth/sim_bundle.rs b/crates/rpc/rpc/src/eth/sim_bundle.rs index a9a6a17f50ee..de2597b64a3f 100644 --- a/crates/rpc/rpc/src/eth/sim_bundle.rs +++ b/crates/rpc/rpc/src/eth/sim_bundle.rs @@ -172,7 +172,7 @@ where match &body[idx] { BundleItem::Tx { tx, can_revert } => { let recovered_tx = recover_raw_transaction::>(tx)?; - let (tx, signer) = recovered_tx.to_components(); + let (tx, signer) = recovered_tx.into_parts(); let tx: PoolConsensusTx = ::Transaction::pooled_into_consensus(tx); diff --git a/crates/rpc/rpc/src/trace.rs b/crates/rpc/rpc/src/trace.rs index aaf8539ab454..33e32aec0281 100644 --- a/crates/rpc/rpc/src/trace.rs +++ b/crates/rpc/rpc/src/trace.rs @@ -121,7 +121,7 @@ where let env = EnvWithHandlerCfg::new_with_cfg_env( cfg_env_with_handler_cfg, block_env, - self.eth_api().evm_config().tx_env(tx.as_signed(), tx.signer()), + self.eth_api().evm_config().tx_env(tx.tx(), tx.signer()), ); let config = TracingInspectorConfig::from_parity_config(&trace_types); diff --git a/crates/rpc/rpc/src/txpool.rs b/crates/rpc/rpc/src/txpool.rs index a8d783406773..0d247f307567 100644 --- a/crates/rpc/rpc/src/txpool.rs +++ b/crates/rpc/rpc/src/txpool.rs @@ -103,7 +103,7 @@ where ) { let entry = inspect.entry(tx.sender()).or_default(); let tx = tx.clone_into_consensus(); - entry.insert(tx.nonce().to_string(), tx.into_signed().into()); + entry.insert(tx.nonce().to_string(), tx.into_tx().into()); } let AllPoolTransactions { pending, queued } = self.pool.all_transactions(); diff --git a/crates/transaction-pool/src/maintain.rs b/crates/transaction-pool/src/maintain.rs index 6ccd479c2b83..583b291685d5 100644 --- a/crates/transaction-pool/src/maintain.rs +++ b/crates/transaction-pool/src/maintain.rs @@ -600,7 +600,7 @@ where let local_transactions = local_transactions .into_iter() - .map(|tx| tx.transaction.clone_into_consensus().into_signed()) + .map(|tx| tx.transaction.clone_into_consensus().into_tx()) .collect::>(); let num_txs = local_transactions.len(); diff --git a/crates/transaction-pool/src/pool/mod.rs b/crates/transaction-pool/src/pool/mod.rs index 088fbe59bb65..a7c16d05aa8e 100644 --- a/crates/transaction-pool/src/pool/mod.rs +++ b/crates/transaction-pool/src/pool/mod.rs @@ -357,7 +357,7 @@ where }; size += encoded_len; - elements.push(pooled.into_signed()); + elements.push(pooled.into_tx()); if limit.exceeds(size) { break diff --git a/crates/transaction-pool/src/test_utils/mock.rs b/crates/transaction-pool/src/test_utils/mock.rs index 390538950db8..0f9243f607ce 100644 --- a/crates/transaction-pool/src/test_utils/mock.rs +++ b/crates/transaction-pool/src/test_utils/mock.rs @@ -685,7 +685,7 @@ impl PoolTransaction for MockTransaction { fn try_consensus_into_pooled( tx: RecoveredTx, ) -> Result, Self::TryFromConsensusError> { - let (tx, signer) = tx.to_components(); + let (tx, signer) = tx.into_parts(); Self::Pooled::try_from(tx) .map(|tx| tx.with_signer(signer)) .map_err(|_| TryFromRecoveredTransactionError::BlobSidecarMissing) @@ -871,7 +871,7 @@ impl EthPoolTransaction for MockTransaction { self, sidecar: Arc, ) -> Option> { - let (tx, signer) = self.into_consensus().to_components(); + let (tx, signer) = self.into_consensus().into_parts(); tx.try_into_pooled_eip4844(Arc::unwrap_or_clone(sidecar)) .map(|tx| tx.with_signer(signer)) .ok() @@ -881,7 +881,7 @@ impl EthPoolTransaction for MockTransaction { tx: RecoveredTx, sidecar: BlobTransactionSidecar, ) -> Option { - let (tx, signer) = tx.to_components(); + let (tx, signer) = tx.into_parts(); tx.try_into_pooled_eip4844(sidecar) .map(|tx| tx.with_signer(signer)) .ok() @@ -909,7 +909,7 @@ impl TryFrom> for MockTransaction { fn try_from(tx: RecoveredTx) -> Result { let sender = tx.signer(); - let transaction = tx.into_signed(); + let transaction = tx.into_tx(); let hash = transaction.hash(); let size = transaction.size(); diff --git a/crates/transaction-pool/src/traits.rs b/crates/transaction-pool/src/traits.rs index b2bf49292edd..a63e92a476f4 100644 --- a/crates/transaction-pool/src/traits.rs +++ b/crates/transaction-pool/src/traits.rs @@ -1245,7 +1245,7 @@ impl EthPooledTransaction { impl From for EthPooledTransaction { fn from(tx: PooledTransactionsElementEcRecovered) -> Self { let encoded_length = tx.encode_2718_len(); - let (tx, signer) = tx.to_components(); + let (tx, signer) = tx.into_parts(); match tx { PooledTransaction::Eip4844(tx) => { // include the blob sidecar @@ -1280,7 +1280,7 @@ impl PoolTransaction for EthPooledTransaction { fn try_consensus_into_pooled( tx: RecoveredTx, ) -> Result, Self::TryFromConsensusError> { - let (tx, signer) = tx.to_components(); + let (tx, signer) = tx.into_parts(); let pooled = tx .try_into_pooled() .map_err(|_| TryFromRecoveredTransactionError::BlobSidecarMissing)?; @@ -1427,7 +1427,7 @@ impl EthPoolTransaction for EthPooledTransaction { tx: RecoveredTx, sidecar: BlobTransactionSidecar, ) -> Option { - let (tx, signer) = tx.to_components(); + let (tx, signer) = tx.into_parts(); tx.try_into_pooled_eip4844(sidecar) .ok() .map(|tx| tx.with_signer(signer)) diff --git a/docs/crates/network.md b/docs/crates/network.md index 7e38ac5d6014..281f0105b09c 100644 --- a/docs/crates/network.md +++ b/docs/crates/network.md @@ -909,7 +909,7 @@ fn on_new_transactions(&mut self, hashes: impl IntoIterator) { .get_all(hashes) .into_iter() .map(|tx| { - (*tx.hash(), Arc::new(tx.transaction.to_recovered_transaction().into_signed())) + (*tx.hash(), Arc::new(tx.transaction.to_recovered_transaction().into_tx())) }) .collect(), ); @@ -1098,7 +1098,7 @@ fn on_get_pooled_transactions( .pool .get_all(request.0) .into_iter() - .map(|tx| tx.transaction.to_recovered_transaction().into_signed()) + .map(|tx| tx.transaction.to_recovered_transaction().into_tx()) .collect::>(); // we sent a response at which point we assume that the peer is aware of the transaction