Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
Draft
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,6 @@ lcov.info
.rusty-hook.toml
!/starknet_programs/raw_contract_classes/*.json
cairo-*.tar
starknet-pypy-env/
starknet-pypy-env/

executor_logs/
77 changes: 74 additions & 3 deletions Cargo.lock

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

17 changes: 15 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ metrics = []
# Disclaimer: This feature enables state modifications being applied on reverted and failings txs, and also disables address availability check when deploying contracts.
# Only use for benchmarking using the replay binary
replay_benchmark = []
cairo-native = ["dep:ipc-channel", "dep:tracing-appender", "dep:cairo-native", "dep:uuid"]

[workspace]
members = [
Expand Down Expand Up @@ -40,8 +41,10 @@ cairo-lang-casm = { workspace = true }
cairo-lang-sierra = { workspace = true }
cairo-lang-starknet = { workspace = true }
cairo-lang-utils = { workspace = true }
cairo-native = { git = "https://github.com/lambdaclass/cairo_native", rev = "67a8c4e9853f588d4e8cb898f3fda37b7bdae5f1", optional = true }

cairo-native = { git = "https://github.com/lambdaclass/cairo_native", rev = "66d16af0db37ba6769d4576a49e12a40af14f565", features = ["with-serde"], optional = true }
ipc-channel = { version = "0.18.0", features = ["memfd"], optional = true }
tracing-appender = { version = "0.2.3", optional = true}
uuid = { version = "1.6.1", features = ["serde", "v4"], optional = true }

cairo-vm = { workspace = true }
flate2 = "1.0.25"
Expand All @@ -67,6 +70,7 @@ starknet_api = { workspace = true }
starknet-crypto = "0.6.1"
thiserror = { workspace = true }
tracing = "0.1.37"
tracing-subscriber = "0.3.17"

[dev-dependencies]
assert_matches = "1.5.0"
Expand All @@ -85,11 +89,20 @@ path = "src/bin/native_bench.rs"
name = "cairo_native"
required-features = ["cairo-native"]

[[bin]]
path = "src/bin/native_executor.rs"
name = "cairo_native_executor"
required-features = ["cairo-native"]

[[bench]]
path = "bench/yas.rs"
name = "yas"
harness = false

[[example]]
name = "sandbox"
required-features = ["cairo-native"]

[profile.release]
codegen-units = 1
lto = "fat"
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ STARKNET_SIERRA_COMPILE_CAIRO_2:=cairo2/bin/starknet-sierra-compile
usage:
@echo 'Usage:'
@echo ' build: Builds the Rust code'
@echo ' build-native: Builds the Rust code with the cairo-native feature'
@echo ' check: Runs cargo check'
@echo ' deps: Installs dependencies'
@echo ' deps-macos: Installs depedencies for MacOS'
Expand Down Expand Up @@ -156,6 +157,9 @@ cairo-%.tar:
build: compile-cairo compile-starknet compile-cairo-1-casm compile-cairo-1-sierra compile-cairo-2-casm compile-cairo-2-sierra
cargo build --release --workspace

build-native: compile-cairo compile-starknet compile-cairo-1-casm compile-cairo-1-sierra compile-cairo-2-casm compile-cairo-2-sierra
cargo build --release --workspace --features cairo-native

check: compile-cairo compile-starknet compile-cairo-1-casm compile-cairo-1-sierra compile-cairo-2-casm compile-cairo-2-sierra
cargo check --workspace --all-targets

Expand Down
10 changes: 10 additions & 0 deletions bench/internals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ pub fn deploy_account(
block_context,
#[cfg(feature = "cairo-native")]
Some(program_cache.clone()),
#[cfg(feature = "cairo-native")]
None,
)
})
.unwrap();
Expand Down Expand Up @@ -158,6 +160,8 @@ pub fn declare(
block_context,
#[cfg(feature = "cairo-native")]
Some(program_cache.clone()),
#[cfg(feature = "cairo-native")]
None,
)
})
.unwrap();
Expand Down Expand Up @@ -207,6 +211,8 @@ pub fn deploy(
block_context,
#[cfg(feature = "cairo-native")]
Some(program_cache.clone()),
#[cfg(feature = "cairo-native")]
None,
)
})
.unwrap();
Expand Down Expand Up @@ -254,6 +260,8 @@ pub fn invoke(
block_context,
#[cfg(feature = "cairo-native")]
Some(program_cache.clone()),
#[cfg(feature = "cairo-native")]
None,
)
.unwrap();

Expand Down Expand Up @@ -282,6 +290,8 @@ pub fn invoke(
2_000_000,
#[cfg(feature = "cairo-native")]
Some(program_cache.clone()),
#[cfg(feature = "cairo-native")]
None,
)
})
.unwrap();
Expand Down
Loading