feat: command to prepare deferral input - #186
Conversation
…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).
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
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.
|
No description provided.