Skip to content

Commit

Permalink
Chore: bump cairo-vm to latest version with bootloader support (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
odesenfans authored Feb 23, 2024
1 parent d5926ea commit e38435c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "Rust SDK for the Starkware Stone prover and verifier."

[dependencies]
bincode = "2.0.0-rc.3"
cairo-vm = { git = "https://github.com/Moonsong-Labs/cairo-vm", rev = "b2f69d230416129a84ad8237ccc13d088992f74b", features=["extensive_hints"] }
cairo-vm = { git = "https://github.com/Moonsong-Labs/cairo-vm", rev = "e0a4653aa5634664a3f792b38715a572e9f89b44", features = ["extensive_hints"] }
serde = { version = "1.0.192", features = ["derive"] }
serde_json = "1.0.108"
stark_evm_adapter = "0.1.5"
Expand Down
15 changes: 11 additions & 4 deletions src/cairo_vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ pub fn cairo_run(
.secure_run
.unwrap_or(!cairo_run_config.proof_mode);

let allow_missing_builtins = cairo_run_config.allow_missing_builtins.unwrap_or(false);

let mut cairo_runner = CairoRunner::new(
program,
cairo_run_config.layout,
Expand All @@ -50,7 +52,7 @@ pub fn cairo_run(
}

let mut vm = VirtualMachine::new(cairo_run_config.trace_enabled);
let end = cairo_runner.initialize(&mut vm)?;
let end = cairo_runner.initialize(&mut vm, allow_missing_builtins)?;
// check step calculation

cairo_runner
Expand Down Expand Up @@ -82,6 +84,7 @@ pub fn cairo_run(
pub fn run_in_proof_mode(
program_content: &[u8],
layout: Layout,
allow_missing_builtins: Option<bool>,
) -> Result<(CairoRunner, VirtualMachine), CairoRunError> {
let proof_mode = true;

Expand All @@ -93,6 +96,7 @@ pub fn run_in_proof_mode(
proof_mode,
secure_run: None,
disable_trace_padding: false,
allow_missing_builtins,
};

let mut hint_processor = BuiltinHintProcessor::new_empty();
Expand Down Expand Up @@ -127,7 +131,7 @@ pub fn make_bootloader_tasks(
pie.map(|pie| TaskSpec {
task: Task::Pie(pie),
})
.map_err(BootloaderTaskError::Pie)
.map_err(BootloaderTaskError::Pie)
});

program_tasks.chain(cairo_pie_tasks).collect()
Expand Down Expand Up @@ -213,18 +217,21 @@ pub fn extract_execution_artifacts(
pub fn run_bootloader_in_proof_mode(
bootloader: &Program,
tasks: Vec<TaskSpec>,
layout: Option<Layout>,
allow_missing_builtins: Option<bool>,
) -> Result<ExecutionArtifacts, ExecutionError> {
let proof_mode = true;
let layout = "starknet_with_keccak";
let layout = layout.unwrap_or(Layout::StarknetWithKeccak);

let cairo_run_config = CairoRunConfig {
entrypoint: "main",
trace_enabled: true,
relocate_mem: true,
layout,
layout: &layout.to_string(),
proof_mode,
secure_run: None,
disable_trace_padding: false,
allow_missing_builtins,
};

let n_tasks = tasks.len();
Expand Down

0 comments on commit e38435c

Please sign in to comment.