chore: update CLI crate with new SDK#2625
chore: update CLI crate with new SDK#2625stephenh-axiom-xyz wants to merge 4 commits intodevelop-v2.0.0-betafrom
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
|
@jonathanpwang @shuklaayush have been starting to wonder if we should pair |
This seems good to also help clarify what depends on what. Let's do it in a follow-up (please make a ticket) and also come up with a good name for this body. |
|
Claude finished @stephenh-axiom-xyz's task in 2m 33s —— View job Code Review: Update CLI crate with new SDK
This is a well-structured refactor that moves CLI from pre-generated global keys to on-demand per-project key caching. The Issues1. Incomplete
Also 2. Solidity interface still uses
3. Duplicated key caching logic in
4.
5.
6.
7.
Minor / Nits8.
local_openvm_path="$(cd ../toolchain/openvm && pwd)"This depends on 9. Shell scripts lack The scripts in 10.
Positive Highlights
|
Note: cells_used metrics omitted because CUDA tracegen does not expose unpadded trace heights. Commit: ea2703b |
Resolves INT-6956.
PR Summary: Update CLI Crate with New SDK
Overview
Two commits that update the CLI crate (
cargo-openvm) to work with the restructured v2 SDK, and fix minor clippy/fmt issues. The main theme is: CLI commands now use the SDK's internal keygen (aggregation + root keys are computed on-demand and cached to disk) instead of relying on pre-generated keys at fixed global paths.1. CLI Command Changes (
crates/cli/)provecommandprove stark: Loads cached agg/root keys from${target_dir}/openvm/agg.pk(or~/.openvm/root.pk) if present, otherwise lets the SDK generate them. After proving, saves keys viasave_keys()for future reuse.prove evm: Same key-caching pattern. Adds--agg-pkargument (was missing). Callsprove_evm()instead ofprove(). Removes the pre-flight check that requiredsetupto be run first — keys are now generated internally.maybe_with_cached_keys(),save_keys(),target_dir_from_cargo_args().commitcommandPreviously only computed and saved
app_exe_commit. Now:app_exe_commitandapp_vk_commit(via newStarkProver::app_vk_commit()).AppExecutionCommitJSON with both values (hex-encoded with0xprefix)..baseline.json) used byverify stark.provecommands.verifycommandverify stark: Now reads a baseline file (.baseline.json) instead of an app commit file. Readsagg.vkfrom${target_dir}/openvm/instead of~/.openvm/agg_stark.vk. Error messages updated to point users toprove starkinstead ofsetup.verify evm: Improved error message formatting with path display.setupcommandMajor simplification (115 lines removed, 53 added):
agg_stark.pk,agg_stark.vk,agg_halo2.pk,root.asm). Those are now handled per-project byprove/commit.solc).~/.openvm/halo2/src/v{VERSION}/.--evmand--force-agg-keygenflags with a single--forceflag.solc.default.rsRemoved global-path defaults for
agg_stark.pk,agg_stark.vk,agg_halo2.pk,root.asm. Remaining:default_params_dir()→~/.openvm/params/default_root_pk_path()→~/.openvm/root.pk(new)default_evm_halo2_verifier_path()→~/.openvm/halo2/util.rsNew path helpers:
get_openvm_dir(),get_agg_pk_path(),get_agg_vk_path(),get_app_baseline_path()read_default_agg_and_halo2_pk().Dependencies
openvm-continuations(withroot-proverfeature) andp3-bn254toCargo.toml.evm-verifyin default features (was temporarily disabled with a TODO).2. CI (
cli.yml)Uncommmented the
pull_requesttrigger and narrowed its path filter to justcrates/cli/**and the workflow file itself (previously listed sdk, vm, toolchain, etc.).3. Integration Tests → Shell Scripts
All 6 integration tests were refactored from inline Rust
Commandcalls to delegated bash scripts intests/scripts/:test_cli_app_e2ecli_app_e2e.shtest_cli_app_e2e_simplifiedcli_app_e2e_simplified.shtest_cli_stark_e2e_simplifiedcli_stark_e2e_simplified.shtest_cli_init_buildcli_init_build.shtest_cli_run_mode_pure_defaultcli_run_mode_pure_default.shtest_cli_run_segmentcli_run_segment.shtest_cli_run_metercli_run_meter.shRust side now uses a single
run_script()helper. Removedreplace_with_local_openvm()(moved intocli_init_build.shas aperlone-liner). Removedtempfile,itertools,fsimports that are no longer needed.4. SDK Changes (
crates/sdk/)keygen/mod.rsRootProvingKeystruct (serializable): holdsroot_pk: Arc<MultiStarkProvingKey<RootSC>>andtrace_heights: Vec<usize>.Halo2ProvingKeynow derivesSerialize, Deserialize(was onlyClone).lib.rsNew methods on
Sdk:with_agg_pk()— inject a pre-computed aggregation proving keywith_root_pk()— inject a pre-computed root proving keyagg_keygen()— convenience to get(AggProvingKey, MultiStarkVerifyingKey)root_pk()— extract root proving key for serializationprover/stark.rsNew
app_vk_commit()method onStarkProver: computes a Poseidon2 hash over the DAG commits (cached_commit + vk_pre_hash) from the leaf, internal-for-leaf, and internal-recursive layers. This is theapp_vk_commitexposed by thecommitCLI command.types.rsAppExecutionCommitno longer gated behind#[cfg(feature = "evm-prove")]— available unconditionally.app_vm_commit→app_vk_committhroughout.hex_bytes32module now public; serialization uses0xprefix; deserialization strips it.solidity.rsComment fix:
app_vm_commit→app_vk_commitin instance layout documentation.5. Static Verifier (
crates/static-verifier/)Serialization support
Several key types now derive
Serialize, Deserializeto enable CLI key caching:StaticVerifierCircuitStaticVerifierProvingKeyHalo2WrapperProvingKeyHalo2ProvingPinningserdeCustom
Serialize/Deserializeimpl added (the Halo2ProvingKeydoesn't natively support serde). Serializes PK as raw bytes + metadata. Deserializes usingProvingKey::from_bytes::<BaseCircuitBuilder<Fr>>()with savedconfig_params.Clippy fixes (commit 2)
keygen.rs: Removed duplicateuse serde::{Deserialize, Serialize}(was under#[cfg(feature = "evm-prove")], now unconditional).prover.rs: Unused import cleanup.Key Behavioral Changes for Reviewers
cargo openvm setupis no longer required for STARK proving. Aggregation and root keys are generated on firstprove/commitand cached in${target_dir}/openvm/.setupis now only needed for EVM Solidity verifier generation.Key storage moved from global to per-project.
agg.pkandagg.vklive in${target_dir}/openvm/instead of~/.openvm/. Exception:root.pkstill uses~/.openvm/root.pk(shared across projects).verify starknow expects a baseline file (.baseline.json) instead of a commit file, and readsagg.vkfrom the target directory instead of~/.openvm/.app_vm_commitrenamed toapp_vk_commitacross SDK types and Solidity interface. This is a breaking change for any external consumers ofAppExecutionCommitJSON or the EVM proof ABI.