Skip to content

Commit 25eb4fc

Browse files
feat: move runner_mode to be a field in StwoCairoRunConfig (#2366)
1 parent edaa02a commit 25eb4fc

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Both branches support Stwo prover opcodes (Blake2s, QM31) since v2.0.0.
1313
#### Upcoming Changes
1414

1515
* Add Stwo cairo runner API [#2351](https://github.com/starkware-libs/cairo-vm/pull/2351)
16+
* feat: move runner_mode to be a field in StwoCairoRunConfig [#2366](https://github.com/starkware-libs/cairo-vm/pull/2366)
17+
1618
* refactor: rename CairoRunConfig to Cairo0RunConfig [#2365](https://github.com/starkware-libs/cairo-vm/pull/2365)
1719

1820
* feat: add disable_trace_padding field to Cairo1RunConfig [#2364](https://github.com/starkware-libs/cairo-vm/pull/2364)

vm/src/cairo_run.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ pub struct StwoCairoRunConfig {
7979
pub fill_holes: bool,
8080
pub secure_run: bool,
8181
pub disable_trace_padding: bool,
82+
pub runner_mode: RunnerMode,
8283
}
8384

8485
impl Default for StwoCairoRunConfig {
@@ -90,25 +91,25 @@ impl Default for StwoCairoRunConfig {
9091
fill_holes: false,
9192
secure_run: true,
9293
disable_trace_padding: true,
94+
runner_mode: RunnerMode::ProofModeCanonical,
9395
}
9496
}
9597
}
9698

9799
#[allow(clippy::result_large_err)]
98100
pub fn cairo_run_stwo(
99101
program: &Program,
100-
runner_mode: RunnerMode,
101102
allowed_builtins: &[BuiltinName],
102103
hint_processor: &mut dyn HintProcessor,
103104
exec_scopes: ExecutionScopes,
104105
cairo_run_config: &StwoCairoRunConfig,
105106
) -> Result<CairoRunner, CairoRunError> {
106107
let _span = span!(Level::INFO, "cairo run stwo").entered();
107108

108-
let proof_mode = runner_mode != RunnerMode::ExecutionMode;
109+
let proof_mode = cairo_run_config.runner_mode != RunnerMode::ExecutionMode;
109110
let mut cairo_runner = CairoRunner::new_stwo(
110111
program,
111-
runner_mode,
112+
cairo_run_config.runner_mode.clone(),
112113
cairo_run_config.trace_enabled,
113114
cairo_run_config.disable_trace_padding,
114115
)?;
@@ -775,12 +776,12 @@ mod tests {
775776
let program = Program::from_bytes(program_content, Some("main")).unwrap();
776777
let runner = cairo_run_stwo(
777778
&program,
778-
RunnerMode::ExecutionMode,
779779
&stwo_allowed_builtins(),
780780
&mut BuiltinHintProcessor::new_empty(),
781781
ExecutionScopes::new(),
782782
&StwoCairoRunConfig {
783783
disable_trace_padding: false,
784+
runner_mode: RunnerMode::ExecutionMode,
784785
..Default::default()
785786
},
786787
)

vm/src/vm/runners/cairo_runner.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5791,7 +5791,6 @@ mod tests {
57915791
];
57925792
let runner = crate::cairo_run::cairo_run_stwo(
57935793
&program,
5794-
RunnerMode::ProofModeCanonical,
57955794
&allowed,
57965795
&mut hint_processor,
57975796
ExecutionScopes::new(),
@@ -5819,7 +5818,6 @@ mod tests {
58195818
];
58205819
let runner = crate::cairo_run::cairo_run_stwo(
58215820
&program,
5822-
RunnerMode::ProofModeCanonical,
58235821
&allowed,
58245822
&mut hint_processor,
58255823
ExecutionScopes::new(),
@@ -5872,7 +5870,6 @@ mod tests {
58725870
// Stwo run
58735871
let stwo_runner = crate::cairo_run::cairo_run_stwo(
58745872
&program,
5875-
RunnerMode::ProofModeCanonical,
58765873
&allowed,
58775874
&mut BuiltinHintProcessor::new_empty(),
58785875
ExecutionScopes::new(),
@@ -5883,6 +5880,7 @@ mod tests {
58835880
fill_holes: false,
58845881
secure_run: true,
58855882
disable_trace_padding: true,
5883+
runner_mode: RunnerMode::ProofModeCanonical,
58865884
},
58875885
)
58885886
.unwrap();

0 commit comments

Comments
 (0)