Skip to content

feat: command to prepare deferral input - #186

Closed
luffykai wants to merge 3 commits into
mainfrom
deferral-prepare
Closed

feat: command to prepare deferral input#186
luffykai wants to merge 3 commits into
mainfrom
deferral-prepare

Conversation

@luffykai

Copy link
Copy Markdown
Collaborator

No description provided.

luffykai added 3 commits July 27, 2026 16:44
…nputs)

Add axiom_sdk::deferral: given a completed child stark proof, derive
everything a verify_stark parent submission needs, hiding all keyset
internals behind the existing API surface:

- downloads the config's complete openvm.toml (GET /configs/{id}/config,
  which carries the keygen-derived [[app_vm_config.deferral.circuits]]
  section; clear rerun-keygen error when absent), the config's agg_vk
  (GET /configs/{id}/vk/agg), and the PARENT program's baseline.json
  (GET /programs/{id}/download/baseline);
- derives def_hook_commit + the verify-stark circuit's cached commit
  locally, exactly as backend keygen does (DeferralAggProver::verify_stark
  on the toml's agg params + 100-bit hook params + memory dims + num user
  PVs), cross-checks the derived circuit commit against the toml's, and
  caches the pair under ~/.axiom/cache/deferral-commits-<sha256(toml)>.json
  (the construction costs ~12s release / minutes dev per config);
- mirrors the backend's internal deferral_prepare helper for the rest:
  child app_exe_commit from the proof's VM public values, child vk =
  agg_vk + baseline with the two deferral overrides,
  get_raw_deferral_results -> input_commit (verifies the child proof
  client-side), openvm-codec child bytes for upload, and the
  {"input": ["0x01<hex>"]} parent input body whose exact
  StdIn::write(&input_commit) encoding is pinned by unit test.

Empirically verified (ignored probe test, run against the standard-config
keyset constants): deferral_circuit_cached_commits[0] != the toml's
circuit commit, so the cached commit cannot be read off the toml and is
always derived (it falls out of the same DeferralAggProver construction
the hook commit needs).

Pins openvm/stark-backend crates at tag v2.0.0 in crates/sdk, matching
the proving backend's keygen; this roughly doubles CLI compile time.
New DeferralCmd group wired into the CLI:

  cargo axiom deferral prepare --child-proof <stark_proof.json|codec.bin>
      [--config-id <id>] --program-id <parent program id>
      --out-child-bin <path> --out-input-json <path>

--config-id defaults from ~/.axiom/config.json like other commands;
--program-id names the PARENT program (the verify_stark guest). The child
proof is accepted in either encoding (downloaded JSON or openvm-codec
binary, sniffed by first byte). Prints the derived input_commit and the
follow-up prove command.
…opied fixture

sdk-config is the canonical owner of openvm_standard.toml (it ships the file
and embeds it as SdkVmConfig::standard()'s docs); a copied fixture can drift
from the pinned openvm version, the constructor cannot. The probe serializes
the constructed config to the user-toml shape and feeds it through the same
parse path a served config takes, so it now also pins constructor-vs-toml
equivalence: all three derived constants unchanged (verified, 12s release).
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedserde@​1.0.219 ⏵ 1.0.2298110093100100
Addedtoml_edit@​0.19.1510010090100100
Addedsha2@​0.10.910010093100100
Addedcargo_metadata@​0.18.110010093100100
Addedtoml@​0.9.510010093100100

View full report

@socket-security

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: cargo zerocopy is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: ?cargo/zerocopy@0.8.55

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore cargo/zerocopy@0.8.55. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@luffykai luffykai closed this Jul 27, 2026
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