feat(batch): construct BatchNoteTree during batch construction - #3022
Draft
mmagician wants to merge 4 commits into
Draft
feat(batch): construct BatchNoteTree during batch construction#3022mmagician wants to merge 4 commits into
BatchNoteTree during batch construction#3022mmagician wants to merge 4 commits into
Conversation
mmagician
commented
Jun 1, 2026
BatchNoteTree during batch construction
mmagician
pushed a commit
that referenced
this pull request
Jun 1, 2026
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
changed the base branch from
next
to
mmagician-claude/batch-kernel-logic
August 18, 2026 11:56
mmagician
force-pushed
the
mmagician-claude/wire-batch-note-tree
branch
from
August 18, 2026 11:56
8f6e032 to
afcad85
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #2905. First of two PRs for #3020.
Builds the
BatchNoteTreeduring batch construction, making the batch's note tree root available to block building and, later, to the batch kernel:ProposedBatchbuilds aBatchNoteTreeover its final (post-erasure) output notes and exposes it viabatch_note_tree()/into_parts. The tree is not serialized; deserialization reconstructs it deterministically.ProvenBatchcarries the tree root in a newnote_tree_rootfield (changes the serialization format and thenew_uncheckedsignature). 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_subtreeand stops cross-batch note erasure, so that per-batch roots remain valid at the block level.