Skip to content

Support dynamic array event sources#1871

Merged
Th0rgal merged 1 commit into
mainfrom
codex/macro-event-dynamic-array-sources
May 14, 2026
Merged

Support dynamic array event sources#1871
Th0rgal merged 1 commit into
mainfrom
codex/macro-event-dynamic-array-sources

Conversation

@Th0rgal
Copy link
Copy Markdown
Member

@Th0rgal Th0rgal commented May 14, 2026

Summary

  • allow event encoding to source uint256[]-style dynamic array payloads from memory-backed locals and projected dynamic members
  • validate the new event argument sentinel forms for supported dynamic array element types
  • lower macro emit arguments for memory arrays and projected dynamic arrays to the compilation model event-source expressions
  • add compilation-model feature coverage for memory-backed and projected event array sources

Notes

This extends the encoder/model path needed for source-shaped dynamic array event payloads. The current executable surface still has , so fully source-level heterogeneous event argument lists remain a separate follow-up.

Verification

  • git diff --check
  • lake build Compiler.CompilationModelFeatureTest
  • lake build PrintAxioms
  • python3 scripts/generate_print_axioms.py --check
  • python3 scripts/check_axioms.py

Note

Medium Risk
Extends event ABI encoding/validation for dynamic arrays and changes macro lowering of emit arguments, which can affect generated Yul for event payloads and topic hashing. Scope is limited to dynamic-array event args, with added feature tests to catch regressions.

Overview
Enables event emission to source uint256[]-style dynamic array payloads not only from direct parameters, but also from memory-backed locals and projected dynamic members (via new sentinel Expr.*Length forms), by plumbing a unified EventDynamicArraySource into both indexed-topic hashing and unindexed data encoding.

Adds validation for these new event-argument shapes, updates the Verity macro so emit lowers eligible array expressions into the new sentinels, and adds compilation-model feature tests that ensure both memory and projected dynamic array sources compile.

Reviewed by Cursor Bugbot for commit 4081e31. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4081e31. Configure here.

| Expr.param name =>
pure (some
{ lengthExpr := YulExpr.ident s!"{name}_length"
dataOffsetExpr := indexedDynamicBaseOffsetExpr dynamicSource name
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong base offset for param array event source

High Severity

In eventDynamicArraySource?, the Expr.param name case sets dataOffsetExpr to indexedDynamicBaseOffsetExpr dynamicSource name, which resolves to {name}_abs_offset (the position of the array's length word). The old code used YulExpr.ident s!"{name}_data_offset", which points 32 bytes later to the first data element. Since dataOffsetExpr is used as the base for element iteration (dataOffsetExpr + i * elemWordSize), every element read is off by −32 bytes — element 0 reads the length word itself, and all subsequent reads are shifted.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4081e31. Configure here.

@Th0rgal Th0rgal merged commit 3b7e69b into main May 14, 2026
6 checks passed
@Th0rgal Th0rgal deleted the codex/macro-event-dynamic-array-sources branch May 14, 2026 19:12
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