feat: impl Encodable2718 and Decodable2718 for PooledTransactionsElement (#11482)

This commit is contained in:
Arsenii Kulikov
2024-10-08 18:33:31 +04:00
committed by GitHub
parent c61ae1371b
commit e18b0bab90
11 changed files with 150 additions and 279 deletions

View File

@ -676,6 +676,7 @@ mod tests {
blobstore::InMemoryBlobStore, validate::EthTransactionValidatorBuilder,
CoinbaseTipOrdering, EthPooledTransaction, Pool, TransactionOrigin,
};
use alloy_eips::eip2718::Decodable2718;
use alloy_primitives::{hex, U256};
use reth_chainspec::MAINNET;
use reth_fs_util as fs;
@ -699,7 +700,7 @@ mod tests {
let temp_dir = tempfile::tempdir().unwrap();
let transactions_path = temp_dir.path().join(FILENAME).with_extension(EXTENSION);
let tx_bytes = hex!("02f87201830655c2808505ef61f08482565f94388c818ca8b9251b393131c08a736a67ccb192978801049e39c4b5b1f580c001a01764ace353514e8abdfb92446de356b260e3c1225b73fc4c8876a6258d12a129a04f02294aa61ca7676061cd99f29275491218b4754b46a0248e5e42bc5091f507");
let tx = PooledTransactionsElement::decode_enveloped(&mut &tx_bytes[..]).unwrap();
let tx = PooledTransactionsElement::decode_2718(&mut &tx_bytes[..]).unwrap();
let provider = MockEthProvider::default();
let transaction: EthPooledTransaction = tx.try_into_ecrecovered().unwrap().into();
let tx_to_cmp = transaction.clone();

View File

@ -1051,7 +1051,7 @@ impl EthPooledTransaction {
/// Conversion from the network transaction type to the pool transaction type.
impl From<PooledTransactionsElementEcRecovered> for EthPooledTransaction {
fn from(tx: PooledTransactionsElementEcRecovered) -> Self {
let encoded_length = tx.length_without_header();
let encoded_length = tx.encode_2718_len();
let (tx, signer) = tx.into_components();
match tx {
PooledTransactionsElement::BlobTransaction(tx) => {

File diff suppressed because one or more lines are too long