Skip to content

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

Merged
Th0rgal merged 4 commits into
mainfrom
task/1974-reverterror-args
Jun 18, 2026
Merged

Allow runtime scalar custom error args (#1974)#2017
Th0rgal merged 4 commits into
mainfrom
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 compile-time validation and lowering for revert/require paths across the macro pipeline; mistakes could allow invalid ABI payloads or break previously accepted call sites, though composite boundaries stay restricted and tests cover the new behavior.

Overview
Custom-error sites (requireError, revert, revertError, and requireSomeUintError) now type-check each argument against the declared error payload instead of only walking syntax for direct-parameter rules.

Scalar error fields (Uint256, Address, Bool, etc.) may use runtime values—locals and expressions such as add preOpGas paid—when lowering to Stmt.revertError / guards. Dynamic and composite payload slots still enforce the existing direct parameter reference constraint for ABI encoding.

Regression coverage adds runtime-arg model/executable checks and a compile-time rejection when a scalar arg’s inferred type does not match the error definition (e.g. Bool passed where Uint256 is declared). docs/ROADMAP.md notes runtime scalar ABI support for custom errors.

Reviewed by Cursor Bugbot for commit d6c2eaf. 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 18, 2026 3:20pm

Request Review

@Th0rgal Th0rgal changed the base branch from task/1889-internal-helper-args to main June 18, 2026 15:02
Resolve conflicts from already-squashed #1889/#2020 content by keeping
main's merged state; retain only the #1974 runtime scalar custom-error
delta (Translate, Translate/Expr, MacroCustomErrorFeatureTest, ROADMAP).
@Th0rgal Th0rgal merged commit 67198d2 into main Jun 18, 2026
21 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.

feat(Macro): revertError ErrName(arg1, arg2, ...) with non-literal args

1 participant