Skip to content

apollo_starknet_os_program,starknet_os: support PROOF_VERSION_V1 in check_proof_facts#14014

Merged
Yoni-Starkware merged 1 commit into
mainfrom
05-10-apollo_starknet_os_program_starknet_os_support_proof_version_v1_in_check_proof_facts
May 18, 2026
Merged

apollo_starknet_os_program,starknet_os: support PROOF_VERSION_V1 in check_proof_facts#14014
Yoni-Starkware merged 1 commit into
mainfrom
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

cursor Bot commented May 10, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches Cairo-level check_proof_facts validation logic and updates the OS program hash/bytecode length, which could reject/accept different proof-facts payloads if mis-specified.

Overview
Updates virtual OS proof-facts handling to support both legacy PROOF_VERSION_V0 and new PROOF_VERSION_V1: virtual_os_output.cairo splits PROOF_VERSION into PROOF_VERSION_V0/PROOF_VERSION_V1, and check_proof_facts now explicitly validates the header variant and allows either version.

Propagates the new constants through Rust (Const::ProofVersionV0/Const::ProofVersionV1 and tests), and updates program_hash.json plus the expected OS program bytecode length to match the rebuilt program.

Reviewed by Cursor Bugbot for commit 7885760. 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 Author

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

@AvivYossef-starkware AvivYossef-starkware left a comment

Copy link
Copy Markdown
Contributor

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 2 times, most recently 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
@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 8a42f7c to 19501d4 Compare May 17, 2026 09:57
@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 46e192d to 7e33536 Compare May 17, 2026 09:57

@Yoni-Starkware Yoni-Starkware left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Yoni-Starkware resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on Yoni-Starkware).

@graphite-app graphite-app Bot changed the base branch from 05-10-starknet_proof_verifier_accept_either_proof_version_v0_or_proof_version_v1_in_verify_proof to main May 18, 2026 08:34
@graphite-app

graphite-app Bot commented May 18, 2026

Copy link
Copy Markdown

Merge activity

  • May 18, 8:34 AM UTC: This pull request can not be added to the Graphite merge queue. Please try rebasing and resubmitting to merge when ready.
  • May 18, 8:34 AM UTC: Graphite disabled "merge when ready" on this PR due to: a merge conflict with the target branch; resolve the conflict and try again..

@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 7e33536 to 7885760 Compare May 18, 2026 09:56

@Yoni-Starkware Yoni-Starkware left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Yoni-Starkware reviewed 6 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on Yoni-Starkware).

@Yoni-Starkware Yoni-Starkware added this pull request to the merge queue May 18, 2026
Merged via the queue into main with commit 2e1f541 May 18, 2026
21 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants