Skip to content

apollo_starknet_os_program,starknet_os: support PROOF_VERSION_V1 in check_proof_facts#14014

Open
Yoni-Starkware wants to merge 1 commit into
05-10-starknet_proof_verifier_accept_either_proof_version_v0_or_proof_version_v1_in_verify_prooffrom
05-10-apollo_starknet_os_program_starknet_os_support_proof_version_v1_in_check_proof_facts
Open

apollo_starknet_os_program,starknet_os: support PROOF_VERSION_V1 in check_proof_facts#14014
Yoni-Starkware wants to merge 1 commit into
05-10-starknet_proof_verifier_accept_either_proof_version_v0_or_proof_version_v1_in_verify_prooffrom
05-10-apollo_starknet_os_program_starknet_os_support_proof_version_v1_in_check_proof_facts

Conversation

@Yoni-Starkware
Copy link
Copy Markdown
Collaborator

No description provided.

@cursor
Copy link
Copy Markdown

cursor Bot commented May 10, 2026

PR Summary

Medium Risk
Touches Cairo-level proof-facts validation and updates the compiled OS program hash, which could affect which proofs/transactions are accepted if constants or hashing are wrong.

Overview
Updates check_proof_facts to explicitly validate proof_variant and accept either PROOF_VERSION_V0 (legacy) or PROOF_VERSION_V1 with a clearer error message, instead of requiring an exact header match.

Renames the Cairo constant PROOF_VERSION to PROOF_VERSION_V0, introduces PROOF_VERSION_V1, wires both through the Rust constant fetcher (Const) and tests, and updates the OS program hash and expected OS bytecode length accordingly.

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

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

Copy link
Copy Markdown
Collaborator Author

@Yoni-Starkware Yoni-Starkware left a comment

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 6 files reviewed, 1 unresolved discussion.


crates/apollo_starknet_os_program/src/cairo/starkware/starknet/core/os/execution/execution_constraints.cairo line 57 at r1 (raw file):

        tempvar v1_diff = proof_header.proof_version - PROOF_VERSION_V1;
        assert v0_diff * v1_diff = 0;
    }

Suggestion:

    // Validate the proof header.
    static_assert ProofHeader.SIZE == 3;
    let proof_header = cast(proof_facts, ProofHeader*);
    assert proof_header.proof_variant = VIRTUAL_SNOS;
    assert is_program_hash_allowed(proof_header.program_hash) = TRUE;
    // Proof variant must be VIRTUAL_SNOS; proof version may be V0 (legacy) or V1 (current).
    with_attr error_message("Unsupported proof version") {
        tempvar proof_version = proof_header.proof_version;
        assert (proof_version - PROOF_VERSION_V1) * (proof_version - PROOF_VERSION_V1) = 0;
    }

@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-apollo_starknet_os_program_starknet_os_support_proof_version_v1_in_check_proof_facts branch from af28490 to 39b9d56 Compare May 10, 2026 17:01
@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-starknet_proof_verifier_accept_either_proof_version_v0_or_proof_version_v1_in_verify_proof branch from 01c985a to a2f547a Compare May 10, 2026 17:01
@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-apollo_starknet_os_program_starknet_os_support_proof_version_v1_in_check_proof_facts branch 2 times, most recently from d0f4a98 to d72bed0 Compare May 11, 2026 07:23
@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-starknet_proof_verifier_accept_either_proof_version_v0_or_proof_version_v1_in_verify_proof branch 2 times, most recently from 90c0ffc to e357e34 Compare May 11, 2026 07:30
@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-apollo_starknet_os_program_starknet_os_support_proof_version_v1_in_check_proof_facts branch from d72bed0 to c496f63 Compare May 11, 2026 07:30
@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-starknet_proof_verifier_accept_either_proof_version_v0_or_proof_version_v1_in_verify_proof branch from e357e34 to 9396eaa Compare May 11, 2026 07:32
@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-apollo_starknet_os_program_starknet_os_support_proof_version_v1_in_check_proof_facts branch 2 times, most recently from 04f95dd to 558f5fc Compare May 11, 2026 07:33
@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-starknet_proof_verifier_accept_either_proof_version_v0_or_proof_version_v1_in_verify_proof branch 2 times, most recently from 106b8dd to c1edbac Compare May 11, 2026 07:55
@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-apollo_starknet_os_program_starknet_os_support_proof_version_v1_in_check_proof_facts branch from 558f5fc to 8436836 Compare May 11, 2026 07:55
Copy link
Copy Markdown
Contributor

@AvivYossef-starkware AvivYossef-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@AvivYossef-starkware reviewed 6 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion.

@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-starknet_proof_verifier_accept_either_proof_version_v0_or_proof_version_v1_in_verify_proof branch from c1edbac to e78c9e8 Compare May 11, 2026 11:35
@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-apollo_starknet_os_program_starknet_os_support_proof_version_v1_in_check_proof_facts branch 2 times, most recently from 693e3ee to 4ffdb3c Compare May 11, 2026 11:49
@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-starknet_proof_verifier_accept_either_proof_version_v0_or_proof_version_v1_in_verify_proof branch from e78c9e8 to 2b0ff64 Compare May 11, 2026 11:49
@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-starknet_proof_verifier_accept_either_proof_version_v0_or_proof_version_v1_in_verify_proof branch from 2b0ff64 to 8a42f7c Compare May 11, 2026 12:03
@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-apollo_starknet_os_program_starknet_os_support_proof_version_v1_in_check_proof_facts branch from 4ffdb3c to 46e192d Compare May 11, 2026 12:03
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