Support dynamic struct element helper args#1862
Conversation
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 695cc13. Configure here.
| | Expr.paramDynamicMemberLength _ _ | ||
| | Expr.paramDynamicMemberDataOffset _ _ => true | ||
| | Expr.paramDynamicMemberElement _ _ innerIndex => | ||
| exprUsesParamDynamicHeadWord innerIndex |
There was a problem hiding this comment.
Missing unconditional true for paramDynamicMemberElement usage detection
High Severity
exprUsesParamDynamicHeadWord returns exprUsesParamDynamicHeadWord innerIndex for Expr.paramDynamicMemberElement, but it needs to return true unconditionally (like paramDynamicMemberLength and paramDynamicMemberDataOffset do). The checkedParamDynamicMemberElementHelper is gated by paramDynamicHeadWordHelpersRequired, so if a function only uses paramDynamicMemberElement with a simple literal index, the helper won't be emitted and the generated Yul will reference an undefined function.
Reviewed by Cursor Bugbot for commit 695cc13. Configure here.
| \n### CI Failure Hints\n\nFailed jobs: `compiler-regressions`\n\nCopy-paste local triage:\n```bash\nmake check\nlake build\nFOUNDRY_PROFILE=difftest forge test -vv\n``` |
Updates the public/private theorem index to include the 5 new IR Expr
constructors (arrayElementDynamicDataOffset, arrayElementDynamicMemberDataOffset,
paramDynamicMember{Length,DataOffset,Element}) shipped in upstream PRs
#1858-#1862, plus the dispatchBody / DynamicData helpers they reference.
Followup to the merge commit `60d38ba8`.


Summary
Tests
Note
Medium Risk
Touches ABI encoding/offset calculations and macro lowering for dynamic tuple/struct parameters, which can cause subtle miscompilations if offsets/length checks are wrong; changes are localized but span compiler, validators, and proofs.
Overview
Adds new IR/Yul support for passing dynamically encoded struct/tuple values into internal helpers by introducing
Expr.arrayElementDynamicDataOffsetplus dynamic-member projections (Expr.paramDynamicMemberLength,Expr.paramDynamicMemberDataOffset,Expr.paramDynamicMemberElement) and compiling them to new checked Yul helpers (calldata + memory variants).Extends validation/usage analysis/purity checks and internal helper parameter lowering to recognize these new expression forms, and updates the macro translator to lower dynamic struct-member uses in
arrayLength/arrayElement, external/linked calls, and internal helper calls (including allowing struct/tuple helper params).Adds a new smoke contract (
DynamicStructElementHelperArgSmoke) and updates invariant/round-trip fuzz suites and generated Solidity property-test scaffolding; the property-test generator now falls back to anabi.decode(abi.encode(...))placeholder for unsupported array element example values instead of failing.Reviewed by Cursor Bugbot for commit 92514c6. Bugbot is set up for automated code reviews on this repo. Configure here.