Skip to content

starknet_os_flow_tests,starknet_os,starknet_transaction_prover: test the fold against the verifier - #15095

Open
einat-starkware wants to merge 1 commit into
claude/privacy-proof-os-verify-gsxf2h-5-verifier-taskfrom
claude/privacy-proof-os-verify-gsxf2h-6-combined-verify
Open

einat-starkware wants to merge 1 commit into
claude/privacy-proof-os-verify-gsxf2h-5-verifier-taskfrom
claude/privacy-proof-os-verify-gsxf2h-6-combined-verify

Conversation

@einat-starkware

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

Copy link
Copy Markdown
Contributor

Part 8 of the privacy proof-fact fold stack, on top of #15088. Test-only: combined tests connecting the OS side of the fold to a real simple-bootloader run of the circuit verifier.

New tests (starknet_os_flow_tests::proof_fact_verifier_test):

  • test_cairo_fold_matches_circuit_verifier_output — the positive loop on real artifacts: the Cairo0 fold_block_proof_facts (the exact code the OS runs) over the four_leaves transactions' proof facts, packed the way the OS output packs the root output digest, matches the digest the circuit verifier outputs when the simple bootloader runs it on the fixture's root proof. Previously the verifier was only compared against the Rust fold; this closes bootloader+verifier ⟷ Cairo OS fold directly, through the production comparison function (verify_circuit_verifier_task_output).
  • test_os_emitted_fold_output_feeds_verifier_task_comparison — the OS program in the loop: a real OS run over a block of 4 proof-facts invokes, whose emitted proof_facts_root_output_low/high are fed into verify_circuit_verifier_task_output against the real verifier run. Asserts the OS-emitted packed digest is cleanly unpacked and rejected as FoldDigestMismatch (the facts differ from the fixture's), i.e. the packing seam is well-formed and mismatched fact sets are caught.

Why the OS-program run can't be on the matching-digest path yet (documented on the test): the OS only accepts proof facts whose program hash is an allowed virtual-OS hash, while the four_leaves fixture's leaves carry the proving side's test-task program hash; and the transaction proofs the OS does accept are verified against the privacy recursion circuits or the production (large_proofs) registry — not the canonical_small registry the fold's circuit hashes are pinned to. Closing that gap needs the fold's production-registry swap (see the leaf-verifier question in #15086) plus a recursive-tree fixture over OS-valid proof facts; until then the matching path is covered by the Cairo-fold test above, and the OS output wiring by the fold assertions every flow test already makes.

Plumbing (no production-code changes): the Cairo fold entry-point runner moved from proof_fact_fold_test to starknet_os::test_utils::proof_fact_fold_runner (exposed under testing, which now also enables apollo_starknet_os_program/test_programs); the verifier-task fixtures and helpers moved from verifier_task_test to starknet_transaction_prover::verifier_task::test_utils (new testing feature); both test files now import from there.

Verified: the 2 new flow tests pass; 24/24 starknet_os fold tests and 2/2 verifier-task tests pass after the refactor (against cairo-program-runner-lib 1.1.0 from the 0.14.4 merge); rustfmt clean.

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

🤖 Generated with Claude Code

https://claude.ai/code/session_01XmPJM3Wph4QLmFmhcxVsh4

@cursor

cursor Bot commented Sep 3, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Changes are limited to test code, shared test utilities, and optional Cargo features; no production fold or verifier behavior is modified.

Overview
Adds test-only wiring that connects the OS proof-fact fold to a real simple-bootloader run of the circuit verifier on the four_leaves fixture.

New flow tests in starknet_os_flow_tests::proof_fact_verifier_test: one asserts Cairo0 fold_block_proof_facts (packed like OS output) matches the verifier digest via verify_circuit_verifier_task_output; another runs a full OS block with four proof-facts invokes and checks emitted proof_facts_root_output_low/high unpack cleanly and fail with FoldDigestMismatch against the fixture verifier (mismatch path only—documented why end-to-end match on OS program isn’t possible yet).

Refactor for reuse: Cairo fold entry-point helpers move from proof_fact_fold_test to starknet_os::test_utils::proof_fact_fold_runner (testing now also enables apollo_starknet_os_program/test_programs). Verifier bootloader/executable/root-proof fixtures move to starknet_transaction_prover::verifier_task::test_utils behind a new optional testing feature (flate2); flow tests depend on starknet_transaction_prover with features = ["testing"].

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

@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

@einat-starkware
einat-starkware force-pushed the claude/privacy-proof-os-verify-gsxf2h-5-verifier-task branch from c9f1861 to fcf4042 Compare September 17, 2026 13:36
@einat-starkware
einat-starkware force-pushed the claude/privacy-proof-os-verify-gsxf2h-6-combined-verify branch from 69d4399 to 5038791 Compare September 17, 2026 13:36
…the fold against the verifier

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-5-verifier-task branch from fcf4042 to 377b5b4 Compare September 22, 2026 09:22
@einat-starkware
einat-starkware force-pushed the claude/privacy-proof-os-verify-gsxf2h-6-combined-verify branch from 5038791 to a47dcf4 Compare September 22, 2026 09:22

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.

3 participants