feat: update architecture for generic ProverBackends#1836
Merged
Conversation
This is a partial PR merging into another feature branch `feat/new-exec-device` where I'll collect the overall work into generalizing chips for different tracegen and `ProverBackend`s. The integration tests in `rv32im/tests` work and `VirtualMachine, VmExecutor` were updated for the correct flow, assuming you call `set_main_widths` ahead of time (a temporary measure). The unit test framework is really not designed for this, so I only demonstrate `rand_auipc_test` works -- I'm not going to update all the tests to use `give_away_arena` since this is all going to change in the next PR. Overall summary: - chore change to `TraceStep` to remove useless `<CTX>` generic - `InstructionExecutor` is now basically `TraceStep` without the associate types, but still implemented on the old `Chip` struct that contains a trace matrix - however now the flow is that the `**Chip` is created with empty matrix, the record arena is owned by `TracegenCtx`, and then after all the records are populated, we give the record arenas to the chips via `give_me_my_arena` (function intentionally named to make sure we remove it later) The goal here is just to do the initial refactor to get the `RecordArena` into the correct place. Coming soon: blowing everything up to support different `RA, PB` generics. closes INT-4062
Previously, `VmExtension` had only a single notion of chip, where some chips could be executors, and the notions of execution, circuit, tracegen were all deeply intertwined. With the new design, we have multiple modes of execution which are more disconnected from the circuit design, and we also want tracegen to support different device / prover backends. The overall realization is that a true VM extension, meaning a modular way to extend the functionality of a working zkVM (including the prover) has three _separate_ components: - extending the execution methods for custom opcodes (this includes different execution modes) - extending the circuit itself at the level of AIRs - extending how tracegen and ultimately proving of the circuit from execution traces is actually performed In this PR, we aim to separate the notion of `VmExtension` into three separate traits `VmExecutionExtension, VmCircuitExtension, VmProverExtension` to better encapsulate this. - The `VmExecutionExtension` is in principle separate from any circuit considerations: it is just a way to specify hooks to opcodes. Although practically, there is still some connection, and we still take an enum dispatch approach (for now) for storage purposes. This is intended to be compatible with the fn pointer changes being made in parallel. - The `VmCircuitExtension` is the most security critical, and it should have **no** dependencies on the other two components. This will be made so that the verifying keys do not change even after this PR, and also this trait will not depend on any prover backend differences. - `VmProverExtension` is the most customizable, and hence unfortunately will have a bunch of generics. We will allow even the system chips to be customized according to the prover backend. Also - Deleted `NewVmChipWrapper` because the wrapper pattern is not good. Now each chip owns `mem_helper` -- it is perhaps more correct if just the adapter chip owns `mem_helper`, but since we aren't so convinced about adapter chips existing in the future, I just did the more immediate refactor. - Deleted the `Shared**Chip` wrapper structs because we don't need them anymore. I made them typedef to `Arc<..>`. ## Design Questions I am still somewhat on the fence about `Chip` being generic in `RA` versus doing the old approach where the `**Chip` struct is generic in `RA` and starts off with empty records which get swapped out with the records from the `TracegenCtx` (see before this PR). However it feels weird when the clear use case is now that the "preflight trace" is recorded elsewhere and only fed into the chip at time of tracegen.
… we are rewriting it
…mory chore: remove generic <F> from TracingMemory
added access_adapter_records and touched_memory
Toward INT-4363 implemented the new extension traits for `rv32im` and `native` extensions. `cargo check` passes for both however had to comment out bunch of stuff (mainly testing related) update: implemented keccak and sha2 as well
5672570 to
91175c6
Compare
This comment has been minimized.
This comment has been minimized.
Segment check frequency shouldn't be larger than the height limit.
This comment has been minimized.
This comment has been minimized.
Contributor
Author
|
In GH comment summary, app.cells_used is |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Commit: e8f3eba |
jonathanpwang
added a commit
to axiom-crypto/openvm-eth
that referenced
this pull request
Jul 24, 2025
Make interface changes to coordinate with openvm-org/openvm#1836
jonathanpwang
added a commit
to axiom-crypto/openvm-eth
that referenced
this pull request
Jul 24, 2025
* chore: fix benchmark for new traits Make interface changes to coordinate with openvm-org/openvm#1836 * chore: update openvm for trace_gen_time_ms
shayanh
pushed a commit
to axiom-crypto/openvm-eth
that referenced
this pull request
Aug 19, 2025
* chore: fix benchmark for new traits Make interface changes to coordinate with openvm-org/openvm#1836 * chore: update openvm for trace_gen_time_ms
shayanh
pushed a commit
to axiom-crypto/openvm-eth
that referenced
this pull request
Aug 19, 2025
* chore: fix benchmark for new traits Make interface changes to coordinate with openvm-org/openvm#1836 * chore: update openvm for trace_gen_time_ms
jonathanpwang
commented
Aug 19, 2025
| // ATTENTION: make sure to permute everything in vm_pk that references the original AIR | ||
| // ID ordering: | ||
| root_air_perm.permute(&mut vm_pk.per_air); | ||
| for thc in &mut vm_pk.trace_height_constraints { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
jonathanpwang
added a commit
to axiom-crypto/openvm-eth
that referenced
this pull request
Aug 20, 2025
* fix: update tracegen to do keygen first
# Conflicts:
# .cargo/config.toml
# Cargo.lock
# bin/client-eth/Cargo.lock
# bin/client-eth/Cargo.toml
* chore: update lock files
* chore: update lock files
* feat: impl max_{cells,trace_height} for segmentation strategy
* chore: update lock files
* chore: update lock files
* chore: update lock files
* fix: directly use vmexecutor
* chore: add e2 execution to benchmark (#428)
* chore: add e2 execution to benchmark
* fix: typo
* fix: typo
* chore: update deps
* chore: nit
* chore: logging (#429)
* chore: logging
* update run.sh
* update patch
* tmp: fix tag until we merge main
* chore: update openvm and all patches...
* feat: use branch openvm-prof
* update lock
* ci: use ssh key
* fix: wasn't patching k256
* debug bencher
* update openvm-prof
* Revert "debug bencher"
This reverts commit c4c489a.
* chore: update lock
* feature flag evm-verify
* update branch
* update cargo dependencies (but still need patch for revm)
* chore(ci): display inputs/result link in summary
* fix: update default segment_max_cells
* chore: show results in summary
* chore: update openvm
* chore: remove patching (#434)
* chore: update patching to openvm:feat/new-execution
* fix: update patch workflow to handle double patch
* chore: update stark-backend and openvm
* chore: update lock files
* fix: use hyphen for metered
* chore: update commit
* chore: update openvm/stark-backend to fix span
* chore: update deps
* fix: use debug directory for dev build
* fix: remove widths from metered call (#439)
* chore: update lock files
* chore: fix benchmark for new traits (#445)
* chore: fix benchmark for new traits
Make interface changes to coordinate with openvm-org/openvm#1836
* chore: update openvm for trace_gen_time_ms
* feat(ci): allow passing block number to compare workflow
* fix: replace --unstable-presymbolicate with --presymbolicate
* feat(new-execution): upload execute profile to firefox (#448)
* feat: upload execute profile to firefox; store gzipped
* chore: update lock files
* feat: add block number to run name
* chore: update lock files
* fix(new-execution): remove segmentation strategy (#450)
* chore: update lock files
* chore: update openvm commit
* fix: use interpreter to run execute_metered (#456)
* chore: update openvm traits (#462)
* chore: update lock files
* chore: update `openvm_init.rs` to new format (#466)
* fix(ci): use cargo-openvm from target rev (#467)
* chore: update openvm commit
* fix: constrain storage roots (#469)
We check the state root against a trusted state root, but we missed this check on storage roots. This PR fixes this bug by checking storage trie roots against account storage roots, which are stored and constrain in the state trie.
* feat(new-execution): update to use new sdk interface (#470)
* feat: update to use new sdk interface
* fix: update params dir
* fix: checkout correct openvm rev
* fix: use var
* fix: remove public value config override
* chore: comment state root and fix handling of empty accounts (#468)
* chore: comment out state root check
* fix: properly handle empty accounts in the Rpc DB
* fix: make guest change to handle empty accounts
* fix: compute bytecode hash instead of reading from proof to sidestep different handling of empty codehash by rpc providers
* chore: address comments
* chore: update lock files
* fix: `BenchmarkCli` max cells override (#471)
* chore: update start-backend tag (#473)
* chore: replace feat/new-execution with main
* chore: update revm dep
---------
Co-authored-by: Yi Sun <yi-sun@users.noreply.github.com>
Co-authored-by: Jonathan Wang <31040440+jonathanpwang@users.noreply.github.com>
Co-authored-by: Valery <valery@intrinsictech.xyz>
Co-authored-by: Shayan Hosseini <shayan.hosseiny@gmail.com>
Co-authored-by: HrikB <23041116+HrikB@users.noreply.github.com>
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.
Depends on openvm-org/stark-backend#83
We update the overall architecture, mainly in the form of the VM extension and config traits, so that OpenVM becomes even more modular:
ProverBackend, which is the hardware backend forstark-backend.Some motivations were described in the description of #1809
Todo:
VmTestBuilder) to adapt to new designRecordArenatype (don't always use air width)