impl Encodable2718, Decodable2718 for TransactionSigned (#11218)

This commit is contained in:
Arsenii Kulikov
2024-09-30 19:36:38 +04:00
committed by GitHub
parent 24b6341205
commit 42afcbd75a
26 changed files with 211 additions and 317 deletions

View File

@ -1,6 +1,6 @@
use crate::EthPooledTransaction;
use alloy_consensus::{TxEip1559, TxEip4844, TxLegacy};
use alloy_eips::eip2930::AccessList;
use alloy_eips::{eip2718::Encodable2718, eip2930::AccessList};
use alloy_primitives::{Address, Bytes, TxKind, B256, U256};
use rand::Rng;
use reth_chainspec::MAINNET;
@ -106,7 +106,7 @@ impl<R: Rng> TransactionGenerator<R> {
/// Generates and returns a pooled EIP-4844 transaction with a random signer.
pub fn gen_eip4844_pooled(&mut self) -> EthPooledTransaction {
let tx = self.gen_eip4844().into_ecrecovered().unwrap();
let encoded_length = tx.length_without_header();
let encoded_length = tx.encode_2718_len();
EthPooledTransaction::new(tx, encoded_length)
}
}

View File

@ -7,7 +7,7 @@ use crate::{
validate::ValidPoolTransaction,
AllTransactionsEvents,
};
use alloy_eips::{eip2930::AccessList, eip4844::BlobAndProofV1};
use alloy_eips::{eip2718::Encodable2718, eip2930::AccessList, eip4844::BlobAndProofV1};
use alloy_primitives::{Address, TxHash, TxKind, B256, U256};
use futures_util::{ready, Stream};
use reth_eth_wire_types::HandleMempoolData;
@ -1251,7 +1251,7 @@ impl TryFrom<TransactionSignedEcRecovered> for EthPooledTransaction {
}
};
let encoded_length = tx.length_without_header();
let encoded_length = tx.encode_2718_len();
let transaction = Self::new(tx, encoded_length);
Ok(transaction)
}