Skip to content

fix(simulation): capture CREATE revert reasons - #958

Merged
crystalt merged 2 commits into
mainfrom
crystal/fix-create-revert-capture
Aug 6, 2026
Merged

fix(simulation): capture CREATE revert reasons#958
crystalt merged 2 commits into
mainfrom
crystal/fix-create-revert-capture

Conversation

@crystalt

@crystalt crystalt commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Mirrors the existing call_end revert capture in create_end, capturing revert data from failed contract deployments before an outer call can mask it.

Test: cargo test -p world-chain-rpc --test inspector_create_revert


Note

Low Risk
Small, symmetric change to simulation inspector revert capture with an in-memory regression test; no auth, persistence, or consensus impact.

Overview
Simulation now surfaces constructor revert data when a CREATE/CREATE2 fails, not only when a nested CALL reverts.

SimulationInspector::create_end records the first InstructionResult::Revert output into deepest_revert_payload, matching the existing call_end behavior so revert_reason on simulate_unsignedUserOp stays the innermost payload instead of being replaced by an outer frame with empty or wrapper revert data (e.g. EntryPoint FailedOp).

Docs on deepest_revert_payload now note both call_end and create_end. A new in-memory regression test (inspector_create_revert) uses bytecode that CREATE-reverts with 0xdeadbeef then outer-reverts with no data, asserting the inspector still returns 0xdeadbeef and no committed creations.

Reviewed by Cursor Bugbot for commit b63c4a2. Bugbot is set up for automated code reviews on this repo. Configure here.

@crystalt crystalt changed the title Capture constructor revert reasons Capture CREATE revert reasons Aug 3, 2026
@crystalt crystalt changed the title Capture CREATE revert reasons fix(simulation): capture CREATE revert reasons Aug 3, 2026
@crystalt
crystalt marked this pull request as ready for review August 3, 2026 23:48
@crystalt
crystalt requested a review from Copilot August 4, 2026 01:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the RPC simulation inspector so constructor reverts from failed contract deployments (CREATE/CREATE2) are captured as the deepest revert payload, preventing outer wrapper reverts from masking the root cause during simulation. Adds a dedicated in-memory EVM regression test to validate revert reason capture and ensure failed creates do not get recorded as contract creations.

Changes:

  • Capture InstructionResult::Revert payloads in SimulationInspector::create_end, mirroring existing call_end behavior.
  • Update deepest_revert_payload documentation to include both call_end and create_end.
  • Add inspector_create_revert regression test covering masked constructor revert payloads.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
crates/rpc/src/simulate.rs Extends deepest-revert capture to CREATE/CREATE2 end-hook paths and updates associated docs.
crates/rpc/tests/inspector_create_revert.rs Adds a regression test ensuring constructor revert payloads are preserved even when an outer frame reverts with empty output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/rpc/tests/inspector_create_revert.rs
@crystalt
crystalt merged commit 13ff525 into main Aug 6, 2026
14 checks passed
@crystalt
crystalt deleted the crystal/fix-create-revert-capture branch August 6, 2026 22:59
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.

3 participants