Skip to content

feat: Add stateless-executor guest program and SP1 cluster infrastructure#15

Open
WiseMrMusa wants to merge 34 commits intomasterfrom
nm/01-guest-program
Open

feat: Add stateless-executor guest program and SP1 cluster infrastructure#15
WiseMrMusa wants to merge 34 commits intomasterfrom
nm/01-guest-program

Conversation

@WiseMrMusa
Copy link

This PR introduces the stateless-executor guest program, a new benchmarking workload that executes Ethereum blocks without pre/post execution validation overhead. It also adds initial SP1 cluster Docker infrastructure for local proving.

Detailed Changes

1. New Stateless Executor Guest Program

Added a complete stateless-executor crate under ere-guests/ that provides execution-only benchmarking capabilities:

Core Library (ere-guests/stateless-executor/src/)

File Description
lib.rs Module exports and common types
execution.rs Core execution logic - executes block transactions without validation
guest.rs Guest program entry point and cycle tracking
witness_db.rs Database implementation using witness data

zkVM Entry Points

Each supported zkVM has its own entry point:

zkVM Path Description
RISC0 risc0/src/main.rs RISC0 zkVM guest entry
SP1 sp1/src/main.rs SP1 zkVM guest entry
OpenVM openvm/src/main.rs OpenVM guest entry
Pico pico/src/main.rs Pico zkVM guest entry
Zisk zisk/src/main.rs Zisk zkVM guest entry
Airbender airbender/src/main.rs Airbender entry

2. Benchmark Runner Integration

Updated crates/benchmark-runner/ to support the stateless-executor:

Change Description
stateless_executor.rs New module for executor-specific runner logic
stateless_executor/reth.rs Reth execution client integration
runner.rs Added executor mode alongside validator mode
Cargo.toml Added memory tracking features

3. CLI Enhancements

Updated crates/ere-hosts/src/cli.rs:

Feature Description
Guest type selection Added --guest flag for stateless-executor vs stateless-validator
Input handling Support for both --input-file and --input-folder
Network resource Added network as valid resource type for SP1 zkVM

4. Memory Tracking (crates/metrics/)

Added memory tracking capabilities:

// New memory tracking feature
pub struct MemoryStats {
    pub peak_memory_bytes: u64,
    pub average_memory_bytes: u64,
}

5. SP1 Cluster Infrastructure

Added Docker-based SP1 cluster setup under scripts/sp1-cluster/:

File Description
docker-compose.yml Docker Compose configuration for SP1 cluster services
start-sp1-cluster.sh Startup script with GPU worker configuration (0-8 GPUs)
stop-sp1-cluster.sh Graceful shutdown script

Services included:

  • Redis (artifact storage)
  • PostgreSQL (job metadata)
  • API service (gRPC endpoint)
  • Coordinator (job distribution)
  • CPU/GPU worker nodes

6. Dependency Updates

Updated Cargo.toml and Cargo.lock:

  • Point ere packages to NethermindEth/ere repository
  • Version update to 4bac87e
  • Updated ethrex dependencies for stateless-validator

7. Cluster Resource Support

Added cluster resource type for SP1 proving:

pub enum ProverResourceType {
    Cpu,
    Gpu,
    Network,  // Uses SP1 network
    Cluster,  // Uses local SP1 cluster
}

Why These Changes?

Stateless Executor Benefits

  1. Pure EVM Benchmarking: Measures only execution cycles without validation overhead
  2. Opcode Cost Analysis: More accurate per-opcode cost measurement
  3. Research Focused: Isolates EVM execution for performance research
  4. Comparison Baseline: Provides baseline for comparing against full validation

SP1 Cluster Benefits

  1. Self-Hosted Proving: Run provers locally without network dependency
  2. Multi-GPU Support: Leverage multiple GPUs for parallel proving
  3. Consistent Environment: Reproducible benchmarking environment
  4. Cost Control: No network proving costs for development/testing

Testing

# Build the stateless-executor
cargo build --release -p benchmark-runner

# Run executor benchmark
./target/release/ere-hosts prove \
  --guest stateless-executor \
  --zkvm risc0 \
  --input-folder ./zkevm-fixtures-input-1M

# Start SP1 cluster
cd scripts/sp1-cluster
./start-sp1-cluster.sh --gpu-nodes 4 -d

Breaking Changes

None. This PR adds new functionality without modifying existing APIs.

jsign and others added 25 commits December 12, 2025 15:09
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Co-authored-by: Han <tinghan0110@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
…ion 4bac87e for ere packages in Cargo.toml and Cargo.lock
- Introduced Cluster variant in Resource enum for SP1 cluster resources.
- Updated ProverResourceType conversion to handle Cluster using default ClusterProverConfig.
- Introduced a new `docker-compose.yml` file for managing SP1 Cluster services including Redis, PostgreSQL, API, Coordinator, CPU, and GPU nodes.
- Added `start-sp1-cluster.sh` script for starting the cluster with options for GPU nodes and mixed worker modes.
- Created `stop-sp1-cluster.sh` script for stopping the cluster and managing persistent data and images.
- Enhanced user experience with logging and help messages in the scripts.
- Added validation in the CLI to ensure that the Cluster resource can only be used with SP1 zkVMs.
- Introduced `bail` from `anyhow` for error handling in case of invalid resource configurations.
Adds a new crate that provides pure EVM transaction execution without
pre-execution validation or post-execution consensus checks.

Key components:
- stateless_execution_with_trie: Core execution function returning bool
- WitnessDatabase: EVM database backed by StatelessTrie witness data
- RethStatelessExecutorGuest: Guest implementation for zkVMs
- SP1 and RISC0 entry points for zkVM compilation

This enables accurate benchmarking of raw EVM execution cycles in zkVMs
by skipping all validation overhead.
Updates both root and ere-guests workspace Cargo.toml to include:
- reth-stateless-executor as a workspace member
- Required reth dependencies (reth-evm, reth-revm)
- Dependency declarations for the new crate
Adds stateless_executor module to benchmark-runner for execution-only
benchmarking support:
- stateless_executor/reth.rs: Input preparation for Reth executor
- Updated lib.rs to export the new module
- Made BlockMetadata.block_used_gas public for reuse
…-executor

Adds zkVM-specific entry points for all supported platforms:
- Airbender: With custom allocator and runtime
- OpenVM: With crypto provider installation
- Pico: With KZG proof verification crypto provider
- ZisK: Standard entry point

These mirror the structure of stateless-validator entry points.
Introduces a new stateless_executor module with the following features:
- Added stateless_executor.rs for handling execution client variants and input preparation.
- Updated reth.rs to utilize StatelessExecutorFixture for input processing.
- Enhanced read_benchmark_fixtures_folder to read and parse benchmark fixtures.

This lays the groundwork for execution-only benchmarking of stateless programs.
…cutor and validator to allow both input_file and input_folder

This commit introduces the ability to specify either an input folder or a single input file for the stateless executor and validator. The `stateless_executor_inputs` and `stateless_validator_inputs` functions are updated to support this new functionality, along with corresponding changes in the CLI to accept an optional input file argument. This improves flexibility in benchmarking by allowing users to work with individual benchmark fixture files directly.
…r stateless executor

This commit modifies the CLI to set a default value for the execution client argument, allowing for easier configuration. Additionally, the guest relative path for the Reth execution client is simplified by removing the specific subdirectory, enhancing the path resolution for the stateless executor.
This commit introduces a new `MemoryTracker` struct to monitor memory usage during the proving process. It tracks initial, peak, and average memory usage, and integrates memory sampling into the benchmark runner. The proving metrics now include memory usage statistics, enhancing performance analysis capabilities.
…d runner.rs

This commit introduces optional memory tracking capabilities in the benchmark runner. The `Cargo.toml` is updated to include new features for memory tracking, and the `runner.rs` file is modified to conditionally compile memory tracking logic based on the feature flag. This enhances the ability to monitor memory usage during the proving process, aligning with previous enhancements to performance analysis.
…chmark CLI

This commit introduces a new `Network` resource type in the CLI, allowing users to specify network proving. It also adds validation to ensure that network proving is only used with SP1, enhancing the robustness of the command line interface for the zkVM benchmarker. The changes improve user experience by preventing misconfigurations related to resource selection.
… in reth.rs

This commit updates the input handling in the `stateless_executor_inputs_from_fixtures` function to pass a reference to the benchmark wrapper instead of moving it. This change ensures that the benchmark wrapper can be reused, improving memory efficiency and preventing potential ownership issues.
This commit cleans up the `runner.rs` file by removing the unused `PublicValues` import from the `ere_zkvm_interface` module. This enhances code clarity and maintains a cleaner codebase.
…nd version 4bac87e for ere packages in Cargo.toml and Cargo.lock
run: ls -R artifacts

- name: Release
uses: softprops/action-gh-release@v2

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Release Compiled Guests' step
Uses Step
uses 'softprops/action-gh-release' with ref 'v2', not a pinned commit hash
Regenerate lockfile to resolve Git merge conflict markers that were
preventing the project from building. The conflicts were between
different versions of ere dependencies.
… commit hashes

This commit modifies the Rust toolchain version in multiple workflow files to use specific commit hashes instead of the stable tag. This change ensures consistency in the toolchain used across different CI jobs, enhancing build reliability.
…e files

This commit refactors several files by reorganizing and cleaning up import statements for better readability and consistency. Additionally, it enhances code formatting in the `runner.rs`, `stateless_executor.rs`, `stateless_validator.rs`, and other related files, ensuring a more maintainable codebase. These changes do not alter functionality but improve overall code clarity.
This commit updates multiple GitHub workflow files to include the `toolchain` parameter when installing the Rust toolchain. This change ensures that the toolchain is explicitly set to either stable or nightly, improving consistency and clarity in the CI configuration.
This commit introduces a new `Cluster` resource type in the CLI, allowing users to specify cluster proving. It also updates the validation logic to ensure that both network and cluster proving are only used with SP1, improving the robustness of the command line interface for the zkVM benchmarker. Additionally, the `MemoryTracker` struct is enhanced with a default implementation and methods for peak and initial memory usage are marked as `const`, optimizing performance.
This commit enhances the `proving` structure in the metrics README by adding fields for peak, average, and initial memory usage in bytes. These additions improve the granularity of memory tracking during the proving process, aligning with recent enhancements in memory tracking capabilities.
This commit refines the header parsing logic in the `RpcBlocksAndWitnessesBuilder` by trimming whitespace and filtering out empty headers. This enhancement ensures that only valid headers are processed, improving the robustness of the RPC request handling.
@WiseMrMusa WiseMrMusa force-pushed the nm/01-guest-program branch 2 times, most recently from 590a0d6 to 97b6421 Compare January 8, 2026 11:02
WiseMrMusa pushed a commit that referenced this pull request Jan 8, 2026
Create benchmark runner and allow parallel execution
@WiseMrMusa WiseMrMusa force-pushed the nm/01-guest-program branch from 97b6421 to 590a0d6 Compare January 8, 2026 11:15
@NethermindEth NethermindEth deleted a comment from vercel bot Jan 8, 2026
@vercel
Copy link

vercel bot commented Jan 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
zkgas-profiling Ignored Ignored Jan 8, 2026 5:02pm

@WiseMrMusa WiseMrMusa force-pushed the nm/01-guest-program branch from e4bdeab to 33861da Compare January 8, 2026 11:52
This commit updates the versions of several dependencies in `Cargo.lock` and modifies the source revisions for the `ere` packages in `Cargo.toml` and `ere-guests/Cargo.toml`. The changes include downgrading `itertools`, `syn`, and `windows-sys` versions, as well as updating the source revision for various `ere` packages to a more recent commit. These updates aim to ensure compatibility and stability across the project.
@WiseMrMusa WiseMrMusa force-pushed the nm/01-guest-program branch from 33861da to 817c03f Compare January 8, 2026 11:59
This commit introduces several new workspace dependencies in `Cargo.toml`, including `openvm-k256`, `openvm-keccak256`, `openvm-kzg`, `openvm-p256`, `openvm-pairing`, and `openvm-sha2`, enhancing the functionality of the OpenVM platform. Additionally, a new module for `openvm_revm_crypto` is added in `main.rs`, setting the stage for further development in cryptographic functionalities.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants