Skip to content

perf(evm): skip gas-limit estimation in execute - #57

Merged
kyscott18 merged 1 commit into
mainfrom
perf/execute-skip-gas-estimate
Oct 13, 2026
Merged

kyscott18 merged 1 commit into
mainfrom
perf/execute-skip-gas-estimate

Conversation

@kyscott18

@kyscott18 kyscott18 commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Each accepted mutation ran the EVM about 18 times: pass 1, pass 2, about 15 gas-limit binary-search runs, and a final pass. Only simulate needs a gas limit, because it builds the onchain transaction. execute only accepts the mutation into local state.

  • execute skips the gas-limit search, and its result has no gas_limit.
  • simulate returns the new SimulateResult type, which keeps gas_limit. The runtime reads gas_limit only from simulate, at submit.
  • A test pins the new behavior: execute omits gas_limit.

Results

  • Counter benchmark: evm execute 1.13 ms → 0.20 ms per mutation.
  • Harness benchmark: 2,236 → 3,026 mutations/s.

Test plan

  • bun run lint, bun run typecheck, bun run test
  • The gas-limit tests (Solmate ERC20 and EIP-150 headroom) use simulate and still pass.

🤖 Generated with Claude Code

RetriggerConfidence Score: 5/5

This PR appears safe to merge; no actionable issues were found.

Summary

This PR skips gas-limit estimation when execute accepts a local mutation. simulate keeps the search for transactions sent to the chain.

  • Local mutation execution skips gas-limit searches.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Contract call] --> B{Method}
  B -->|execute| C[Discover access list and run second pass]
  C --> D{Succeeded?}
  D -->|Yes| E[Commit local state and create journal]
  D -->|No| F[Discard writes]
  B -->|simulate| G[Temporarily rewind selected journals]
  G --> H[Run with access list]
  H --> I[Estimate gas limit on success]
  I --> J[Discard simulated writes and restore journals]
  J --> K[Return result with gas limit]
Loading

Reviews (1) · Last reviewed commit: "perf(evm): skip gas-limit estimation in ..." · Reviewed by Greptile

Execute ran pass 1, pass 2, a gas-limit binary search (~15 runs), and a
final pass: about 18 EVM runs per accepted mutation. Only simulate needs
a gas limit, because it builds the onchain transaction. Execute now runs
pass 1 and pass 2 only, and its result has no gas_limit. Simulate returns
the new SimulateResult type, which keeps gas_limit.

Counter benchmark: evm execute 1.13ms -> 0.20ms per mutation.
Harness benchmark: 2,236 -> 3,026 mutations/s.
@kyscott18
kyscott18 merged commit 7fdaadd into main Oct 13, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant