fix(aztec-nr): return Option from decode functions and fix event commitment capacity#21264
Conversation
| ) -> Field { | ||
| let mut commitment_preimage = | ||
| BoundedVec::<_, 1 + MAX_EVENT_SERIALIZED_LEN>::from_array([randomness, event_type_id]); | ||
| BoundedVec::<_, 2 + MAX_EVENT_SERIALIZED_LEN>::from_array([randomness, event_type_id]); |
There was a problem hiding this comment.
This was actually a bug. We are adding two fields, so it should have been + 2 all along
The new test below would fail before this fix
|
|
||
| (note_type_id, owner, storage_slot, randomness, packed_note) | ||
| ) -> Option<(Field, AztecAddress, Field, Field, BoundedVec<Field, MAX_NOTE_PACKED_LEN>)> { | ||
| if msg_content.len() < PRIVATE_NOTE_MSG_PLAINTEXT_RESERVED_FIELDS_LEN { |
There was a problem hiding this comment.
We used to panic when msg_content.len() == PRIVATE_NOTE_MSG_PLAINTEXT_RESERVED_FIELDS_LEN. Now we allow it per @benesjan 's suggestion
We might want to have >= for notes and events as well as we might want to emit no-content note to represent e.g. an "is_registered" flag.
There was a problem hiding this comment.
I think we should add an empty note and empty event tests to verify this works.
That makes sense to do in a followup PR though. Any reason why this change needed to be here?
Would wait for Nico's opinion on if we want to support empty notes and events before investing more time in this.
There was a problem hiding this comment.
I had tests called decode_succeeds_with_only_reserved_fields (would be the same as empty) for this scenario. Did you mean e2e tests?
Anyways, I reverted the behavior back to how it worked, we can revisit if we want to change it later
There was a problem hiding this comment.
If we already had this tested then there was no reason to revert this. I just thought the tests would increase the scope too much.
|
|
||
| (event_type_id, randomness, serialized_event) | ||
| ) -> Option<(EventSelector, Field, BoundedVec<Field, MAX_EVENT_SERIALIZED_LEN>)> { | ||
| if msg_content.len() < PRIVATE_EVENT_MSG_PLAINTEXT_RESERVED_FIELDS_LEN { |
There was a problem hiding this comment.
We used to panic when msg_content.len() == PRIVATE_EVENT_MSG_PLAINTEXT_RESERVED_FIELDS_LEN. Now we allow it per @benesjan 's suggestion
We might want to have >= for notes and events as well as we might want to emit no-content note to represent e.g. an "is_registered" flag.
# Conflicts: # noir-projects/aztec-nr/aztec/src/messages/discovery/partial_notes.nr # noir-projects/aztec-nr/aztec/src/messages/logs/partial_note.nr
|
❌ Failed to cherry-pick to |
Adapted PR #21264 changes to v4-next: - v4-next uses protocol logging (debug_log/warn_log_format) instead of aztecnr macros - v4-next partial note decode has storage_slot (4 reserved fields vs 3) - v4-next process_message.nr has no custom message handling
Adapted PR #21264 changes for v4-next: - Keep storage_slot in partial note decode (4 reserved fields vs 3 on next) - Use debug_log_format instead of aztecnr_warn_log_format (not available on v4-next) - Keep v4-next's simpler process_message without custom message handling
BEGIN_COMMIT_OVERRIDE fix: skip oracle version check for pinned protocol contracts (#21349) fix: not reusing tags of partially reverted txs (#20817) feat: move storage_slot from partial commitment to completion hash (#21351) feat: offchain reception (#20893) fix: handle workspace members in needsRecompile crate collection (#21284) fix(aztec-nr): return Option from decode functions and fix event commitment capacity (#21264) fix: handle bad note lengths on compute_note_hash_and_nullifier (#21271) fix: address review feedback from PRs #21284 and #21237 (#21369) fix: claim contract & improve nullif docs (#21234) feat!: auto-enqueue public init nullifier for contracts with public functions (#20775) fix: search for all note nonces instead of just the one for the note index (#21438) fix: set anvilSlotsInAnEpoch in e2e_offchain_payment to prevent finalization race (#21452) fix: complete legacy oracle mappings for all pinned contracts (#21404) fix: correct inverted constrained encryption check in message delivery (#21399) feat!: improve L2ToL1MessageWitness API (#21231) END_COMMIT_OVERRIDE
Adapted PR #21264 changes for backport-to-v4-staging: - Keep storage_slot in partial note decode (4 reserved fields vs 3 on next) - Use debug_log_format instead of aztecnr_warn_log_format (not available on v4) - Keep v4's simpler process_message without custom message handling - Fix private_events.nr auto-merged import of unavailable aztecnr_warn_log_format
BEGIN_COMMIT_OVERRIDE fix(aztec-nr): return Option from decode functions and fix event commitment capacity (backport #21264) (#21360) fix: backport #21271 — handle bad note lengths on compute_note_hash_and_nullifier (#21364) fix: not reusing tags of partially reverted txs (#20817) chore: revert accidental backport of #20817 (#21583) feat: Implement commit all and revert all for world state checkpoints (#21532) cherry-pick: fix: dependabot alerts (#21531) fix: dependabot alerts (backport #21531 to v4) (#21592) fix: backport #21443 — Don't update state if we failed to execute sufficient transactions (v4) (#21610) chore: Fix msgpack serialisation (#21612) END_COMMIT_OVERRIDE --------- Co-authored-by: Jan Beneš <janbenes1234@gmail.com> Co-authored-by: PhilWindle <60546371+PhilWindle@users.noreply.github.com> Co-authored-by: Phil Windle <philip.windle@gmail.com> Co-authored-by: Santiago Palladino <santiago@aztecprotocol.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: ludamad <adam.domurad@gmail.com>
BEGIN_COMMIT_OVERRIDE fix(aztec-nr): return Option from decode functions and fix event commitment capacity (backport #21264) (#21360) fix: backport #21271 — handle bad note lengths on compute_note_hash_and_nullifier (#21364) fix: not reusing tags of partially reverted txs (#20817) chore: revert accidental backport of #20817 (#21583) feat: Implement commit all and revert all for world state checkpoints (#21532) cherry-pick: fix: dependabot alerts (#21531) fix: dependabot alerts (backport #21531 to v4) (#21592) fix: backport #21443 — Don't update state if we failed to execute sufficient transactions (v4) (#21610) chore: Fix msgpack serialisation (#21612) fix(p2p): fall back to maxTxsPerCheckpoint for per-block tx validation (#21605) chore: merge v4 into backport-to-v4-staging (#21618) fix(revert): avm sim uses event loop again (#21138) (#21630) fix(e2e): remove historic/finalized block checks from epochs_multiple test (#21642) fix: clamp finalized block to oldest available in world-state (#21643) fix: skip handleChainFinalized when block is behind oldest available (#21656) chore: demote finalized block skip log to trace (#21661) fix: off-by-1 in getBlockHashMembershipWitness archive snapshot (backport #21648) (#21663) fix: capture txs not available error reason in proposal handler (#21670) chore: add L1 inclusion time to stg public (#21665) END_COMMIT_OVERRIDE --------- Co-authored-by: Jan Beneš <janbenes1234@gmail.com> Co-authored-by: PhilWindle <60546371+PhilWindle@users.noreply.github.com> Co-authored-by: Phil Windle <philip.windle@gmail.com> Co-authored-by: Santiago Palladino <santiago@aztecprotocol.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: ludamad <adam.domurad@gmail.com> Co-authored-by: Alex Gherghisan <alexghr@users.noreply.github.com>
Summary
compute_private_serialized_event_commitment(capacity1 + MAX→2 + MAX) that would panic on max-size eventsOptioninstead of panicking on malformed inputCloses F-357