Support dynamic/composite internal helper args (#1889)#2016
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…lper-args # Conflicts: # PrintAxioms.lean
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e11c39a. Configure here.
| (internalRetNames : List String := []) | ||
| (isInternal : Bool := false) | ||
| (inScopeNames : List String := []) | ||
| (adtTypes : List AdtTypeDef := []) : |
There was a problem hiding this comment.
ADT storage write skips internals
Medium Severity
compileAdtStorageWrite still lowers payload expressions with compileExprList, which uses an empty internal-function table. After this change, other setStorage paths use compileExprWithInternals with internalFunctions, so internal helper calls inside ADT constructor payloads can compile with incorrect argument expansion.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit e11c39a. Configure here.


Summary
Compiler/CompilationModel/InternalArgs.lean): internal helper definitions now receive expanded Yul slots for dynamic/composite params, and helper calls forward source-level dynamic/composite args by direct param/local reference with slot expansion.PrintAxioms.leanregenerated (zero new axioms, no sorry, no native_decide).Closes #1889. Tier 1 dynamic ABI codec track (downstream: Morpho Midnight ECM removal). Stacked on #2006 (#1975 struct-array calldata).
Test plan
lake build Verity Contracts Compiler PrintAxioms→ "Build completed successfully."refresh_verification_artifacts.sh→[refresh] PASSmake check→ "All checks passed."scripts/check_proof_length.pypassedNote
Medium Risk
Touches core compilation and validation for internal calls across the whole stmt/expr pipeline; mistakes could mis-lower ABI-shaped helper args or accept invalid forwards, but behavior is gated by stricter validation and extensive feature/proof updates.
Overview
Internal helper calls now treat dynamic and composite parameters (arrays, bytes, static tuples/fixed arrays, ADTs) like external ABI slots: callee Yul signatures expand to multiple slots, and callers must forward matching source-level args—direct
Expr.paramreferences for expanded types, or legacy flat expanded Yul arg lists with exact generated names / checked dynamic-member projections.A new
InternalArgsmodule centralizesinternalFunctionYulParamNames, static binding names, andisExpandedInternalParamType;compileInternalCallArgs/compileExprWithInternalsreplace plain expression compilation wherever internal specs are in scope (statements, events, storage writes, dispatch). Validation drops raw Yul-arg-count checks in favor ofvalidateInternalCallSourceArgs(type/layout match, forwarding rules, issue #1889 errors); constructor bodies pass caller params into internal-call shape validation.compileValidatedCorethreads the internal function list into external bodies, internal Yul defs, and constructors (each internal compiles with the full internal table). IR-generation proofs and feature tests are updated for the extra parameters and empty-internal supported fragment;compileExpr/compileExprListremain as wrappers withinternalFunctions = [].Reviewed by Cursor Bugbot for commit e11c39a. Bugbot is set up for automated code reviews on this repo. Configure here.