feat: improve deferral interface + add verify-stark example#2910
Open
stephenh-axiom-xyz wants to merge 14 commits into
Open
feat: improve deferral interface + add verify-stark example#2910stephenh-axiom-xyz wants to merge 14 commits into
stephenh-axiom-xyz wants to merge 14 commits into
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
Note: cells_used metrics omitted because CUDA tracegen does not expose unpadded trace heights. Commit: 3120e05 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves INT-8458.
Overview
This PR adds a reusable cached SDK proving-key flow, makes supported deferral configurations serializable, restructures SDK deferral proving into clearer layers, and adds an end-to-end
verify-starkexample that reuses cached keys to wrap existing OpenVM STARK proofs. It also updates docs and CI to exercise the new example.Suggested review order:
crates/sdk-config,crates/sdk,crates/continuations, andguest-libs/verify-stark/circuit.crates/sdk.examples/verify-starkhost/guest flow and docs.SDK Proving Key Caching
Files:
crates/sdk/src/keygen/mod.rscrates/sdk/src/lib.rscrates/sdk/src/builder.rscrates/sdk/src/types.rsChanges:
SdkCachedProvingKey<VC>, containing app and aggregation proving keys plus optional deferral, deferral-aggregation, and root proving keys.Sdk::cached_proving_key()to extract already-generated or seeded proving keys without triggering additional keygen. Halo2 proving keys remain excluded and still use the Halo2-specific file helpers.Sdk::from_cached_proving_key(...)for non-deferral SDKs.Sdk::from_deferral_cached_proving_key(...)forSdkVmConfigSDKs with supported deferral proving keys.CommitByteshex serde support intoopenvm-continuations, soAppExecutionCommit,VkCommitJson, andVerificationBaselineJsonno longer need local serializer modules.Reviewer notes:
Serializable Deferral Configuration
Files:
crates/sdk-config/src/deferral.rscrates/sdk-config/src/lib.rscrates/continuations/src/commit_bytes.rsChanges:
DeferralConfig,DeferralCircuitConfig, andSupportedDeferral.SdkVmConfig.deferralfromOption<DeferralExtension>toOption<DeferralConfig>.DeferralConfiginto the lower-levelDeferralExtensionwhen building transpiler/execution/prover components.SdkVmConfig::to_toml()so programmatically generated deferral commits can be written back toopenvm.toml.CommitBytes::to_field_le_bytes()for converting serialized deferral commits back to the byte format expected byDeferralExtension.Reviewer notes:
SupportedDeferral::VerifyStarkis fully reconstructable.SupportedDeferral::Otherpreserves config shape through serde but installs a panic placeholder unless callers replace it with the realDeferralFn.SdkVmConfig::optimize()now keeps the deferral address space when deferrals are configured and zeros it when they are not.Deferral Prover Restructure
Files:
crates/sdk/src/prover/deferral/agg.rscrates/sdk/src/prover/deferral/multi_circuit.rscrates/sdk/src/prover/deferral/single_circuit.rscrates/sdk/src/prover/deferral/mod.rscrates/sdk/src/prover/stark.rscrates/sdk/src/prover/root.rscrates/sdk/src/prover/evm.rscrates/sdk/src/keygen/dummy.rsChanges:
SingleDeferralCircuitProver: proves one concrete deferral circuit and wraps those proofs into leaf/internal-for-leaf proofs.MultiDeferralCircuitProver: owns the ordered set of deferral circuits and emits hook proofs or absent deferral public values.DeferralAggProver: aggregates hook proofs into the deferral proof consumed by the main SDK prover.DeferralProver/DeferralPathProverbuilder surface withmulti_deferral_circuit_prover(...)/deferral_agg_prover(...).DeferralAggProver::verify_stark(...).merkle.rs.Reviewer notes:
DeferralConfig.circuits, guestDEF_IDX,MultiDeferralCircuitProver, and cached proving keys.DeferralAggProver::verify_stark(...), especially the dummy circuit use anddef_hook_commitderivation.Deferral Circuit Proving Keys
Files:
crates/continuations/src/prover/deferral/mod.rsguest-libs/verify-stark/circuit/src/prover/mod.rsguest-libs/verify-stark/circuit/Cargo.tomlChanges:
DeferralCircuitProverwithget_pk()andfrom_pk(...).DeferralCircuitProverKey, which stores a base STARK proving key plus encoded auxiliary data.bitcode, including child VK, cached commit, memory dimensions, public-value count, optional deferral hook commit, and deferral index.Option<CommitBytes>fordef_hook_commit.Reviewer notes:
VM, Recursion, and Memory Config
Files:
crates/vm/src/arch/config.rscrates/vm/src/arch/testing/cpu.rscrates/recursion/src/batch_constraint/mod.rscrates/recursion/src/system/mod.rsextensions/deferral/*Changes:
DEFAULT_DEFERRAL_ADDR_SPACE_CELLS = 1 << 14and reserves the deferral address space in the defaultMemoryConfig.commit_child_vk(...)helper usable by CPU and GPU paths.Reviewer notes:
SdkVmConfig::optimize()removes it for non-deferral SDK configs.Verify-Stark Example
Files:
examples/verify-stark/guest/*examples/verify-stark/host/*examples/verify-stark/verify-book-examples.shChanges:
verify_stark_unchecked::<0>(), and prints the verified app execution output.keygen,build, andprovecommands.keygenbuilds the verify-stark deferral prover, writes a generatedopenvm.toml, writes the cached SDK proving key, and writes the example aggregation VK.buildreconstructs the SDK from cached proving keys, builds the guest, writes the VM executable, and writes its verification baseline.provereconstructs the SDK from cached proving keys, prepares guest stdin and deferral input from a child STARK proof, and writes the wrapped verify-stark STARK proof.cargo openvm verify stark.Reviewer notes:
[workspace], so it is not built as part of the root workspace by default.VERIFY_STARK_HOST_FEATURESdefaulting tocuda.Docs and CI
Files:
.github/workflows/cli.ymldocs/vocs/docs/pages/book/acceleration-using-extensions/deferral.mdxdocs/vocs/docs/pages/book/advanced-usage/sdk.mdxdocs/vocs/docs/pages/book/guest-libraries/verify-stark.mdxdocs/repo/layout.mdChanges:
cargo-openvmwith CUDA and runsexamples/verify-stark/verify-book-examples.sh.DeferralExtension-centric setup toDeferralConfigand the new SDK builder methods.Tests Updated
Files:
crates/sdk/src/tests.rscrates/continuations/src/tests/e2e.rsextensions/deferral/circuit/src/*/tests.rsextensions/deferral/tests/src/lib.rsChanges:
DeferralConfig,SupportedDeferral::VerifyStark,MultiDeferralCircuitProver, andDeferralAggProver.CommitBytesdef_hook_commitAPI.