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

Fix WASM32 compilation for Cairo1-run and cairo-vm #1792

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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: 2 additions & 2 deletions cairo1-run/src/cairo_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ pub fn cairo_run_program(

let main_func = find_function(sierra_program, "::main")?;

let initial_gas = 9999999999999_usize;
let initial_gas = 9999999999999_u64;

// Fetch return type data
let return_type_id = match main_func.signature.ret_types.last() {
Expand Down Expand Up @@ -453,7 +453,7 @@ fn load_arguments(
runner: &mut CairoRunner,
cairo_run_config: &Cairo1RunConfig,
main_func: &Function,
initial_gas: usize,
initial_gas: u64,
) -> Result<(), Error> {
let got_gas_builtin = main_func
.signature
Expand Down
4 changes: 1 addition & 3 deletions vm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ test_utils = ["std", "dep:arbitrary", "starknet-types-core/arbitrary", "starknet
extensive_hints = []

[dependencies]
zip = {version = "0.6.6", optional = true }
zip = {version = "0.6.6", optional = true, default_features = false, features=["deflate"] }
num-bigint = { workspace = true }
rand = { workspace = true }
num-traits = { workspace = true }
Expand Down Expand Up @@ -67,8 +67,6 @@ bitvec = { workspace = true }
cairo-lang-starknet = { workspace = true, optional = true }
cairo-lang-starknet-classes = { workspace = true, optional = true }
cairo-lang-casm = { workspace = true, optional = true }

# TODO: check these dependencies for wasm compatibility
ark-ff = { workspace = true, optional = true }
ark-std = { workspace = true, optional = true }

Expand Down
2 changes: 1 addition & 1 deletion vm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(warnings)]
#![forbid(unsafe_code)]
#![cfg_attr(any(target_arch = "wasm32", not(feature = "std")), no_std)]
#![cfg_attr(any(not(feature = "std")), no_std)]

#[cfg(feature = "std")]
include!("./with_std.rs");
Expand Down
2 changes: 1 addition & 1 deletion vm/src/vm/runners/cairo_pie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ pub(super) mod serde_impl {

use super::CAIRO_PIE_VERSION;
use super::{CairoPieMemory, Pages, PublicMemoryPage, SegmentInfo};
#[cfg(any(target_arch = "wasm32", no_std, not(feature = "std")))]
#[cfg(any(no_std, not(feature = "std")))]
use crate::alloc::string::ToString;
use crate::stdlib::prelude::{String, Vec};
use crate::{
Expand Down
Loading