Skip to content

apollo_starknet_os_program: restore keccak syscall in virtual OS#14071

Merged
Yoni-Starkware merged 1 commit into
mainfrom
05-18-apollo_starknet_os_program_restore_keccak_syscall_in_virtual_os
May 24, 2026
Merged

apollo_starknet_os_program: restore keccak syscall in virtual OS#14071
Yoni-Starkware merged 1 commit into
mainfrom
05-18-apollo_starknet_os_program_restore_keccak_syscall_in_virtual_os

Conversation

@Yoni-Starkware

@Yoni-Starkware Yoni-Starkware commented May 18, 2026

Copy link
Copy Markdown
Collaborator

Stack:

Summary

  • Re-adds the keccak syscall to the virtual OS — reverts the removal from apollo_starknet_os_program: remove keccak syscall from virtual OS #12355. The KECCAK_SELECTOR arm is restored in execute_syscalls__virtual.cairo so virtual-OS proofs can again contain transactions that call the keccak syscall.
  • Bumps the latest allowed_virtual_os_program_hashes entry (in blockifier_versioned_constants_0_14_3.json and constants.cairo) to the new virtual OS program hash, replacing the previous keccak-disabled hash.
  • Drops the now-redundant Keccak arm in test_contract::test_forbidden_syscall_in_virtual_mode and the corresponding rstest case in virtual_os_test::test_forbidden_syscall.
  • Uncomments the serialize_call("test_keccak", &[]) line in prove_and_verify_multicall_tx (added by stacked PR starknet_os_flow_tests: add multicall prove test; drop balance_of test #14082) so the multicall test now exercises the keccak syscall path via the virtual OS.

Auto-regenerated fixtures:

  • program_hash.json virtual_os hash
  • versioned_constants_diff_regression/0.14.2_0.14.3.txt
  • bouncer_test::class_hash_migration_data_from_state expected sierra/proving gas
  • stack_trace_regression/test_contract_ctor_frame_stack_trace_cairo1_casm.txt

Test plan

  • cargo test -p apollo_starknet_os_program test_program_hashes (with UPDATE_EXPECT=1)
  • cargo test -p apollo_starknet_os_program test_os_constants (with UPDATE_EXPECT=1)
  • cargo test -p starknet_os test_virtual_os_program_hash_is_allowed
  • cargo test -p blockifier test_vc_diffs_regression (with UPDATE_EXPECT=1)
  • cargo test -p blockifier --lib bouncer:: (regen'd snapshots)
  • cargo test -p starknet_os_flow_tests virtual_os_test::test_basic_happy_flow
  • cargo test -p starknet_os_flow_tests virtual_os_test::test_forbidden_syscall (remaining cases pass)
  • Local prove+verify via prove_and_verify_multicall_tx -- --ignored (requires --features starknet_transaction_prover/stwo_proving --release + nightly)

@cursor

cursor Bot commented May 18, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Re-enables a previously disabled syscall in virtual OS mode and bumps the allowed virtual OS program hash, which can affect proof compatibility and any clients pinned to prior hashes. Risk is mostly around consensus/verification mismatch if any component still expects the old virtual OS hash or syscall set.

Overview
Restores support for the keccak syscall in virtual OS execution by wiring KECCAK_SELECTOR back into execute_syscalls__virtual.cairo and calling execute_keccak.

Bumps the virtual OS program hash everywhere it’s pinned/validated (constants.cairo, program_hash.json, Blockifier versioned constants + diff regression) and updates snapshots/fixtures (virtual OS bytecode length, bouncer gas expectations, and systest preconfirmed block blob fixtures).

Adjusts virtual-OS security tests to reflect that keccak is now allowed (removes it from the forbidden-syscall cases) and updates the ignored multicall prove+verify test to exercise test_keccak again.

Reviewed by Cursor Bugbot for commit cec96b1. 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 force-pushed the 05-18-apollo_starknet_os_program_restore_keccak_syscall_in_virtual_os branch 2 times, most recently from b862e02 to 44e99e0 Compare May 18, 2026 17:44
@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-starknet_os_flow_tests_test_tx_per_proof_version_and_program_hash branch from 3210a0e to 5d66a74 Compare May 19, 2026 07:08
@Yoni-Starkware Yoni-Starkware force-pushed the 05-18-apollo_starknet_os_program_restore_keccak_syscall_in_virtual_os branch from 44e99e0 to ba1f90d Compare May 19, 2026 07:09
@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-starknet_os_flow_tests_test_tx_per_proof_version_and_program_hash branch from 5d66a74 to b22c491 Compare May 19, 2026 10:37
@Yoni-Starkware Yoni-Starkware force-pushed the 05-18-apollo_starknet_os_program_restore_keccak_syscall_in_virtual_os branch from ba1f90d to 1ac2afb Compare May 19, 2026 10:37
@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-starknet_os_flow_tests_test_tx_per_proof_version_and_program_hash branch from b22c491 to ac8abb5 Compare May 19, 2026 11:40
@Yoni-Starkware Yoni-Starkware force-pushed the 05-18-apollo_starknet_os_program_restore_keccak_syscall_in_virtual_os branch 2 times, most recently from de06d14 to c95aeed Compare May 19, 2026 12:12
@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-starknet_os_flow_tests_test_tx_per_proof_version_and_program_hash branch from ac8abb5 to 375c852 Compare May 19, 2026 12:12
@Yoni-Starkware Yoni-Starkware changed the base branch from 05-10-starknet_os_flow_tests_test_tx_per_proof_version_and_program_hash to 05-19-multicall_keccak_ec_op_prove_test_remove_balance_of May 19, 2026 12:19
@Yoni-Starkware Yoni-Starkware force-pushed the 05-18-apollo_starknet_os_program_restore_keccak_syscall_in_virtual_os branch 2 times, most recently from b1beaab to 7b6c094 Compare May 19, 2026 12:24
@Yoni-Starkware Yoni-Starkware force-pushed the 05-19-multicall_keccak_ec_op_prove_test_remove_balance_of branch 2 times, most recently from 6c65407 to 6a5b663 Compare May 19, 2026 12:57
@Yoni-Starkware Yoni-Starkware force-pushed the 05-18-apollo_starknet_os_program_restore_keccak_syscall_in_virtual_os branch from 7b6c094 to 4377e32 Compare May 19, 2026 12:58

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

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


Cargo.toml line 337 at r1 (raw file):

pretty_assertions = "1.4.0"
primitive-types = "0.12.1"
privacy-circuit-verify = { git = "https://github.com/Yoni-Starkware/proving-utils", rev = "95bc227" }

consider adding v1 to be consistent with ProofVersion enum

Code quote:

privacy-circuit-verify

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

Where does it "Re-adds the keccak syscall to the virtual OS"? The PR description/name is misleading

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

@Yoni-Starkware Yoni-Starkware changed the base branch from 05-19-multicall_keccak_ec_op_prove_test_remove_balance_of to 05-10-workspace_starknet_proof_verifier_bump_privacy-prove_and_privacy-circuit-verify_to_69ed219_add_legacy_alias_dispatch_v0_to_legacy May 19, 2026 15:46

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

In the beginning, the virtual OS contained keccak

@Yoni-Starkware made 1 comment.
Reviewable status: 0 of 15 files reviewed, all discussions resolved (waiting on AvivYossef-starkware).

@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-workspace_starknet_proof_verifier_bump_privacy-prove_and_privacy-circuit-verify_to_69ed219_add_legacy_alias_dispatch_v0_to_legacy branch from 4377e32 to c086c43 Compare May 19, 2026 16:14
@Yoni-Starkware Yoni-Starkware force-pushed the 05-18-apollo_starknet_os_program_restore_keccak_syscall_in_virtual_os branch from e71dabc to f9e3866 Compare May 19, 2026 16:14
@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-workspace_starknet_proof_verifier_bump_privacy-prove_and_privacy-circuit-verify_to_69ed219_add_legacy_alias_dispatch_v0_to_legacy branch from c086c43 to e7dede0 Compare May 19, 2026 16:29
@Yoni-Starkware Yoni-Starkware force-pushed the 05-18-apollo_starknet_os_program_restore_keccak_syscall_in_virtual_os branch from f9e3866 to a3b9278 Compare May 19, 2026 16:29

@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 15 files reviewed, all discussions resolved (waiting on AvivYossef-starkware).


Cargo.toml line 337 at r1 (raw file):

Previously, AvivYossef-starkware wrote…

consider adding v1 to be consistent with ProofVersion enum

Done in prev PR

@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-workspace_starknet_proof_verifier_bump_privacy-prove_and_privacy-circuit-verify_to_69ed219_add_legacy_alias_dispatch_v0_to_legacy branch from e7dede0 to 429d431 Compare May 19, 2026 16:47
@Yoni-Starkware Yoni-Starkware force-pushed the 05-18-apollo_starknet_os_program_restore_keccak_syscall_in_virtual_os branch 3 times, most recently from 62375eb to a69b2b8 Compare May 19, 2026 17:14
@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-workspace_starknet_proof_verifier_bump_privacy-prove_and_privacy-circuit-verify_to_69ed219_add_legacy_alias_dispatch_v0_to_legacy branch from 429d431 to cc8b12d Compare May 19, 2026 17:29
@Yoni-Starkware Yoni-Starkware force-pushed the 05-18-apollo_starknet_os_program_restore_keccak_syscall_in_virtual_os branch from a69b2b8 to 473e4be Compare May 19, 2026 17:29
@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-workspace_starknet_proof_verifier_bump_privacy-prove_and_privacy-circuit-verify_to_69ed219_add_legacy_alias_dispatch_v0_to_legacy branch from cc8b12d to e9aef6a Compare May 20, 2026 12:49
@Yoni-Starkware Yoni-Starkware force-pushed the 05-18-apollo_starknet_os_program_restore_keccak_syscall_in_virtual_os branch from 473e4be to 3da1bb0 Compare May 20, 2026 12:49
@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-workspace_starknet_proof_verifier_bump_privacy-prove_and_privacy-circuit-verify_to_69ed219_add_legacy_alias_dispatch_v0_to_legacy branch from e9aef6a to a6beb27 Compare May 20, 2026 12:50
@Yoni-Starkware Yoni-Starkware force-pushed the 05-18-apollo_starknet_os_program_restore_keccak_syscall_in_virtual_os branch from 3da1bb0 to 487d287 Compare May 20, 2026 12:51
@Yoni-Starkware Yoni-Starkware force-pushed the 05-10-workspace_starknet_proof_verifier_bump_privacy-prove_and_privacy-circuit-verify_to_69ed219_add_legacy_alias_dispatch_v0_to_legacy branch from a6beb27 to aff094e Compare May 20, 2026 12:53
@Yoni-Starkware Yoni-Starkware force-pushed the 05-18-apollo_starknet_os_program_restore_keccak_syscall_in_virtual_os branch from 487d287 to 4070973 Compare May 20, 2026 12:53
@Yoni-Starkware Yoni-Starkware changed the base branch from 05-10-workspace_starknet_proof_verifier_bump_privacy-prove_and_privacy-circuit-verify_to_69ed219_add_legacy_alias_dispatch_v0_to_legacy to 05-19-multicall_keccak_ec_op_prove_test_remove_balance_of May 20, 2026 12:53
Re-adds the keccak syscall to the virtual OS (reverts the removal from #12355) and bumps
allowed_virtual_os_program_hashes to the new virtual_os program hash.

Cleans up the now-redundant 'Keccak' arm in test_contract's
test_forbidden_syscall_in_virtual_mode and drops the corresponding case in
test_forbidden_syscall.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Yoni-Starkware Yoni-Starkware force-pushed the 05-18-apollo_starknet_os_program_restore_keccak_syscall_in_virtual_os branch from 4070973 to cec96b1 Compare May 21, 2026 11:11
@Yoni-Starkware Yoni-Starkware changed the base branch from 05-19-multicall_keccak_ec_op_prove_test_remove_balance_of to main May 21, 2026 11:11

@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 17 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 24, 2026
Merged via the queue into main with commit 644b45f May 24, 2026
44 of 77 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 25, 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