Skip to content

starknet_os: add the privacy proof-fact leaf digest - #15090

Open
einat-starkware wants to merge 1 commit into
mainfrom
claude/privacy-proof-os-verify-gsxf2h-1-rust-leaf-digest
Open

einat-starkware wants to merge 1 commit into
mainfrom
claude/privacy-proof-os-verify-gsxf2h-1-rust-leaf-digest

Conversation

@einat-starkware

Copy link
Copy Markdown
Contributor

First PR of the privacy proof-fact fold stack (OS-side design: reproduce the proving side's recursive proof-tree digest fold so the circuit verifier's output digest can be compared against an OS-computed value).

This PR adds only the leaf layer of the digest chain, in Rust: starknet_os::proof_fact_fold with compute_leaf_output_digest — one transaction's leaf output digest, blake2s(encode_felt252s_to_u32s(proof_facts[2..])) (dropping the proof version and variant markers, keeping [program_hash, ...virtual OS output]), exactly the preimage the leaf simple bootloader hashes to its own output.

Tested against a golden value taken from the proving side (stwo_run_and_prove_recursive_tree tests).

Stack: this PR ← rust tree fold ← 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
New isolated module and golden test only; no changes to execution, verification, or existing OS paths.

Overview
Introduces starknet_os::proof_fact_fold, the first OS-side piece of the privacy proof-fact fold stack. It computes a single transaction’s leaf output digest the same way the proving side does: Blake2s over u32-encoded felts from proof_facts[2..] (skipping the two version markers, keeping program hash and virtual OS output).

Adds a small blake2s_over_u32_words helper and exports digest types as eight little-endian u32 words. A unit test locks the leaf digest to a golden from stwo_run_and_prove_recursive_tree; nothing in the OS runner is wired to this yet—that comes in later stack PRs.

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

@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

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

@Yoni-Starkware made 1 comment.
Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on einat-starkware).


crates/starknet_os/src/proof_fact_fold.rs line 25 at r1 (raw file):

}

pub fn blake2s_over_u32_words(words: &[u32]) -> Blake2sDigestWords {

See if you can use the stwo's impl

@einat-starkware
einat-starkware force-pushed the claude/privacy-proof-os-verify-gsxf2h-1-rust-leaf-digest branch from 9ad4558 to 12a9c13 Compare September 15, 2026 14:05
@einat-starkware

Copy link
Copy Markdown
Contributor Author

crates/starknet_os/src/proof_fact_fold.rs line 25 at r1 (raw file):

Previously, Yoni-Starkware (Yoni) wrote…

See if you can use the stwo's impl

Added a comment referencing the crate

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

:lgtm:

@Yoni-Starkware partially reviewed 3 files, made 1 comment, and resolved 1 discussion.
Reviewable status: all files reviewed (commit messages unreviewed), all discussions resolved (waiting on einat-starkware).

The digest of one privacy transaction's proof facts, exactly as the proving
side computes the corresponding leaf proof's public output:
blake2s(encode_felt252s_to_u32s(proof_facts[2..])) - dropping the proof
version and variant markers, matching the leaf simple bootloader's own output
hashing. Pinned against the proving side's leaf digest golden. The recursive
tree fold over these digests lands on top of this module.

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-1-rust-leaf-digest branch from 12a9c13 to 511537c Compare September 17, 2026 13:36

This branch has not been deployed

No deployments
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.

4 participants