Skip to content

Conversation

@ilitteri
Copy link
Contributor

@ilitteri ilitteri commented Dec 1, 2025

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 _timed versions for execution and proving for all zkVM backends.

@ilitteri ilitteri self-assigned this Dec 1, 2025
Copilot AI review requested due to automatic review settings December 1, 2025 17:11
@github-actions github-actions bot added the L2 Rollup client label Dec 1, 2025
Copilot finished reviewing on behalf of ilitteri December 1, 2025 17:13
Copy link
Contributor

Copilot AI left a 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_timed and prove_timed functions to the main prover API and all backend implementations (exec, sp1, risc0, zisk, openvm)
  • Removes inline timing/logging from existing execute and prove functions to avoid duplication
  • Adds PartialEq derive to the Backend enum 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.

@github-actions
Copy link

github-actions bot commented Dec 1, 2025

Lines of code report

Total lines added: 180
Total lines removed: 0
Total lines changed: 180

Detailed view
+-----------------------------------------------+-------+------+
| File                                          | Lines | Diff |
+-----------------------------------------------+-------+------+
| ethrex/crates/l2/prover/src/backend/exec.rs   | 58    | +16  |
+-----------------------------------------------+-------+------+
| ethrex/crates/l2/prover/src/backend/openvm.rs | 79    | +34  |
+-----------------------------------------------+-------+------+
| ethrex/crates/l2/prover/src/backend/risc0.rs  | 130   | +25  |
+-----------------------------------------------+-------+------+
| ethrex/crates/l2/prover/src/backend/sp1.rs    | 153   | +25  |
+-----------------------------------------------+-------+------+
| ethrex/crates/l2/prover/src/backend/zisk.rs   | 138   | +41  |
+-----------------------------------------------+-------+------+
| ethrex/crates/l2/prover/src/lib.rs            | 97    | +39  |
+-----------------------------------------------+-------+------+

Comment on lines +123 to +126
#[serde(rename = "cycles")]
_cycles: u64,
#[serde(rename = "id")]
_id: String,
Copy link
Contributor

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

xqft and others added 3 commits December 1, 2025 20:40
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                    |
@ilitteri ilitteri enabled auto-merge December 2, 2025 11:46
@ilitteri ilitteri added this pull request to the merge queue Dec 2, 2025
Merged via the queue into main with commit 0c0759e Dec 2, 2025
39 checks passed
@ilitteri ilitteri deleted the guest_program_timed_api branch December 2, 2025 12:57
@github-project-automation github-project-automation bot moved this to Done in ethrex_l2 Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L2 Rollup client

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants