apollo_starknet_os_program,starknet_os,blockifier: emit the proof-fact fold in the OS output - #15064
Conversation
PR SummaryHigh Risk Overview Per block: invoke execution records non-empty proof facts (including on reverts) via a new Multi-block / aggregator: Rust & protocol: output parsing, aggregator header wiring, Reviewed by Cursor Bugbot for commit 93f03f6. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
Artifacts upload workflows: |
93dfeeb to
811a6c1
Compare
cb06bb9 to
d1023d1
Compare
d1023d1 to
7cc17ba
Compare
7cc17ba to
cb470b4
Compare
cb470b4 to
96dd329
Compare
96dd329 to
5f9bd84
Compare
…t fold in the OS output Wires the privacy proof-fact fold into the OS and its output, per the decision that the block-root fold continues in the Starknet aggregator: - During execution, each invoke transaction's validated proof facts are recorded (reverted transactions included - their facts are part of the block) via a new proof_facts_references implicit, threaded only through the execute_transactions chain. - At block end the OS folds the recorded references into the block's root entry and emits (proof_facts_root_output_low/high, n_proof_facts_transactions) in OsOutputHeader - the digest packed as the Uint256 low/high halves. Blocks with no contributing transactions emit zeros; the virtual OS always does (it rejects proof facts). - combine_blocks - shared by the multi-block OS and the aggregator - folds the contributing blocks' root entries pairwise (a lone block root is carried, not self-folded) and emits the combined values, defining the multiblock tree shape the proving side must mirror. - Rust: output parsing, the aggregator header writer, mirrors of the combine fold and digest packing, and flow-test assertions comparing the OS's emitted fold against the Rust mirror end to end. Program hashes, bytecode-length pins, and the os_resources measurements are regenerated (+14 steps per invoke); the new virtual OS hash replaces the older allowed_virtual_os_program_hashes entry, keeping the current one so committed proof fixtures stay valid. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmPJM3Wph4QLmFmhcxVsh4
5f9bd84 to
93f03f6
Compare
Part 5 of the privacy proof-fact fold stack, on top of #15093 (the stack bottom was split into #15090 ← #15091 ← #15092 ← #15093 per review feedback). Implements the decision that the block-root fold continues in the Starknet aggregator.
OS side (per block):
check_proof_factsalready validated, so the §4.5 binding-by-construction holds — are recorded during execution via a newproof_facts_referencesimplicit, threaded only through theexecute_transactionschain (not the syscall layer, and without touchingOsCarriedOutputs/the revert-dummy hint). Reverted transactions are included: their facts are part of the block and their proofs were verified regardless of the revert.(proof_facts_root_output_low/high, n_proof_facts_transactions)inOsOutputHeader— the root output digest packed as Uint256 low/high halves (the same compositionencode_felt252_data_and_calc_blake2suses). A block with no contributing transactions emits zeros and is skipped by higher folds; the virtual OS always emits zeros (it rejects proof facts; asserted).Combine side (multiblock OS + aggregator, one implementation):
combine_blockscollects the contributing blocks' root entries (unpacking with range checks; all entries are multiverifier nodes since a block always folds to one entry), folds them pairwise with the carry rule — a lone block root is carried, not self-folded — and emits the combined values. This defines the hierarchical block→multiblock tree shape the proving side must mirror; a linear fold was rejected since it would serialize upstream proving.Rust: output parsing +
CommonOsOutputfields, the aggregator header writer, mirrors of the combine fold and digest packing, and flow-test assertions comparing the OS's emitted fold against the Rust mirror end to end (multi-block, multiple contributing transactions).Protocol-visible changes:
OsOutputHeader.SIZE9 → 12; OS/virtual-OS/aggregator program hashes and bytecode pins regenerated; os_resources +14 steps per invoke (the recording cost); the new virtual-OS hash replaces the olderallowed_virtual_os_program_hashesentry, keeping the current one so the committed proof fixtures stay valid without re-proving.Verified: all three Cairo programs compile;
starknet_os275/275;apollo_starknet_os_program6/6; flow tests 115/115; clippy clean.Flagged for review: the aggregator program now reaches
blake_with_opcodeon its execution path (when blocks contribute proof facts) — its proving layout must support the blake opcode (e.g. stwo'sall_cairo_stwo); if the aggregator is proven under a layout without it, the fold should switch to the builtin-based blake2s (digests unchanged,bitwisebuiltin needed).🤖 Generated with Claude Code
https://claude.ai/code/session_01XmPJM3Wph4QLmFmhcxVsh4