Skip to content

feat: move event size check from declaration to private emission#22168

Merged
benesjan merged 4 commits into
merge-train/fairiesfrom
nv/change-event-guard
Mar 31, 2026
Merged

feat: move event size check from declaration to private emission#22168
benesjan merged 4 commits into
merge-train/fairiesfrom
nv/change-event-guard

Conversation

@nventuro

Copy link
Copy Markdown
Contributor

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.

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.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@benesjan benesjan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice!

@benesjan benesjan enabled auto-merge (squash) March 31, 2026 07:48
@benesjan benesjan added the claudebox Owned by claudebox. it can push to this PR. label Mar 31, 2026
@benesjan

Copy link
Copy Markdown
Contributor

the failure looks like some CI nonsense so merging in base branch to hopefully get this to merge

@benesjan benesjan merged commit ed8f9f9 into merge-train/fairies Mar 31, 2026
12 checks passed
@benesjan benesjan deleted the nv/change-event-guard branch March 31, 2026 11:56
@AztecBot

Copy link
Copy Markdown
Collaborator

❌ Failed to cherry-pick to v4-next due to conflicts. (🤖) View backport run.

Thunkar added a commit that referenced this pull request Apr 1, 2026
) [v4-next backport] (#22182)

## 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
github-merge-queue Bot pushed a commit that referenced this pull request Apr 1, 2026
BEGIN_COMMIT_OVERRIDE
feat!: remove ALL_SCOPES (#22136)
chore: syncing oracle versions (#22131)
fix(aztec-nr): use registered accounts as capsule test scopes (#22171)
chore: reverting accidentally merged AI slop (#22175)
feat: move event size check from declaration to private emission
(#22168)
fix: prevent oracle failure on tag computation for invalid recipient
(#22163)
feat: disable noir test cache on merge-train/fairies (#22206)
END_COMMIT_OVERRIDE
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

backport-to-v4-next claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants