Skip to content

feat(protocol): add output note sealing - #3923

Merged
partylikeits1983 merged 11 commits into
nextfrom
ajl-output-note-seal
Sep 25, 2026
Merged

partylikeits1983 merged 11 commits into
nextfrom
ajl-output-note-seal

Conversation

@partylikeits1983

@partylikeits1983 partylikeits1983 commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

summary:

This PR adds miden::protocol::output_note::seal(note_idx). Once sealed, any attempt to add assets or attachments fails. Sealing is irreversible within the transaction and idempotent; other output notes remain mutable.

The sealed flag is stored beside the dirty flag in output note memory. output_note::seal requires the active account to be the native account. The new output_note::is_sealed(note_idx) procedure returns the flag and can be called from any context.

Note sealing is opt in. Note serialization and commitments are unchanged. This provides the kernel prerequisite for #3918 and #3911.

Related: output note sealing discussion, #3909.

why this is needed:

The shielded PSWAP flow needs to create a private P2ID whose contents the recipient can reconstruct. Currently, the PSWAP filler can add assets or attachments to that output later in the transaction, changing its NoteId and making it unrecoverable from the expected details.

@partylikeits1983 partylikeits1983 added kernels Related to transaction, batch, or block kernels pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority labels Sep 22, 2026
@partylikeits1983 partylikeits1983 self-assigned this Sep 22, 2026
@partylikeits1983
partylikeits1983 marked this pull request as ready for review September 22, 2026 13:06

@zeapoz zeapoz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Implementation looks good to me! The question of whether this is the right approach I'll defer to other reviewers, but I left a couple of nits I spotted.

Comment thread crates/miden-testing/src/kernel_tests/tx/test_output_note.rs
Comment thread CHANGELOG.md Outdated
Comment thread docs/src/protocol_library.md Outdated
Comment thread crates/miden-protocol/src/transaction/kernel/memory.rs Outdated
Merge next at 701b6e1 to pick up the latest release workflow updates.

Link the sealing changelog entry to PR #3923, align the seal procedure table row, clarify the sealed-flag offset documentation, and rename the mixed test helper section to HELPERS.

Validation: 77 output-note, callback, and foreign-account tests passed; workspace formatting, targeted spelling, and diff checks passed.
partylikeits1983 added a commit that referenced this pull request Sep 23, 2026
Integrate PR #3923 and its latest next merge so PSWAP can compile and enforce immutable paybacks and remainders.

@bobbinth bobbinth 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.

Looks good! Thank you! I left a few comments inline - the biggest one is about adding the is_sealed procedure.

Comment thread crates/miden-protocol/asm/protocol/src/kernel_proc_offsets.masm Outdated
Comment thread crates/miden-protocol/src/transaction/kernel/memory.rs Outdated
Comment thread crates/miden-protocol/asm/kernels/transaction-core/src/memory.masm Outdated
Comment thread docs/src/protocol_library.md

@PhilippGackstatter PhilippGackstatter 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.

LGTM, left a few suggestions, nothing major.

Comment thread crates/miden-protocol/asm/kernels/transaction/lib/api.masm
Comment thread crates/miden-protocol/asm/kernels/transaction-core/src/output_note.masm Outdated
Comment thread crates/miden-protocol/asm/protocol/src/output_note.masm Outdated
Comment thread crates/miden-protocol/asm/protocol/src/output_note.masm Outdated
Comment thread crates/miden-testing/src/kernel_tests/tx/test_output_note.rs Outdated
Comment thread crates/miden-testing/src/kernel_tests/tx/test_output_note.rs Outdated
Comment thread crates/miden-testing/src/kernel_tests/tx/test_output_note.rs Outdated
Comment thread crates/miden-testing/src/kernel_tests/tx/test_output_note.rs
Comment thread crates/miden-testing/src/kernel_tests/tx/test_output_note.rs
Comment thread crates/miden-testing/src/kernel_tests/tx/test_output_note.rs Outdated

@zeapoz zeapoz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good! Left a question and a suggestion to reorganize some preexisting docs

Comment thread crates/miden-protocol/src/transaction/kernel/memory.rs Outdated
Comment thread crates/miden-testing/src/kernel_tests/tx/test_output_note.rs Outdated

@bobbinth bobbinth 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.

Looks good! Thank you!

@Fumuran Fumuran 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.

Looks great, I don't have any comments whatsoever!

@partylikeits1983
partylikeits1983 added this pull request to stack #3948 September 25, 2026 10:43
@partylikeits1983
partylikeits1983 added this pull request to the merge queue Sep 25, 2026
Merged via the queue into next with commit 6c0bf06 Sep 25, 2026
20 checks passed
@partylikeits1983
partylikeits1983 deleted the ajl-output-note-seal branch September 25, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kernels Related to transaction, batch, or block kernels pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants