-
Notifications
You must be signed in to change notification settings - Fork 128
feat(l2): add timed prover API #5478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds timed execution and proving capabilities to all zkVM backends by introducing execute_timed and prove_timed functions that measure and return the duration of operations instead of just logging them.
- Adds
execute_timedandprove_timedfunctions to the main prover API and all backend implementations (exec, sp1, risc0, zisk, openvm) - Removes inline timing/logging from existing
executeandprovefunctions to avoid duplication - Adds
PartialEqderive to theBackendenum for comparison support
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/l2/prover/src/lib.rs | Adds public execute_timed and prove_timed API functions that dispatch to backend-specific implementations |
| crates/l2/prover/src/backend/exec.rs | Implements execute_timed and prove_timed for the exec backend |
| crates/l2/prover/src/backend/sp1.rs | Implements execute_timed and prove_timed for SP1, removes timing from non-timed functions |
| crates/l2/prover/src/backend/risc0.rs | Implements execute_timed and prove_timed for RISC0, removes timing from non-timed functions |
| crates/l2/prover/src/backend/zisk.rs | Implements execute_timed and prove_timed for ZisK backend |
| crates/l2/prover/src/backend/openvm.rs | Implements execute_timed and prove_timed for OpenVM backend |
| crates/l2/prover/src/backend/mod.rs | Adds PartialEq trait to Backend enum |
| crates/l2/prover/Cargo.toml | Formats the l2 feature definition to single line |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Lines of code reportTotal lines added: Detailed view |
| #[serde(rename = "cycles")] | ||
| _cycles: u64, | ||
| #[serde(rename = "id")] | ||
| _id: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unknown fields are ignored by default. We can remove them if we are not going to use them. If we want them for completeness, it's ok then
Adds a couple of patches to use ZisK's bls12_381 precompiles **Benchmarks:** ZisK backend, GPU proving with a RTX 4090 | **Block (mainnet)** | **Gas Used** | **ethrex** | **ethrex (kzg-rs patch)** | | --------- | ------------ | ---------- | ------------------------- | | 23919400 | 41,075,722 | 3m 59s | 3m 19s | | 23919500 | 40,237,085 | 4m 13s | 4m 12s | | 23919600 | 24,064,259 | 2m 48s | 2m 48s | | 23919700 | 20,862,238 | 2m 26s | 2m 27s | | 23919800 | 31,813,109 | 3m 18s | 3m 18s | | 23919900 | 22,917,739 | 2m 32s | 2m 31s | | 23920000 | 37,256,487 | 3m 42s | 3m 42s | | 23920100 | 33,542,307 | 3m 25s | 3m 14s | | 23920200 | 22,994,047 | 2m 21s | 2m 21s | | 23920300 | 53,950,967 | 5m 21s | 5m 21s |
Motivation
To measure execution and proving time correctly. This means removing the client initialization from the equation. In the case of ZisK, we use it's own timing exposed via a JSON file generated after proving.
Description
Adds
_timedversions for execution and proving for all zkVM backends.