From 91d710e0ffe48f64583201ae0aeb2573583b272c Mon Sep 17 00:00:00 2001 From: nicolas <48695862+merklefruit@users.noreply.github.com> Date: Mon, 30 Oct 2023 22:44:59 +0100 Subject: [PATCH] chore(primitives): fill tx env in separate fn --- crates/primitives/src/constants/mod.rs | 2 -- crates/primitives/src/revm/env.rs | 14 +++++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/crates/primitives/src/constants/mod.rs b/crates/primitives/src/constants/mod.rs index 9209f2bf0592..102482606212 100644 --- a/crates/primitives/src/constants/mod.rs +++ b/crates/primitives/src/constants/mod.rs @@ -93,12 +93,10 @@ pub const DEV_GENESIS_HASH: B256 = b256!("2f980576711e3617a5e4d83dd539548ec0f7792007d505a3d2e9674833af2d7c"); /// Optimism goerli genesis hash. -#[cfg(feature = "optimism")] pub const GOERLI_OP_GENESIS: B256 = b256!("c1fc15cd51159b1f1e5cbc4b82e85c1447ddfa33c52cf1d98d14fba0d6354be1"); /// Base goerli genesis hash. -#[cfg(feature = "optimism")] pub const GOERLI_BASE_GENESIS: B256 = b256!("a3ab140f15ea7f7443a4702da64c10314eb04d488e72974e02e2d728096b4f76"); diff --git a/crates/primitives/src/revm/env.rs b/crates/primitives/src/revm/env.rs index 047650a9ba42..4c978694af1a 100644 --- a/crates/primitives/src/revm/env.rs +++ b/crates/primitives/src/revm/env.rs @@ -184,15 +184,19 @@ pub fn fill_tx_env_with_beacon_root_contract_call(env: &mut Env, parent_beacon_b } /// Fill transaction environment from [TransactionSignedEcRecovered]. +#[cfg(not(feature = "optimism"))] +pub fn fill_tx_env_with_recovered(tx_env: &mut TxEnv, transaction: &TransactionSignedEcRecovered) { + #[cfg(not(feature = "optimism"))] + fill_tx_env(tx_env, transaction.as_ref(), transaction.signer()); +} + +/// Fill transaction environment from [TransactionSignedEcRecovered] and the given envelope. +#[cfg(feature = "optimism")] pub fn fill_tx_env_with_recovered( tx_env: &mut TxEnv, transaction: &TransactionSignedEcRecovered, - #[cfg(feature = "optimism")] envelope: Bytes, + envelope: Bytes, ) { - #[cfg(not(feature = "optimism"))] - fill_tx_env(tx_env, transaction.as_ref(), transaction.signer()); - - #[cfg(feature = "optimism")] fill_tx_env(tx_env, transaction.as_ref(), transaction.signer(), envelope); }