Skip to content

starknet_os_flow_tests,apollo_starknet_os_program,blockifier: measure deploy_v2 syscall gas - #14839

Draft
ron-starkware wants to merge 1 commit into
ron/contract-address/v4-os-flow-e2efrom
ron/contract-address/deploy-v2-gas
Draft

starknet_os_flow_tests,apollo_starknet_os_program,blockifier: measure deploy_v2 syscall gas#14839
ron-starkware wants to merge 1 commit into
ron/contract-address/v4-os-flow-e2efrom
ron/contract-address/deploy-v2-gas

Conversation

@ron-starkware

@ron-starkware ron-starkware commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Stack — on top of ron/contract-address/v4-os-flow-e2e (#14819). Measures the deploy_v2 syscall's OS gas, which was a provisional copy of Deploy's (gated behind UNMEASURABLE_SYSCALLS) until the Cairo compiler could emit the syscall.

Measured (vs the provisional Deploy-equal)

provisional (= Deploy) measured deploy_v2
DEPLOY_V2_GAS_COST 147120 175510
DEPLOY_V2_CALLDATA_FACTOR_GAS_COST 4850 1670
VC constant 1173 steps / 21 range_check / 7 pedersen 1725 steps / 43 range_check / 0 pedersen
VC calldata factor 8 steps / 1 pedersen 16 steps / 1 range_check

The Blake path drops the pedersen builtin and spends more steps + range-checks (BLAKE2s hash + the range-check-witnessed Pedersen-image escape), so deploy_v2 genuinely costs more than the Pedersen deploy.

Changes

  • os_resources_test_contract.cairo: exercise deploy_v2_syscall (base + linear), declared inline like meta_tx_v0_syscall.
  • os_resources_test.rs: drop DeployV2 from UNMEASURABLE_SYSCALLS, add to SYSCALLS_WITH_LINEAR_FACTOR (=1, like Deploy).
  • allowed_libfuncs.json + PENDING_LIBFUNCS: allow deploy_v2_syscall for feature-contract compilation (pending its addition to Cairo's audited list).
  • Regenerated: blockifier_versioned_constants_0_14_5.json, OS constants.cairo, program_hash.json (main OS only — virtual-OS hash unchanged, so allowed_virtual_os_program_hashes and the frozen stwo proof fixtures are untouched), and the blockifier VC diff-regression fixture.

Parked

The numbers above were measured in July against the pre-rebase OS. They must be re-measured against the current OS before this merges. Until then DeployV2 stays in UNMEASURABLE_SYSCALLS on the rest of the stack, which carries a provisional Deploy-equal profile in 0_14_5.

Requires

A Cairo compiler that emits the DeployV2 Sierra libfunc — cairo#10214 (ron/deploy-v2/compiler). Measured here with a starknet-compile built from that branch; land after that compiler is released and CAIRO1_COMPILER_VERSION is bumped (the pinned 2.19.4 does not carry the libfunc).

🤖 Generated with Claude Code

@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown

@ron-starkware
ron-starkware force-pushed the ron/contract-address/deploy-v2-gas branch from c3899b5 to 005fb19 Compare July 19, 2026 12:21
@ron-starkware ron-starkware changed the title test(os): measure deploy_v2 syscall gas starknet_os_flow_tests,apollo_starknet_os_program,blockifier: measure deploy_v2 syscall gas Jul 19, 2026
@ron-starkware
ron-starkware force-pushed the ron/contract-address/deploy-v2-gas branch from 005fb19 to c1520d6 Compare July 19, 2026 12:43
@github-actions

Copy link
Copy Markdown

There hasn't been any activity on this pull request recently, and in order to prioritize active work, it has been marked as stale.
This PR will be closed and locked in 7 days if no further activity occurs.
Thank you for your contributions!

… deploy_v2 syscall gas

deploy_v2's OS resource cost is a provisional copy of Deploy's (gated behind
UNMEASURABLE_SYSCALLS). Now that the Cairo compiler can emit deploy_v2, measure
it for real and run the versioned-constants regeneration cycle.

Measured (vs the provisional Deploy-equal):
- OS gas: DEPLOY_V2_GAS_COST 147120 -> 175510, calldata factor 4850 -> 1670.
- VC resources (constant): 1725 steps / 43 range_check (was 1173 / 21 range_check
  + 7 pedersen); calldata factor: 16 steps / 1 range_check (was 8 / 1 pedersen).
The Blake path drops the pedersen builtin and spends more steps + range_checks
(BLAKE2s hash + the range-check-witnessed Pedersen-image escape), so it costs
more than the Pedersen deploy.

Changes:
- os_resources_test_contract.cairo: call deploy_v2_syscall (base + linear),
  declared inline like meta_tx_v0_syscall (+ #[allow(extern_outside_corelib)]).
- os_resources_test.rs: drop DeployV2 from UNMEASURABLE_SYSCALLS, add it to
  SYSCALLS_WITH_LINEAR_FACTOR (=1, like Deploy).
- allowed_libfuncs.json + PENDING_LIBFUNCS: allow deploy_v2_syscall for feature-
  contract compilation (pending its addition to Cairo's audited list).
- Regenerated: blockifier_versioned_constants_0_14_5.json, the OS constants.cairo
  gas constants, program_hash.json (main OS only; virtual-OS hash unchanged, so
  allowed_virtual_os_program_hashes and the frozen proof fixtures are untouched),
  and the blockifier VC diff-regression fixture.

PARKED: the numbers above were measured in July against the pre-rebase OS. They
must be re-measured against the current OS before this merges, which needs a
Cairo compiler that emits the DeployV2 libfunc (cairo#10214) and a
CAIRO1_COMPILER_VERSION bump -- the pinned 2.19.4 does not have it. Until then
DeployV2 stays in UNMEASURABLE_SYSCALLS on the rest of the stack.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

2 participants