diff --git a/circuits/src/register/generation.rs b/circuits/src/register/generation.rs index 696f29cc0..59f5511ab 100644 --- a/circuits/src/register/generation.rs +++ b/circuits/src/register/generation.rs @@ -76,10 +76,10 @@ where /// Generates the trace for registers. /// /// There are 3 steps: -/// 1) populate the trace with a similar layout as the -/// [`RegisterInit` table](crate::registerinit::columns), -/// 2) go through the program and extract all ops that act on registers, -/// filling up this table, +/// 1) populate the trace with a similar layout as the [`RegisterInit` +/// table](crate::registerinit::columns), +/// 2) go through the program and extract all ops that act on registers, filling +/// up this table, /// 3) pad with dummy rows (`is_used` == 0) to ensure that trace is a power of /// 2. #[allow(clippy::type_complexity)] diff --git a/examples-builder/Cargo.toml b/examples-builder/Cargo.toml index 754afcfad..58b05fda4 100644 --- a/examples-builder/Cargo.toml +++ b/examples-builder/Cargo.toml @@ -10,9 +10,11 @@ repository = "https://github.com/0xmozak/mozak-vm" version = "0.1.0" [features] +bss-tester = [] empty = [] fibonacci = [] inputtape = [] +inputtapebin = [] memory-access = [] min-max = [] mozak-sort = [] @@ -21,4 +23,7 @@ rkyv-serialization = [] sha2 = [] static-mem-access = [] token = [] +# Not sure whether token, tokenbin, wallet and walletbin should all be here, or whether we forget cleaning them up in recent renames? +tokenbin = [] wallet = [] +walletbin = [] diff --git a/examples-builder/build.rs b/examples-builder/build.rs index 3265032c0..65cec29d5 100644 --- a/examples-builder/build.rs +++ b/examples-builder/build.rs @@ -47,34 +47,28 @@ const CRATES: &[Crate] = &[ const CARGO_MANIFEST_DIR: &str = env!("CARGO_MANIFEST_DIR"); fn build_elf(dest: &mut File, crate_path: &str, elf_path: &str, glob_name: &str, uses_std: bool) { - // Use a dummy array for clippy, since not building the elf is faster than - // building the elf - if cfg!(feature = "cargo-clippy") { - writeln!(dest, r#"pub const {glob_name}: &[u8] = &[];"#) + let args = if uses_std { + vec!["build", "--release", "--features=std"] } else { - let args = if uses_std { - vec!["build", "--release", "--features=std"] - } else { - vec!["build", "--release"] - }; - let output = Command::new("cargo") - .args(args) - .current_dir(crate_path) - .env_clear() - .envs(std::env::vars().filter(|x| !x.0.starts_with("CARGO_"))) - .output() - .expect("cargo command failed to run"); - if !output.status.success() { - io::stdout().write_all(&output.stdout).unwrap(); - io::stderr().write_all(&output.stderr).unwrap(); - panic!("cargo build {crate_path} failed."); - } - writeln!( - dest, - r#"pub const {glob_name}: &[u8] = - include_bytes!(r"{CARGO_MANIFEST_DIR}/{elf_path}");"# - ) + vec!["build", "--release"] + }; + let output = Command::new("cargo") + .args(args) + .current_dir(crate_path) + .env_clear() + .envs(std::env::vars().filter(|x| !x.0.starts_with("CARGO_"))) + .output() + .expect("cargo command failed to run"); + if !output.status.success() { + io::stdout().write_all(&output.stdout).unwrap(); + io::stderr().write_all(&output.stderr).unwrap(); + panic!("cargo build {crate_path} failed."); } + writeln!( + dest, + r#"pub const {glob_name}: &[u8] = + include_bytes!(r"{CARGO_MANIFEST_DIR}/{elf_path}");"# + ) .expect("failed to write vars.rs"); println!("cargo:rerun-if-changed={crate_path}"); diff --git a/examples/bss-tester/Cargo.toml b/examples/bss-tester/Cargo.toml index 26778e3cb..31c5baf8e 100644 --- a/examples/bss-tester/Cargo.toml +++ b/examples/bss-tester/Cargo.toml @@ -6,6 +6,9 @@ version = "0.1.0" [dependencies] mozak-sdk = { path = "../../sdk", default-features = false } +[features] +std = [] + [[bin]] name = "bss-tester" path = "main.rs" diff --git a/examples/empty/Cargo.toml b/examples/empty/Cargo.toml index 80b85d99b..ed2a573d3 100644 --- a/examples/empty/Cargo.toml +++ b/examples/empty/Cargo.toml @@ -6,6 +6,9 @@ version = "0.1.0" [dependencies] mozak-sdk = { path = "../../sdk", default-features = false } +[features] +std = [] + [[bin]] name = "empty" path = "main.rs" diff --git a/examples/mozak-sort/Cargo.toml b/examples/mozak-sort/Cargo.toml index 59e9fd7ec..149d87028 100644 --- a/examples/mozak-sort/Cargo.toml +++ b/examples/mozak-sort/Cargo.toml @@ -5,7 +5,10 @@ version = "0.1.0" [dependencies] mozak-sdk = { path = "../../sdk", default-features = false } -rand = { version = "0.8", default_features = false, features = ["alloc", "small_rng"] } +rand = { version = "0.8", default-features = false, features = ["alloc", "small_rng"] } + +[features] +std = [] [[bin]] name = "mozak-sort" diff --git a/expr/src/lib.rs b/expr/src/lib.rs index 49d52e2ce..46d893ea5 100644 --- a/expr/src/lib.rs +++ b/expr/src/lib.rs @@ -55,8 +55,8 @@ //! //! - [ ] TODO: support `|` via multiplication. //! - [ ] TODO support `&` via distributive law, and integration with constraint -//! builder. (a & b) | c == (a | c) & (b | c) == [(a | c), (b | c)] where [..] -//! means split into multiple constraints. +//! builder. (a & b) | c == (a | c) & (b | c) == [(a | c), (b | c)] where [..] +//! means split into multiple constraints. pub mod ops; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index b0731b297..59d1ba629 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2024-04-24" +channel = "nightly-2024-05-27" components = ["rustfmt", "rust-src", "clippy"] profile = "minimal" diff --git a/sdk/src/lib.rs b/sdk/src/lib.rs index 6ca7cf0b3..1840afdbb 100644 --- a/sdk/src/lib.rs +++ b/sdk/src/lib.rs @@ -3,6 +3,8 @@ #![allow(clippy::missing_panics_doc)] #![feature(trait_alias)] #![deny(warnings)] +// To allow `target_os = "mozakvm"` cfg on native, when the defining json file ain't available. +#![allow(unexpected_cfgs)] #![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(feature = "std", feature(restricted_std))]