chore: rm pooledtx element type (#13286)

This commit is contained in:
Matthias Seitz
2024-12-13 13:58:40 +01:00
committed by GitHub
parent 088925c08a
commit acc125a528
13 changed files with 214 additions and 993 deletions

View File

@ -872,7 +872,7 @@ impl EthPoolTransaction for MockTransaction {
sidecar: Arc<BlobTransactionSidecar>,
) -> Option<RecoveredTx<Self::Pooled>> {
let (tx, signer) = self.into_consensus().to_components();
Self::Pooled::try_from_blob_transaction(tx, Arc::unwrap_or_clone(sidecar))
tx.try_into_pooled_eip4844(Arc::unwrap_or_clone(sidecar))
.map(|tx| tx.with_signer(signer))
.ok()
}
@ -882,7 +882,7 @@ impl EthPoolTransaction for MockTransaction {
sidecar: BlobTransactionSidecar,
) -> Option<Self> {
let (tx, signer) = tx.to_components();
Self::Pooled::try_from_blob_transaction(tx, sidecar)
tx.try_into_pooled_eip4844(sidecar)
.map(|tx| tx.with_signer(signer))
.ok()
.map(Self::from_pooled)

View File

@ -1238,9 +1238,11 @@ impl From<PooledTransactionsElementEcRecovered> for EthPooledTransaction {
let encoded_length = tx.encode_2718_len();
let (tx, signer) = tx.to_components();
match tx {
PooledTransactionsElement::BlobTransaction(tx) => {
PooledTransactionsElement::Eip4844(tx) => {
// include the blob sidecar
let (tx, sig, hash) = tx.into_parts();
let (tx, blob) = tx.into_parts();
let tx = TransactionSigned::new(tx.into(), sig, hash);
let tx = RecoveredTx::from_signed_transaction(tx, signer);
let mut pooled = Self::new(tx, encoded_length);
pooled.blob_sidecar = EthBlobTransactionSidecar::Present(blob);
@ -1248,7 +1250,8 @@ impl From<PooledTransactionsElementEcRecovered> for EthPooledTransaction {
}
tx => {
// no blob sidecar
Self::new(tx.into_ecrecovered_transaction(signer), encoded_length)
let tx = RecoveredTx::from_signed_transaction(tx.into(), signer);
Self::new(tx, encoded_length)
}
}
}
@ -1416,7 +1419,7 @@ impl EthPoolTransaction for EthPooledTransaction {
sidecar: BlobTransactionSidecar,
) -> Option<Self> {
let (tx, signer) = tx.to_components();
PooledTransactionsElement::try_from_blob_transaction(tx, sidecar)
tx.try_into_pooled_eip4844(sidecar)
.ok()
.map(|tx| tx.with_signer(signer))
.map(Self::from_pooled)

View File

@ -850,7 +850,9 @@ mod tests {
use alloy_eips::eip2718::Decodable2718;
use alloy_primitives::{hex, U256};
use reth_chainspec::MAINNET;
use reth_primitives::PooledTransactionsElement;
use reth_primitives::{
transaction::SignedTransactionIntoRecoveredExt, PooledTransactionsElement,
};
use reth_provider::test_utils::{ExtendedAccount, MockEthProvider};
fn get_transaction() -> EthPooledTransaction {