Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sierra emulator support #30

Merged
merged 1 commit into from
Jan 3, 2025
Merged
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
111 changes: 84 additions & 27 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ cairo-lang-starknet-classes = "2.9.2"
cairo-lang-utils = "2.9.2"
# Important: when updated, make sure to update the cairo-native submodule as well.
cairo-native = "0.2.5-rc0"
sierra-emu = { git = "https://github.com/lambdaclass/sierra-emu.git", rev = "e015746b4a7e541853725c2773a7909db37f8f6d" }
cairo-vm = "=1.0.1"
camelpaste = "0.1.0"
chrono = "0.4.26"
Expand Down Expand Up @@ -204,7 +205,7 @@ rustc-hex = "2.1.0"
schemars = "0.8.12"
semver = "1.0.23"
serde = "1.0.197"
serde_json = "1.0.116"
serde_json = "1.0.133"
serde_repr = "0.1.19"
serde_yaml = "0.9.16"
sha2 = "0.10.8"
Expand Down
3 changes: 2 additions & 1 deletion crates/blockifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ description = "The transaction-executing component in the Starknet sequencer."
workspace = true

[features]
cairo_native = ["dep:cairo-native", "dep:stacker", "starknet_sierra_compile/cairo_native"]
cairo_native = ["dep:cairo-native", "dep:stacker", "starknet_sierra_compile/cairo_native", "dep:sierra-emu"]
jemalloc = ["dep:tikv-jemallocator"]
native_blockifier = []
reexecution = ["transaction_serde"]
Expand All @@ -30,6 +30,7 @@ cairo-lang-casm = { workspace = true, features = ["parity-scale-codec"] }
cairo-lang-runner.workspace = true
cairo-lang-starknet-classes.workspace = true
cairo-native = { workspace = true, optional = true }
sierra-emu = { workspace = true, optional = true }
cairo-vm.workspace = true
derive_more.workspace = true
indexmap.workspace = true
Expand Down
1 change: 1 addition & 0 deletions crates/blockifier/src/execution/native.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pub mod contract_class;
pub mod entry_point_execution;
pub mod executor;
pub mod syscall_handler;
pub mod utils;

Expand Down
8 changes: 4 additions & 4 deletions crates/blockifier/src/execution/native/contract_class.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::ops::Deref;
use std::sync::Arc;

use cairo_native::executor::AotContractExecutor;
use starknet_api::core::EntryPointSelector;

use super::executor::ContractExecutor;
use crate::execution::contract_class::{CompiledClassV1, EntryPointV1};
use crate::execution::entry_point::CallEntryPoint;
use crate::execution::errors::PreExecutionError;
Expand All @@ -26,7 +26,7 @@ impl NativeCompiledClassV1 {
///
/// executor must be derived from sierra_program which in turn must be derived from
/// sierra_contract_class.
pub fn new(executor: AotContractExecutor, casm: CompiledClassV1) -> NativeCompiledClassV1 {
pub fn new(executor: ContractExecutor, casm: CompiledClassV1) -> NativeCompiledClassV1 {
let contract = NativeCompiledClassV1Inner::new(executor, casm);

Self(Arc::new(contract))
Expand All @@ -46,12 +46,12 @@ impl NativeCompiledClassV1 {

#[derive(Debug)]
pub struct NativeCompiledClassV1Inner {
pub executor: AotContractExecutor,
pub executor: ContractExecutor,
casm: CompiledClassV1,
}

impl NativeCompiledClassV1Inner {
fn new(executor: AotContractExecutor, casm: CompiledClassV1) -> Self {
fn new(executor: ContractExecutor, casm: CompiledClassV1) -> Self {
NativeCompiledClassV1Inner { executor, casm }
}
}
Expand Down
Loading
Loading