Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Both branches support Stwo prover opcodes (Blake2s, QM31) since v2.0.0.
#### Upcoming Changes

* Add Stwo cairo runner API [#2351](https://github.com/starkware-libs/cairo-vm/pull/2351)
* feat: move runner_mode to be a field in StwoCairoRunConfig [#2366](https://github.com/starkware-libs/cairo-vm/pull/2366)

* refactor: rename CairoRunConfig to Cairo0RunConfig [#2365](https://github.com/starkware-libs/cairo-vm/pull/2365)

* feat: add disable_trace_padding field to Cairo1RunConfig [#2364](https://github.com/starkware-libs/cairo-vm/pull/2364)
Expand Down
9 changes: 5 additions & 4 deletions vm/src/cairo_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ pub struct StwoCairoRunConfig {
pub fill_holes: bool,
pub secure_run: bool,
pub disable_trace_padding: bool,
pub runner_mode: RunnerMode,
}

impl Default for StwoCairoRunConfig {
Expand All @@ -90,25 +91,25 @@ impl Default for StwoCairoRunConfig {
fill_holes: false,
secure_run: true,
disable_trace_padding: true,
runner_mode: RunnerMode::ProofModeCanonical,
}
}
}

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

let proof_mode = runner_mode != RunnerMode::ExecutionMode;
let proof_mode = cairo_run_config.runner_mode != RunnerMode::ExecutionMode;
let mut cairo_runner = CairoRunner::new_stwo(
program,
runner_mode,
cairo_run_config.runner_mode.clone(),
cairo_run_config.trace_enabled,
cairo_run_config.disable_trace_padding,
)?;
Expand Down Expand Up @@ -775,12 +776,12 @@ mod tests {
let program = Program::from_bytes(program_content, Some("main")).unwrap();
let runner = cairo_run_stwo(
&program,
RunnerMode::ExecutionMode,
&stwo_allowed_builtins(),
&mut BuiltinHintProcessor::new_empty(),
ExecutionScopes::new(),
&StwoCairoRunConfig {
disable_trace_padding: false,
runner_mode: RunnerMode::ExecutionMode,
..Default::default()
},
)
Expand Down
4 changes: 1 addition & 3 deletions vm/src/vm/runners/cairo_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5791,7 +5791,6 @@ mod tests {
];
let runner = crate::cairo_run::cairo_run_stwo(
&program,
RunnerMode::ProofModeCanonical,
&allowed,
&mut hint_processor,
ExecutionScopes::new(),
Expand Down Expand Up @@ -5819,7 +5818,6 @@ mod tests {
];
let runner = crate::cairo_run::cairo_run_stwo(
&program,
RunnerMode::ProofModeCanonical,
&allowed,
&mut hint_processor,
ExecutionScopes::new(),
Expand Down Expand Up @@ -5872,7 +5870,6 @@ mod tests {
// Stwo run
let stwo_runner = crate::cairo_run::cairo_run_stwo(
&program,
RunnerMode::ProofModeCanonical,
&allowed,
&mut BuiltinHintProcessor::new_empty(),
ExecutionScopes::new(),
Expand All @@ -5883,6 +5880,7 @@ mod tests {
fill_holes: false,
secure_run: true,
disable_trace_padding: true,
runner_mode: RunnerMode::ProofModeCanonical,
},
)
.unwrap();
Expand Down
Loading