From 74e7e5f1cf2615960dd4a47e94beee67194c5116 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Fri, 9 May 2025 18:28:07 +0200 Subject: [PATCH] chore: use signedtx trait (#16143) --- crates/prune/prune/src/segments/user/sender_recovery.rs | 3 ++- crates/transaction-pool/src/test_utils/tx_gen.rs | 8 +++++--- testing/testing-utils/src/generators.rs | 1 - 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/prune/prune/src/segments/user/sender_recovery.rs b/crates/prune/prune/src/segments/user/sender_recovery.rs index 104fbf110f..bb0a812aa9 100644 --- a/crates/prune/prune/src/segments/user/sender_recovery.rs +++ b/crates/prune/prune/src/segments/user/sender_recovery.rs @@ -90,6 +90,7 @@ mod tests { Itertools, }; use reth_db_api::tables; + use reth_primitives_traits::SignedTransaction; use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader}; use reth_prune_types::{PruneCheckpoint, PruneMode, PruneProgress, PruneSegment}; use reth_stages::test_utils::{StorageKind, TestStageDB}; @@ -114,7 +115,7 @@ mod tests { for transaction in &block.body().transactions { transaction_senders.push(( transaction_senders.len() as u64, - transaction.recover_signer().expect("recover signer"), + SignedTransaction::recover_signer(transaction).expect("recover signer"), )); } } diff --git a/crates/transaction-pool/src/test_utils/tx_gen.rs b/crates/transaction-pool/src/test_utils/tx_gen.rs index fde019c675..11504b28b9 100644 --- a/crates/transaction-pool/src/test_utils/tx_gen.rs +++ b/crates/transaction-pool/src/test_utils/tx_gen.rs @@ -5,7 +5,7 @@ use alloy_primitives::{Address, Bytes, TxKind, B256, U256}; use rand::{Rng, RngCore}; use reth_chainspec::MAINNET; use reth_ethereum_primitives::{Transaction, TransactionSigned}; -use reth_primitives_traits::crypto::secp256k1::sign_message; +use reth_primitives_traits::{crypto::secp256k1::sign_message, SignedTransaction}; /// A generator for transactions for testing purposes. #[derive(Debug)] @@ -99,8 +99,10 @@ impl TransactionGenerator { /// Generates and returns a pooled EIP-1559 transaction with a random signer. pub fn gen_eip1559_pooled(&mut self) -> EthPooledTransaction { - EthPooledTransaction::try_from_consensus(self.gen_eip1559().try_into_recovered().unwrap()) - .unwrap() + EthPooledTransaction::try_from_consensus( + SignedTransaction::try_into_recovered(self.gen_eip1559()).unwrap(), + ) + .unwrap() } /// Generates and returns a pooled EIP-4844 transaction with a random signer. diff --git a/testing/testing-utils/src/generators.rs b/testing/testing-utils/src/generators.rs index cbbc38cc2f..1a9297f8e1 100644 --- a/testing/testing-utils/src/generators.rs +++ b/testing/testing-utils/src/generators.rs @@ -16,7 +16,6 @@ use reth_primitives_traits::{ crypto::secp256k1::sign_message, proofs, Account, Block as _, Log, SealedBlock, SealedHeader, StorageEntry, }; - use secp256k1::{Keypair, Secp256k1}; use std::{ cmp::{max, min},