Skip to content

Allow runtime scalar custom error args (#1974)#2017

Open
Th0rgal wants to merge 1 commit into
task/1889-internal-helper-argsfrom
task/1974-reverterror-args
Open

Allow runtime scalar custom error args (#1974)#2017
Th0rgal wants to merge 1 commit into
task/1889-internal-helper-argsfrom
task/1974-reverterror-args

Conversation

@Th0rgal

@Th0rgal Th0rgal commented Jun 12, 2026

Copy link
Copy Markdown
Member

Summary

  • requireError, revert, revertError, and requireSomeUintError now validate custom-error arguments against declared error parameter types, and accept runtime scalar ABI args — locals and expressions like add preOpGas paid — instead of literals only.
  • Dynamic/composite custom-error payloads keep the existing direct-parameter ABI boundary; regression coverage for runtime scalar args and wrong-type rejection (Compiler/MacroCustomErrorFeatureTest.lean).
  • Docs updated (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] PASS
  • make check → "All checks passed."
  • CI green

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, and requireSomeUintError) 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 to Expr.localVar / general expressions in Stmt.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_msgs case 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.

@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
verity Ready Ready Preview, Comment Jun 12, 2026 11:26pm

Request Review

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