starknet_os_runner: add stwo_proving feature gates and compile-safe fallbacks#12708
Conversation
621fe36 to
f154ccc
Compare
8d4a427 to
10ba7a0
Compare
f154ccc to
24179e3
Compare
10ba7a0 to
39fd2b2
Compare
0058dfb to
bb7f513
Compare
bb7f513 to
dfb2fc9
Compare
3ee787c to
0cb054c
Compare
bbfce30 to
d5460a7
Compare
fa0d50b to
a8b50bd
Compare
d5460a7 to
38132b9
Compare
a8b50bd to
9e076a3
Compare
38132b9 to
0be34b0
Compare
9e076a3 to
e69f7bf
Compare
0be34b0 to
0a00177
Compare
ce9a341 to
23047e9
Compare
b139d28 to
18e31c6
Compare
AvivYossef-starkware
left a comment
There was a problem hiding this comment.
@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_unnercrates/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"])
avi-starkware
left a comment
There was a problem hiding this comment.
@avi-starkware made 3 comments.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on AvivYossef-starkware and Yoni-Starkware).
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.
793c354 to
098ef82
Compare
avi-starkware
left a comment
There was a problem hiding this comment.
@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.
AvivYossef-starkware
left a comment
There was a problem hiding this comment.
@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 hardcodenightly-2025-07-14here. It will be in a crate-levelrust-toolchain.toml, and then running cargo aftercd crates/starknet_os_runnerwill run with the correct nightly toolchain.
Can you add a comment that explains it?
098ef82 to
76399fc
Compare
|
Previously, AvivYossef-starkware wrote…
There is a comment above the constant definition: Added another comment here. |
AvivYossef-starkware
left a comment
There was a problem hiding this comment.
@AvivYossef-starkware reviewed 1 file and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on Yoni-Starkware).
76399fc to
d211a90
Compare
…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.
d211a90 to
5e2331b
Compare
AvivYossef-starkware
left a comment
There was a problem hiding this comment.
@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
)
AvivYossef-starkware
left a comment
There was a problem hiding this comment.
@AvivYossef-starkware reviewed 1 file.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on Yoni-Starkware).
Summary
stwo_provingCargo feature gating the proving and server modules behind nightly-only stwo deps.main()that exits with a message whenstwo_provingis disabled.ProvingError::ProverExecution, related server error handling, and proving imports invirtual_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_runnerand 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_provingCargo feature to isolate nightly-only in-memory STWO proving support, and conditionally compiles proving/server integration sostarknet_os_runnercan still build on stable without those deps.When
stwo_provingis disabled, the binary now exits immediately with a clear message, while proving-related error variants, RPC error mapping, andvirtual_snos_proverproving entry points arecfg-gated (includingunimplemented!fallbacks where proving would run). CI tooling (scripts/run_tests.py) is updated so stablecargo clippy --all-featuresexcludes 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.