feat(rpc): add machine-readable UserOp safety warnings - #879
Open
realmehmetali wants to merge 1 commit into
Open
feat(rpc): add machine-readable UserOp safety warnings#879realmehmetali wants to merge 1 commit into
realmehmetali wants to merge 1 commit into
Conversation
Populate the existing warnings field from simulation effects. Evaluate final approval state to avoid warnings for permissions revoked later in the same operation.
realmehmetali
marked this pull request as ready for review
July 21, 2026 17:55
realmehmetali
requested review from
0xForerunner,
0xOsiris,
Dzejkop,
Kemperino,
alessandromazza98,
cichaczem,
karankurbur,
kilianglas,
murph and
piohei
as code owners
July 21, 2026 17:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
warningsresponse field with typed, deterministic safety signals.Why
Autonomous agents and smart-account wallets need machine-readable safety inputs before they sign. The simulator already extracts objective approval and account-management effects; exposing those facts as stable warning codes lets clients enforce local policy without trusting an external reputation service.
These warnings describe state changes, not intent. They do not label a destination, asset, or operation as malicious.
Safety and scope
warningsarray is now populated with typed entries.Validation
cargo fmt --all -- --checkcargo test -p world-chain-rpc --lib(16 passed)cargo test -p world-chain-rpc --test fork_simulate --no-runcargo clippy -p world-chain-rpc --lib --tests -- -D warningsNew tests cover final approval ordering, grant-then-revoke behavior, account-authority changes, reverted simulations, unrelated accounts, deterministic deduplication, and stable JSON serialization.
Note
Low Risk
Read-only RPC response enrichment with no execution or state changes; only affects clients consuming the previously empty
warningsarray.Overview
The
simulate_unsignedUserOpresponse fills the reservedwarningsfield with typedSimulationWarningentries instead of always returning an empty array. Warnings describe objective effects on the simulated sender only—unlimited ERC-20 approvals, activeApprovalForAll-style operator grants, and smart-account authority changes (ownership, modules, proxy upgrade, self-destruct, authorization)—not malicious intent.generate_simulation_warningsderives warnings from existingexposure_changesandcontract_managementoutput. Approval signals use the final state per(asset, counterparty, approval kind)so a later reduce/revoke in the same UserOp does not leave a stale warning. Reverted simulations return no warnings; results are deduplicated and ordered viaBTreeSet.New unit tests cover approval ordering, grant/revoke, account-management mapping, unrelated accounts, reverts, and stable JSON serialization for warning types.
Reviewed by Cursor Bugbot for commit ee6bb2a. Bugbot is set up for automated code reviews on this repo. Configure here.