Skip to content

starknet_os: add the privacy proof-fact fold tree - #15091

Open
einat-starkware wants to merge 1 commit into
claude/privacy-proof-os-verify-gsxf2h-1-rust-leaf-digestfrom
claude/privacy-proof-os-verify-gsxf2h-2-rust-tree-fold
Open

einat-starkware wants to merge 1 commit into
claude/privacy-proof-os-verify-gsxf2h-1-rust-leaf-digestfrom
claude/privacy-proof-os-verify-gsxf2h-2-rust-tree-fold

Conversation

@einat-starkware

Copy link
Copy Markdown
Contributor

Second PR of the privacy proof-fact fold stack. Builds the fold tree above the leaf digest, in Rust:

  • FoldEntry (circuit hash + output digest, 16 u32 words) and the two canonical_small circuit-hash constants (leaf verifier, multiverifier; placeholders until the production registry lands).
  • fold_block_proof_facts: leaf entries folded pairwise left-to-right with a carried trailing entry; a single transaction self-folds, so the block root is always a multiverifier node.
  • compute_fold_digest: the digest the Cairo circuit verifier outputs for a proof whose facts fold to a given entry.

Tested against the proving side's four_leaves golden fixture (a real proven tree).

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

🤖 Generated with Claude Code

https://claude.ai/code/session_01XmPJM3Wph4QLmFmhcxVsh4


Generated by Claude Code

@cursor

cursor Bot commented Sep 2, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Self-contained digest/fold logic with golden tests; circuit hashes are explicit test-registry placeholders and callers are not wired in this PR.

Overview
Extends proof_fact_fold with the privacy proof-fact fold tree above the existing leaf digest: a FoldEntry (leaf/multiverifier circuit hash + Blake2s output digest), placeholder canonical_small registry hashes for leaf verifier and multiverifier, and fold_block_proof_facts to turn each transaction’s proof facts into leaf entries and fold them pairwise (trailing odd entry carried; a single tx self-folds so the block root is always a multiverifier node). Also adds compute_fold_digest (verifier output over the entry’s 16 u32 words) and internal fold helpers that hash pairs of children’s raw 32-word preimages.

Adds a four_leaves golden test aligned with the proving side’s recursive-tree fixture, alongside the existing leaf-digest golden.

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

@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

The recursive proof tree digest chain over the leaf digests, exactly as the
proving side builds it: adjacent entries pair left to right into
blake2s(circuit_hash_L || output_L || circuit_hash_R || output_R) parents
carrying the multiverifier's circuit hash, a trailing unpaired entry is
carried unchanged, and a single-entry block self-folds; compute_fold_digest
is the circuit verifier's output digest of an entry. The circuit hash
constants come from the canonical_small registry (production values pending).
Pinned against the proving side's four_leaves golden root output.

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-2-rust-tree-fold branch from 8654747 to 1f626c0 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