diff --git a/Cargo.lock b/Cargo.lock index 646abd0bfc..4dd3d481d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1870,7 +1870,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" dependencies = [ - "uuid 1.11.0", + "uuid", ] [[package]] @@ -5539,7 +5539,6 @@ dependencies = [ "clap", "ctrlc", "dirs", - "gecko_profile", "goblin", "hex", "indicatif", @@ -5568,8 +5567,11 @@ dependencies = [ "elf", "enum-map", "eyre", + "gecko_profile", + "goblin", "hashbrown 0.14.5", "hex", + "indicatif", "itertools 0.13.0", "log", "nohash-hasher", @@ -5578,7 +5580,9 @@ dependencies = [ "p3-maybe-rayon", "rand 0.8.5", "rrs-succinct", + "rustc-demangle", "serde", + "serde_json", "sp1-curves", "sp1-primitives", "sp1-stark", @@ -7002,6 +7006,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +[[package]] +name = "uuid" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" + [[package]] name = "valuable" version = "0.1.0" diff --git a/book/developers/profiling.md b/book/developers/profiling.md index a5b55d9524..3b3673fd94 100644 --- a/book/developers/profiling.md +++ b/book/developers/profiling.md @@ -17,7 +17,7 @@ The full command to profile should look something like this TRACE_FILE=output.json TRACE_SAMPLE_RATE=100 cargo run ... ``` -To view these profiles, we reccomened Samply. +To view these profiles, we reccomend Samply. ```sh cargo install --locked samply samply load output.json diff --git a/crates/cli/src/bin/cargo-prove.rs b/crates/cli/src/bin/cargo-prove.rs index 3dea7d28af..aad9f58614 100644 --- a/crates/cli/src/bin/cargo-prove.rs +++ b/crates/cli/src/bin/cargo-prove.rs @@ -3,8 +3,7 @@ use clap::{Parser, Subcommand}; use sp1_cli::{ commands::{ build::BuildCmd, build_toolchain::BuildToolchainCmd, - install_toolchain::InstallToolchainCmd, new::NewCmd, prove::ProveCmd, - vkey::VkeyCmd, + install_toolchain::InstallToolchainCmd, new::NewCmd, prove::ProveCmd, vkey::VkeyCmd, }, SP1_VERSION_MESSAGE, }; diff --git a/crates/cli/src/util.rs b/crates/cli/src/util.rs index 68dc07e3e4..6993d74403 100644 --- a/crates/cli/src/util.rs +++ b/crates/cli/src/util.rs @@ -1,4 +1,3 @@ -use std::path::{Path, PathBuf}; use std::{fmt::Display, time::Duration}; pub(crate) fn write_status(style: &dyn Display, status: &str, msg: &str) { @@ -14,39 +13,3 @@ pub(crate) fn elapsed(duration: Duration) -> String { format!("{}.{:02}s", secs, duration.subsec_nanos() / 10_000_000) } } - -/// Create a canonical path from a given path. -/// -/// This function will create any necessary directories in the path if they do not exist. -/// -/// This function does not guarntee that the file or directory exists, only that the path is valid. -/// (ie. [std::fs::File::create] and [std::fs::DirBuilder::create] will work) -pub(crate) fn canon_path(path: impl AsRef) -> Result { - let path = path.as_ref(); - - // in case this is a file, we only need to ensure its parent directorys are created - if path.components().count() > 1 { - if let Some(parent) = path.parent() { - std::fs::create_dir_all(parent)?; - // unwrap: we know we have a last component because we have a parent - let last_component = path.components().last().unwrap(); - - return Ok(parent - .canonicalize() - .inspect_err(|_| { - eprintln!("Failed to canonicalize parent directory: {:?}", parent); - })? - .join(last_component)); - } - } - - if !path.has_root() { - // we dont have a parent or a root, - // so lets just adjoin it to the currnet working dir - return Ok(std::env::current_dir()?.join(path)); - } - - // we didnt have a parent, and we have root - // so this can only be the root dir - Ok(path.to_path_buf()) -} diff --git a/crates/core/executor/src/executor.rs b/crates/core/executor/src/executor.rs index 6a298fb7b4..503711a893 100644 --- a/crates/core/executor/src/executor.rs +++ b/crates/core/executor/src/executor.rs @@ -1,8 +1,4 @@ -use std::{ - fs::File, - io::BufWriter, - sync::Arc, -}; +use std::{fs::File, io::BufWriter, sync::Arc}; use hashbrown::HashMap; use serde::{Deserialize, Serialize}; @@ -98,7 +94,7 @@ pub struct Executor<'a> { /// A buffer for stdout and stderr IO. pub io_buf: HashMap, - + /// The ZKVM profiler. This is only available in debug mode. pub profiler: Option<(Profiler, BufWriter)>, @@ -178,7 +174,7 @@ impl<'a> Executor<'a> { pub fn new(program: Program, opts: SP1CoreOpts) -> Self { Self::with_context(program, opts, SP1Context::default()) } - + /// Crete a new runtime for the program, and setup the profiler if `TRACE_FILE` is set. #[cfg(debug_assertions)] #[must_use] @@ -206,9 +202,10 @@ impl<'a> Executor<'a> { }) .unwrap_or(1); - this.profiler = Some( - (Profiler::new(elf_bytes, sample_rate).expect("Failed to create profiler"), trace_buf) - ); + this.profiler = Some(( + Profiler::new(elf_bytes, sample_rate).expect("Failed to create profiler"), + trace_buf, + )); } this @@ -1485,7 +1482,6 @@ impl<'a> Executor<'a> { } } - Ok(()) } @@ -1498,7 +1494,7 @@ impl<'a> Executor<'a> { self.executor_mode = ExecutorMode::Trace; self.print_report = true; while !self.execute()? {} - + #[cfg(debug_assertions)] { if let Some((profiler, writer)) = self.profiler.take() { diff --git a/crates/prover/src/lib.rs b/crates/prover/src/lib.rs index 2459ac9d00..9d55542bf9 100644 --- a/crates/prover/src/lib.rs +++ b/crates/prover/src/lib.rs @@ -275,11 +275,11 @@ impl SP1Prover { context.subproof_verifier.replace(Arc::new(self)); let program = self.get_program(elf).unwrap(); let opts = SP1CoreOpts::default(); - let mut runtime = if cfg!(debug_assertions) { + let mut runtime = if cfg!(debug_assertions) { Executor::with_context_and_elf(program, opts, context, elf) } else { Executor::with_context(program, opts, context) - }; + }; runtime.write_vecs(&stdin.buffer); for (proof, vkey) in stdin.proofs.iter() { diff --git a/examples/Cargo.lock b/examples/Cargo.lock index 9acc219708..7de1c9bf43 100644 --- a/examples/Cargo.lock +++ b/examples/Cargo.lock @@ -219,7 +219,7 @@ dependencies = [ "alloy-sol-types", "serde", "serde_json", - "thiserror", + "thiserror 1.0.68", "tracing", ] @@ -241,7 +241,7 @@ dependencies = [ "async-trait", "auto_impl", "futures-utils-wasm", - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -426,7 +426,7 @@ dependencies = [ "auto_impl", "elliptic-curve", "k256", - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -442,7 +442,7 @@ dependencies = [ "async-trait", "k256", "rand 0.8.5", - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -1053,7 +1053,7 @@ version = "1.1.0" dependencies = [ "rand 0.8.5", "sp1-zkvm", - "substrate-bn 0.6.0 (git+https://github.com/sp1-patches/bn?tag=substrate_bn-v0.6.0-patch-v1)", + "substrate-bn", ] [[package]] @@ -1155,7 +1155,7 @@ dependencies = [ "semver 1.0.23", "serde", "serde_json", - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -1636,6 +1636,15 @@ dependencies = [ "rustversion", ] +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "uuid", +] + [[package]] name = "der" version = "0.5.1" @@ -1834,7 +1843,7 @@ dependencies = [ "rand_core 0.6.4", "serde", "sha2 0.9.9", - "thiserror", + "thiserror 1.0.68", "zeroize", ] @@ -2214,6 +2223,17 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" +[[package]] +name = "gecko_profile" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "890852c7e1e02bc6758e325d6b1e0236e4fbf21b492f585ce4d4715be54b4c6a" +dependencies = [ + "debugid", + "serde", + "serde_json", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -2271,6 +2291,17 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "goblin" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b363a30c165f666402fe6a3024d3bec7ebc898f96a4a23bd1c99f8dbf3f4f47" +dependencies = [ + "log", + "plain", + "scroll", +] + [[package]] name = "groth16-verifier-program" version = "1.1.0" @@ -3846,7 +3877,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" dependencies = [ "memchr", - "thiserror", + "thiserror 1.0.68", "ucd-trie", ] @@ -3911,6 +3942,12 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" + [[package]] name = "portable-atomic" version = "1.9.0" @@ -4106,7 +4143,7 @@ dependencies = [ "rustc-hash 2.0.0", "rustls", "socket2", - "thiserror", + "thiserror 1.0.68", "tokio", "tracing", ] @@ -4123,7 +4160,7 @@ dependencies = [ "rustc-hash 2.0.0", "rustls", "slab", - "thiserror", + "thiserror 1.0.68", "tinyvec", "tracing", ] @@ -4289,7 +4326,7 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom", "libredox", - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -4407,7 +4444,7 @@ dependencies = [ "http", "reqwest", "serde", - "thiserror", + "thiserror 1.0.68", "tower-service", ] @@ -4420,7 +4457,7 @@ dependencies = [ "reth-execution-errors", "reth-primitives", "reth-storage-errors", - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -4514,7 +4551,7 @@ dependencies = [ "reth-execution-errors", "reth-fs-util", "reth-storage-errors", - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -4598,7 +4635,7 @@ dependencies = [ "reth-revm", "revm", "revm-primitives", - "thiserror", + "thiserror 1.0.68", "tracing", ] @@ -4637,7 +4674,7 @@ source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240830#260c7ed2c9374 dependencies = [ "serde", "serde_json", - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -4649,7 +4686,7 @@ dependencies = [ "alloy-rlp", "enr", "serde_with", - "thiserror", + "thiserror 1.0.68", "url", ] @@ -4706,7 +4743,7 @@ dependencies = [ "reth-trie-common", "revm-primitives", "serde", - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -4741,7 +4778,7 @@ dependencies = [ "modular-bitfield", "reth-codecs", "serde", - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -4891,7 +4928,7 @@ dependencies = [ "ripemd", "secp256k1", "sha2 0.10.8", - "substrate-bn 0.6.0 (git+https://github.com/sp1-patches/bn?tag=substrate_bn-v0.6.0-patch-v1)", + "substrate-bn", ] [[package]] @@ -5090,7 +5127,7 @@ dependencies = [ "rlp", "rsp-primitives", "serde", - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -5337,6 +5374,26 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "scroll" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ab8598aa408498679922eff7fa985c25d58a90771bd6be794434c5277eab1a6" +dependencies = [ + "scroll_derive", +] + +[[package]] +name = "scroll_derive" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f81c2fde025af7e69b1d1420531c8a8811ca898919db177141a85313b1cb932" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "sdd" version = "3.0.4" @@ -5697,8 +5754,11 @@ dependencies = [ "elf", "enum-map", "eyre", + "gecko_profile", + "goblin", "hashbrown 0.14.5", "hex", + "indicatif", "itertools 0.13.0", "log", "nohash-hasher", @@ -5707,13 +5767,15 @@ dependencies = [ "p3-maybe-rayon", "rand 0.8.5", "rrs-succinct", + "rustc-demangle", "serde", + "serde_json", "sp1-curves", "sp1-primitives", "sp1-stark", "strum", "strum_macros", - "thiserror", + "thiserror 1.0.68", "tiny-keccak", "tracing", "typenum", @@ -5758,7 +5820,7 @@ dependencies = [ "strum", "strum_macros", "tempfile", - "thiserror", + "thiserror 1.0.68", "tracing", "tracing-forest", "tracing-subscriber", @@ -5888,7 +5950,7 @@ dependencies = [ "sp1-recursion-core", "sp1-recursion-gnark-ffi", "sp1-stark", - "thiserror", + "thiserror 1.0.68", "tracing", "tracing-subscriber", ] @@ -5973,7 +6035,7 @@ dependencies = [ "sp1-primitives", "sp1-stark", "static_assertions", - "thiserror", + "thiserror 1.0.68", "tracing", "vec_map", "zkhash", @@ -6045,7 +6107,7 @@ dependencies = [ "strum", "strum_macros", "tempfile", - "thiserror", + "thiserror 1.0.68", "tokio", "tracing", "twirp-rs", @@ -6091,8 +6153,8 @@ dependencies = [ "hex", "lazy_static", "sha2 0.10.8", - "substrate-bn 0.6.0 (git+https://github.com/sp1-patches/bn?tag=substrate_bn-v0.6.0-patch-v2)", - "thiserror-no-std", + "substrate-bn-succinct", + "thiserror 2.0.3", ] [[package]] @@ -6258,9 +6320,10 @@ dependencies = [ ] [[package]] -name = "substrate-bn" +name = "substrate-bn-succinct" version = "0.6.0" -source = "git+https://github.com/sp1-patches/bn?tag=substrate_bn-v0.6.0-patch-v2#8ef05d3969312eca34fa9f1f566a469022badda6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "114c855c26ad0594c830129cb868552fb41415603a6133276c2ecdd9e5ef4255" dependencies = [ "bytemuck", "byteorder", @@ -6486,7 +6549,16 @@ version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02dd99dc800bbb97186339685293e1cc5d9df1f8fae2d0aecd9ff1c77efea892" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.68", +] + +[[package]] +name = "thiserror" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" +dependencies = [ + "thiserror-impl 2.0.3", ] [[package]] @@ -6500,6 +6572,17 @@ dependencies = [ "syn 2.0.87", ] +[[package]] +name = "thiserror-impl" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "thiserror-impl-no-std" version = "2.0.2" @@ -6756,7 +6839,7 @@ checksum = "ee40835db14ddd1e3ba414292272eddde9dad04d3d4b65509656414d1c42592f" dependencies = [ "ansi_term", "smallvec", - "thiserror", + "thiserror 1.0.68", "tracing", "tracing-subscriber", ] @@ -6812,7 +6895,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "thiserror", + "thiserror 1.0.68", "tokio", "tower", "url", @@ -6907,6 +6990,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +[[package]] +name = "uuid" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" + [[package]] name = "valuable" version = "0.1.0"