Skip to content

starknet_os_runner: add stwo_proving feature gates and compile-safe fallbacks#12708

Merged
avi-starkware merged 1 commit intomain-v0.14.2from
avi/privacy/stwo-proving-feature-gates
Feb 26, 2026
Merged

starknet_os_runner: add stwo_proving feature gates and compile-safe fallbacks#12708
avi-starkware merged 1 commit intomain-v0.14.2from
avi/privacy/stwo-proving-feature-gates

Conversation

@avi-starkware
Copy link
Copy Markdown
Collaborator

@avi-starkware avi-starkware commented Feb 18, 2026

Summary

  • Add stwo_proving Cargo feature gating the proving and server modules behind nightly-only stwo deps.
  • Provide a fallback main() that exits with a message when stwo_proving is disabled.
  • cfg-gate ProvingError::ProverExecution, related server error handling, and proving imports in virtual_snos_prover.rs.

Stack: 2/4 — reviewable wiring PR; no core proving logic yet, just feature boundaries and error plumbing.

Depends on: #12707

Test plan

  • cargo test -p starknet_os_runner (default features, no stwo_proving)
  • cargo clippy -p starknet_os_runner --all-targets

🤖 Generated with Claude Code


Note

Medium Risk
Introduces feature-flagged code paths that change build/run behavior for starknet_os_runner and alters CI clippy invocation; risk is mainly around conditional compilation and ensuring stable vs nightly builds/tests behave as intended.

Overview
Adds a new stwo_proving Cargo feature to isolate nightly-only in-memory STWO proving support, and conditionally compiles proving/server integration so starknet_os_runner can still build on stable without those deps.

When stwo_proving is disabled, the binary now exits immediately with a clear message, while proving-related error variants, RPC error mapping, and virtual_snos_prover proving entry points are cfg-gated (including unimplemented! fallbacks where proving would run). CI tooling (scripts/run_tests.py) is updated so stable cargo clippy --all-features excludes nightly-feature packages and runs those packages in a separate, feature-limited clippy pass.

Written by Cursor Bugbot for commit 5e2331b. This will update automatically on new commits. Configure here.

@avi-starkware avi-starkware requested a review from a team as a code owner February 18, 2026 13:37
@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

Comment thread crates/starknet_os_runner/Cargo.toml Outdated
Comment thread crates/starknet_os_runner/src/proving/virtual_snos_prover.rs
@avi-starkware avi-starkware force-pushed the avi/privacy/stwo-proving-feature-gates branch from 621fe36 to f154ccc Compare February 18, 2026 19:05
@avi-starkware avi-starkware force-pushed the avi/privacy/align-proving-deps-stwo-1.0.1 branch from 8d4a427 to 10ba7a0 Compare February 18, 2026 20:24
@avi-starkware avi-starkware force-pushed the avi/privacy/stwo-proving-feature-gates branch from f154ccc to 24179e3 Compare February 18, 2026 20:54
Comment thread scripts/run_tests.py Outdated
@avi-starkware avi-starkware force-pushed the avi/privacy/align-proving-deps-stwo-1.0.1 branch from 10ba7a0 to 39fd2b2 Compare February 18, 2026 21:14
@avi-starkware avi-starkware force-pushed the avi/privacy/stwo-proving-feature-gates branch 2 times, most recently from 0058dfb to bb7f513 Compare February 18, 2026 21:23
@avi-starkware avi-starkware force-pushed the avi/privacy/stwo-proving-feature-gates branch from bb7f513 to dfb2fc9 Compare February 22, 2026 15:15
@avi-starkware avi-starkware force-pushed the avi/privacy/align-proving-deps-stwo-1.0.1 branch 2 times, most recently from 3ee787c to 0cb054c Compare February 22, 2026 15:38
@avi-starkware avi-starkware force-pushed the avi/privacy/stwo-proving-feature-gates branch 3 times, most recently from bbfce30 to d5460a7 Compare February 22, 2026 16:50
@avi-starkware avi-starkware force-pushed the avi/privacy/align-proving-deps-stwo-1.0.1 branch from fa0d50b to a8b50bd Compare February 23, 2026 09:38
@avi-starkware avi-starkware force-pushed the avi/privacy/stwo-proving-feature-gates branch from d5460a7 to 38132b9 Compare February 23, 2026 09:38
Comment thread crates/starknet_os_runner/src/running/test_utils.rs Outdated
@avi-starkware avi-starkware force-pushed the avi/privacy/align-proving-deps-stwo-1.0.1 branch from a8b50bd to 9e076a3 Compare February 23, 2026 11:09
@avi-starkware avi-starkware force-pushed the avi/privacy/stwo-proving-feature-gates branch from 38132b9 to 0be34b0 Compare February 23, 2026 11:09
Comment thread crates/starknet_os_runner/src/proving/virtual_snos_prover.rs
@avi-starkware avi-starkware force-pushed the avi/privacy/align-proving-deps-stwo-1.0.1 branch from 9e076a3 to e69f7bf Compare February 23, 2026 11:39
@avi-starkware avi-starkware force-pushed the avi/privacy/stwo-proving-feature-gates branch from 0be34b0 to 0a00177 Compare February 23, 2026 12:32
Base automatically changed from avi/privacy/align-proving-deps-stwo-1.0.1 to main-v0.14.2 February 25, 2026 06:06
@avi-starkware avi-starkware force-pushed the avi/privacy/stwo-proving-feature-gates branch 3 times, most recently from ce9a341 to 23047e9 Compare February 25, 2026 09:27
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Comment thread crates/starknet_os_runner/src/errors.rs
Comment thread crates/starknet_os_runner/src/errors.rs
@avi-starkware avi-starkware force-pushed the avi/privacy/stwo-proving-feature-gates branch 3 times, most recently from b139d28 to 18e31c6 Compare February 25, 2026 12:54
Copy link
Copy Markdown
Contributor

@AvivYossef-starkware AvivYossef-starkware left a comment

Choose a reason for hiding this comment

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

@AvivYossef-starkware reviewed 16 files and all commit messages, and made 5 comments.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on avi-starkware and Yoni-Starkware).


-- commits line 21 at r7:
I`d delete it, one day they'll claim that they own the code

Code quote:

  Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

crates/starknet_os_runner/src/main.rs line 5 at r7 (raw file):

#[cfg(not(feature = "stwo_proving"))]
fn main() {
    eprintln!("This binary requires the `stwo_proving` feature.");

Suggestion:

starknet_os_unner

crates/starknet_os_runner/src/proving/virtual_snos_prover.rs line 194 at r7 (raw file):

            Ok(VirtualSnosProverOutput { result, os_duration, prove_duration, total_duration })
        }
    }

cant you put in in the same block of

#[cfg(feature = "stwo_proving")]
        let (result, prove_duration) = {
            let prove_start = Instant::now();
            let result = prove_virtual_snos_run(runner_output).await?;
            let prove_duration = prove_start.elapsed();

            info!(
                prove_duration_ms = %prove_duration.as_millis(),
                "Proving completed"
            );
            (result, prove_duration)
        };

?

Code quote:

        #[cfg(feature = "stwo_proving")]
        {
            let total_duration = start_time.elapsed();
            info!(total_duration_ms = %total_duration.as_millis(), "prove_transaction completed");
            Ok(VirtualSnosProverOutput { result, os_duration, prove_duration, total_duration })
        }
    }

crates/starknet_os_runner/src/running/classes_provider.rs line 29 at r7 (raw file):

/// - `compiler_version`: Set to empty string
/// - `pythonic_hints`: Set to None
#[allow(dead_code)]

what has changed?

Code quote:

#[allow(dead_code)]

scripts/run_tests.py line 69 at r7 (raw file):

                cmds.append(["cargo", "clippy"] + args + ["--all-targets", "--all-features"])
            for p in nightly_crates:
                cmds.append(["cargo", "clippy", "--package", p, "--all-targets"])

Don't you want to check it with the feature?

Code quote:

cmds.append(["cargo", "clippy", "--package", p, "--all-targets"])

Copy link
Copy Markdown
Collaborator Author

@avi-starkware avi-starkware left a comment

Choose a reason for hiding this comment

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

@avi-starkware made 3 comments.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on AvivYossef-starkware and Yoni-Starkware).


-- commits line 21 at r7:

Previously, AvivYossef-starkware wrote…

I`d delete it, one day they'll claim that they own the code

I doubt they will make that claim, but I don't mind removing it.

If they ever make that claim people will stop using their products...
They just put it here for marketing


crates/starknet_os_runner/src/running/classes_provider.rs line 29 at r7 (raw file):

Previously, AvivYossef-starkware wrote…

what has changed?

I just removed dead_code where it is not necessary. Earlier I added a bunch of dead_code proc macro because my feature gating covered more of the code. Now that I limited feature gating many dead_code proc macros can be removed. Turns out this one can also be removed.


scripts/run_tests.py line 69 at r7 (raw file):

Previously, AvivYossef-starkware wrote…

Don't you want to check it with the feature?

No
With the feature, it will fail. (Not in this PR, in the next one #12708)

We need a CI workflow that runs cargo with nightly.
I don't want to hardcode nightly-2025-07-14 here. It will be in a crate-level rust-toolchain.toml, and then running cargo after cd crates/starknet_os_runner will run with the correct nightly toolchain.

@avi-starkware avi-starkware force-pushed the avi/privacy/stwo-proving-feature-gates branch 2 times, most recently from 793c354 to 098ef82 Compare February 26, 2026 10:07
Copy link
Copy Markdown
Collaborator Author

@avi-starkware avi-starkware left a comment

Choose a reason for hiding this comment

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

@avi-starkware made 2 comments.
Reviewable status: 14 of 16 files reviewed, 3 unresolved discussions (waiting on AvivYossef-starkware and Yoni-Starkware).


crates/starknet_os_runner/src/proving/virtual_snos_prover.rs line 194 at r7 (raw file):

Previously, AvivYossef-starkware wrote…

cant you put in in the same block of

#[cfg(feature = "stwo_proving")]
        let (result, prove_duration) = {
            let prove_start = Instant::now();
            let result = prove_virtual_snos_run(runner_output).await?;
            let prove_duration = prove_start.elapsed();

            info!(
                prove_duration_ms = %prove_duration.as_millis(),
                "Proving completed"
            );
            (result, prove_duration)
        };

?

Done.


crates/starknet_os_runner/src/main.rs line 5 at r7 (raw file):

#[cfg(not(feature = "stwo_proving"))]
fn main() {
    eprintln!("This binary requires the `stwo_proving` feature.");

Done.

Copy link
Copy Markdown
Contributor

@AvivYossef-starkware AvivYossef-starkware left a comment

Choose a reason for hiding this comment

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

@AvivYossef-starkware reviewed 2 files and all commit messages, made 1 comment, and resolved 2 discussions.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on avi-starkware and Yoni-Starkware).


scripts/run_tests.py line 69 at r7 (raw file):

Previously, avi-starkware (Avi Cohen) wrote…

No
With the feature, it will fail. (Not in this PR, in the next one #12708)

We need a CI workflow that runs cargo with nightly.
I don't want to hardcode nightly-2025-07-14 here. It will be in a crate-level rust-toolchain.toml, and then running cargo after cd crates/starknet_os_runner will run with the correct nightly toolchain.

Can you add a comment that explains it?

@avi-starkware avi-starkware force-pushed the avi/privacy/stwo-proving-feature-gates branch from 098ef82 to 76399fc Compare February 26, 2026 11:11
@avi-starkware
Copy link
Copy Markdown
Collaborator Author

scripts/run_tests.py line 69 at r7 (raw file):

Previously, AvivYossef-starkware wrote…

Can you add a comment that explains it?

There is a comment above the constant definition:

# Packages that have features requiring a nightly Rust toolchain.  These are excluded from the
# main CI clippy run (which uses --all-features on stable) and are instead checked by their own
# dedicated CI workflow with the appropriate toolchain.
NIGHTLY_FEATURES_PACKAGES: Set[str] = {"starknet_os_runner"}

Added another comment here.

Copy link
Copy Markdown
Contributor

@AvivYossef-starkware AvivYossef-starkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

@AvivYossef-starkware reviewed 1 file and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on Yoni-Starkware).

@avi-starkware avi-starkware force-pushed the avi/privacy/stwo-proving-feature-gates branch from 76399fc to d211a90 Compare February 26, 2026 13:18
…allbacks

Gate the proving and server modules behind the new `stwo_proving` Cargo
feature so the crate compiles on stable Rust without pulling in
nightly-only
stwo dependencies.

Changes:
- Add `stwo_proving` feature in Cargo.toml with optional deps
  (cairo-program-runner-lib, stwo_run_and_prove_lib).
- cfg-gate `proving` and `server` modules in lib.rs.
- Provide a fallback main() that exits with a message when
  stwo_proving is not enabled.
- Gate ProvingError::ProverExecution and related server error
  handling behind the feature.
- Gate proving imports and call sites in virtual_snos_prover.rs.
- cfg-gate RpcRunner, RpcRunnerFactory, VirtualSnosRunner trait,
  and related test utilities that are only used from the gated
  proving module.
@avi-starkware avi-starkware force-pushed the avi/privacy/stwo-proving-feature-gates branch from d211a90 to 5e2331b Compare February 26, 2026 13:30
Copy link
Copy Markdown
Contributor

@AvivYossef-starkware AvivYossef-starkware left a comment

Choose a reason for hiding this comment

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

@AvivYossef-starkware reviewed all commit messages and made 1 comment.
Reviewable status: 15 of 16 files reviewed, all discussions resolved (waiting on Yoni-Starkware).


scripts/run_tests.py line 61 at r10 (raw file):

            nightly_crates = (
                crates & NIGHTLY_FEATURES_PACKAGES if crates else NIGHTLY_FEATURES_PACKAGES
            )

Is it documented somewhere that a crate being empty means workspace-wide?

Code quote:

            nightly_crates = (
                crates & NIGHTLY_FEATURES_PACKAGES if crates else NIGHTLY_FEATURES_PACKAGES
            )

Copy link
Copy Markdown
Contributor

@AvivYossef-starkware AvivYossef-starkware left a comment

Choose a reason for hiding this comment

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

@AvivYossef-starkware reviewed 1 file.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on Yoni-Starkware).

@avi-starkware avi-starkware added this pull request to the merge queue Feb 26, 2026
Merged via the queue into main-v0.14.2 with commit d83a499 Feb 26, 2026
16 of 18 checks passed
@avi-starkware avi-starkware deleted the avi/privacy/stwo-proving-feature-gates branch February 26, 2026 17:22
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 28, 2026
@avi-starkware avi-starkware restored the avi/privacy/stwo-proving-feature-gates branch February 28, 2026 09:41
@avi-starkware avi-starkware deleted the avi/privacy/stwo-proving-feature-gates branch February 28, 2026 09:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants