Skip to content

feat: add executeTransaction cheatcode#13437

Open
onbjerg wants to merge 1 commit intomasterfrom
onbjerg/execute-transaction
Open

feat: add executeTransaction cheatcode#13437
onbjerg wants to merge 1 commit intomasterfrom
onbjerg/execute-transaction

Conversation

@onbjerg
Copy link
Member

@onbjerg onbjerg commented Feb 13, 2026

Summary

Adds a new executeTransaction(bytes calldata rawTx) cheatcode that executes an RLP-encoded signed transaction with full EVM semantics in an isolated context (similar to --isolate mode).

Ported from tempoxyz/tempo-foundry.

Interface

function executeTransaction(bytes calldata rawTx) external returns (bytes memory);
  • Decodes EIP-2718 typed transactions (type prefix + RLP) or legacy RLP
  • Recovers the signer from the transaction signature
  • Executes in an isolated EVM: basefee/gas price zeroed, nonce checks enabled, EIP-3860 initcode limits enforced
  • Merges state changes back into the parent context, preserving warm account/slot status
  • Returns the execution output bytes
  • Blocked in forge script contexts

Unsupported transaction types

OP deposit and Tempo AA transactions currently return an error with a TODO to add support later.

Test cases

  • test_revert_not_a_tx — invalid RLP
  • test_execute_legacy_transfer — type 0 ETH transfer
  • test_execute_eip1559_transfer — type 2 ETH transfer
  • test_execute_erc20_transfer — contract interaction (approve + transferFrom)
  • test_execute_then_interact — state isolation: prank call after executeTransaction

Files changed

  • crates/cheatcodes/spec/src/vm.rs — cheatcode declaration
  • crates/cheatcodes/Cargo.toml — added foundry-primitives dep
  • crates/cheatcodes/src/evm.rs — implementation
  • testdata/utils/Vm.sol — auto-regenerated
  • testdata/default/cheats/ExecuteTransaction.t.sol — tests

Port the executeTransaction cheatcode from
tempoxyz/tempo-foundry. Executes RLP-encoded
signed transactions in an isolated EVM context
with full semantics (like --isolate mode).

OP deposit and Tempo AA transactions return
errors for now (marked with TODOs).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant