diff --git a/crates/common/src/constants.rs b/crates/common/src/constants.rs index 5e30eec89c9f0..1850febb2fb95 100644 --- a/crates/common/src/constants.rs +++ b/crates/common/src/constants.rs @@ -1,8 +1,6 @@ //! Commonly used constants. -use alloy_consensus::Typed2718; -use alloy_network::AnyTxEnvelope; -use alloy_primitives::{address, Address, Signature, B256}; +use alloy_primitives::{address, Address}; use std::time::Duration; /// The dev chain-id, inherited from hardhat @@ -58,24 +56,6 @@ pub fn is_known_system_sender(sender: Address) -> bool { [ARBITRUM_SENDER, OPTIMISM_SYSTEM_ADDRESS, Address::ZERO].contains(&sender) } -pub fn is_impersonated_tx(tx: &AnyTxEnvelope) -> bool { - if let AnyTxEnvelope::Ethereum(tx) = tx { - return is_impersonated_sig(tx.signature(), tx.ty()); - } - false -} - -pub fn is_impersonated_sig(sig: &Signature, ty: u8) -> bool { - let impersonated_sig = - Signature::from_scalars_and_parity(B256::with_last_byte(1), B256::with_last_byte(1), false); - if ty != SYSTEM_TRANSACTION_TYPE && - (sig == &impersonated_sig || sig.r() == impersonated_sig.r()) - { - return true; - } - false -} - #[cfg(test)] mod tests { use super::*; diff --git a/crates/evm/core/src/utils.rs b/crates/evm/core/src/utils.rs index 59287b250168c..9cd88a43a5eb0 100644 --- a/crates/evm/core/src/utils.rs +++ b/crates/evm/core/src/utils.rs @@ -5,7 +5,6 @@ use alloy_network::{AnyTxEnvelope, TransactionResponse}; use alloy_primitives::{Address, Selector, TxKind, B256, U256}; use alloy_provider::{network::BlockResponse, Network}; use alloy_rpc_types::{Transaction, TransactionRequest}; -use foundry_common::is_impersonated_tx; use foundry_config::NamedChain; pub use revm::state::EvmState as StateChangeset; @@ -86,9 +85,9 @@ pub fn get_function<'a>( /// Configures the env for the given RPC transaction. /// Accounts for an impersonated transaction by resetting the `env.tx.caller` field to `tx.from`. pub fn configure_tx_env(env: &mut EnvMut<'_>, tx: &Transaction) { - let impersonated_from = is_impersonated_tx(&tx.inner).then_some(tx.from()); + let from = tx.from(); if let AnyTxEnvelope::Ethereum(tx) = &tx.inner.inner() { - configure_tx_req_env(env, &tx.clone().into(), impersonated_from).expect("cannot fail"); + configure_tx_req_env(env, &tx.clone().into(), Some(from)).expect("cannot fail"); } }