Skip to content

feat: move event size check from declaration to private emission (#22168) [v4-next backport]#22182

Merged
Thunkar merged 4 commits intobackport-to-v4-next-stagingfrom
claudebox/backport-22168-event-size-check
Apr 1, 2026
Merged

feat: move event size check from declaration to private emission (#22168) [v4-next backport]#22182
Thunkar merged 4 commits intobackport-to-v4-next-stagingfrom
claudebox/backport-22168-event-size-check

Conversation

@AztecBot
Copy link
Copy Markdown
Collaborator

Summary

Backport of #22168 to v4-next.

The #[event] macro previously enforced MAX_EVENT_SERIALIZED_LEN at declaration time, blocking valid use cases like large public-only events. The size constraint only applies to private emission (due to encryption overhead), so the check now lives in encode_private_event_message instead. Adds a test contract and e2e test proving large events work when emitted publicly.

Conflict Resolution

The invalid_event comp-failure contract had a conflict because on v4-next the InvalidEvent struct is defined inline (with a custom Serialize impl) rather than in a separate module. Resolution kept the inline definition while updating the function body to use the new self.emit().deliver_to() pattern instead of get_event_type_id().

Changes

  • Removed event size static assertion from #[event] macro's get_event_type_id()
  • Added size check to encode_private_event_message (only enforced for private emission)
  • Updated invalid_event comp-failure contract to emit privately instead of calling get_event_type_id()
  • Added large_public_event_contract test contract
  • Added e2e test for large public events

ClaudeBox log: https://claudebox.work/s/e313e5935f72366d?run=1

@AztecBot AztecBot added ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR. labels Mar 31, 2026
v4-next's Noir compiler requires #[abi(tag)] attributes to be on structs
inside contract bodies. Moving InvalidEvent to a separate file triggers
'#[abi(tag)] attributes can only be used in contracts'.
@AztecBot
Copy link
Copy Markdown
Collaborator Author

Flakey Tests

🤖 says: This CI run detected 1 tests that failed, but were tolerated due to a .test_patterns.yml entry.

\033FLAKED\033 (8;;http://ci.aztec-labs.com/31e9e3f3222632be�31e9e3f3222632be8;;�):  yarn-project/end-to-end/scripts/run_test.sh simple src/e2e_epochs/epochs_l1_reorgs.parallel.test.ts "updates L1 to L2 messages changed due to an L1 reorg" (67s) (code: 0) group:e2e-p2p-epoch-flakes

@Thunkar Thunkar marked this pull request as ready for review April 1, 2026 05:56
@Thunkar Thunkar requested a review from nventuro as a code owner April 1, 2026 05:56
@Thunkar Thunkar enabled auto-merge April 1, 2026 05:56
@Thunkar Thunkar merged commit 6b3d875 into backport-to-v4-next-staging Apr 1, 2026
13 checks passed
@Thunkar Thunkar deleted the claudebox/backport-22168-event-size-check branch April 1, 2026 05:56
AztecBot added a commit that referenced this pull request Apr 1, 2026
BEGIN_COMMIT_OVERRIDE
cherry-pick: feat: move event size check from declaration to private
emission (#22168)
fix: prevent oracle failure on tag computation for invalid recipient
(#22163)
feat: move event size check from declaration to private emission
(#22168) [v4-next backport] (#22182)
fix(cli-wallet): peek claim stack instead of popping for
estimate-gas-only (#22196)
fix: use Fr.fromString for CLI wallet claim params to handle decimal
values (#22197)
fix: indefinite retry for prover node and agent broker communication
(#22202)
END_COMMIT_OVERRIDE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants