From 91d45871b29dd1f6ed9af83aab92c7307e9d09bc Mon Sep 17 00:00:00 2001 From: Thomas Coratger <60488569+tcoratger@users.noreply.github.com> Date: Mon, 1 Jul 2024 11:46:43 +0200 Subject: [PATCH] refactor(revm): simplify `fill_tx_env` (#9206) --- crates/primitives/src/revm/env.rs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/crates/primitives/src/revm/env.rs b/crates/primitives/src/revm/env.rs index bbd4cffd3..ada789451 100644 --- a/crates/primitives/src/revm/env.rs +++ b/crates/primitives/src/revm/env.rs @@ -245,10 +245,7 @@ where tx_env.gas_limit = tx.gas_limit; tx_env.gas_price = U256::from(tx.gas_price); tx_env.gas_priority_fee = None; - tx_env.transact_to = match tx.to { - TxKind::Call(to) => TxKind::Call(to), - TxKind::Create => TxKind::Create, - }; + tx_env.transact_to = tx.to; tx_env.value = tx.value; tx_env.data = tx.input.clone(); tx_env.chain_id = tx.chain_id; @@ -261,17 +258,13 @@ where tx_env.gas_limit = tx.gas_limit; tx_env.gas_price = U256::from(tx.gas_price); tx_env.gas_priority_fee = None; - tx_env.transact_to = match tx.to { - TxKind::Call(to) => TxKind::Call(to), - TxKind::Create => TxKind::Create, - }; + tx_env.transact_to = tx.to; tx_env.value = tx.value; tx_env.data = tx.input.clone(); tx_env.chain_id = Some(tx.chain_id); tx_env.nonce = Some(tx.nonce); tx_env.access_list = tx .access_list - .0 .iter() .map(|l| { (l.address, l.storage_keys.iter().map(|k| U256::from_be_bytes(k.0)).collect()) @@ -284,17 +277,13 @@ where tx_env.gas_limit = tx.gas_limit; tx_env.gas_price = U256::from(tx.max_fee_per_gas); tx_env.gas_priority_fee = Some(U256::from(tx.max_priority_fee_per_gas)); - tx_env.transact_to = match tx.to { - TxKind::Call(to) => TxKind::Call(to), - TxKind::Create => TxKind::Create, - }; + tx_env.transact_to = tx.to; tx_env.value = tx.value; tx_env.data = tx.input.clone(); tx_env.chain_id = Some(tx.chain_id); tx_env.nonce = Some(tx.nonce); tx_env.access_list = tx .access_list - .0 .iter() .map(|l| { (l.address, l.storage_keys.iter().map(|k| U256::from_be_bytes(k.0)).collect()) @@ -314,7 +303,6 @@ where tx_env.nonce = Some(tx.nonce); tx_env.access_list = tx .access_list - .0 .iter() .map(|l| { (l.address, l.storage_keys.iter().map(|k| U256::from_be_bytes(k.0)).collect())