Skip to content

Commit

Permalink
Merge pull request #33 from lambdaclass/add-only-cairo-vm-feature
Browse files Browse the repository at this point in the history
Add the only_cairo_vm feature
  • Loading branch information
pefontana authored Jul 18, 2024
2 parents 7b60add + 1e1c057 commit 99bf2cf
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "8eab209eabee1359bec1cc0e9d0a34542a8b65a5" }
tracing = "0.1"
2 changes: 2 additions & 0 deletions replay/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ 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]
# starknet specific crates
Expand Down
5 changes: 5 additions & 0 deletions rpc-state-reader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ name = "rpc-state-reader"
version = "0.1.0"
edition = "2021"

[features]
# 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]
ureq = { version = "2.7.1", features = ["json"] }
serde = { version = "1.0", features = ["derive"] }
Expand Down
9 changes: 8 additions & 1 deletion rpc-state-reader/src/blockifier_state_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 99bf2cf

Please sign in to comment.