diff --git a/Cargo.lock b/Cargo.lock index a89362c0..7ce670c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2566,12 +2566,12 @@ dependencies = [ [[package]] name = "common" version = "0.2.0" -source = "git+https://github.com/a16z/jolt.git?rev=35d46f5#35d46f5486769528104a91ac076d7dbc547b5c93" +source = "git+https://github.com/a16z/jolt.git?rev=2e05fe88#2e05fe883920054df2ee3a6df8f85c2caba77c99" dependencies = [ "allocative", "ark-serialize 0.5.0", "serde", - "syn 1.0.109", + "syn 2.0.101", ] [[package]] @@ -6287,7 +6287,7 @@ dependencies = [ [[package]] name = "jolt-core" version = "0.1.0" -source = "git+https://github.com/a16z/jolt.git?rev=35d46f5#35d46f5486769528104a91ac076d7dbc547b5c93" +source = "git+https://github.com/a16z/jolt.git?rev=2e05fe88#2e05fe883920054df2ee3a6df8f85c2caba77c99" dependencies = [ "allocative", "ark-bn254", @@ -6295,7 +6295,7 @@ dependencies = [ "ark-ff 0.5.0", "ark-serialize 0.5.0", "ark-std 0.5.0", - "bincode 1.3.3", + "bincode 2.0.1", "blake2", "chrono", "clap", @@ -6304,7 +6304,7 @@ dependencies = [ "dory-pcs", "eyre", "fixedbitset 0.5.7", - "itertools 0.10.5", + "itertools 0.14.0", "jolt-inlines-keccak256", "jolt-inlines-sha2", "jolt-optimizations", @@ -6319,8 +6319,8 @@ dependencies = [ "rayon", "serde", "sha3", - "strum 0.27.2", - "strum_macros 0.26.4", + "strum 0.28.0", + "strum_macros 0.28.0", "thiserror 2.0.18", "tracer", "tracing", @@ -6331,7 +6331,7 @@ dependencies = [ [[package]] name = "jolt-inlines-keccak256" version = "0.1.0" -source = "git+https://github.com/a16z/jolt.git?rev=35d46f5#35d46f5486769528104a91ac076d7dbc547b5c93" +source = "git+https://github.com/a16z/jolt.git?rev=2e05fe88#2e05fe883920054df2ee3a6df8f85c2caba77c99" dependencies = [ "ctor 0.6.3", "tracer", @@ -6341,7 +6341,7 @@ dependencies = [ [[package]] name = "jolt-inlines-secp256k1" version = "0.1.0" -source = "git+https://github.com/a16z/jolt.git?rev=35d46f5#35d46f5486769528104a91ac076d7dbc547b5c93" +source = "git+https://github.com/a16z/jolt.git?rev=2e05fe88#2e05fe883920054df2ee3a6df8f85c2caba77c99" dependencies = [ "ark-ff 0.5.0", "ark-secp256k1", @@ -6356,7 +6356,7 @@ dependencies = [ [[package]] name = "jolt-inlines-sha2" version = "0.1.0" -source = "git+https://github.com/a16z/jolt.git?rev=35d46f5#35d46f5486769528104a91ac076d7dbc547b5c93" +source = "git+https://github.com/a16z/jolt.git?rev=2e05fe88#2e05fe883920054df2ee3a6df8f85c2caba77c99" dependencies = [ "ctor 0.6.3", "tracer", @@ -6384,7 +6384,7 @@ dependencies = [ [[package]] name = "jolt-platform" version = "0.1.0" -source = "git+https://github.com/a16z/jolt.git?rev=35d46f5#35d46f5486769528104a91ac076d7dbc547b5c93" +source = "git+https://github.com/a16z/jolt.git?rev=2e05fe88#2e05fe883920054df2ee3a6df8f85c2caba77c99" dependencies = [ "getrandom 0.2.16", "getrandom 0.3.3", @@ -6394,7 +6394,7 @@ dependencies = [ [[package]] name = "jolt-sdk" version = "0.1.0" -source = "git+https://github.com/a16z/jolt.git?rev=35d46f5#35d46f5486769528104a91ac076d7dbc547b5c93" +source = "git+https://github.com/a16z/jolt.git?rev=2e05fe88#2e05fe883920054df2ee3a6df8f85c2caba77c99" dependencies = [ "bytemuck", "cfg-if", @@ -6403,7 +6403,7 @@ dependencies = [ "jolt-platform", "jolt-sdk-macros", "postcard", - "riscv 0.12.1", + "riscv 0.16.0", "serde", "zeroos", ] @@ -6411,12 +6411,12 @@ dependencies = [ [[package]] name = "jolt-sdk-macros" version = "0.1.0" -source = "git+https://github.com/a16z/jolt.git?rev=35d46f5#35d46f5486769528104a91ac076d7dbc547b5c93" +source = "git+https://github.com/a16z/jolt.git?rev=2e05fe88#2e05fe883920054df2ee3a6df8f85c2caba77c99" dependencies = [ "common", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.101", ] [[package]] @@ -12840,21 +12840,21 @@ dependencies = [ [[package]] name = "riscv" -version = "0.12.1" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea8ff73d3720bdd0a97925f0bf79ad2744b6da8ff36be3840c48ac81191d7a7" +checksum = "9251433e48c39d2133cbaff3ae7809ce6a1ecbc8225ca7da33d96d10cf360582" dependencies = [ "critical-section", "embedded-hal", "paste", - "riscv-pac", + "riscv-types", ] [[package]] -name = "riscv-pac" -version = "0.2.0" +name = "riscv-types" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8188909339ccc0c68cfb5a04648313f09621e8b87dc03095454f1a11f6c5d436" +checksum = "d3f2ad9f15a07f4a0e1677124f9120ce7e83ab7e1ca7186af0ca9da529b62e80" [[package]] name = "riscv_common" @@ -15150,6 +15150,12 @@ dependencies = [ "strum_macros 0.27.2", ] +[[package]] +name = "strum" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd" + [[package]] name = "strum_macros" version = "0.26.4" @@ -15175,6 +15181,18 @@ dependencies = [ "syn 2.0.101", ] +[[package]] +name = "strum_macros" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.101", +] + [[package]] name = "stwo" version = "0.1.1" @@ -16127,7 +16145,7 @@ dependencies = [ [[package]] name = "tracer" version = "0.2.0" -source = "git+https://github.com/a16z/jolt.git?rev=35d46f5#35d46f5486769528104a91ac076d7dbc547b5c93" +source = "git+https://github.com/a16z/jolt.git?rev=2e05fe88#2e05fe883920054df2ee3a6df8f85c2caba77c99" dependencies = [ "addr2line 0.26.0", "ark-serialize 0.5.0", @@ -16135,15 +16153,15 @@ dependencies = [ "common", "derive_more 2.0.1", "fnv", - "itertools 0.10.5", + "itertools 0.14.0", "jolt-platform", "object 0.38.1", "paste", "postcard", "serde", "serde_json", - "strum 0.27.2", - "strum_macros 0.26.4", + "strum 0.28.0", + "strum_macros 0.28.0", "tracing", "tracing-subscriber 0.3.20", ] @@ -17645,7 +17663,7 @@ dependencies = [ [[package]] name = "zeroos" version = "0.1.0" -source = "git+https://github.com/LayerZero-Labs/ZeroOS.git?rev=ebdf6de34a0719022d42c9d719391b02ba747f8b#ebdf6de34a0719022d42c9d719391b02ba747f8b" +source = "git+https://github.com/LayerZero-Labs/ZeroOS.git?rev=3b132ce862ba6769a4261d151f69ff32c5f0dc30#3b132ce862ba6769a4261d151f69ff32c5f0dc30" dependencies = [ "zeroos-allocator-linked-list", "zeroos-arch-riscv", @@ -17653,7 +17671,6 @@ dependencies = [ "zeroos-foundation", "zeroos-macros", "zeroos-os-linux", - "zeroos-runtime-musl", "zeroos-runtime-nostd", "zeroos-scheduler-cooperative", ] @@ -17661,7 +17678,7 @@ dependencies = [ [[package]] name = "zeroos-allocator-linked-list" version = "0.1.0" -source = "git+https://github.com/LayerZero-Labs/ZeroOS.git?rev=ebdf6de34a0719022d42c9d719391b02ba747f8b#ebdf6de34a0719022d42c9d719391b02ba747f8b" +source = "git+https://github.com/LayerZero-Labs/ZeroOS.git?rev=3b132ce862ba6769a4261d151f69ff32c5f0dc30#3b132ce862ba6769a4261d151f69ff32c5f0dc30" dependencies = [ "linked_list_allocator", "zeroos-foundation", @@ -17670,7 +17687,7 @@ dependencies = [ [[package]] name = "zeroos-arch-riscv" version = "0.1.0" -source = "git+https://github.com/LayerZero-Labs/ZeroOS.git?rev=ebdf6de34a0719022d42c9d719391b02ba747f8b#ebdf6de34a0719022d42c9d719391b02ba747f8b" +source = "git+https://github.com/LayerZero-Labs/ZeroOS.git?rev=3b132ce862ba6769a4261d151f69ff32c5f0dc30#3b132ce862ba6769a4261d151f69ff32c5f0dc30" dependencies = [ "cfg-if", "memoffset", @@ -17684,7 +17701,7 @@ dependencies = [ [[package]] name = "zeroos-backtrace" version = "0.1.0" -source = "git+https://github.com/LayerZero-Labs/ZeroOS.git?rev=ebdf6de34a0719022d42c9d719391b02ba747f8b#ebdf6de34a0719022d42c9d719391b02ba747f8b" +source = "git+https://github.com/LayerZero-Labs/ZeroOS.git?rev=3b132ce862ba6769a4261d151f69ff32c5f0dc30#3b132ce862ba6769a4261d151f69ff32c5f0dc30" dependencies = [ "cfg-if", "zeroos-macros", @@ -17693,7 +17710,7 @@ dependencies = [ [[package]] name = "zeroos-debug" version = "0.1.0" -source = "git+https://github.com/LayerZero-Labs/ZeroOS.git?rev=ebdf6de34a0719022d42c9d719391b02ba747f8b#ebdf6de34a0719022d42c9d719391b02ba747f8b" +source = "git+https://github.com/LayerZero-Labs/ZeroOS.git?rev=3b132ce862ba6769a4261d151f69ff32c5f0dc30#3b132ce862ba6769a4261d151f69ff32c5f0dc30" dependencies = [ "cfg-if", ] @@ -17701,7 +17718,7 @@ dependencies = [ [[package]] name = "zeroos-foundation" version = "0.1.0" -source = "git+https://github.com/LayerZero-Labs/ZeroOS.git?rev=ebdf6de34a0719022d42c9d719391b02ba747f8b#ebdf6de34a0719022d42c9d719391b02ba747f8b" +source = "git+https://github.com/LayerZero-Labs/ZeroOS.git?rev=3b132ce862ba6769a4261d151f69ff32c5f0dc30#3b132ce862ba6769a4261d151f69ff32c5f0dc30" dependencies = [ "cfg-if", "libc", @@ -17711,32 +17728,22 @@ dependencies = [ [[package]] name = "zeroos-macros" version = "0.1.0" -source = "git+https://github.com/LayerZero-Labs/ZeroOS.git?rev=ebdf6de34a0719022d42c9d719391b02ba747f8b#ebdf6de34a0719022d42c9d719391b02ba747f8b" +source = "git+https://github.com/LayerZero-Labs/ZeroOS.git?rev=3b132ce862ba6769a4261d151f69ff32c5f0dc30#3b132ce862ba6769a4261d151f69ff32c5f0dc30" [[package]] name = "zeroos-os-linux" version = "0.1.0" -source = "git+https://github.com/LayerZero-Labs/ZeroOS.git?rev=ebdf6de34a0719022d42c9d719391b02ba747f8b#ebdf6de34a0719022d42c9d719391b02ba747f8b" +source = "git+https://github.com/LayerZero-Labs/ZeroOS.git?rev=3b132ce862ba6769a4261d151f69ff32c5f0dc30#3b132ce862ba6769a4261d151f69ff32c5f0dc30" dependencies = [ "cfg-if", "libc", "zeroos-foundation", ] -[[package]] -name = "zeroos-runtime-musl" -version = "0.1.0" -source = "git+https://github.com/LayerZero-Labs/ZeroOS.git?rev=ebdf6de34a0719022d42c9d719391b02ba747f8b#ebdf6de34a0719022d42c9d719391b02ba747f8b" -dependencies = [ - "zeroos-backtrace", - "zeroos-debug", - "zeroos-foundation", -] - [[package]] name = "zeroos-runtime-nostd" version = "0.1.0" -source = "git+https://github.com/LayerZero-Labs/ZeroOS.git?rev=ebdf6de34a0719022d42c9d719391b02ba747f8b#ebdf6de34a0719022d42c9d719391b02ba747f8b" +source = "git+https://github.com/LayerZero-Labs/ZeroOS.git?rev=3b132ce862ba6769a4261d151f69ff32c5f0dc30#3b132ce862ba6769a4261d151f69ff32c5f0dc30" dependencies = [ "cfg-if", "zeroos-backtrace", @@ -17746,7 +17753,7 @@ dependencies = [ [[package]] name = "zeroos-scheduler-cooperative" version = "0.1.0" -source = "git+https://github.com/LayerZero-Labs/ZeroOS.git?rev=ebdf6de34a0719022d42c9d719391b02ba747f8b#ebdf6de34a0719022d42c9d719391b02ba747f8b" +source = "git+https://github.com/LayerZero-Labs/ZeroOS.git?rev=3b132ce862ba6769a4261d151f69ff32c5f0dc30#3b132ce862ba6769a4261d151f69ff32c5f0dc30" dependencies = [ "cfg-if", "libc", diff --git a/Cargo.toml b/Cargo.toml index 84f03084..81b143c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -93,12 +93,12 @@ airbender_riscv_common = { git = "https://github.com/matter-labs/zksync-airbende # Jolt dependencies jolt-ark-serialize = { git = "https://github.com/a16z/arkworks-algebra", package = "ark-serialize", branch = "dev/twist-shout" } -jolt-common = { git = "https://github.com/a16z/jolt.git", package = "common", rev = "35d46f5", default-features = false } -jolt-core = { git = "https://github.com/a16z/jolt.git", rev = "35d46f5" } -jolt-sdk = { git = "https://github.com/a16z/jolt.git", rev = "35d46f5", default-features = false } -jolt-inlines-keccak256 = { git = "https://github.com/a16z/jolt.git", rev = "35d46f5", features = ["host"] } -jolt-inlines-secp256k1 = { git = "https://github.com/a16z/jolt.git", rev = "35d46f5", features = ["host"] } -jolt-inlines-sha2 = { git = "https://github.com/a16z/jolt.git", rev = "35d46f5", features = ["host"] } +jolt-common = { git = "https://github.com/a16z/jolt.git", package = "common", rev = "2e05fe88", default-features = false } +jolt-core = { git = "https://github.com/a16z/jolt.git", rev = "2e05fe88", default-features = false } +jolt-sdk = { git = "https://github.com/a16z/jolt.git", rev = "2e05fe88", default-features = false } +jolt-inlines-keccak256 = { git = "https://github.com/a16z/jolt.git", rev = "2e05fe88", features = ["host"] } +jolt-inlines-secp256k1 = { git = "https://github.com/a16z/jolt.git", rev = "2e05fe88", features = ["host"] } +jolt-inlines-sha2 = { git = "https://github.com/a16z/jolt.git", rev = "2e05fe88", features = ["host"] } # Miden dependencies miden-assembly = { git = "https://github.com/0xPolygonMiden/miden-vm.git", tag = "v0.21.0" } diff --git a/README.md b/README.md index 6fe5ee23..b7c6bbf3 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,7 @@ OutputHashedPlatform::::write_whole_output(&large_output | zkVM | Version | GPU | | --------- | ---------------------------------------------------------------------- | --- | | Airbender | [`0.5.2`](https://github.com/matter-labs/zksync-airbender/tree/v0.5.2) | Yes | -| Jolt | [`35d46f5`](https://github.com/a16z/jolt/tree/35d46f5) | No | +| Jolt | [`2e05fe88`](https://github.com/a16z/jolt/tree/2e05fe88) | No | | Miden | [`0.21.0`](https://github.com/0xMiden/miden-vm/tree/v0.21.0) | No | | Nexus | [`0.3.6`](https://github.com/nexus-xyz/nexus-zkvm/tree/v0.3.6) | No | | OpenVM | [`1.4.3`](https://github.com/openvm-org/openvm/tree/v1.4.3) | Yes | diff --git a/crates/compile-utils/src/lib.rs b/crates/compile-utils/src/lib.rs index 2d9e720b..70b9436b 100644 --- a/crates/compile-utils/src/lib.rs +++ b/crates/compile-utils/src/lib.rs @@ -4,7 +4,7 @@ mod rust; pub use { error::CommonError, rust::{ - CargoBuildCmd, RustTarget, cargo_metadata, rustc_path, rustup_add_components, - rustup_add_rust_src, + CargoBuildCmd, RustTarget, cargo_metadata, rustc_path, rustup_active_toolchain, + rustup_add_components, rustup_add_rust_src, rustup_add_target, }, }; diff --git a/crates/compile-utils/src/rust.rs b/crates/compile-utils/src/rust.rs index 3f49df42..c0dab330 100644 --- a/crates/compile-utils/src/rust.rs +++ b/crates/compile-utils/src/rust.rs @@ -1,7 +1,7 @@ use crate::CommonError; use cargo_metadata::{Metadata, MetadataCommand}; use std::{ - fs, iter, + fs, io, iter, path::{Path, PathBuf}, process::Command, sync::Mutex, @@ -228,6 +228,29 @@ pub fn rustc_path(toolchain: &str) -> Result { ) } +/// Returns the active toolchain. +pub fn rustup_active_toolchain() -> Result { + let mut cmd = Command::new("rustup"); + let output = cmd + .args(["show", "active-toolchain"]) + .output() + .map_err(|err| CommonError::command(&cmd, err))?; + + if !output.status.success() { + return Err(CommonError::command_exit_non_zero( + &cmd, + output.status, + Some(&output), + )); + } + + String::from_utf8_lossy(&output.stdout) + .split(' ') + .next() + .map(ToString::to_string) + .ok_or_else(|| CommonError::command(&cmd, io::Error::other("missing active toolchain"))) +} + /// Install `rust-src` for the given `toolchain` if not found. pub fn rustup_add_rust_src(toolchain: &str) -> Result<(), CommonError> { rustup_add_components(toolchain, ["rust-src"]) @@ -260,6 +283,29 @@ pub fn rustup_add_components( Ok(()) } +/// Install `target` for the given `toolchain` if not found. +pub fn rustup_add_target(toolchain: &str, target: impl AsRef) -> Result<(), CommonError> { + static LOCK: Mutex<()> = Mutex::new(()); + + let _guard = LOCK.lock().unwrap_or_else(|err| err.into_inner()); + + let mut cmd = Command::new("rustup"); + let output = cmd + .args([&plus_toolchain(toolchain), "target", "add", target.as_ref()]) + .output() + .map_err(|err| CommonError::command(&cmd, err))?; + + if !output.status.success() { + return Err(CommonError::command_exit_non_zero( + &cmd, + output.status, + Some(&output), + )); + } + + Ok(()) +} + fn plus_toolchain(toolchain: &str) -> String { format!("+{toolchain}") } diff --git a/crates/zkvm/jolt/Cargo.toml b/crates/zkvm/jolt/Cargo.toml index 61e477a6..0c2aaf19 100644 --- a/crates/zkvm/jolt/Cargo.toml +++ b/crates/zkvm/jolt/Cargo.toml @@ -14,8 +14,8 @@ thiserror.workspace = true # Jolt dependencies jolt-ark-serialize = { workspace = true, features = ["derive"] } jolt-common.workspace = true -jolt-core.workspace = true -jolt-sdk = { workspace = true, features = ["host"], optional = true } +jolt-core = { workspace = true, features = ["host", "zk"] } +jolt-sdk = { workspace = true, features = ["host", "zk"], optional = true } jolt-inlines-keccak256 = { workspace = true, optional = true } jolt-inlines-secp256k1 = { workspace = true, optional = true } jolt-inlines-sha2 = { workspace = true, optional = true } @@ -34,7 +34,6 @@ ere-build-utils.workspace = true default = ["compiler", "zkvm"] compiler = ["dep:ere-compile-utils"] zkvm = ["dep:jolt-sdk", "dep:jolt-inlines-keccak256", "dep:jolt-inlines-secp256k1", "dep:jolt-inlines-sha2"] -zk = ["jolt-core/zk", "jolt-sdk?/zk"] [lints] workspace = true diff --git a/crates/zkvm/jolt/platform/Cargo.toml b/crates/zkvm/jolt/platform/Cargo.toml index 6d57c1d0..bef42654 100644 --- a/crates/zkvm/jolt/platform/Cargo.toml +++ b/crates/zkvm/jolt/platform/Cargo.toml @@ -16,8 +16,7 @@ jolt-sdk.workspace = true ere-platform-trait.workspace = true [features] -default = ["jolt-sdk/default", "jolt-common/std"] -guest-std = ["jolt-sdk/guest-std", "jolt-common/std"] +default = [] [lints] workspace = true diff --git a/crates/zkvm/jolt/platform/src/lib.rs b/crates/zkvm/jolt/platform/src/lib.rs index 50d1fc33..02edc174 100644 --- a/crates/zkvm/jolt/platform/src/lib.rs +++ b/crates/zkvm/jolt/platform/src/lib.rs @@ -12,7 +12,7 @@ use jolt_common::jolt_device::{MemoryConfig, MemoryLayout}; pub use ere_platform_trait::{Digest, OutputHashedPlatform, Platform}; pub use jolt_sdk as jolt; -// According to https://github.com/a16z/jolt/blob/35d46f5/common/src/jolt_device.rs +// According to https://github.com/a16z/jolt/blob/2e05fe88/common/src/jolt_device.rs pub trait JoltMemoryConfig { const MAX_INPUT_SIZE: u64; const MAX_TRUSTED_ADVICE_SIZE: u64; @@ -80,6 +80,6 @@ impl Platform for JoltPlatform { } fn print(message: &str) { - jolt::puts(message); + jolt::print!("{message}"); } } diff --git a/crates/zkvm/jolt/src/compiler/rust_rv64imac.rs b/crates/zkvm/jolt/src/compiler/rust_rv64imac.rs index adebed1a..9b7db761 100644 --- a/crates/zkvm/jolt/src/compiler/rust_rv64imac.rs +++ b/crates/zkvm/jolt/src/compiler/rust_rv64imac.rs @@ -4,7 +4,7 @@ use ere_zkvm_interface::compiler::Compiler; use std::{env, path::Path}; const TARGET_TRIPLE: &str = "riscv64imac-unknown-none-elf"; -// According to https://github.com/a16z/jolt/blob/35d46f5/jolt-core/src/host/program.rs#L96 +// According to https://github.com/a16z/jolt/blob/2e05fe88/jolt-core/src/host/program.rs#L96 const RUSTFLAGS: &[&str] = &[ "-C", "passes=lower-atomic", diff --git a/crates/zkvm/jolt/src/compiler/rust_rv64imac/link.x b/crates/zkvm/jolt/src/compiler/rust_rv64imac/link.x index e588aedd..72107a09 100644 --- a/crates/zkvm/jolt/src/compiler/rust_rv64imac/link.x +++ b/crates/zkvm/jolt/src/compiler/rust_rv64imac/link.x @@ -1,4 +1,4 @@ -/* Copied and modified from https://github.com/a16z/jolt/blob/35d46f5486769528104a91ac076d7dbc547b5c93/src/linker.ld.template */ +/* Copied and modified from https://github.com/a16z/jolt/blob/2e05fe883920054df2ee3a6df8f85c2caba77c99/src/linker.ld.template */ OUTPUT_ARCH(riscv) ENTRY(_start) diff --git a/crates/zkvm/jolt/src/compiler/rust_rv64imac_customized.rs b/crates/zkvm/jolt/src/compiler/rust_rv64imac_customized.rs index 6ed13ca7..15236f53 100644 --- a/crates/zkvm/jolt/src/compiler/rust_rv64imac_customized.rs +++ b/crates/zkvm/jolt/src/compiler/rust_rv64imac_customized.rs @@ -1,10 +1,12 @@ use crate::{compiler::Error, program::JoltProgram}; -use ere_compile_utils::{CommonError, cargo_metadata}; +use ere_compile_utils::{CommonError, cargo_metadata, rustup_active_toolchain, rustup_add_target}; use ere_zkvm_interface::compiler::Compiler; use jolt_core::host::Program; use std::{env::set_current_dir, fs, path::Path}; use tempfile::tempdir; +const TARGET: &str = "riscv64imac-unknown-none-elf"; + /// Compiler for Rust guest program to RV64IMAC architecture, using customized /// Rust toolchain of Jolt. pub struct RustRv64imacCustomized; @@ -15,6 +17,8 @@ impl Compiler for RustRv64imacCustomized { type Program = JoltProgram; fn compile(&self, guest_directory: &Path) -> Result { + rustup_add_target(&rustup_active_toolchain()?, TARGET)?; + let guest_directory = guest_directory .canonicalize() .map_err(|err| CommonError::canonicalize(guest_directory, err))?; @@ -33,7 +37,6 @@ impl Compiler for RustRv64imacCustomized { // Note that if this fails, it will panic, hence we need to catch it. let elf_path = std::panic::catch_unwind(|| { let mut program = Program::new(package_name); - program.set_std(true); program.build(&tempdir.path().to_string_lossy()); program.elf.unwrap() }) diff --git a/crates/zkvm/jolt/src/zkvm/sdk.rs b/crates/zkvm/jolt/src/zkvm/sdk.rs index 32df7e34..9c43e04e 100644 --- a/crates/zkvm/jolt/src/zkvm/sdk.rs +++ b/crates/zkvm/jolt/src/zkvm/sdk.rs @@ -7,8 +7,9 @@ use jolt_common::constants::{ DEFAULT_MAX_TRUSTED_ADVICE_SIZE, DEFAULT_MAX_UNTRUSTED_ADVICE_SIZE, DEFAULT_STACK_SIZE, }; use jolt_sdk::{ - F, JoltDevice, JoltProverPreprocessing, JoltSharedPreprocessing, JoltVerifierPreprocessing, - MemoryConfig, MemoryLayout, PCS, RV64IMACProof, RV64IMACProver, RV64IMACVerifier, + Curve, F, JoltDevice, JoltProverPreprocessing, JoltSharedPreprocessing, + JoltVerifierPreprocessing, MemoryConfig, MemoryLayout, PCS, RV64IMACProof, RV64IMACProver, + RV64IMACVerifier, guest::program::{decode, trace}, }; use std::env; @@ -71,8 +72,8 @@ impl JoltConfig { pub struct JoltSdk { elf: Vec, memory_config: MemoryConfig, - pk: JoltProverPreprocessing, - vk: JoltVerifierPreprocessing, + pk: JoltProverPreprocessing, + vk: JoltVerifierPreprocessing, } impl JoltSdk { diff --git a/docker/jolt/Dockerfile.base b/docker/jolt/Dockerfile.base index af727ef3..2c297939 100644 --- a/docker/jolt/Dockerfile.base +++ b/docker/jolt/Dockerfile.base @@ -5,10 +5,6 @@ FROM $BASE_IMAGE # The ere-base image provides Rust, Cargo (with a default nightly), and common tools. # We operate as root for SDK installation. -# Set default toolchain to 1.88. -RUN rustup default 1.88 -RUN rustup component add rust-src --toolchain 1.88 - # Copy the Jolt SDK (CLI) installer script from the workspace context COPY --chmod=755 scripts/sdk_installers/install_jolt_sdk.sh /tmp/install_jolt_sdk.sh diff --git a/scripts/sdk_installers/install_jolt_sdk.sh b/scripts/sdk_installers/install_jolt_sdk.sh index c417b873..3487cb29 100755 --- a/scripts/sdk_installers/install_jolt_sdk.sh +++ b/scripts/sdk_installers/install_jolt_sdk.sh @@ -28,7 +28,7 @@ ensure_tool_installed "rustup" "to manage Rust toolchains (though Jolt uses defa ensure_tool_installed "git" "to install Jolt from a git repository" ensure_tool_installed "cargo" "to build and install Rust packages" -JOLT_VERSION_TAG="35d46f5" +JOLT_VERSION_TAG="2e05fe88" # Install Jolt CLI using cargo install with +nightly # This installs the 'jolt' binary directly to $HOME/.cargo/bin diff --git a/tests/jolt/basic/Cargo.toml b/tests/jolt/basic/Cargo.toml index c927992f..af5a4eb7 100644 --- a/tests/jolt/basic/Cargo.toml +++ b/tests/jolt/basic/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -ere-platform-jolt = { path = "../../../crates/zkvm/jolt/platform", features = ["guest-std"] } +ere-platform-jolt = { path = "../../../crates/zkvm/jolt/platform" } ere-test-utils = { path = "../../../crates/test-utils" } [features] diff --git a/tests/jolt/stock_nightly_no_std/src/jolt_rt.rs b/tests/jolt/stock_nightly_no_std/src/jolt_rt.rs index 12b7e761..c51eb3a5 100644 --- a/tests/jolt/stock_nightly_no_std/src/jolt_rt.rs +++ b/tests/jolt/stock_nightly_no_std/src/jolt_rt.rs @@ -3,7 +3,7 @@ use core::{ panic::PanicInfo, }; -// According to https://github.com/a16z/jolt/blob/35d46f5/common/src/jolt_device.rs +// According to https://github.com/a16z/jolt/blob/2e05fe88/common/src/jolt_device.rs const DEFAULT_TERMINATION_ADDR: usize = 0x7FFFC008; const DEFAULT_PANIC_ADDR: usize = 0x7FFFC000;