From e38435cad3d906f1169979947204fff87aa328e1 Mon Sep 17 00:00:00 2001 From: Olivier Desenfans Date: Fri, 23 Feb 2024 13:45:31 +0100 Subject: [PATCH] Chore: bump cairo-vm to latest version with bootloader support (#5) --- Cargo.toml | 2 +- src/cairo_vm.rs | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7f0f979..37a7daf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/src/cairo_vm.rs b/src/cairo_vm.rs index c69a515..ccdaf27 100644 --- a/src/cairo_vm.rs +++ b/src/cairo_vm.rs @@ -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, @@ -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 @@ -82,6 +84,7 @@ pub fn cairo_run( pub fn run_in_proof_mode( program_content: &[u8], layout: Layout, + allow_missing_builtins: Option, ) -> Result<(CairoRunner, VirtualMachine), CairoRunError> { let proof_mode = true; @@ -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(); @@ -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() @@ -213,18 +217,21 @@ pub fn extract_execution_artifacts( pub fn run_bootloader_in_proof_mode( bootloader: &Program, tasks: Vec, + layout: Option, + allow_missing_builtins: Option, ) -> Result { 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();