From 20facd44e822214be5cc3fe3e1e6492911fadfc5 Mon Sep 17 00:00:00 2001 From: Pedro Fontana Date: Wed, 17 Jul 2024 12:52:57 +0200 Subject: [PATCH 1/5] Update blockifier version --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 939265b..7787982 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -442,7 +442,7 @@ dependencies = [ [[package]] name = "blockifier" version = "0.7.0-dev.1" -source = "git+https://github.com/lambdaclass/blockifier?rev=d458a8d64b6d31da49c447576894ce013af862c2#d458a8d64b6d31da49c447576894ce013af862c2" +source = "git+https://github.com/lambdaclass/blockifier?rev=c675896abd183b268aa87d838388339ae0ca6545#c675896abd183b268aa87d838388339ae0ca6545" dependencies = [ "anyhow", "ark-ec", @@ -1037,7 +1037,7 @@ dependencies = [ [[package]] name = "cairo-native" version = "0.2.0" -source = "git+https://github.com/lambdaclass/cairo_native?rev=905d6959662edfec4829568f995206fcb8bf64d0#905d6959662edfec4829568f995206fcb8bf64d0" +source = "git+https://github.com/lambdaclass/cairo_native?rev=6526193a85f282c4ff58bd15d31ca77ccfd580ba#6526193a85f282c4ff58bd15d31ca77ccfd580ba" dependencies = [ "anyhow", "bumpalo", @@ -1087,7 +1087,7 @@ dependencies = [ [[package]] name = "cairo-native-runtime" version = "0.2.0" -source = "git+https://github.com/lambdaclass/cairo_native?rev=905d6959662edfec4829568f995206fcb8bf64d0#905d6959662edfec4829568f995206fcb8bf64d0" +source = "git+https://github.com/lambdaclass/cairo_native?rev=6526193a85f282c4ff58bd15d31ca77ccfd580ba#6526193a85f282c4ff58bd15d31ca77ccfd580ba" dependencies = [ "cairo-lang-runner", "cairo-lang-sierra-gas", diff --git a/Cargo.toml b/Cargo.toml index 073b3a7..eaa8bbb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,5 +9,5 @@ resolver = "2" [workspace.dependencies] thiserror = "1.0.32" starknet_api = "=0.12.0-dev.1" -blockifier = { git = "https://github.com/lambdaclass/blockifier", rev = "d458a8d64b6d31da49c447576894ce013af862c2" } +blockifier = { git = "https://github.com/lambdaclass/blockifier", rev = "c675896abd183b268aa87d838388339ae0ca6545" } tracing = "0.1" From 63f7b3f2e36e1abf746a30aefe4da07139354c89 Mon Sep 17 00:00:00 2001 From: Pedro Fontana Date: Wed, 17 Jul 2024 18:47:19 +0200 Subject: [PATCH 2/5] Update blockifier version --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7787982..7577482 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -442,7 +442,7 @@ dependencies = [ [[package]] name = "blockifier" version = "0.7.0-dev.1" -source = "git+https://github.com/lambdaclass/blockifier?rev=c675896abd183b268aa87d838388339ae0ca6545#c675896abd183b268aa87d838388339ae0ca6545" +source = "git+https://github.com/lambdaclass/blockifier?rev=8eab209eabee1359bec1cc0e9d0a34542a8b65a5#8eab209eabee1359bec1cc0e9d0a34542a8b65a5" dependencies = [ "anyhow", "ark-ec", @@ -1037,7 +1037,7 @@ dependencies = [ [[package]] name = "cairo-native" version = "0.2.0" -source = "git+https://github.com/lambdaclass/cairo_native?rev=6526193a85f282c4ff58bd15d31ca77ccfd580ba#6526193a85f282c4ff58bd15d31ca77ccfd580ba" +source = "git+https://github.com/lambdaclass/cairo_native?rev=72d10b7923cb4f97ae0b1688ea7de1d34297b0b2#72d10b7923cb4f97ae0b1688ea7de1d34297b0b2" dependencies = [ "anyhow", "bumpalo", @@ -1087,7 +1087,7 @@ dependencies = [ [[package]] name = "cairo-native-runtime" version = "0.2.0" -source = "git+https://github.com/lambdaclass/cairo_native?rev=6526193a85f282c4ff58bd15d31ca77ccfd580ba#6526193a85f282c4ff58bd15d31ca77ccfd580ba" +source = "git+https://github.com/lambdaclass/cairo_native?rev=72d10b7923cb4f97ae0b1688ea7de1d34297b0b2#72d10b7923cb4f97ae0b1688ea7de1d34297b0b2" dependencies = [ "cairo-lang-runner", "cairo-lang-sierra-gas", diff --git a/Cargo.toml b/Cargo.toml index eaa8bbb..9e35bab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,5 +9,5 @@ resolver = "2" [workspace.dependencies] thiserror = "1.0.32" starknet_api = "=0.12.0-dev.1" -blockifier = { git = "https://github.com/lambdaclass/blockifier", rev = "c675896abd183b268aa87d838388339ae0ca6545" } +blockifier = { git = "https://github.com/lambdaclass/blockifier", rev = "8eab209eabee1359bec1cc0e9d0a34542a8b65a5" } tracing = "0.1" From 3bd3261d0420f9a3a2e725a72bb20fb9e198ff6c Mon Sep 17 00:00:00 2001 From: Pedro Fontana Date: Wed, 17 Jul 2024 19:16:36 +0200 Subject: [PATCH 3/5] Add only_casm feature in state reader --- rpc-state-reader/Cargo.toml | 5 +++++ rpc-state-reader/src/blockifier_state_reader.rs | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/rpc-state-reader/Cargo.toml b/rpc-state-reader/Cargo.toml index 3f200e4..b61ffe6 100644 --- a/rpc-state-reader/Cargo.toml +++ b/rpc-state-reader/Cargo.toml @@ -3,6 +3,11 @@ name = "rpc-state-reader" version = "0.1.0" edition = "2021" +[features] +# The only_casm features, compiles all the sierra fetched contracts to casm. +# We use this feature in case we want to avoid using cairo_native in the Replay crate +only_casm = [] + [dependencies] ureq = { version = "2.7.1", features = ["json"] } serde = { version = "1.0", features = ["derive"] } diff --git a/rpc-state-reader/src/blockifier_state_reader.rs b/rpc-state-reader/src/blockifier_state_reader.rs index 47adba0..20bef34 100644 --- a/rpc-state-reader/src/blockifier_state_reader.rs +++ b/rpc-state-reader/src/blockifier_state_reader.rs @@ -89,7 +89,14 @@ impl StateReader for RpcStateReader { sierra_program_debug_info: None, abi: None, }; - ContractClass::V1Sierra(sierra_cc.try_into().unwrap()) + + if cfg!(feature = "only_casm") { + let casm_cc = + cairo_lang_starknet_classes::casm_contract_class::CasmContractClass::from_contract_class(sierra_cc, false, usize::MAX).unwrap(); + ContractClass::V1(casm_cc.try_into().unwrap()) + } else { + ContractClass::V1Sierra(sierra_cc.try_into().unwrap()) + } } None => { return Err(StateError::UndeclaredClassHash( From 35c460556a63120fd83c3cce449a769ea711fd67 Mon Sep 17 00:00:00 2001 From: Pedro Fontana Date: Wed, 17 Jul 2024 19:17:21 +0200 Subject: [PATCH 4/5] Add only_cairo_vm feature in replay --- replay/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/replay/Cargo.toml b/replay/Cargo.toml index 6043ff0..ebd44c3 100644 --- a/replay/Cargo.toml +++ b/replay/Cargo.toml @@ -5,6 +5,7 @@ edition = "2021" [features] benchmark = [] +only_cairo_vm = ["rpc-state-reader/only_casm"] [dependencies] # starknet specific crates From 1e1c057425c0f364f6c5ac4ffd3e744124de9041 Mon Sep 17 00:00:00 2001 From: Pedro Fontana Date: Wed, 17 Jul 2024 19:21:53 +0200 Subject: [PATCH 5/5] Add doc --- replay/Cargo.toml | 1 + rpc-state-reader/Cargo.toml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/replay/Cargo.toml b/replay/Cargo.toml index ebd44c3..7d44adb 100644 --- a/replay/Cargo.toml +++ b/replay/Cargo.toml @@ -5,6 +5,7 @@ edition = "2021" [features] benchmark = [] +# The only_cairo_vm feature is designed to avoid executing transitions with cairo_native and instead use cairo_vm exclusively only_cairo_vm = ["rpc-state-reader/only_casm"] [dependencies] diff --git a/rpc-state-reader/Cargo.toml b/rpc-state-reader/Cargo.toml index b61ffe6..c3dd737 100644 --- a/rpc-state-reader/Cargo.toml +++ b/rpc-state-reader/Cargo.toml @@ -4,8 +4,8 @@ version = "0.1.0" edition = "2021" [features] -# The only_casm features, compiles all the sierra fetched contracts to casm. -# We use this feature in case we want to avoid using cairo_native in the Replay crate +# The only_casm feature compiles all the Sierra fetched contracts to CASM. +# We use this feature to avoid using cairo_native in the Replay crate. only_casm = [] [dependencies]