Skip to content

feat(zk-benchmarks): add profile types#3231

Draft
mw2000 wants to merge 1 commit into
mainfrom
mw2000/zk-benchmarks-config
Draft

feat(zk-benchmarks): add profile types#3231
mw2000 wants to merge 1 commit into
mainfrom
mw2000/zk-benchmarks-config

Conversation

@mw2000
Copy link
Copy Markdown
Contributor

@mw2000 mw2000 commented Jun 4, 2026

Adds the initial ZK benchmark scenario config/profile types as the next layer after the merged scaffold PR.

@cb-heimdall
Copy link
Copy Markdown
Collaborator

cb-heimdall commented Jun 4, 2026

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

use serde::{Deserialize, Serialize};
use url::Url;

use crate::{Profiles, ProofConfig, ProofMode};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The types ProofConfig, ProofMode, and B20SequenceWorkloadConfig (line 120) are imported from crate:: but are not defined anywhere in this crate. lib.rs also doesn't declare/re-export the config or profile modules. This means the code won't compile as-is.

Even for a draft PR stacked on other work, consider either:

  • Adding stub type definitions in this PR so it compiles independently, or
  • Noting explicitly which prior PR must land first and keeping this PR's base branch set to that PR's branch rather than main.

Comment thread crates/infra/zk-benchmarks/src/config.rs Outdated
}

/// Validates semantic config requirements.
pub fn validate(&self) -> Result<()> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validate() checks the profile name, but resolve_profile() (line 56) performs the same lookup and returns its own error. This means calling from_yamlvalidateresolve_profile does the profile lookup twice.

Consider either:

  • Having validate store/cache the resolved profile, or
  • Removing the profile check from validate and relying on resolve_profile to catch unknown profiles at resolution time, or
  • Documenting that validate is a fast-fail check and the duplication is intentional.

@mw2000 mw2000 force-pushed the mw2000/zk-benchmarks-config branch from 5e03596 to aa65c6f Compare June 4, 2026 17:50

impl ProofConfig {
/// Validates proof configuration.
pub const fn validate(&self) -> Result<()> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const fn here compiles only because the body is trivially Ok(()). The moment real validation logic is added (string checks, ensure!, etc.), const will need to be removed since eyre::Result isn't const-compatible for non-trivial operations. Drop const now to avoid a misleading API and a future breaking change if this is part of a public interface.

Suggested change
pub const fn validate(&self) -> Result<()> {
pub fn validate(&self) -> Result<()> {

Comment on lines +100 to +113
/// Resolved runtime endpoint profile.
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct BenchmarkProfile {
/// Profile name.
pub name: String,
/// L2 execution RPC URL.
pub l2_rpc_url: Url,
/// Rollup RPC URL.
pub rollup_rpc_url: Url,
/// ZK prover RPC URL.
pub zk_prover_url: Url,
/// L2 chain ID.
pub l2_chain_id: u64,
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BenchmarkProfile is the core type of the profile subsystem — it's what Profiles::get() returns — yet it's defined here in config.rs rather than in profile.rs. This creates a conceptual circular dependency: profile.rs imports BenchmarkProfile from config, while config.rs imports Profiles from profile.

Consider moving BenchmarkProfile to profile.rs so the dependency flows one way: configprofile (config uses profile types to resolve endpoints).

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Review Summary

2 findings — both low severity, no blockers.

Findings

  1. ProofConfig::validate is unnecessarily const fn (proof_config.rs:16) — Compiles only because the body is Ok(()). Will break the moment real validation logic is added. Drop const to avoid a misleading API and future churn.

  2. BenchmarkProfile lives in the wrong module (config.rs:100-113) — This type is the core return type of Profiles::get() but is defined in config.rs, creating a conceptual circular dependency between config and profile modules. Moving it to profile.rs would make the dependency flow one-directional.

Structure

The overall design is clean: config loading with serde, named profiles with CLI overrides, and a proof mode enum. lib.rs follows project conventions (minimal, grouped mod + re-export). Cargo.toml dependencies are properly sorted and inherit workspace lints.

@mw2000 mw2000 changed the title feat(zk-benchmarks): add scenario config profiles feat(zk-benchmarks): add profile types Jun 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

✅ base-std fork tests: all 602 passed

base/base is fully in sync with the base-std spec.

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.

2 participants