EEVM.Handler.Execution (eevm v0.1.0)

Copy Markdown View Source

Step 8 of the transaction pipeline — actually run the EVM.

Two paths:

  • Call (tx.to is a 20-byte address): transfer tx.value, fetch the code at to, and run the interpreter against it. When to is an active precompile with no code, the precompile runs on tx.data instead.
  • Create (tx.to is nil): derive the new contract address, fail with all execution gas consumed if it collides with an existing account (EIP-684, EIP-7610), transfer tx.value, run tx.data as initcode, then deploy whatever the initcode returns as the new account's runtime code (subject to size and EIP-3541 deposit-cost checks).

Returns {final_state, contract_address} where contract_address is the newly-deployed address (CREATE path) or nil (call path).

From Prague, a call to an account whose code is an EIP-7702 delegation designator runs the delegate's code instead, with the delegate pre-warmed.

Summary

Functions

Runs a validated transaction's EVM execution with execution_gas against db, in which the sender's nonce is already bumped and any EIP-7702 authorizations are applied.

Functions

run_top_level(tx, db, block, config, execution_gas, authorization \\ %{authorities: %{__struct__: MapSet, map: %{}}, refund: 0})

Runs a validated transaction's EVM execution with execution_gas against db, in which the sender's nonce is already bumped and any EIP-7702 authorizations are applied.

authorization is the outcome of PreExecution.apply_authorizations/3: its authorities start warm and its refund is added to the transaction's refund counter even if execution fails.

Returns the final machine state and the deployed contract address, or nil for a message call or a failed deployment.