Skip to content

feat: block kernel skeleton - #3703

Merged
mmagician merged 16 commits into
nextfrom
fumuran-claude/block-kernel-skeleton
Aug 27, 2026
Merged

feat: block kernel skeleton#3703
mmagician merged 16 commits into
nextfrom
fumuran-claude/block-kernel-skeleton

Conversation

@Fumuran

@Fumuran Fumuran commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Towards #1706.

Block production is currently unproven: LocalBlockProver::prove returns an empty BlockProof without reading its inputs, and every validation and tree computation lives in native Rust in ProposedBlock. Porting all of it to MASM at once is not tractable, so this follows the batch kernel's path (#2904) and lands the contract and the surrounding plumbing first, with a kernel that drops its inputs and emits the empty word output shape.

The contract is:

Inputs:  [PREV_BLOCK_COMMITMENT, BATCHES_COMMITMENT, pad(8)]
Outputs: [BLOCK_COMMITMENT, NULLIFIER_COMMITMENT, pad(8)]

PREV_BLOCK_COMMITMENT anchors the block to the chain state it extends and will bind the previous header that the kernel reads from the advice provider. BATCHES_COMMITMENT is needed because the header's tx_commitment flattens batches away, losing the grouping that drives note erasure and block-note-tree placement. NULLIFIER_COMMITMENT follows the shape proposed in this comment; it is worth keeping as a separate output because BlockBody::created_nullifiers is not checked against the header anywhere today.

Changes

  • Added the miden-block-kernel MASM package and its build.rs wiring, mirroring kernels/batch. It also had to be registered in the MASM workspace members, otherwise assembly fails with "package is not a member of a workspace".
  • Added BlockKernel and BlockOutputs alongside the batch equivalents, plus OrderedBatches::commitment for the sequential hash over batch IDs that BATCHES_COMMITMENT names.
  • BlockProof now carries an ExecutionProof with real serialization, replacing the field-less placeholder and its two serialization TODOs.
  • miden-block-prover gained BlockExecutor and ExecutedBlock, and LocalBlockProver::prove now proves an executed block instead of returning a placeholder.

The kernel verifies nothing yet, so the proof does not bind the block's account updates, notes or nullifiers; LocalBlockProver's docs say so explicitly. MockChain::prove_block keeps using prove_dummy to avoid proving a STARK per mock block. No commitments or account IDs change.

claude and others added 4 commits August 24, 2026 14:47
Establishes the public input/output contract for the block kernel plus the
Rust plumbing that surrounds it. The kernel does not yet perform any
verification: it drops its public inputs and emits the empty word output
shape.

Inputs are [PREV_BLOCK_COMMITMENT, BATCHES_COMMITMENT] and outputs are
[BLOCK_COMMITMENT, NULLIFIER_COMMITMENT]. PREV_BLOCK_COMMITMENT anchors the
block to the chain state it extends and will bind the previous header
supplied through the advice provider. BATCHES_COMMITMENT is a new sequential
hash over the block's BatchIds, which pins both the batch set and its order.

BlockProof now carries an ExecutionProof, and LocalBlockProver proves an
ExecutedBlock produced by the new BlockExecutor rather than returning a
placeholder.

towards #1706

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011x14HrJEs4WFDf1qcA898w
Trim the CHANGELOG entry to a single sentence and add the post-auto-pad
stack tracker to the block kernel's main procedure.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011x14HrJEs4WFDf1qcA898w
prove_dummy was gated on cfg(any(feature = "testing", test)). Under
cargo check --all-targets --no-default-features, the lib test target
activates cfg(test), so prove_dummy compiled while miden-protocol/testing
stayed off, leaving BlockProof::new_dummy undefined. cfg(test) is per-crate
and does not enable a dependency's testing feature.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011x14HrJEs4WFDf1qcA898w
@Fumuran Fumuran added the pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority label Aug 24, 2026
claude and others added 2 commits August 25, 2026 00:27
The block kernel itself is additive; what breaks is the BlockProof and
LocalBlockProver rework. Separate the two so the BREAKING tag sits on the
change that actually breaks callers. Also fix a typo in the kernel doc
comment.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011x14HrJEs4WFDf1qcA898w
@Fumuran
Fumuran marked this pull request as ready for review August 24, 2026 22:01

@partylikeits1983 partylikeits1983 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!

I left two non blocking comments about adding batches_commitment to the BlockProof struct for future BlockProof verification and adding an e2e verification test. They can be addressed here or in a follow up.

Comment thread crates/miden-protocol/src/block/block_proof.rs Outdated
Comment thread crates/miden-testing/src/kernel_tests/block/test_block_kernel.rs

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

Looks good! Left a few suggestions.

Comment thread crates/miden-protocol/src/batch/ordered_batches.rs Outdated
Comment thread crates/miden-protocol/src/block/block_proof.rs Outdated
Comment thread crates/miden-protocol/src/block/kernel.rs Outdated
Comment thread crates/miden-protocol/src/block/mod.rs Outdated
Comment thread crates/miden-protocol/src/errors/mod.rs Outdated
Comment thread crates/miden-testing/src/kernel_tests/block/test_block_kernel.rs Outdated
claude and others added 9 commits August 25, 2026 22:56
BlockProof was a placeholder wrapper around nothing. ProvenTransaction and
ProvenBatch both carry a raw ExecutionProof, so ProvenBlock now does the
same and the wrapper is removed.

Adds a TODO on the proof field: the kernel takes BATCHES_COMMITMENT as a
public input, but ProvenBlock carries neither that commitment nor the
BatchIds behind it, and BlockBody flattens away the per-batch grouping of
transactions needed to recompute them. Until that is addressed the proof's
claim cannot be reconstructed or reconciled against the block's data.

Addresses #3703 (comment)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011x14HrJEs4WFDf1qcA898w
Point the two block kernel entries at PR #3703 rather than the tracking
issue, and fold the duplicate `### Changes` heading left by the merge from
next back into one section.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011x14HrJEs4WFDf1qcA898w
…kernel-skeleton

# Conflicts:
#	crates/miden-protocol/src/block/proven_block.rs
#	crates/miden-testing/src/mock_chain/chain_builder.rs

@mmagician mmagician 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 great!

@mmagician
mmagician enabled auto-merge August 27, 2026 12:58
@mmagician
mmagician added this pull request to the merge queue Aug 27, 2026
Merged via the queue into next with commit 7962dbb Aug 27, 2026
19 checks passed
@mmagician
mmagician deleted the fumuran-claude/block-kernel-skeleton branch August 27, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

5 participants