chore: use signedtx trait (#16143)

This commit is contained in:
Matthias Seitz
2025-05-09 18:28:07 +02:00
committed by GitHub
parent db885ccae8
commit 74e7e5f1cf
3 changed files with 7 additions and 5 deletions

View File

@@ -90,6 +90,7 @@ mod tests {
Itertools, Itertools,
}; };
use reth_db_api::tables; use reth_db_api::tables;
use reth_primitives_traits::SignedTransaction;
use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader}; use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader};
use reth_prune_types::{PruneCheckpoint, PruneMode, PruneProgress, PruneSegment}; use reth_prune_types::{PruneCheckpoint, PruneMode, PruneProgress, PruneSegment};
use reth_stages::test_utils::{StorageKind, TestStageDB}; use reth_stages::test_utils::{StorageKind, TestStageDB};
@@ -114,7 +115,7 @@ mod tests {
for transaction in &block.body().transactions { for transaction in &block.body().transactions {
transaction_senders.push(( transaction_senders.push((
transaction_senders.len() as u64, transaction_senders.len() as u64,
transaction.recover_signer().expect("recover signer"), SignedTransaction::recover_signer(transaction).expect("recover signer"),
)); ));
} }
} }

View File

@@ -5,7 +5,7 @@ use alloy_primitives::{Address, Bytes, TxKind, B256, U256};
use rand::{Rng, RngCore}; use rand::{Rng, RngCore};
use reth_chainspec::MAINNET; use reth_chainspec::MAINNET;
use reth_ethereum_primitives::{Transaction, TransactionSigned}; 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. /// A generator for transactions for testing purposes.
#[derive(Debug)] #[derive(Debug)]
@@ -99,8 +99,10 @@ impl<R: RngCore> TransactionGenerator<R> {
/// Generates and returns a pooled EIP-1559 transaction with a random signer. /// Generates and returns a pooled EIP-1559 transaction with a random signer.
pub fn gen_eip1559_pooled(&mut self) -> EthPooledTransaction { pub fn gen_eip1559_pooled(&mut self) -> EthPooledTransaction {
EthPooledTransaction::try_from_consensus(self.gen_eip1559().try_into_recovered().unwrap()) EthPooledTransaction::try_from_consensus(
.unwrap() SignedTransaction::try_into_recovered(self.gen_eip1559()).unwrap(),
)
.unwrap()
} }
/// Generates and returns a pooled EIP-4844 transaction with a random signer. /// Generates and returns a pooled EIP-4844 transaction with a random signer.

View File

@@ -16,7 +16,6 @@ use reth_primitives_traits::{
crypto::secp256k1::sign_message, proofs, Account, Block as _, Log, SealedBlock, SealedHeader, crypto::secp256k1::sign_message, proofs, Account, Block as _, Log, SealedBlock, SealedHeader,
StorageEntry, StorageEntry,
}; };
use secp256k1::{Keypair, Secp256k1}; use secp256k1::{Keypair, Secp256k1};
use std::{ use std::{
cmp::{max, min}, cmp::{max, min},