Skip to content

apollo_starknet_os_program,starknet_os: add the Cairo0 proof-fact leaf digest - #15092

Open
einat-starkware wants to merge 1 commit into
claude/privacy-proof-os-verify-gsxf2h-2-rust-tree-foldfrom
claude/privacy-proof-os-verify-gsxf2h-3-cairo-leaf-digest
Open

einat-starkware wants to merge 1 commit into
claude/privacy-proof-os-verify-gsxf2h-2-rust-tree-foldfrom
claude/privacy-proof-os-verify-gsxf2h-3-cairo-leaf-digest

Conversation

@einat-starkware

@einat-starkware einat-starkware commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Third PR of the privacy proof-fact fold stack. First Cairo0 piece: proof_fact_fold.cairo with the leaf layer only — compute_leaf_output_digest (felt encoding + blake opcode) and the circuit-hash getters (dw data tables, the stdlib _get_sigma idiom), plus the standalone-program build wiring and the Rust↔Cairo test harness (an entry-point runner for the module's functions). Not yet reachable from the OS program.

Every Cairo function is tested for bit-exact agreement with the Rust mirror, including felt-encoding boundary cases around 2^63.

Stack: leaf digest (#15090) ← rust tree fold (#15091) ← this PR ← cairo tree fold ← OS output wiring (#15064) ← registry pin (#15086) ← verifier task (#15088).

🤖 Generated with Claude Code

https://claude.ai/code/session_01XmPJM3Wph4QLmFmhcxVsh4

@cursor

cursor Bot commented Sep 2, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Test-only Cairo module and parity tests; no OS runtime or production registry wiring yet.

Overview
Introduces the first Cairo0 piece of the privacy proof-fact fold stack: a standalone proof_fact_fold module that mirrors the proving side’s leaf layer so digests can later be checked against the verifier’s public output.

proof_fact_fold.cairo adds compute_leaf_output_digest (encode felts after the two version markers, then BLAKE2s via opcode) and getters for pinned leaf-verifier and multiverifier circuit hashes (dw tables). The module is not linked into the main OS program yet.

Build and tests: compile_test_contracts compiles this Cairo file to proof_fact_fold_bytes, exposed as PROOF_FACT_FOLD_BYTES. proof_fact_fold_test gains a small Cairo entry-point runner and rstest cases that assert bit-exact agreement with the existing Rust proof_fact_fold mirror, including felt-encoding boundaries around 2^63.

Reviewed by Cursor Bugbot for commit 1fcfd19. Bugbot is set up for automated code reviews on this repo. Configure here.

@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

…f digest

The Cairo0 mirror of the leaf layer: the per-transaction leaf output digest
(encode_felt252s_to_u32s + blake_with_opcode over proof_facts[2:]) and the
leaf-verifier / multiverifier circuit hash constants. 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 are
unchanged. Tests pin the Cairo leaf digest and constants bit-for-bit against
the Rust mirror, including the felt-encoding boundaries at 2^63.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmPJM3Wph4QLmFmhcxVsh4
@einat-starkware
einat-starkware force-pushed the claude/privacy-proof-os-verify-gsxf2h-3-cairo-leaf-digest branch from efaa234 to 1fcfd19 Compare September 17, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants