Skip to content

feat(batch): construct BatchNoteTree during batch construction - #3022

Draft
mmagician wants to merge 4 commits into
mmagician-claude/batch-kernel-logicfrom
mmagician-claude/wire-batch-note-tree
Draft

feat(batch): construct BatchNoteTree during batch construction#3022
mmagician wants to merge 4 commits into
mmagician-claude/batch-kernel-logicfrom
mmagician-claude/wire-batch-note-tree

Conversation

@mmagician

@mmagician mmagician commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #2905. First of two PRs for #3020.

Builds the BatchNoteTree during batch construction, making the batch's note tree root available to block building and, later, to the batch kernel:

  • ProposedBatch builds a BatchNoteTree over its final (post-erasure) output notes and exposes it via batch_note_tree() / into_parts. The tree is not serialized; deserialization reconstructs it deterministically.
  • [BREAKING] ProvenBatch carries the tree root in a new note_tree_root field (changes the serialization format and the new_unchecked signature). The root is stored as-is and must not be trusted at a trust boundary until a consumer binds it to the output notes. Today no consumer does: the block still recomputes its note tree from the output notes themselves.

The follow-up PR wires the per-batch trees into block construction via BlockNoteTree::insert_batch_note_subtree and stops cross-batch note erasure, so that per-batch roots remain valid at the block level.

Comment thread crates/miden-protocol/src/batch/proposed_batch.rs Outdated
@mmagician mmagician changed the title feat(batch): construct BatchNoteTree during batch construction feat(batch): construct BatchNoteTree during batch construction Jun 1, 2026
@mmagician mmagician 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 Jun 1, 2026
mmagician pushed a commit that referenced this pull request Jun 1, 2026
claude added 4 commits August 18, 2026 11:41
Build a BatchNoteTree over the batch's final (non-erased) output notes in
ProposedBatch::new_batch_inner, store it on ProposedBatch, expose it via a
batch_note_tree() accessor, and include it in into_parts. This is the Rust-side
foundation for the batch kernel outputting BATCH_NOTE_TREE_ROOT.

Part of #3020.
Propagate the BatchNoteTree root computed during batch construction onto
ProvenBatch via a new note_tree_root field (serialization, new_unchecked, and
note_tree_root() accessor), so the commitment flows to block construction and is
ready for batch-kernel verification. LocalBatchProver passes the root from the
ProposedBatch tree.

Also renames the construction error variant to BatchNoteTreeConstructionFailed
and adds an empty-output-notes batch tree test.

Part of #3020.
Address review feedback: add a ProvenBatch serialization round-trip test
asserting note_tree_root survives, assert batch_note_tree equality in the
ProposedBatch round-trip test, and document that ProvenBatch::note_tree_root is
unvalidated and must not be trusted at a trust boundary until a consumer binds
it to the output notes.
@mmagician
mmagician changed the base branch from next to mmagician-claude/batch-kernel-logic August 18, 2026 11:56
@mmagician
mmagician force-pushed the mmagician-claude/wire-batch-note-tree branch from 8f6e032 to afcad85 Compare August 18, 2026 11:56
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.

2 participants