Skip to content

Commit

Permalink
style: Use env rather than passing a flag
Browse files Browse the repository at this point in the history
  • Loading branch information
clabby committed Sep 2, 2023
1 parent 4154183 commit 9bb0c49
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
8 changes: 2 additions & 6 deletions crates/primitives/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,7 @@ impl Env {

/// Validate transaction against state.
#[inline]
pub fn validate_tx_against_state(
&self,
account: &Account,
#[cfg(feature = "optimism")] is_deposit: bool,
) -> Result<(), InvalidTransaction> {
pub fn validate_tx_against_state(&self, account: &Account) -> Result<(), InvalidTransaction> {
// EIP-3607: Reject transactions from senders with deployed code
// This EIP is introduced after london but there was no collision in past
// so we can leave it enabled always
Expand All @@ -370,7 +366,7 @@ impl Env {
// On Optimism, deposit transactions do not have verification on the nonce
// nor the balance of the account.
#[cfg(feature = "optimism")]
if self.cfg.optimism && is_deposit {
if self.cfg.optimism && self.tx.source_hash.is_some() {
return Ok(());
}

Expand Down
6 changes: 1 addition & 5 deletions crates/revm/src/evm_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,7 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> Transact<DB::Error>
.load_account(tx_caller, self.data.db)
.map_err(EVMError::Database)?;

self.data.env.validate_tx_against_state(
caller_account,
#[cfg(feature = "optimism")]
is_deposit,
)?;
self.data.env.validate_tx_against_state(caller_account)?;

Ok(())
}
Expand Down

0 comments on commit 9bb0c49

Please sign in to comment.