Allow runtime scalar custom error args (#1974)#2017
Open
Th0rgal wants to merge 1 commit into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
3 tasks
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
requireError,revert,revertError, andrequireSomeUintErrornow validate custom-error arguments against declared error parameter types, and accept runtime scalar ABI args — locals and expressions likeadd preOpGas paid— instead of literals only.Compiler/MacroCustomErrorFeatureTest.lean).docs/ROADMAP.md, EDSL API reference).Closes #1974. Tier 1 dynamic ABI codec track. Stacked on #2016 (#1889) → #2006 (#1975).
Known limitation: non-direct dynamic/composite custom-error arguments remain constrained to direct parameter references.
Test plan
lake build Verity Contracts Compiler PrintAxioms→ "Build completed successfully."refresh_verification_artifacts.sh→[refresh] PASSmake check→ "All checks passed."Note
Medium Risk
Changes macro compile-time validation and lowering for revert paths; mistakes could affect ABI encoding or reject valid contracts, but scope is limited to custom-error sites with new tests and explicit wrong-type diagnostics.
Overview
Custom-error sites (
requireError,revert,revertError, andrequireSomeUintError) now infer each argument’s type and validate it against the declared error payload before lowering, instead of only checking arity and direct-parameter rules for composite args.Scalar ABI payload fields (
Uint256,Address,Bool, word aliases, newtypes) may be runtime expressions (locals, arithmetic, etc.); the compilation model lowers them toExpr.localVar/ general expressions inStmt.revertError/requireError. Dynamic and composite error args still require direct parameter references on the compilation-model path.Regression coverage adds runtime-arg model/executable smoke tests and a
#guard_msgscase for wrong arg types; ROADMAP and the EDSL API reference note the scalar vs composite boundary.Reviewed by Cursor Bugbot for commit ca25f77. Bugbot is set up for automated code reviews on this repo. Configure here.