apollo_starknet_os_program,starknet_os: add Cairo0 privacy proof-fact fold - #15059
Conversation
… fold Adds the OS-side fact fold for privacy proofs in Cairo0: the leaf output digest via encode_felt252s_to_u32s + blake_with_opcode over proof_facts[2..], the pairwise fold over raw u32 words with the odd-entry carry rule, the single-entry self-fold, and the circuit verifier's output digest. Entries are contiguous 16-word [circuit_hash, output_digest] blocks, so two adjacent entries are the parent digest's exact 32-word blake preimage. The module is not yet reachable from the OS program; it is compiled as a standalone test program (test_programs feature), so the OS and aggregator program hashes and bytecode-length pins are unchanged. Tests pin it bit-for-bit against the Rust mirror (self-fold, carry at one and two layers, felt-encoding boundaries, circuit hash constants). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmPJM3Wph4QLmFmhcxVsh4
PR SummaryMedium Risk Overview The module is compiled as a standalone test program (build hook + Tests extend Reviewed by Cursor Bugbot for commit 2573191. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
Closing: split into two smaller PRs per review feedback — #15092 (Cairo leaf digest) and #15093 (Cairo fold tree). No content is lost; #15064 is now retargeted onto #15093. Generated by Claude Code |
Part 2 of 2 of the privacy proof-fact fold stack, on top of #15058.
Adds the OS-side fact fold in Cairo0 (
starkware/starknet/core/os/proof_fact_fold.cairo):encode_felt252s_to_u32s+blake_with_opcodeoverproof_facts[2..].[circuit_hash, output_digest]blocks, so two adjacent entries are literally the parent digest's 32-word blake preimage — no copying at fold levels.compute_fold_digest— the digest the Cairo circuit verifier outputs for the proof whose facts fold to a given entry.canonical_smallregistry values, documented as placeholders pending the production registry).The module is not yet reachable from the OS program: it is compiled as a standalone test program under the
test_programsfeature, so the OS and aggregator program hashes and the bytecode-length pins are unchanged (verified by the existing pin tests). Wiring it into the OS output is deferred to the layering decision (where the block root continues — aggregator vs. a new program).Tests pin the Cairo implementation bit-for-bit against the Rust mirror from #15058: the self-fold, the carry rule at one and at two layers, deeper trees, the felt-encoding boundaries at 2^63, the fold digest, and the circuit hash constants.
🤖 Generated with Claude Code
https://claude.ai/code/session_01XmPJM3Wph4QLmFmhcxVsh4
Generated by Claude Code