Skip to content

feat(starknet): add deploy_v2 syscall support#1649

Draft
ron-starkware wants to merge 1 commit into
starkware-libs:mainfrom
ron-starkware:ron/deploy-v2/native
Draft

feat(starknet): add deploy_v2 syscall support#1649
ron-starkware wants to merge 1 commit into
starkware-libs:mainfrom
ron-starkware:ron/deploy-v2/native

Conversation

@ron-starkware

Copy link
Copy Markdown

Adds cairo_native support for the deploy_v2 syscall (same request/response layout as deploy, but the deployed address uses the BLAKE2s-with-Pedersen-image-escape derivation). Companion to the cairo compiler + corelib work (starkware-libs/cairo#10214 → #10215 → #10216) and the sequencer ron/contract-address/* stack.

  • Trait: deploy_v2 required method on StarknetSyscallHandler, mirroring deploy — fans out to every impl (the checklist below).
  • Runtime ABI: deploy_v2 field in StarknetSyscallHandlerCallbacks, the DEPLOY_V2 vtable offset, init, and wrap_deploy_v2.
  • MLIR: DeployV2 dispatch arm + build_deploy_v2; build_deploy's body is shared via build_deploy_impl(callback_offset) (native dispatches by vtable offset — the only difference from deploy). Debug name maps updated (main + sierra-emu).
  • Handlers: DummySyscallHandler (unimplemented), StubSyscallHandler (the real Blake-escaped derivation, matching the sequencer + cairo runner), the sierra-emu handler + eval_deploy_v2 interpreter arm, and the example/test stubs.
  • Tests: the stub reproduces the five frozen derivation vectors (0/1/2/3/7 escape steps) + the pedersen_reachable truth table; a JIT deploy_v2 test asserts the syscall routes to the handler's deploy_v2 (returns a distinct address from deploy); sierra-emu covered.

⚠️ Temporary dep override: the DeployV2 Sierra variant isn't in a published cairo-lang-* release yet, so the version pins are bumped and a [patch.crates-io] block points at the cairo ron/deploy-v2/compiler branch (#10214). Replace with a plain version bump once the variant ships. (Runtime tests that compile Cairo also need a corelib carrying deploy_v2_syscall, i.e. the vendored corelib bumped to that release.)

🤖 Generated with Claude Code

Support the `deploy_v2` syscall (same request/response layout as `deploy`, but
the deployed address is derived with the BLAKE2s-with-Pedersen-image-escape
derivation). Matches the `DeployV2` Sierra libfunc / `deploy_v2_syscall` corelib
function added upstream in cairo (ron/deploy-v2/* stack).

- Trait: `deploy_v2` required method on `StarknetSyscallHandler`, mirroring
  `deploy`. This fans out to every impl (the checklist below).
- Runtime ABI: `deploy_v2` field in `StarknetSyscallHandlerCallbacks`, the
  `DEPLOY_V2` vtable offset, init, and `wrap_deploy_v2`.
- MLIR: `DeployV2` dispatch arm + `build_deploy_v2`; the `build_deploy` body is
  shared via `build_deploy_impl(callback_offset)` (native dispatches by vtable
  offset, the only difference from `deploy`). Debug name maps updated.
- Handlers: `DummySyscallHandler` (unimplemented), `StubSyscallHandler` (the real
  Blake-escaped derivation, matching the sequencer + cairo runner), the sierra-emu
  handler + `eval_deploy_v2` interpreter arm, and the example/test stubs.
- Tests: the stub reproduces the five frozen §3.1 derivation vectors and the
  pedersen_reachable truth table; a JIT `deploy_v2` test asserts the syscall
  routes to the handler's `deploy_v2` (distinct address from `deploy`).

Dep override: the `DeployV2` variant is not yet in a published cairo-lang-*
release, so the version pins are bumped and a temporary `[patch.crates-io]` block
redirects them to the local cairo checkout. Replace with a plain version bump
once the variant is released.

Co-Authored-By: Claude Opus 4.8 (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.

1 participant