diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 5c76b62b6b..be3f32b2ca 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -36,6 +36,12 @@ jobs: - name: Setup CI uses: ./.github/actions/setup + - name: Install SP1 toolchain + run: | + curl -L https://sp1.succinct.xyz | bash + ~/.sp1/bin/sp1up + ~/.sp1/bin/cargo-prove prove --version + - name: Run cargo check uses: actions-rs/cargo@v1 with: @@ -72,6 +78,12 @@ jobs: - name: Setup CI uses: ./.github/actions/setup + - name: Install SP1 toolchain + run: | + curl -L https://sp1.succinct.xyz | bash + ~/.sp1/bin/sp1up + ~/.sp1/bin/cargo-prove prove --version + - name: Run cargo check uses: actions-rs/cargo@v1 with: @@ -102,6 +114,12 @@ jobs: - name: Setup CI uses: ./.github/actions/setup + - name: Install SP1 toolchain + run: | + curl -L https://sp1.succinct.xyz | bash + ~/.sp1/bin/sp1up + ~/.sp1/bin/cargo-prove prove --version + - name: Run cargo fmt uses: actions-rs/cargo@v1 with: @@ -110,6 +128,14 @@ jobs: env: CARGO_INCREMENTAL: 1 + - name: Check test-artifacts + uses: actions-rs/cargo@v1 + with: + command: check + args: -p test-artifacts + env: + CARGO_INCREMENTAL: 1 + - name: Run cargo clippy uses: actions-rs/cargo@v1 with: @@ -155,36 +181,6 @@ jobs: cd ./examples/ cargo clippy --all-targets --all-features -- -D warnings -A incomplete-features - tests: - name: Tests - runs-on: [runs-on, runner=64cpu-linux-x64, "run-id=${{ github.run_id }}"] - steps: - - name: Checkout sources - uses: actions/checkout@v4 - - - name: Setup CI - uses: ./.github/actions/setup - - - name: Install SP1 toolchain - run: | - cargo install --locked --force --path crates/cli - cargo prove install-toolchain - - - name: Run cargo fmt - run: | - cd ./tests/ - cargo fmt --all -- --check - - - name: Run cargo clippy - run: | - cd ./tests/ - cargo clippy --all-targets --all-features -- -D warnings -A incomplete-features - - - name: Build test ELF files - run: | - cd ./tests/ - make - cli: name: CLI runs-on: [runs-on, runner=8cpu-linux-x64, "run-id=${{ github.run_id }}"] @@ -438,13 +434,14 @@ jobs: run: | find -name Cargo.lock -type f -exec rm {} \; - - name: "Build SP1 without lock files" - run: | - cargo build --all --all-targets - + # We need the SP1 toolchain to be installed in order to build test-artifacts - name: Install SP1 toolchain run: | cargo run -p sp1-cli -- prove install-toolchain + + - name: "Build SP1 without lock files" + run: | + cargo build --all --all-targets - name: "Build examples without lock files" run: | diff --git a/Cargo.lock b/Cargo.lock index 0ebe93f373..59889fb088 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1591,6 +1591,15 @@ dependencies = [ "itertools 0.10.5", ] +[[package]] +name = "crossbeam-channel" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-deque" version = "0.8.5" @@ -5564,6 +5573,7 @@ dependencies = [ "sp1-zkvm", "strum", "strum_macros", + "test-artifacts", "thiserror 1.0.69", "tiny-keccak", "tracing", @@ -5611,6 +5621,7 @@ dependencies = [ "strum", "strum_macros", "tempfile", + "test-artifacts", "thiserror 1.0.69", "tiny-keccak", "tracing", @@ -5631,6 +5642,7 @@ dependencies = [ "serde", "sp1-core-machine", "sp1-prover", + "test-artifacts", "tokio", "tracing", "twirp-build-rs", @@ -5723,6 +5735,7 @@ dependencies = [ "sp1-prover", "sp1-sdk", "sp1-stark", + "test-artifacts", "time 0.3.36", ] @@ -5772,8 +5785,10 @@ dependencies = [ "sp1-recursion-core", "sp1-recursion-gnark-ffi", "sp1-stark", + "test-artifacts", "thiserror 1.0.69", "tracing", + "tracing-appender", "tracing-subscriber 0.3.18", ] @@ -5809,6 +5824,7 @@ dependencies = [ "sp1-recursion-core", "sp1-recursion-gnark-ffi", "sp1-stark", + "test-artifacts", "tracing", "zkhash", ] @@ -5941,6 +5957,7 @@ dependencies = [ "reqwest", "reqwest-middleware", "serde", + "sp1-build", "sp1-core-executor", "sp1-core-machine", "sp1-cuda", @@ -5950,6 +5967,7 @@ dependencies = [ "strum", "strum_macros", "tempfile", + "test-artifacts", "thiserror 1.0.69", "tokio", "tonic", @@ -6339,6 +6357,13 @@ dependencies = [ "winapi", ] +[[package]] +name = "test-artifacts" +version = "3.0.0" +dependencies = [ + "sp1-build", +] + [[package]] name = "textwrap" version = "0.16.1" @@ -6719,6 +6744,18 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-appender" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3566e8ce28cc0a3fe42519fc80e6b4c943cc4c8cef275620eb8dac2d3d4e06cf" +dependencies = [ + "crossbeam-channel", + "thiserror 1.0.69", + "time 0.3.36", + "tracing-subscriber 0.3.18", +] + [[package]] name = "tracing-attributes" version = "0.1.27" diff --git a/Cargo.toml b/Cargo.toml index bd046bf3df..f48c993410 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,7 @@ members = [ "crates/verifier", "crates/stark", "crates/zkvm/*", + "crates/test-artifacts", ] exclude = ["examples/target"] resolver = "2" @@ -72,6 +73,9 @@ sp1-lib = { path = "crates/zkvm/lib", version = "3.0.0", default-features = fals # make sure to update this crate. sp1-zkvm = { path = "crates/zkvm/entrypoint", version = "3.0.1", default-features = false } +# For testing. +test-artifacts = { path = "crates/test-artifacts", version = "3.0.0" } + # p3 # p3-air = "0.1.4-succinct" # p3-field = "0.1.4-succinct" diff --git a/book/getting-started/quickstart.md b/book/getting-started/quickstart.md index 824ddbf857..76f1356b3d 100644 --- a/book/getting-started/quickstart.md +++ b/book/getting-started/quickstart.md @@ -34,8 +34,6 @@ Your new project will have the following structure (ignoring the `contracts` fol ├── program │   ├── Cargo.lock │   ├── Cargo.toml -│   ├── elf -│   │   └── riscv32im-succinct-zkvm-elf │   └── src │   └── main.rs ├── rust-toolchain @@ -66,7 +64,7 @@ Before we can run the program inside the zkVM, it must be compiled to a RISC-V e cd program && cargo prove build ``` -which will output the compiled ELF to the file `program/elf/riscv32im-succinct-zkvm-elf`. +which will generate an ELF file under `target/elf-compilation`. Note: the `build.rs` file in the `script` directory will use run the above command automatically to build the ELF, meaning you don't have to manually run `cargo prove build` every time you make a change to the program! diff --git a/book/writing-programs/compiling.md b/book/writing-programs/compiling.md index 6a1fdc56b4..297facb547 100644 --- a/book/writing-programs/compiling.md +++ b/book/writing-programs/compiling.md @@ -14,7 +14,7 @@ To build a program while developing, simply run the following command in the cra cargo prove build ``` -This will compile the ELF that can be executed in the zkVM and put it in the file `elf/riscv32im-succinct-zkvm-elf`. The output from the command will look something like this: +This will compile the ELF that can be executed in the zkVM. The output from the command will look something like this: ```bash [sp1] Compiling version_check v0.9.4 diff --git a/crates/build/src/build.rs b/crates/build/src/build.rs index b19207d406..3279a8ea78 100644 --- a/crates/build/src/build.rs +++ b/crates/build/src/build.rs @@ -5,7 +5,7 @@ use cargo_metadata::camino::Utf8PathBuf; use crate::{ command::{docker::create_docker_command, local::create_local_command, utils::execute_command}, - utils::{cargo_rerun_if_changed, copy_elf_to_output_dir, current_datetime}, + utils::{cargo_rerun_if_changed, current_datetime}, BuildArgs, BUILD_TARGET, HELPER_TARGET_SUBDIR, }; @@ -48,12 +48,6 @@ pub fn execute_build_program( let target_elf_paths = generate_elf_paths(&program_metadata, Some(args))?; - // Temporary backward compatibility with the deprecated behavior of copying the ELF file. - // TODO: add option to turn off this behavior - if target_elf_paths.len() == 1 { - copy_elf_to_output_dir(args, &program_metadata, &target_elf_paths[0].1)?; - } - Ok(target_elf_paths) } @@ -120,12 +114,33 @@ fn generate_elf_paths( args: Option<&BuildArgs>, ) -> Result> { let mut target_elf_paths = vec![]; + let packages_to_iterate = if let Some(args) = args { + if !args.packages.is_empty() { + args.packages + .iter() + .map(|wanted_package| { + metadata + .packages + .iter() + .find(|p| p.name == *wanted_package) + .ok_or_else(|| { + anyhow::anyhow!("cannot find package named {}", wanted_package) + }) + .map(|p| p.id.clone()) + }) + .collect::>>()? + } else { + metadata.workspace_default_members.to_vec() + } + } else { + metadata.workspace_default_members.to_vec() + }; - for program_crate in metadata.workspace_default_members.iter() { + for program_crate in packages_to_iterate { let program = metadata .packages .iter() - .find(|p| &p.id == program_crate) + .find(|p| p.id == program_crate) .ok_or_else(|| anyhow::anyhow!("cannot find package for {}", program_crate))?; for bin_target in program.targets.iter().filter(|t| { @@ -133,7 +148,7 @@ fn generate_elf_paths( }) { // Filter out irrelevant targets if `--bin` is used. if let Some(args) = args { - if !args.binary.is_empty() && bin_target.name != args.binary { + if !args.binaries.is_empty() && !args.binaries.contains(&bin_target.name) { continue; } } diff --git a/crates/build/src/command/utils.rs b/crates/build/src/command/utils.rs index 7eef9dc9a4..ba5ec28532 100644 --- a/crates/build/src/command/utils.rs +++ b/crates/build/src/command/utils.rs @@ -22,9 +22,14 @@ pub(crate) fn get_program_build_args(args: &BuildArgs) -> Vec { build_args.push("-Ztrim-paths".to_string()); - if !args.binary.is_empty() { + for p in &args.packages { + build_args.push("-p".to_string()); + build_args.push(p.to_string()); + } + + for b in &args.binaries { build_args.push("--bin".to_string()); - build_args.push(args.binary.clone()); + build_args.push(b.to_string()); } if !args.features.is_empty() { diff --git a/crates/build/src/lib.rs b/crates/build/src/lib.rs index 17b18602fc..1ce2a09c4c 100644 --- a/crates/build/src/lib.rs +++ b/crates/build/src/lib.rs @@ -50,14 +50,22 @@ pub struct BuildArgs { pub ignore_rust_version: bool, #[clap(long, action, help = "Assert that `Cargo.lock` will remain unchanged")] pub locked: bool, + #[clap( + short, + long, + action, + help = "Build only the specified packages", + num_args = 1.. + )] + pub packages: Vec, #[clap( alias = "bin", long, action, - help = "Build only the specified binary", - default_value = "" + help = "Build only the specified binaries", + num_args = 1.. )] - pub binary: String, + pub binaries: Vec, #[clap(long, action, help = "ELF binary name", default_value = "")] pub elf_name: String, #[clap( @@ -79,7 +87,8 @@ impl Default for BuildArgs { features: vec![], rustflags: vec![], ignore_rust_version: false, - binary: "".to_string(), + packages: vec![], + binaries: vec![], elf_name: "".to_string(), output_directory: DEFAULT_OUTPUT_DIR.to_string(), locked: false, @@ -117,3 +126,19 @@ pub fn build_program(path: &str) { pub fn build_program_with_args(path: &str, args: BuildArgs) { build_program_internal(path, Some(args)) } + +/// Returns the raw ELF bytes by the zkVM program target name. +/// +/// Note that this only works when using `sp1_build::build_program` or +/// `sp1_build::build_program_with_args` in a build script. +/// +/// By default, the program target name is the same as the program crate name. However, this might +/// not be the case for non-standard project structures. For example, placing the entrypoint source +/// file at `src/bin/my_entry.rs` would result in the program target being named `my_entry`, in +/// which case the invocation should be `include_elf!("my_entry")` instead. +#[macro_export] +macro_rules! include_elf { + ($arg:tt) => {{ + include_bytes!(env!(concat!("SP1_ELF_", $arg))) + }}; +} diff --git a/crates/build/src/utils.rs b/crates/build/src/utils.rs index ac5dd03c19..032692808b 100644 --- a/crates/build/src/utils.rs +++ b/crates/build/src/utils.rs @@ -1,40 +1,8 @@ -use std::{fs, path::Path}; +use std::path::Path; -use anyhow::Result; -use cargo_metadata::{camino::Utf8PathBuf, Metadata}; +use cargo_metadata::Metadata; use chrono::Local; -use crate::{BuildArgs, BUILD_TARGET}; - -/// Copy the ELF to the specified output directory. -pub(crate) fn copy_elf_to_output_dir( - args: &BuildArgs, - program_metadata: &cargo_metadata::Metadata, - elf_path: &Utf8PathBuf, -) -> Result { - // The order of precedence for the ELF name is: - // 1. --elf_name flag - // 2. --binary flag + -elf suffix (defaults to riscv32im-succinct-zkvm-elf) - let elf_name = if !args.elf_name.is_empty() { - args.elf_name.clone() - } else if !args.binary.is_empty() { - // TODO: In the future, change this to default to the package name. Will require updating - // docs and examples. - args.binary.clone() - } else { - BUILD_TARGET.to_string() - }; - - let elf_dir = program_metadata.target_directory.parent().unwrap().join(&args.output_directory); - fs::create_dir_all(&elf_dir)?; - let result_elf_path = elf_dir.join(elf_name); - - // Copy the ELF to the specified output directory. - fs::copy(elf_path, &result_elf_path)?; - - Ok(result_elf_path) -} - pub(crate) fn current_datetime() -> String { let now = Local::now(); now.format("%Y-%m-%d %H:%M:%S").to_string() diff --git a/crates/core/executor/Cargo.toml b/crates/core/executor/Cargo.toml index 88c8044b37..3c09170d6f 100644 --- a/crates/core/executor/Cargo.toml +++ b/crates/core/executor/Cargo.toml @@ -41,10 +41,11 @@ bytemuck = "1.16.3" tiny-keccak = { version = "2.0.2", features = ["keccak"] } vec_map = { version = "0.8.2", features = ["serde"] } enum-map = { version = "2.7.3", features = ["serde"] } +test-artifacts = { workspace = true, optional = true } [dev-dependencies] sp1-zkvm = { workspace = true } [features] -programs = [] +programs = ["dep:test-artifacts"] bigint-rug = ["sp1-curves/bigint-rug"] diff --git a/crates/core/executor/src/programs.rs b/crates/core/executor/src/programs.rs index cce2a8c7a7..d281c27875 100644 --- a/crates/core/executor/src/programs.rs +++ b/crates/core/executor/src/programs.rs @@ -5,129 +5,10 @@ pub mod tests { use crate::{Instruction, Opcode, Program}; - pub const CHESS_ELF: &[u8] = - include_bytes!("../../../../examples/chess/program/elf/riscv32im-succinct-zkvm-elf"); - - pub const FIBONACCI_IO_ELF: &[u8] = - include_bytes!("../../../../examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf"); - - pub const IO_ELF: &[u8] = - include_bytes!("../../../../examples/io/program/elf/riscv32im-succinct-zkvm-elf"); - - pub const JSON_ELF: &[u8] = - include_bytes!("../../../../examples/json/program/elf/riscv32im-succinct-zkvm-elf"); - - pub const REGEX_ELF: &[u8] = - include_bytes!("../../../../examples/regex/program/elf/riscv32im-succinct-zkvm-elf"); - - pub const RSA_ELF: &[u8] = - include_bytes!("../../../../examples/rsa/program/elf/riscv32im-succinct-zkvm-elf"); - - pub const SSZ_WITHDRAWALS_ELF: &[u8] = include_bytes!( - "../../../../examples/ssz-withdrawals/program/elf/riscv32im-succinct-zkvm-elf" - ); - - pub const TENDERMINT_ELF: &[u8] = - include_bytes!("../../../../examples/tendermint/program/elf/riscv32im-succinct-zkvm-elf"); - - pub const FIBONACCI_ELF: &[u8] = - include_bytes!("../../../../tests/fibonacci/elf/riscv32im-succinct-zkvm-elf"); - - pub const ED25519_ELF: &[u8] = - include_bytes!("../../../../tests/ed25519/elf/riscv32im-succinct-zkvm-elf"); - - pub const CYCLE_TRACKER_ELF: &[u8] = - include_bytes!("../../../../tests/cycle-tracker/elf/riscv32im-succinct-zkvm-elf"); - - pub const ED_ADD_ELF: &[u8] = - include_bytes!("../../../../tests/ed-add/elf/riscv32im-succinct-zkvm-elf"); - - pub const ED_DECOMPRESS_ELF: &[u8] = - include_bytes!("../../../../tests/ed-decompress/elf/riscv32im-succinct-zkvm-elf"); - - pub const KECCAK_PERMUTE_ELF: &[u8] = - include_bytes!("../../../../tests/keccak-permute/elf/riscv32im-succinct-zkvm-elf"); - - pub const KECCAK256_ELF: &[u8] = - include_bytes!("../../../../tests/keccak256/elf/riscv32im-succinct-zkvm-elf"); - - pub const SECP256K1_ADD_ELF: &[u8] = - include_bytes!("../../../../tests/secp256k1-add/elf/riscv32im-succinct-zkvm-elf"); - - pub const SECP256K1_DECOMPRESS_ELF: &[u8] = - include_bytes!("../../../../tests/secp256k1-decompress/elf/riscv32im-succinct-zkvm-elf"); - - pub const SECP256K1_DOUBLE_ELF: &[u8] = - include_bytes!("../../../../tests/secp256k1-double/elf/riscv32im-succinct-zkvm-elf"); - - pub const SECP256R1_ADD_ELF: &[u8] = - include_bytes!("../../../../tests/secp256r1-add/elf/riscv32im-succinct-zkvm-elf"); - - pub const SECP256R1_DOUBLE_ELF: &[u8] = - include_bytes!("../../../../tests/secp256r1-double/elf/riscv32im-succinct-zkvm-elf"); - - pub const SHA_COMPRESS_ELF: &[u8] = - include_bytes!("../../../../tests/sha-compress/elf/riscv32im-succinct-zkvm-elf"); - - pub const SHA_EXTEND_ELF: &[u8] = - include_bytes!("../../../../tests/sha-extend/elf/riscv32im-succinct-zkvm-elf"); - - pub const SHA2_ELF: &[u8] = - include_bytes!("../../../../tests/sha2/elf/riscv32im-succinct-zkvm-elf"); - - pub const BN254_ADD_ELF: &[u8] = - include_bytes!("../../../../tests/bn254-add/elf/riscv32im-succinct-zkvm-elf"); - - pub const BN254_DOUBLE_ELF: &[u8] = - include_bytes!("../../../../tests/bn254-double/elf/riscv32im-succinct-zkvm-elf"); - - pub const BN254_MUL_ELF: &[u8] = - include_bytes!("../../../../tests/bn254-mul/elf/riscv32im-succinct-zkvm-elf"); - - pub const SECP256K1_MUL_ELF: &[u8] = - include_bytes!("../../../../tests/secp256k1-mul/elf/riscv32im-succinct-zkvm-elf"); - - pub const BLS12381_ADD_ELF: &[u8] = - include_bytes!("../../../../tests/bls12381-add/elf/riscv32im-succinct-zkvm-elf"); - - pub const BLS12381_DOUBLE_ELF: &[u8] = - include_bytes!("../../../../tests/bls12381-double/elf/riscv32im-succinct-zkvm-elf"); - - pub const BLS12381_MUL_ELF: &[u8] = - include_bytes!("../../../../tests/bls12381-mul/elf/riscv32im-succinct-zkvm-elf"); - - pub const UINT256_MUL_ELF: &[u8] = - include_bytes!("../../../../tests/uint256-mul/elf/riscv32im-succinct-zkvm-elf"); - - pub const U256XU2048_MUL_ELF: &[u8] = - include_bytes!("../../../../tests/u256x2048-mul/elf/riscv32im-succinct-zkvm-elf"); - - pub const BLS12381_DECOMPRESS_ELF: &[u8] = - include_bytes!("../../../../tests/bls12381-decompress/elf/riscv32im-succinct-zkvm-elf"); - - pub const VERIFY_PROOF_ELF: &[u8] = - include_bytes!("../../../../tests/verify-proof/elf/riscv32im-succinct-zkvm-elf"); - - pub const PANIC_ELF: &[u8] = - include_bytes!("../../../../tests/panic/elf/riscv32im-succinct-zkvm-elf"); - - pub const BLS12381_FP_ELF: &[u8] = - include_bytes!("../../../../tests/bls12381-fp/elf/riscv32im-succinct-zkvm-elf"); - - pub const BLS12381_FP2_MUL_ELF: &[u8] = - include_bytes!("../../../../tests/bls12381-fp2-mul/elf/riscv32im-succinct-zkvm-elf"); - - pub const BLS12381_FP2_ADDSUB_ELF: &[u8] = - include_bytes!("../../../../tests/bls12381-fp2-addsub/elf/riscv32im-succinct-zkvm-elf"); - - pub const BN254_FP_ELF: &[u8] = - include_bytes!("../../../../tests/bn254-fp/elf/riscv32im-succinct-zkvm-elf"); - - pub const BN254_FP2_ADDSUB_ELF: &[u8] = - include_bytes!("../../../../tests/bn254-fp2-addsub/elf/riscv32im-succinct-zkvm-elf"); - - pub const BN254_FP2_MUL_ELF: &[u8] = - include_bytes!("../../../../tests/bn254-fp2-mul/elf/riscv32im-succinct-zkvm-elf"); + use test_artifacts::{ + FIBONACCI_ELF, KECCAK_PERMUTE_ELF, PANIC_ELF, SECP256R1_ADD_ELF, SECP256R1_DOUBLE_ELF, + U256XU2048_MUL_ELF, + }; #[must_use] pub fn simple_program() -> Program { diff --git a/crates/core/machine/Cargo.toml b/crates/core/machine/Cargo.toml index f59e01219f..0128e67ee5 100644 --- a/crates/core/machine/Cargo.toml +++ b/crates/core/machine/Cargo.toml @@ -63,9 +63,9 @@ num = { version = "0.4.3", features = ["rand"] } rand = "0.8.5" sp1-zkvm = { workspace = true } sp1-core-executor = { workspace = true, features = ["programs"] } +test-artifacts = { workspace = true } [features] -programs = [] debug = [] bigint-rug = ["sp1-curves/bigint-rug"] diff --git a/crates/core/machine/src/riscv/shape.rs b/crates/core/machine/src/riscv/shape.rs index 2eb57338df..4ef0650043 100644 --- a/crates/core/machine/src/riscv/shape.rs +++ b/crates/core/machine/src/riscv/shape.rs @@ -703,7 +703,7 @@ impl Default for CoreShapeConfig { } } -#[cfg(any(test, feature = "programs"))] +#[cfg(test)] pub mod tests { use std::fmt::Debug; diff --git a/crates/core/machine/src/syscall/precompiles/README.md b/crates/core/machine/src/syscall/precompiles/README.md index 315d78915a..a6d26bd3fe 100644 --- a/crates/core/machine/src/syscall/precompiles/README.md +++ b/crates/core/machine/src/syscall/precompiles/README.md @@ -188,9 +188,9 @@ pub fn default_syscall_map() -> HashMap> { ## Write Unit Tests for the New Precompile ### Create a New SP1 Test Package -Create a new SP1 crate for your custom precompile test package inside the directory `sp1/tests`. An example `Cargo.toml` for this may look like +Create a new SP1 crate for your custom precompile test package inside the directory +`sp1/crates/test-artifacts/programs`. An example `Cargo.toml` for this may look like: ```toml -[workspace] [package] name = "custom-precompile-test" version = "1.0.0" @@ -198,18 +198,17 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../zkvm/entrypoint" } -sp1-derive = { path = "../../derive" } +sp1-zkvm = { path = "../../../../zkvm/entrypoint" } +sp1-derive = { path = "../../../../derive" } num-bigint = "0.4.6" rand = "0.8.5" ``` -Then implement the tests and run `cargo prove build` to generate an ELF file. +Don't forget to include your crate to the workspace at `crates/test-artifacts/programs/Cargo.toml`. Then implement the tests and run `cargo prove build` to generate an ELF file. -### Include the ELF File in `program.rs` -In your main SP1 project, include the generated ELF file by updating `program.rs`. +### Include the ELF File in `test-artifacts` crate `lib.rs` +In your main SP1 project, include the generated ELF file by updating `crates/test-artifacts/src/lib.rs`. ```rust -pub const CUSTOM_PRECOMPILE_ELF: &[u8] = - include_bytes!("path/to/generated/elf/file"); +pub const CUSTOM_PRECOMPILE_ELF: &[u8] = include_elf!("your-test-crate-name"); // Other ELF files... ``` @@ -230,10 +229,11 @@ mod tests { utils::{ self, run_test_io, - tests::CUSTOM_PRECOMPILE_ELF, }, }; + use test_artifacts::CUSTOM_PRECOMPILE_ELF; + #[test] fn test_custom_precompile() { utils::setup_logger(); diff --git a/crates/core/machine/src/syscall/precompiles/edwards/ed_add.rs b/crates/core/machine/src/syscall/precompiles/edwards/ed_add.rs index 94e81e20cb..7488a772c3 100644 --- a/crates/core/machine/src/syscall/precompiles/edwards/ed_add.rs +++ b/crates/core/machine/src/syscall/precompiles/edwards/ed_add.rs @@ -342,11 +342,9 @@ where mod tests { use sp1_core_executor::Program; use sp1_stark::CpuProver; + use test_artifacts::{ED25519_ELF, ED_ADD_ELF}; - use crate::{ - utils, - utils::tests::{ED25519_ELF, ED_ADD_ELF}, - }; + use crate::utils; #[test] fn test_ed_add_simple() { diff --git a/crates/core/machine/src/syscall/precompiles/edwards/ed_decompress.rs b/crates/core/machine/src/syscall/precompiles/edwards/ed_decompress.rs index 97d0e526fe..51b3f32e59 100644 --- a/crates/core/machine/src/syscall/precompiles/edwards/ed_decompress.rs +++ b/crates/core/machine/src/syscall/precompiles/edwards/ed_decompress.rs @@ -298,8 +298,9 @@ where pub mod tests { use sp1_core_executor::Program; use sp1_stark::CpuProver; + use test_artifacts::ED_DECOMPRESS_ELF; - use crate::utils::{self, tests::ED_DECOMPRESS_ELF}; + use crate::utils; #[test] fn test_ed_decompress() { diff --git a/crates/core/machine/src/syscall/precompiles/fptower/mod.rs b/crates/core/machine/src/syscall/precompiles/fptower/mod.rs index c0d63d3ab4..bf097adc05 100644 --- a/crates/core/machine/src/syscall/precompiles/fptower/mod.rs +++ b/crates/core/machine/src/syscall/precompiles/fptower/mod.rs @@ -10,12 +10,10 @@ pub use fp2_mul::*; mod tests { use sp1_stark::CpuProver; - use sp1_core_executor::{ - programs::tests::{ - BLS12381_FP2_ADDSUB_ELF, BLS12381_FP2_MUL_ELF, BLS12381_FP_ELF, BN254_FP2_ADDSUB_ELF, - BN254_FP2_MUL_ELF, BN254_FP_ELF, - }, - Program, + use sp1_core_executor::Program; + use test_artifacts::{ + BLS12381_FP2_ADDSUB_ELF, BLS12381_FP2_MUL_ELF, BLS12381_FP_ELF, BN254_FP2_ADDSUB_ELF, + BN254_FP2_MUL_ELF, BN254_FP_ELF, }; use crate::utils; diff --git a/crates/core/machine/src/syscall/precompiles/keccak256/air.rs b/crates/core/machine/src/syscall/precompiles/keccak256/air.rs index a5925fb6c8..d6c46cefce 100644 --- a/crates/core/machine/src/syscall/precompiles/keccak256/air.rs +++ b/crates/core/machine/src/syscall/precompiles/keccak256/air.rs @@ -140,7 +140,7 @@ mod test { use crate::{ io::SP1Stdin, riscv::RiscvAir, - utils::{prove, setup_logger, tests::KECCAK256_ELF}, + utils::{prove, setup_logger}, }; use sp1_primitives::io::SP1PublicValues; @@ -149,6 +149,7 @@ mod test { use sp1_stark::{ baby_bear_poseidon2::BabyBearPoseidon2, CpuProver, SP1CoreOpts, StarkGenericConfig, }; + use test_artifacts::KECCAK256_ELF; use tiny_keccak::Hasher; const NUM_TEST_CASES: usize = 45; diff --git a/crates/core/machine/src/syscall/precompiles/keccak256/mod.rs b/crates/core/machine/src/syscall/precompiles/keccak256/mod.rs index 2f53e23c77..348702a570 100644 --- a/crates/core/machine/src/syscall/precompiles/keccak256/mod.rs +++ b/crates/core/machine/src/syscall/precompiles/keccak256/mod.rs @@ -23,8 +23,9 @@ impl KeccakPermuteChip { pub mod permute_tests { use sp1_core_executor::{syscalls::SyscallCode, Executor, Instruction, Opcode, Program}; use sp1_stark::{CpuProver, SP1CoreOpts}; + use test_artifacts::KECCAK_PERMUTE_ELF; - use crate::utils::{self, run_test, tests::KECCAK_PERMUTE_ELF}; + use crate::utils::{self, run_test}; pub fn keccak_permute_program() -> Program { let digest_ptr = 100; diff --git a/crates/core/machine/src/syscall/precompiles/sha256/compress/mod.rs b/crates/core/machine/src/syscall/precompiles/sha256/compress/mod.rs index 539dbe885b..bd15cce2dd 100644 --- a/crates/core/machine/src/syscall/precompiles/sha256/compress/mod.rs +++ b/crates/core/machine/src/syscall/precompiles/sha256/compress/mod.rs @@ -34,8 +34,9 @@ pub mod compress_tests { use sp1_core_executor::{syscalls::SyscallCode, Instruction, Opcode, Program}; use sp1_stark::CpuProver; + use test_artifacts::SHA_COMPRESS_ELF; - use crate::utils::{run_test, setup_logger, tests::SHA_COMPRESS_ELF}; + use crate::utils::{run_test, setup_logger}; pub fn sha_compress_program() -> Program { let w_ptr = 100; diff --git a/crates/core/machine/src/syscall/precompiles/sha256/extend/mod.rs b/crates/core/machine/src/syscall/precompiles/sha256/extend/mod.rs index cb3aea1bbb..e978902812 100644 --- a/crates/core/machine/src/syscall/precompiles/sha256/extend/mod.rs +++ b/crates/core/machine/src/syscall/precompiles/sha256/extend/mod.rs @@ -37,11 +37,9 @@ pub mod extend_tests { events::AluEvent, syscalls::SyscallCode, ExecutionRecord, Instruction, Opcode, Program, }; use sp1_stark::{air::MachineAir, CpuProver}; + use test_artifacts::{SHA2_ELF, SHA_EXTEND_ELF}; - use crate::utils::{ - self, run_test, - tests::{SHA2_ELF, SHA_EXTEND_ELF}, - }; + use crate::utils::{self, run_test}; use super::ShaExtendChip; diff --git a/crates/core/machine/src/syscall/precompiles/u256x2048_mul/mod.rs b/crates/core/machine/src/syscall/precompiles/u256x2048_mul/mod.rs index 95a40d4587..df525659d8 100644 --- a/crates/core/machine/src/syscall/precompiles/u256x2048_mul/mod.rs +++ b/crates/core/machine/src/syscall/precompiles/u256x2048_mul/mod.rs @@ -13,7 +13,6 @@ mod tests { LookupId, MemoryReadRecord, MemoryWriteRecord, PrecompileEvent, SyscallEvent, U256xU2048MulEvent, }, - programs::tests::U256XU2048_MUL_ELF, syscalls::SyscallCode, ExecutionRecord, Program, }; @@ -21,6 +20,7 @@ mod tests { use sp1_stark::{ air::MachineAir, baby_bear_poseidon2::BabyBearPoseidon2, CpuProver, StarkGenericConfig, }; + use test_artifacts::U256XU2048_MUL_ELF; use crate::{ io::SP1Stdin, diff --git a/crates/core/machine/src/syscall/precompiles/uint256/mod.rs b/crates/core/machine/src/syscall/precompiles/uint256/mod.rs index ce50c01cae..7bea9fcca3 100644 --- a/crates/core/machine/src/syscall/precompiles/uint256/mod.rs +++ b/crates/core/machine/src/syscall/precompiles/uint256/mod.rs @@ -8,10 +8,11 @@ mod tests { use sp1_core_executor::Program; use sp1_curves::{params::FieldParameters, uint256::U256Field, utils::biguint_from_limbs}; use sp1_stark::CpuProver; + use test_artifacts::UINT256_MUL_ELF; use crate::{ io::SP1Stdin, - utils::{self, run_test_io, tests::UINT256_MUL_ELF}, + utils::{self, run_test_io}, }; #[test] diff --git a/crates/core/machine/src/syscall/precompiles/weierstrass/weierstrass_add.rs b/crates/core/machine/src/syscall/precompiles/weierstrass/weierstrass_add.rs index d678f93086..ac82fb88ce 100644 --- a/crates/core/machine/src/syscall/precompiles/weierstrass/weierstrass_add.rs +++ b/crates/core/machine/src/syscall/precompiles/weierstrass/weierstrass_add.rs @@ -466,15 +466,13 @@ mod tests { use sp1_core_executor::Program; use sp1_stark::CpuProver; - - use crate::utils::{ - run_test, setup_logger, - tests::{ - BLS12381_ADD_ELF, BLS12381_DOUBLE_ELF, BLS12381_MUL_ELF, BN254_ADD_ELF, BN254_MUL_ELF, - SECP256K1_ADD_ELF, SECP256K1_MUL_ELF, SECP256R1_ADD_ELF, - }, + use test_artifacts::{ + BLS12381_ADD_ELF, BLS12381_DOUBLE_ELF, BLS12381_MUL_ELF, BN254_ADD_ELF, BN254_MUL_ELF, + SECP256K1_ADD_ELF, SECP256K1_MUL_ELF, SECP256R1_ADD_ELF, }; + use crate::utils::{run_test, setup_logger}; + #[test] fn test_secp256k1_add_simple() { setup_logger(); diff --git a/crates/core/machine/src/syscall/precompiles/weierstrass/weierstrass_decompress.rs b/crates/core/machine/src/syscall/precompiles/weierstrass/weierstrass_decompress.rs index 1edc1440f9..da010cf81d 100644 --- a/crates/core/machine/src/syscall/precompiles/weierstrass/weierstrass_decompress.rs +++ b/crates/core/machine/src/syscall/precompiles/weierstrass/weierstrass_decompress.rs @@ -540,10 +540,7 @@ where #[cfg(test)] mod tests { - use crate::{ - io::SP1Stdin, - utils::{self, tests::BLS12381_DECOMPRESS_ELF}, - }; + use crate::{io::SP1Stdin, utils}; use amcl::{ bls381::bls381::{basic::key_pair_generate_g2, utils::deserialize_g1}, rand::RAND, @@ -552,11 +549,12 @@ mod tests { use rand::{thread_rng, Rng}; use sp1_core_executor::Program; use sp1_stark::CpuProver; - - use crate::utils::{ - run_test_io, tests::SECP256K1_DECOMPRESS_ELF, tests::SECP256R1_DECOMPRESS_ELF, + use test_artifacts::{ + BLS12381_DECOMPRESS_ELF, SECP256K1_DECOMPRESS_ELF, SECP256R1_DECOMPRESS_ELF, }; + use crate::utils::run_test_io; + #[test] fn test_weierstrass_bls_decompress() { utils::setup_logger(); diff --git a/crates/core/machine/src/syscall/precompiles/weierstrass/weierstrass_double.rs b/crates/core/machine/src/syscall/precompiles/weierstrass/weierstrass_double.rs index 9e18fc60f1..e7a8f9600f 100644 --- a/crates/core/machine/src/syscall/precompiles/weierstrass/weierstrass_double.rs +++ b/crates/core/machine/src/syscall/precompiles/weierstrass/weierstrass_double.rs @@ -494,14 +494,12 @@ where pub mod tests { use sp1_core_executor::Program; use sp1_stark::CpuProver; - - use crate::utils::{ - run_test, setup_logger, - tests::{ - BLS12381_DOUBLE_ELF, BN254_DOUBLE_ELF, SECP256K1_DOUBLE_ELF, SECP256R1_DOUBLE_ELF, - }, + use test_artifacts::{ + BLS12381_DOUBLE_ELF, BN254_DOUBLE_ELF, SECP256K1_DOUBLE_ELF, SECP256R1_DOUBLE_ELF, }; + use crate::utils::{run_test, setup_logger}; + #[test] fn test_secp256k1_double_simple() { setup_logger(); diff --git a/crates/core/machine/src/utils/mod.rs b/crates/core/machine/src/utils/mod.rs index 124cd402f9..aed57bd751 100644 --- a/crates/core/machine/src/utils/mod.rs +++ b/crates/core/machine/src/utils/mod.rs @@ -1,7 +1,5 @@ pub mod concurrency; mod logger; -#[cfg(any(test, feature = "programs"))] -mod programs; mod prove; mod span; mod tracer; @@ -13,9 +11,6 @@ use sp1_curves::params::Limbs; pub use span::*; pub use tracer::*; -#[cfg(any(test, feature = "programs"))] -pub use programs::*; - use crate::memory::MemoryCols; use generic_array::ArrayLength; use p3_maybe_rayon::prelude::{ParallelBridge, ParallelIterator}; diff --git a/crates/core/machine/src/utils/programs.rs b/crates/core/machine/src/utils/programs.rs deleted file mode 100644 index 4ee29bb7ad..0000000000 --- a/crates/core/machine/src/utils/programs.rs +++ /dev/null @@ -1,112 +0,0 @@ -pub mod tests { - /// Demos. - - pub const CHESS_ELF: &[u8] = - include_bytes!("../../../../../examples/chess/program/elf/riscv32im-succinct-zkvm-elf"); - - pub const FIBONACCI_IO_ELF: &[u8] = - include_bytes!("../../../../../examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf"); - - pub const IO_ELF: &[u8] = - include_bytes!("../../../../../examples/io/program/elf/riscv32im-succinct-zkvm-elf"); - - pub const JSON_ELF: &[u8] = - include_bytes!("../../../../../examples/json/program/elf/riscv32im-succinct-zkvm-elf"); - - pub const REGEX_ELF: &[u8] = - include_bytes!("../../../../../examples/regex/program/elf/riscv32im-succinct-zkvm-elf"); - - pub const RSA_ELF: &[u8] = - include_bytes!("../../../../../examples/rsa/program/elf/riscv32im-succinct-zkvm-elf"); - - pub const SSZ_WITHDRAWALS_ELF: &[u8] = include_bytes!( - "../../../../../examples/ssz-withdrawals/program/elf/riscv32im-succinct-zkvm-elf" - ); - - pub const TENDERMINT_ELF: &[u8] = include_bytes!( - "../../../../../examples/tendermint/program/elf/riscv32im-succinct-zkvm-elf" - ); - - /// Tests. - - pub const FIBONACCI_ELF: &[u8] = - include_bytes!("../../../../../tests/fibonacci/elf/riscv32im-succinct-zkvm-elf"); - - pub const ED25519_ELF: &[u8] = - include_bytes!("../../../../../tests/ed25519/elf/riscv32im-succinct-zkvm-elf"); - - pub const CYCLE_TRACKER_ELF: &[u8] = - include_bytes!("../../../../../tests/cycle-tracker/elf/riscv32im-succinct-zkvm-elf"); - - pub const ED_ADD_ELF: &[u8] = - include_bytes!("../../../../../tests/ed-add/elf/riscv32im-succinct-zkvm-elf"); - - pub const ED_DECOMPRESS_ELF: &[u8] = - include_bytes!("../../../../../tests/ed-decompress/elf/riscv32im-succinct-zkvm-elf"); - - pub const KECCAK_PERMUTE_ELF: &[u8] = - include_bytes!("../../../../../tests/keccak-permute/elf/riscv32im-succinct-zkvm-elf"); - - pub const KECCAK256_ELF: &[u8] = - include_bytes!("../../../../../tests/keccak256/elf/riscv32im-succinct-zkvm-elf"); - - pub const SECP256K1_ADD_ELF: &[u8] = - include_bytes!("../../../../../tests/secp256k1-add/elf/riscv32im-succinct-zkvm-elf"); - - pub const SECP256K1_DECOMPRESS_ELF: &[u8] = - include_bytes!("../../../../../tests/secp256k1-decompress/elf/riscv32im-succinct-zkvm-elf"); - - pub const SECP256K1_DOUBLE_ELF: &[u8] = - include_bytes!("../../../../../tests/secp256k1-double/elf/riscv32im-succinct-zkvm-elf"); - - pub const SECP256R1_ADD_ELF: &[u8] = - include_bytes!("../../../../../tests/secp256r1-add/elf/riscv32im-succinct-zkvm-elf"); - - pub const SECP256R1_DECOMPRESS_ELF: &[u8] = - include_bytes!("../../../../../tests/secp256r1-decompress/elf/riscv32im-succinct-zkvm-elf"); - - pub const SECP256R1_DOUBLE_ELF: &[u8] = - include_bytes!("../../../../../tests/secp256r1-double/elf/riscv32im-succinct-zkvm-elf"); - - pub const SHA_COMPRESS_ELF: &[u8] = - include_bytes!("../../../../../tests/sha-compress/elf/riscv32im-succinct-zkvm-elf"); - - pub const SHA_EXTEND_ELF: &[u8] = - include_bytes!("../../../../../tests/sha-extend/elf/riscv32im-succinct-zkvm-elf"); - - pub const SHA2_ELF: &[u8] = - include_bytes!("../../../../../tests/sha2/elf/riscv32im-succinct-zkvm-elf"); - - pub const BN254_ADD_ELF: &[u8] = - include_bytes!("../../../../../tests/bn254-add/elf/riscv32im-succinct-zkvm-elf"); - - pub const BN254_DOUBLE_ELF: &[u8] = - include_bytes!("../../../../../tests/bn254-double/elf/riscv32im-succinct-zkvm-elf"); - - pub const BN254_MUL_ELF: &[u8] = - include_bytes!("../../../../../tests/bn254-mul/elf/riscv32im-succinct-zkvm-elf"); - - pub const SECP256K1_MUL_ELF: &[u8] = - include_bytes!("../../../../../tests/secp256k1-mul/elf/riscv32im-succinct-zkvm-elf"); - - pub const BLS12381_ADD_ELF: &[u8] = - include_bytes!("../../../../../tests/bls12381-add/elf/riscv32im-succinct-zkvm-elf"); - - pub const BLS12381_DOUBLE_ELF: &[u8] = - include_bytes!("../../../../../tests/bls12381-double/elf/riscv32im-succinct-zkvm-elf"); - - pub const BLS12381_MUL_ELF: &[u8] = - include_bytes!("../../../../../tests/bls12381-mul/elf/riscv32im-succinct-zkvm-elf"); - - pub const UINT256_MUL_ELF: &[u8] = - include_bytes!("../../../../../tests/uint256-mul/elf/riscv32im-succinct-zkvm-elf"); - - pub const BLS12381_DECOMPRESS_ELF: &[u8] = - include_bytes!("../../../../../tests/bls12381-decompress/elf/riscv32im-succinct-zkvm-elf"); - - pub const VERIFY_PROOF_ELF: &[u8] = - include_bytes!("../../../../../tests/verify-proof/elf/riscv32im-succinct-zkvm-elf"); - - pub const PANIC_ELF: &[u8] = - include_bytes!("../../../../../tests/panic/elf/riscv32im-succinct-zkvm-elf"); -} diff --git a/crates/cuda/Cargo.toml b/crates/cuda/Cargo.toml index 5dad4cbebf..a94f88c11b 100644 --- a/crates/cuda/Cargo.toml +++ b/crates/cuda/Cargo.toml @@ -19,14 +19,15 @@ tokio = { version = "^1.38.0", features = ["full"] } tracing = { workspace = true } twirp = { package = "twirp-rs", version = "0.13.0-succinct" } ctrlc = "3.4.4" +test-artifacts = { workspace = true, optional = true } [build-dependencies] prost-build = { version = "0.13", optional = true } twirp-build = { package = "twirp-build-rs", version = "0.13.0-succinct", optional = true } [dev-dependencies] -sp1-core-machine = { workspace = true, features = ["programs"] } +sp1-core-machine = { workspace = true } [features] default = [] -protobuf = ["dep:prost-build", "dep:twirp-build"] +protobuf = ["dep:prost-build", "dep:twirp-build", "dep:test-artifacts"] diff --git a/crates/cuda/src/lib.rs b/crates/cuda/src/lib.rs index f63a65c744..3493f6a58c 100644 --- a/crates/cuda/src/lib.rs +++ b/crates/cuda/src/lib.rs @@ -366,11 +366,9 @@ impl Middleware for LoggingMiddleware { #[cfg(feature = "protobuf")] #[cfg(test)] mod tests { - use sp1_core_machine::{ - reduce::SP1ReduceProof, - utils::{setup_logger, tests::FIBONACCI_ELF}, - }; + use sp1_core_machine::{reduce::SP1ReduceProof, utils::setup_logger}; use sp1_prover::{components::DefaultProverComponents, InnerSC, SP1CoreProof, SP1Prover}; + use test_artifacts::FIBONACCI_ELF; use twirp::{url::Url, Client}; use crate::{ diff --git a/crates/perf/Cargo.toml b/crates/perf/Cargo.toml index 93ae716949..38300783fe 100644 --- a/crates/perf/Cargo.toml +++ b/crates/perf/Cargo.toml @@ -16,6 +16,7 @@ sp1-sdk = { workspace = true } p3-baby-bear = { workspace = true } sp1-stark = { workspace = true } sp1-cuda = { workspace = true } +test-artifacts = { workspace = true } clap = { version = "4.5.9", features = ["derive"] } bincode = "1.3.3" diff --git a/crates/perf/src/main.rs b/crates/perf/src/main.rs index baeffbc49b..df53c04bf3 100644 --- a/crates/perf/src/main.rs +++ b/crates/perf/src/main.rs @@ -1,12 +1,12 @@ use std::time::{Duration, Instant}; use clap::{command, Parser, ValueEnum}; -use sp1_core_executor::programs::tests::VERIFY_PROOF_ELF; use sp1_cuda::SP1CudaProver; use sp1_prover::components::DefaultProverComponents; use sp1_prover::HashableKey; use sp1_sdk::{self, ProverClient, SP1Context, SP1Prover, SP1Stdin}; use sp1_stark::SP1ProverOpts; +use test_artifacts::VERIFY_PROOF_ELF; #[derive(Parser, Clone)] #[command(about = "Evaluate the performance of SP1 on programs.")] diff --git a/crates/prover/Cargo.toml b/crates/prover/Cargo.toml index c5793ee106..226b902c60 100644 --- a/crates/prover/Cargo.toml +++ b/crates/prover/Cargo.toml @@ -30,6 +30,7 @@ serde = { workspace = true, features = ["derive", "rc"] } itertools = { workspace = true } tracing = { workspace = true } tracing-subscriber = { workspace = true } +tracing-appender = "0.2.3" serde_json = { workspace = true } clap = { version = "4.5.9", features = ["derive", "env"] } anyhow = "1.0.83" @@ -39,6 +40,10 @@ num-bigint = "0.4.6" thiserror = "1.0.63" lru = "0.12.4" eyre = "0.6.12" +test-artifacts = { workspace = true, optional = true } + +[dev-dependencies] +test-artifacts = { workspace = true } [[bin]] name = "build_plonk_bn254" @@ -60,7 +65,23 @@ path = "scripts/post_trusted_setup.rs" name = "e2e" path = "scripts/e2e.rs" +[[bin]] +name = "fibonacci_groth16" +path = "scripts/fibonacci_groth16.rs" +required-features = ["export-tests"] + +[[bin]] +name = "fibonacci_sweep" +path = "scripts/fibonacci_sweep.rs" +required-features = ["export-tests"] + +[[bin]] +name = "tendermint_sweep" +path = "scripts/tendermint_sweep.rs" +required-features = ["export-tests"] + + [features] native-gnark = ["sp1-recursion-gnark-ffi/native"] -export-tests = [] +export-tests = ["dep:test-artifacts"] debug = ["sp1-core-machine/debug"] diff --git a/crates/prover/scripts/fibonacci_groth16.rs b/crates/prover/scripts/fibonacci_groth16.rs index 2082b0587a..4ca51b00af 100644 --- a/crates/prover/scripts/fibonacci_groth16.rs +++ b/crates/prover/scripts/fibonacci_groth16.rs @@ -3,13 +3,14 @@ use std::time::Instant; use itertools::iproduct; -use sp1_core_machine::{ - io::SP1Stdin, - utils::{SP1ProverOpts, SP1ProverOpts}, -}; +use sp1_core_executor::SP1Context; +use sp1_core_machine::io::SP1Stdin; +use sp1_prover::components::DefaultProverComponents; use sp1_prover::SP1Prover; +use sp1_stark::SP1ProverOpts; +use tracing_subscriber::fmt::format::FmtSpan; +use tracing_subscriber::util::SubscriberInitExt; use tracing_subscriber::EnvFilter; -use tracing_subscriber::{fmt::format::FmtSpan, util::SubscriberInitExt}; fn main() { // Setup tracer. @@ -37,13 +38,13 @@ fn main() { std::env::set_var("RECONSTRUCT_COMMITMENTS", "false"); // Initialize prover. - let prover = SP1Prover::new(); + let prover = SP1Prover::::new(); // Setup sweep. let iterations = [480000u32]; let shard_sizes = [1 << 22]; let batch_sizes = [2]; - let elf = include_bytes!("../../examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf"); + let elf = test_artifacts::FIBONACCI_ELF; let (pk, vk) = prover.setup(elf); for (shard_size, iterations, batch_size) in iproduct!(shard_sizes, iterations, batch_sizes) { @@ -70,7 +71,7 @@ fn main() { tracing::info!("proving inner"); let recursion_proving_start = Instant::now(); - let _ = prover.compress(&vk, proof, vec![]); + let _ = prover.compress(&vk, proof, vec![], SP1ProverOpts::default()); let recursion_proving_duration = recursion_proving_start.elapsed().as_secs_f64(); tracing::info!("recursion_proving_duration={}", recursion_proving_duration); } diff --git a/crates/prover/scripts/fibonacci_sweep.rs b/crates/prover/scripts/fibonacci_sweep.rs index ca9eb93ce7..5321d4cf71 100644 --- a/crates/prover/scripts/fibonacci_sweep.rs +++ b/crates/prover/scripts/fibonacci_sweep.rs @@ -3,11 +3,11 @@ use std::{fs::File, io::BufWriter, io::Write, time::Instant}; use itertools::iproduct; -use sp1_core_machine::{ - io::SP1Stdin, - utils::{SP1ProverOpts, SP1ProverOpts}, -}; +use sp1_core_executor::SP1Context; +use sp1_core_machine::io::SP1Stdin; +use sp1_prover::components::DefaultProverComponents; use sp1_prover::SP1Prover; +use sp1_stark::SP1ProverOpts; use tracing_subscriber::EnvFilter; use tracing_subscriber::{fmt::format::FmtSpan, util::SubscriberInitExt}; @@ -37,19 +37,18 @@ fn main() { std::env::set_var("RECONSTRUCT_COMMITMENTS", "false"); // Initialize prover. - let prover = SP1Prover::new(); + let prover = SP1Prover::::new(); // Setup sweep. let iterations = [480000u32]; let shard_sizes = [1 << 19, 1 << 20, 1 << 21, 1 << 22]; let batch_sizes = [2, 3, 4]; - let elf = include_bytes!("../../examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf"); + let elf = test_artifacts::FIBONACCI_ELF; let (pk, vk) = prover.setup(elf); - let mut lines = vec![ - "iterations,shard_size,batch_size,leaf_proving_duration,recursion_proving_duration" - .to_string(), - ]; + let mut lines = + vec!["iterations,shard_size,batch_size,leaf_proving_duration,recursion_proving_duration" + .to_string()]; for (shard_size, iterations, batch_size) in iproduct!(shard_sizes, iterations, batch_sizes) { tracing::info!( "running: shard_size={}, iterations={}, batch_size={}", @@ -71,7 +70,7 @@ fn main() { let leaf_proving_duration = leaf_proving_start.elapsed().as_secs_f64(); let recursion_proving_start = Instant::now(); - let _ = prover.compress(&vk, proof, vec![]); + let _ = prover.compress(&vk, proof, vec![], SP1ProverOpts::default()); let recursion_proving_duration = recursion_proving_start.elapsed().as_secs_f64(); lines.push(format!( diff --git a/crates/prover/scripts/tendermint_sweep.rs b/crates/prover/scripts/tendermint_sweep.rs index 467d3b2f8d..bb80f848ea 100644 --- a/crates/prover/scripts/tendermint_sweep.rs +++ b/crates/prover/scripts/tendermint_sweep.rs @@ -3,11 +3,11 @@ use std::{fs::File, io::BufWriter, io::Write, time::Instant}; use itertools::iproduct; -use sp1_core_machine::{ - io::SP1Stdin, - utils::{SP1ProverOpts, SP1ProverOpts}, -}; +use sp1_core_executor::SP1Context; +use sp1_core_machine::io::SP1Stdin; +use sp1_prover::components::DefaultProverComponents; use sp1_prover::SP1Prover; +use sp1_stark::SP1ProverOpts; use tracing_subscriber::EnvFilter; use tracing_subscriber::{fmt::format::FmtSpan, util::SubscriberInitExt}; @@ -37,19 +37,18 @@ fn main() { std::env::set_var("RECONSTRUCT_COMMITMENTS", "false"); // Initialize prover. - let prover = SP1Prover::new(); + let prover = SP1Prover::::new(); // Setup sweep. let iterations = [480000u32]; let shard_sizes = [1 << 19, 1 << 20, 1 << 21, 1 << 22]; let batch_sizes = [2]; - let elf = include_bytes!("../../tests/tendermint-benchmark/elf/riscv32im-succinct-zkvm-elf"); + let elf = test_artifacts::TENDERMINT_BENCHMARK_ELF; let (pk, vk) = prover.setup(elf); - let mut lines = vec![ - "iterations,shard_size,batch_size,leaf_proving_duration,recursion_proving_duration" - .to_string(), - ]; + let mut lines = + vec!["iterations,shard_size,batch_size,leaf_proving_duration,recursion_proving_duration" + .to_string()]; for (shard_size, iterations, batch_size) in iproduct!(shard_sizes, iterations, batch_sizes) { tracing::info!( "running: shard_size={}, iterations={}, batch_size={}", @@ -71,7 +70,7 @@ fn main() { let leaf_proving_duration = leaf_proving_start.elapsed().as_secs_f64(); let recursion_proving_start = Instant::now(); - let _ = prover.compress(&vk, proof, vec![]); + let _ = prover.compress(&vk, proof, vec![], SP1ProverOpts::default()); let recursion_proving_duration = recursion_proving_start.elapsed().as_secs_f64(); lines.push(format!( diff --git a/crates/prover/src/lib.rs b/crates/prover/src/lib.rs index 5ffd096e43..b18be4b784 100644 --- a/crates/prover/src/lib.rs +++ b/crates/prover/src/lib.rs @@ -1412,11 +1412,10 @@ pub mod tests { opts: SP1ProverOpts, ) -> Result<()> { // Test program which proves the Keccak-256 hash of various inputs. - let keccak_elf = include_bytes!("../../../tests/keccak256/elf/riscv32im-succinct-zkvm-elf"); + let keccak_elf = test_artifacts::KECCAK256_ELF; // Test program which verifies proofs of a vkey and a list of committed inputs. - let verify_elf = - include_bytes!("../../../tests/verify-proof/elf/riscv32im-succinct-zkvm-elf"); + let verify_elf = test_artifacts::VERIFY_PROOF_ELF; tracing::info!("initializing prover"); let prover = SP1Prover::::new(); @@ -1511,7 +1510,7 @@ pub mod tests { #[test] #[serial] fn test_e2e() -> Result<()> { - let elf = include_bytes!("../../../tests/fibonacci/elf/riscv32im-succinct-zkvm-elf"); + let elf = test_artifacts::FIBONACCI_ELF; setup_logger(); let opts = SP1ProverOpts::default(); // TODO(mattstam): We should Test::Plonk here, but this uses the existing diff --git a/crates/recursion/circuit/Cargo.toml b/crates/recursion/circuit/Cargo.toml index 2dc23896a3..708fa7368e 100644 --- a/crates/recursion/circuit/Cargo.toml +++ b/crates/recursion/circuit/Cargo.toml @@ -38,6 +38,7 @@ tracing = { workspace = true } hashbrown = { workspace = true, features = ["serde", "inline-more"] } num-traits = "0.2.19" rayon = "1.10.0" +test-artifacts = { workspace = true, optional = true } [dev-dependencies] sp1-core-executor = { workspace = true, features = ["programs"] } @@ -49,8 +50,9 @@ p3-merkle-tree = { workspace = true } p3-poseidon2 = { workspace = true } zkhash = "0.2.0" rand = "0.8.5" +test-artifacts = { workspace = true } [features] native-gnark = ["sp1-recursion-gnark-ffi/native"] -export-tests = [] +export-tests = ["dep:test-artifacts"] debug = ["sp1-core-machine/debug"] diff --git a/crates/recursion/circuit/src/stark.rs b/crates/recursion/circuit/src/stark.rs index feb81e0ef4..8242ab23ab 100644 --- a/crates/recursion/circuit/src/stark.rs +++ b/crates/recursion/circuit/src/stark.rs @@ -553,7 +553,7 @@ pub mod tests { BabyBearFriConfig, }; - use sp1_core_executor::{programs::tests::FIBONACCI_ELF, Program}; + use sp1_core_executor::Program; use sp1_core_machine::{ io::SP1Stdin, riscv::RiscvAir, @@ -569,6 +569,7 @@ pub mod tests { baby_bear_poseidon2::BabyBearPoseidon2, CpuProver, InnerVal, MachineProver, SP1CoreOpts, ShardProof, }; + use test_artifacts::FIBONACCI_ELF; use super::*; use crate::witness::*; diff --git a/crates/sdk/Cargo.toml b/crates/sdk/Cargo.toml index c9a0cd20ce..a55b6caf39 100644 --- a/crates/sdk/Cargo.toml +++ b/crates/sdk/Cargo.toml @@ -24,6 +24,7 @@ anyhow = "1.0.83" sp1-prover = { workspace = true } sp1-core-machine = { workspace = true } sp1-cuda = { workspace = true, optional = true } +sp1-build = { workspace = true } futures = "0.3.30" bincode = "1.3.3" tokio = { version = "1.39.2", features = ["full"], optional = true } @@ -52,6 +53,9 @@ alloy-signer-local = { version = "0.5", optional = true } alloy-primitives = { version = "0.8", optional = true } backoff = { version = "0.4", features = ["tokio"], optional = true } +[dev-dependencies] +test-artifacts = { workspace = true } + [features] default = ["network"] native-gnark = ["sp1-prover/native-gnark"] diff --git a/crates/sdk/src/lib.rs b/crates/sdk/src/lib.rs index ac97f2e47c..615f36ff0e 100644 --- a/crates/sdk/src/lib.rs +++ b/crates/sdk/src/lib.rs @@ -38,6 +38,7 @@ use {std::future::Future, tokio::task::block_in_place}; pub use provers::{CpuProver, MockProver, Prover}; +pub use sp1_build::include_elf; pub use sp1_core_executor::{ExecutionReport, HookEnv, SP1Context, SP1ContextBuilder}; pub use sp1_core_machine::{io::SP1Stdin, riscv::cost::CostEstimator, SP1_CIRCUIT_VERSION}; pub use sp1_primitives::io::SP1PublicValues; @@ -176,7 +177,7 @@ impl ProverClient { /// use sp1_sdk::{ProverClient, SP1Context, SP1Stdin}; /// /// // Load the program. - /// let elf = include_bytes!("../../../examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf"); + /// let elf = test_artifacts::FIBONACCI_ELF; /// /// // Initialize the prover client. /// let client = ProverClient::new(); @@ -206,7 +207,7 @@ impl ProverClient { /// use sp1_sdk::{ProverClient, SP1Context, SP1Stdin}; /// /// // Load the program. - /// let elf = include_bytes!("../../../examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf"); + /// let elf = test_artifacts::FIBONACCI_ELF; /// /// // Initialize the prover client. /// let client = ProverClient::new(); @@ -232,7 +233,7 @@ impl ProverClient { /// ```no_run /// use sp1_sdk::{ProverClient, SP1Stdin}; /// - /// let elf = include_bytes!("../../../examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf"); + /// let elf = test_artifacts::FIBONACCI_ELF; /// let client = ProverClient::new(); /// let (pk, vk) = client.setup(elf); /// let mut stdin = SP1Stdin::new(); @@ -265,7 +266,7 @@ impl ProverClient { /// ```no_run /// use sp1_sdk::{ProverClient, SP1Stdin}; /// - /// let elf = include_bytes!("../../../examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf"); + /// let elf = test_artifacts::FIBONACCI_ELF; /// let client = ProverClient::new(); /// let mut stdin = SP1Stdin::new(); /// stdin.write(&10usize); @@ -298,22 +299,6 @@ pub fn block_on(fut: impl Future) -> T { } } -/// Returns the raw ELF bytes by the zkVM program target name. -/// -/// Note that this only works when using `sp1_build::build_program` or -/// `sp1_build::build_program_with_args` in a build script. -/// -/// By default, the program target name is the same as the program crate name. However, this might -/// not be the case for non-standard project structures. For example, placing the entrypoint source -/// file at `src/bin/my_entry.rs` would result in the program target being named `my_entry`, in -/// which case the invocation should be `include_elf!("my_entry")` instead. -#[macro_export] -macro_rules! include_elf { - ($arg:tt) => {{ - include_bytes!(env!(concat!("SP1_ELF_", $arg))) - }}; -} - #[cfg(test)] mod tests { @@ -325,8 +310,7 @@ mod tests { fn test_execute() { utils::setup_logger(); let client = ProverClient::local(); - let elf = - include_bytes!("../../../examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf"); + let elf = test_artifacts::FIBONACCI_ELF; let mut stdin = SP1Stdin::new(); stdin.write(&10usize); let (_, report) = client.execute(elf, stdin).run().unwrap(); @@ -338,7 +322,7 @@ mod tests { fn test_execute_panic() { utils::setup_logger(); let client = ProverClient::local(); - let elf = include_bytes!("../../../tests/panic/elf/riscv32im-succinct-zkvm-elf"); + let elf = test_artifacts::PANIC_ELF; let mut stdin = SP1Stdin::new(); stdin.write(&10usize); client.execute(elf, stdin).run().unwrap(); @@ -349,7 +333,7 @@ mod tests { fn test_cycle_limit_fail() { utils::setup_logger(); let client = ProverClient::local(); - let elf = include_bytes!("../../../tests/panic/elf/riscv32im-succinct-zkvm-elf"); + let elf = test_artifacts::PANIC_ELF; let mut stdin = SP1Stdin::new(); stdin.write(&10usize); client.execute(elf, stdin).max_cycles(1).run().unwrap(); @@ -359,7 +343,7 @@ mod tests { fn test_e2e_core() { utils::setup_logger(); let client = ProverClient::local(); - let elf = include_bytes!("../../../tests/fibonacci/elf/riscv32im-succinct-zkvm-elf"); + let elf = test_artifacts::FIBONACCI_ELF; let (pk, vk) = client.setup(elf); let mut stdin = SP1Stdin::new(); stdin.write(&10usize); @@ -379,7 +363,7 @@ mod tests { fn test_e2e_compressed() { utils::setup_logger(); let client = ProverClient::local(); - let elf = include_bytes!("../../../tests/fibonacci/elf/riscv32im-succinct-zkvm-elf"); + let elf = test_artifacts::FIBONACCI_ELF; let (pk, vk) = client.setup(elf); let mut stdin = SP1Stdin::new(); stdin.write(&10usize); @@ -399,7 +383,7 @@ mod tests { fn test_e2e_prove_plonk() { utils::setup_logger(); let client = ProverClient::local(); - let elf = include_bytes!("../../../tests/fibonacci/elf/riscv32im-succinct-zkvm-elf"); + let elf = test_artifacts::FIBONACCI_ELF; let (pk, vk) = client.setup(elf); let mut stdin = SP1Stdin::new(); stdin.write(&10usize); @@ -419,7 +403,7 @@ mod tests { fn test_e2e_prove_plonk_mock() { utils::setup_logger(); let client = ProverClient::mock(); - let elf = include_bytes!("../../../tests/fibonacci/elf/riscv32im-succinct-zkvm-elf"); + let elf = test_artifacts::FIBONACCI_ELF; let (pk, vk) = client.setup(elf); let mut stdin = SP1Stdin::new(); stdin.write(&10usize); diff --git a/crates/test-artifacts/Cargo.toml b/crates/test-artifacts/Cargo.toml new file mode 100644 index 0000000000..6954ca7c0c --- /dev/null +++ b/crates/test-artifacts/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "test-artifacts" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +keywords.workspace = true +categories.workspace = true + +[dependencies] +sp1-build = { workspace = true } + +[build-dependencies] +sp1-build = { workspace = true } \ No newline at end of file diff --git a/crates/test-artifacts/Makefile b/crates/test-artifacts/Makefile new file mode 100644 index 0000000000..772dd9805d --- /dev/null +++ b/crates/test-artifacts/Makefile @@ -0,0 +1,8 @@ +all: + for dir in programs/*/ ; do \ + echo "Building in $${dir}..."; \ + cd $${dir} && cargo prove build || { echo "Failed at command: cd $${dir} && cargo prove build"; exit 1; }; \ + cd ../..; \ + done + +.PHONY: all diff --git a/crates/test-artifacts/build.rs b/crates/test-artifacts/build.rs new file mode 100644 index 0000000000..971d05e860 --- /dev/null +++ b/crates/test-artifacts/build.rs @@ -0,0 +1,20 @@ +use std::{ + io::{Error, Result}, + path::PathBuf, +}; + +use sp1_build::build_program_with_args; + +fn main() -> Result<()> { + let tests_path = + [env!("CARGO_MANIFEST_DIR"), "programs"].iter().collect::().canonicalize()?; + + build_program_with_args( + tests_path + .to_str() + .ok_or_else(|| Error::other(format!("expected {tests_path:?} to be valid UTF-8")))?, + Default::default(), + ); + + Ok(()) +} diff --git a/tests/Cargo.lock b/crates/test-artifacts/programs/Cargo.lock similarity index 99% rename from tests/Cargo.lock rename to crates/test-artifacts/programs/Cargo.lock index 8675161a03..46b406d8f0 100644 --- a/tests/Cargo.lock +++ b/crates/test-artifacts/programs/Cargo.lock @@ -381,7 +381,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -391,7 +391,7 @@ source = "git+https://github.com/sp1-patches/curve25519-dalek?branch=patch-curve dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -533,7 +533,7 @@ checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -1458,7 +1458,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -1727,7 +1727,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -1750,7 +1750,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -1987,7 +1987,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -2024,9 +2024,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.79" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -2193,7 +2193,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -2391,7 +2391,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -2411,5 +2411,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] diff --git a/tests/Cargo.toml b/crates/test-artifacts/programs/Cargo.toml similarity index 98% rename from tests/Cargo.toml rename to crates/test-artifacts/programs/Cargo.toml index 71d3d532de..0a02636733 100644 --- a/tests/Cargo.toml +++ b/crates/test-artifacts/programs/Cargo.toml @@ -35,6 +35,7 @@ members = [ "sha-extend", "sha2", "tendermint-benchmark", + "u256x2048-mul", "uint256-arith", "uint256-mul", "verify-proof", diff --git a/tests/Makefile b/crates/test-artifacts/programs/Makefile similarity index 100% rename from tests/Makefile rename to crates/test-artifacts/programs/Makefile diff --git a/crates/test-artifacts/programs/bls12381-add/Cargo.toml b/crates/test-artifacts/programs/bls12381-add/Cargo.toml new file mode 100644 index 0000000000..eba457a03d --- /dev/null +++ b/crates/test-artifacts/programs/bls12381-add/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "bls12381-add-test" +version = "1.1.0" +edition = "2021" +publish = false + +[dependencies] +common-test-utils = { path = "../common" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } +sp1-lib = { path = "../../../../crates/zkvm/lib" } +sp1-curves = { path = "../../../../crates/curves" } diff --git a/tests/bls12381-add/src/main.rs b/crates/test-artifacts/programs/bls12381-add/src/main.rs similarity index 100% rename from tests/bls12381-add/src/main.rs rename to crates/test-artifacts/programs/bls12381-add/src/main.rs diff --git a/tests/bls12381-decompress/Cargo.toml b/crates/test-artifacts/programs/bls12381-decompress/Cargo.toml similarity index 64% rename from tests/bls12381-decompress/Cargo.toml rename to crates/test-artifacts/programs/bls12381-decompress/Cargo.toml index 1da8e9b5d3..d68befe785 100644 --- a/tests/bls12381-decompress/Cargo.toml +++ b/crates/test-artifacts/programs/bls12381-decompress/Cargo.toml @@ -5,4 +5,4 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } diff --git a/tests/bls12381-decompress/src/main.rs b/crates/test-artifacts/programs/bls12381-decompress/src/main.rs similarity index 100% rename from tests/bls12381-decompress/src/main.rs rename to crates/test-artifacts/programs/bls12381-decompress/src/main.rs diff --git a/tests/bls12381-double/Cargo.toml b/crates/test-artifacts/programs/bls12381-double/Cargo.toml similarity index 64% rename from tests/bls12381-double/Cargo.toml rename to crates/test-artifacts/programs/bls12381-double/Cargo.toml index f93909483e..d3c7e77b25 100644 --- a/tests/bls12381-double/Cargo.toml +++ b/crates/test-artifacts/programs/bls12381-double/Cargo.toml @@ -5,4 +5,4 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } diff --git a/tests/bls12381-double/src/main.rs b/crates/test-artifacts/programs/bls12381-double/src/main.rs similarity index 100% rename from tests/bls12381-double/src/main.rs rename to crates/test-artifacts/programs/bls12381-double/src/main.rs diff --git a/tests/bls12381-fp/Cargo.toml b/crates/test-artifacts/programs/bls12381-fp/Cargo.toml similarity index 70% rename from tests/bls12381-fp/Cargo.toml rename to crates/test-artifacts/programs/bls12381-fp/Cargo.toml index 1fe608fc9e..11fcf35676 100644 --- a/tests/bls12381-fp/Cargo.toml +++ b/crates/test-artifacts/programs/bls12381-fp/Cargo.toml @@ -6,6 +6,6 @@ publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } num-bigint = "0.4.6" rand = "0.8.5" diff --git a/tests/bls12381-fp/src/main.rs b/crates/test-artifacts/programs/bls12381-fp/src/main.rs similarity index 100% rename from tests/bls12381-fp/src/main.rs rename to crates/test-artifacts/programs/bls12381-fp/src/main.rs diff --git a/tests/bls12381-fp2-addsub/Cargo.toml b/crates/test-artifacts/programs/bls12381-fp2-addsub/Cargo.toml similarity index 71% rename from tests/bls12381-fp2-addsub/Cargo.toml rename to crates/test-artifacts/programs/bls12381-fp2-addsub/Cargo.toml index 2d4d21f905..670ece6d23 100644 --- a/tests/bls12381-fp2-addsub/Cargo.toml +++ b/crates/test-artifacts/programs/bls12381-fp2-addsub/Cargo.toml @@ -6,6 +6,6 @@ publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } num-bigint = "0.4.6" rand = "0.8.5" diff --git a/tests/bls12381-fp2-addsub/src/main.rs b/crates/test-artifacts/programs/bls12381-fp2-addsub/src/main.rs similarity index 100% rename from tests/bls12381-fp2-addsub/src/main.rs rename to crates/test-artifacts/programs/bls12381-fp2-addsub/src/main.rs diff --git a/tests/bls12381-fp2-mul/Cargo.toml b/crates/test-artifacts/programs/bls12381-fp2-mul/Cargo.toml similarity index 71% rename from tests/bls12381-fp2-mul/Cargo.toml rename to crates/test-artifacts/programs/bls12381-fp2-mul/Cargo.toml index dee3919614..ee15a0f2cd 100644 --- a/tests/bls12381-fp2-mul/Cargo.toml +++ b/crates/test-artifacts/programs/bls12381-fp2-mul/Cargo.toml @@ -6,6 +6,6 @@ publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } num-bigint = "0.4.6" rand = "0.8.5" diff --git a/tests/bls12381-fp2-mul/src/main.rs b/crates/test-artifacts/programs/bls12381-fp2-mul/src/main.rs similarity index 100% rename from tests/bls12381-fp2-mul/src/main.rs rename to crates/test-artifacts/programs/bls12381-fp2-mul/src/main.rs diff --git a/crates/test-artifacts/programs/bls12381-mul/Cargo.toml b/crates/test-artifacts/programs/bls12381-mul/Cargo.toml new file mode 100644 index 0000000000..e74d3a21ea --- /dev/null +++ b/crates/test-artifacts/programs/bls12381-mul/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "bls12381-mul-test" +version = "1.1.0" +edition = "2021" +publish = false + +[dependencies] +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } +sp1-lib = { path = "../../../../crates/zkvm/lib" } +sp1-derive = { path = "../../../../crates/derive" } diff --git a/tests/bls12381-mul/src/main.rs b/crates/test-artifacts/programs/bls12381-mul/src/main.rs similarity index 100% rename from tests/bls12381-mul/src/main.rs rename to crates/test-artifacts/programs/bls12381-mul/src/main.rs diff --git a/crates/test-artifacts/programs/bn254-add/Cargo.toml b/crates/test-artifacts/programs/bn254-add/Cargo.toml new file mode 100644 index 0000000000..78051d3f5a --- /dev/null +++ b/crates/test-artifacts/programs/bn254-add/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "bn254-add-test" +version = "1.1.0" +edition = "2021" +publish = false + +[dependencies] +common-test-utils = { path = "../common" } +sp1-lib = { path = "../../../../crates/zkvm/lib" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } +sp1-curves = { path = "../../../../crates/curves" } diff --git a/tests/bn254-add/src/main.rs b/crates/test-artifacts/programs/bn254-add/src/main.rs similarity index 100% rename from tests/bn254-add/src/main.rs rename to crates/test-artifacts/programs/bn254-add/src/main.rs diff --git a/tests/bn254-double/Cargo.toml b/crates/test-artifacts/programs/bn254-double/Cargo.toml similarity index 63% rename from tests/bn254-double/Cargo.toml rename to crates/test-artifacts/programs/bn254-double/Cargo.toml index 43b6de30b9..4f00539395 100644 --- a/tests/bn254-double/Cargo.toml +++ b/crates/test-artifacts/programs/bn254-double/Cargo.toml @@ -5,4 +5,4 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } diff --git a/tests/bn254-double/src/main.rs b/crates/test-artifacts/programs/bn254-double/src/main.rs similarity index 100% rename from tests/bn254-double/src/main.rs rename to crates/test-artifacts/programs/bn254-double/src/main.rs diff --git a/tests/bn254-fp/Cargo.toml b/crates/test-artifacts/programs/bn254-fp/Cargo.toml similarity index 69% rename from tests/bn254-fp/Cargo.toml rename to crates/test-artifacts/programs/bn254-fp/Cargo.toml index 9959fe0357..a2b789730c 100644 --- a/tests/bn254-fp/Cargo.toml +++ b/crates/test-artifacts/programs/bn254-fp/Cargo.toml @@ -6,6 +6,6 @@ publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } num-bigint = "0.4.6" rand = "0.8.5" diff --git a/tests/bn254-fp/src/main.rs b/crates/test-artifacts/programs/bn254-fp/src/main.rs similarity index 100% rename from tests/bn254-fp/src/main.rs rename to crates/test-artifacts/programs/bn254-fp/src/main.rs diff --git a/tests/bn254-fp2-addsub/Cargo.toml b/crates/test-artifacts/programs/bn254-fp2-addsub/Cargo.toml similarity index 71% rename from tests/bn254-fp2-addsub/Cargo.toml rename to crates/test-artifacts/programs/bn254-fp2-addsub/Cargo.toml index 3f1b8a399c..d6a8351978 100644 --- a/tests/bn254-fp2-addsub/Cargo.toml +++ b/crates/test-artifacts/programs/bn254-fp2-addsub/Cargo.toml @@ -6,6 +6,6 @@ publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } num-bigint = "0.4.6" rand = "0.8.5" diff --git a/tests/bn254-fp2-addsub/src/main.rs b/crates/test-artifacts/programs/bn254-fp2-addsub/src/main.rs similarity index 100% rename from tests/bn254-fp2-addsub/src/main.rs rename to crates/test-artifacts/programs/bn254-fp2-addsub/src/main.rs diff --git a/tests/bn254-fp2-mul/Cargo.toml b/crates/test-artifacts/programs/bn254-fp2-mul/Cargo.toml similarity index 70% rename from tests/bn254-fp2-mul/Cargo.toml rename to crates/test-artifacts/programs/bn254-fp2-mul/Cargo.toml index aa5d276fd7..41aba97a83 100644 --- a/tests/bn254-fp2-mul/Cargo.toml +++ b/crates/test-artifacts/programs/bn254-fp2-mul/Cargo.toml @@ -6,6 +6,6 @@ publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } num-bigint = "0.4.6" rand = "0.8.5" diff --git a/tests/bn254-fp2-mul/src/main.rs b/crates/test-artifacts/programs/bn254-fp2-mul/src/main.rs similarity index 100% rename from tests/bn254-fp2-mul/src/main.rs rename to crates/test-artifacts/programs/bn254-fp2-mul/src/main.rs diff --git a/crates/test-artifacts/programs/bn254-mul/Cargo.toml b/crates/test-artifacts/programs/bn254-mul/Cargo.toml new file mode 100644 index 0000000000..c9f5a74e66 --- /dev/null +++ b/crates/test-artifacts/programs/bn254-mul/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "bn254-mul-test" +version = "1.1.0" +edition = "2021" +publish = false + +[dependencies] +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } +sp1-lib = { path = "../../../../crates/zkvm/lib" } +sp1-derive = { path = "../../../../crates/derive" } diff --git a/tests/bn254-mul/src/main.rs b/crates/test-artifacts/programs/bn254-mul/src/main.rs similarity index 100% rename from tests/bn254-mul/src/main.rs rename to crates/test-artifacts/programs/bn254-mul/src/main.rs diff --git a/tests/common/Cargo.toml b/crates/test-artifacts/programs/common/Cargo.toml similarity index 70% rename from tests/common/Cargo.toml rename to crates/test-artifacts/programs/common/Cargo.toml index e320ad9f2b..11ecf9a146 100644 --- a/tests/common/Cargo.toml +++ b/crates/test-artifacts/programs/common/Cargo.toml @@ -5,5 +5,5 @@ edition = "2021" publish = false [dependencies] -sp1-lib = { path = "../../crates/zkvm/lib" } +sp1-lib = { path = "../../../../crates/zkvm/lib" } num-bigint = "0.4" diff --git a/tests/common/src/lib.rs b/crates/test-artifacts/programs/common/src/lib.rs similarity index 100% rename from tests/common/src/lib.rs rename to crates/test-artifacts/programs/common/src/lib.rs diff --git a/tests/common/src/weierstrass_add.rs b/crates/test-artifacts/programs/common/src/weierstrass_add.rs similarity index 100% rename from tests/common/src/weierstrass_add.rs rename to crates/test-artifacts/programs/common/src/weierstrass_add.rs diff --git a/crates/test-artifacts/programs/cycle-tracker/Cargo.toml b/crates/test-artifacts/programs/cycle-tracker/Cargo.toml new file mode 100644 index 0000000000..4b7d3ccc5b --- /dev/null +++ b/crates/test-artifacts/programs/cycle-tracker/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "cycle-tracker-test" +version = "1.1.0" +edition = "2021" +publish = false + +[dependencies] +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } +sp1-derive = { path = "../../../../crates/derive" } diff --git a/tests/cycle-tracker/src/main.rs b/crates/test-artifacts/programs/cycle-tracker/src/main.rs similarity index 100% rename from tests/cycle-tracker/src/main.rs rename to crates/test-artifacts/programs/cycle-tracker/src/main.rs diff --git a/tests/ed-add/Cargo.toml b/crates/test-artifacts/programs/ed-add/Cargo.toml similarity index 62% rename from tests/ed-add/Cargo.toml rename to crates/test-artifacts/programs/ed-add/Cargo.toml index 0beb43f4f6..18003aeebd 100644 --- a/tests/ed-add/Cargo.toml +++ b/crates/test-artifacts/programs/ed-add/Cargo.toml @@ -5,4 +5,4 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } diff --git a/tests/ed-add/src/main.rs b/crates/test-artifacts/programs/ed-add/src/main.rs similarity index 100% rename from tests/ed-add/src/main.rs rename to crates/test-artifacts/programs/ed-add/src/main.rs diff --git a/tests/ed-decompress/Cargo.toml b/crates/test-artifacts/programs/ed-decompress/Cargo.toml similarity index 68% rename from tests/ed-decompress/Cargo.toml rename to crates/test-artifacts/programs/ed-decompress/Cargo.toml index c6e0c436f7..38163b84d7 100644 --- a/tests/ed-decompress/Cargo.toml +++ b/crates/test-artifacts/programs/ed-decompress/Cargo.toml @@ -5,5 +5,5 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } hex-literal = "0.4.1" diff --git a/tests/ed-decompress/src/main.rs b/crates/test-artifacts/programs/ed-decompress/src/main.rs similarity index 100% rename from tests/ed-decompress/src/main.rs rename to crates/test-artifacts/programs/ed-decompress/src/main.rs diff --git a/tests/ed25519/Cargo.toml b/crates/test-artifacts/programs/ed25519/Cargo.toml similarity index 80% rename from tests/ed25519/Cargo.toml rename to crates/test-artifacts/programs/ed25519/Cargo.toml index 0c22ff9d2e..fe2a1d2821 100644 --- a/tests/ed25519/Cargo.toml +++ b/crates/test-artifacts/programs/ed25519/Cargo.toml @@ -5,6 +5,6 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } ed25519-dalek = { git = "https://github.com/sp1-patches/curve25519-dalek", branch = "patch-curve25519-v4.1.3" } hex-literal = "0.4.1" diff --git a/tests/ed25519/src/main.rs b/crates/test-artifacts/programs/ed25519/src/main.rs similarity index 100% rename from tests/ed25519/src/main.rs rename to crates/test-artifacts/programs/ed25519/src/main.rs diff --git a/tests/fibonacci/Cargo.toml b/crates/test-artifacts/programs/fibonacci/Cargo.toml similarity index 65% rename from tests/fibonacci/Cargo.toml rename to crates/test-artifacts/programs/fibonacci/Cargo.toml index 28f3f76e9f..c15bb2f381 100644 --- a/tests/fibonacci/Cargo.toml +++ b/crates/test-artifacts/programs/fibonacci/Cargo.toml @@ -5,4 +5,4 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } diff --git a/tests/fibonacci/src/main.rs b/crates/test-artifacts/programs/fibonacci/src/main.rs similarity index 100% rename from tests/fibonacci/src/main.rs rename to crates/test-artifacts/programs/fibonacci/src/main.rs diff --git a/tests/hint-io/Cargo.toml b/crates/test-artifacts/programs/hint-io/Cargo.toml similarity index 62% rename from tests/hint-io/Cargo.toml rename to crates/test-artifacts/programs/hint-io/Cargo.toml index 8f0a538469..ab21da2e7d 100644 --- a/tests/hint-io/Cargo.toml +++ b/crates/test-artifacts/programs/hint-io/Cargo.toml @@ -5,4 +5,4 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } diff --git a/tests/hint-io/src/main.rs b/crates/test-artifacts/programs/hint-io/src/main.rs similarity index 100% rename from tests/hint-io/src/main.rs rename to crates/test-artifacts/programs/hint-io/src/main.rs diff --git a/tests/keccak-permute/Cargo.toml b/crates/test-artifacts/programs/keccak-permute/Cargo.toml similarity index 64% rename from tests/keccak-permute/Cargo.toml rename to crates/test-artifacts/programs/keccak-permute/Cargo.toml index d47b917ddc..22f9baa875 100644 --- a/tests/keccak-permute/Cargo.toml +++ b/crates/test-artifacts/programs/keccak-permute/Cargo.toml @@ -5,4 +5,4 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } diff --git a/tests/keccak-permute/src/main.rs b/crates/test-artifacts/programs/keccak-permute/src/main.rs similarity index 100% rename from tests/keccak-permute/src/main.rs rename to crates/test-artifacts/programs/keccak-permute/src/main.rs diff --git a/tests/keccak256/Cargo.toml b/crates/test-artifacts/programs/keccak256/Cargo.toml similarity index 79% rename from tests/keccak256/Cargo.toml rename to crates/test-artifacts/programs/keccak256/Cargo.toml index c76b886d2f..5bbd18b60a 100644 --- a/tests/keccak256/Cargo.toml +++ b/crates/test-artifacts/programs/keccak256/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } tiny-keccak = { git = "https://github.com/sp1-patches/tiny-keccak", branch = "patch-v2.0.2", features = [ "keccak", ] } diff --git a/tests/keccak256/src/main.rs b/crates/test-artifacts/programs/keccak256/src/main.rs similarity index 100% rename from tests/keccak256/src/main.rs rename to crates/test-artifacts/programs/keccak256/src/main.rs diff --git a/tests/panic/Cargo.toml b/crates/test-artifacts/programs/panic/Cargo.toml similarity index 62% rename from tests/panic/Cargo.toml rename to crates/test-artifacts/programs/panic/Cargo.toml index 6b6fbb65f0..c8f0270dcf 100644 --- a/tests/panic/Cargo.toml +++ b/crates/test-artifacts/programs/panic/Cargo.toml @@ -5,4 +5,4 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } diff --git a/tests/panic/src/main.rs b/crates/test-artifacts/programs/panic/src/main.rs similarity index 100% rename from tests/panic/src/main.rs rename to crates/test-artifacts/programs/panic/src/main.rs diff --git a/tests/rand/Cargo.toml b/crates/test-artifacts/programs/rand/Cargo.toml similarity index 65% rename from tests/rand/Cargo.toml rename to crates/test-artifacts/programs/rand/Cargo.toml index fed3efb4cf..980392d94a 100644 --- a/tests/rand/Cargo.toml +++ b/crates/test-artifacts/programs/rand/Cargo.toml @@ -5,5 +5,5 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } rand = "0.8.5" diff --git a/tests/rand/src/main.rs b/crates/test-artifacts/programs/rand/src/main.rs similarity index 100% rename from tests/rand/src/main.rs rename to crates/test-artifacts/programs/rand/src/main.rs diff --git a/crates/test-artifacts/programs/secp256k1-add/Cargo.toml b/crates/test-artifacts/programs/secp256k1-add/Cargo.toml new file mode 100644 index 0000000000..f21057e88b --- /dev/null +++ b/crates/test-artifacts/programs/secp256k1-add/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "secp256k1-add-test" +version = "1.1.0" +edition = "2021" +publish = false + +[dependencies] +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } +sp1-lib = { path = "../../../../crates/zkvm/lib" } +sp1-curves = { path = "../../../../crates/curves" } +common-test-utils = { path = "../common" } diff --git a/tests/secp256k1-add/src/main.rs b/crates/test-artifacts/programs/secp256k1-add/src/main.rs similarity index 100% rename from tests/secp256k1-add/src/main.rs rename to crates/test-artifacts/programs/secp256k1-add/src/main.rs diff --git a/tests/secp256k1-decompress/Cargo.toml b/crates/test-artifacts/programs/secp256k1-decompress/Cargo.toml similarity index 65% rename from tests/secp256k1-decompress/Cargo.toml rename to crates/test-artifacts/programs/secp256k1-decompress/Cargo.toml index a803f47734..8f504400e7 100644 --- a/tests/secp256k1-decompress/Cargo.toml +++ b/crates/test-artifacts/programs/secp256k1-decompress/Cargo.toml @@ -5,4 +5,4 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } diff --git a/tests/secp256k1-decompress/src/main.rs b/crates/test-artifacts/programs/secp256k1-decompress/src/main.rs similarity index 100% rename from tests/secp256k1-decompress/src/main.rs rename to crates/test-artifacts/programs/secp256k1-decompress/src/main.rs diff --git a/tests/secp256k1-double/Cargo.toml b/crates/test-artifacts/programs/secp256k1-double/Cargo.toml similarity index 64% rename from tests/secp256k1-double/Cargo.toml rename to crates/test-artifacts/programs/secp256k1-double/Cargo.toml index 72f332f741..08979dd5f3 100644 --- a/tests/secp256k1-double/Cargo.toml +++ b/crates/test-artifacts/programs/secp256k1-double/Cargo.toml @@ -5,4 +5,4 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } diff --git a/tests/secp256k1-double/src/main.rs b/crates/test-artifacts/programs/secp256k1-double/src/main.rs similarity index 100% rename from tests/secp256k1-double/src/main.rs rename to crates/test-artifacts/programs/secp256k1-double/src/main.rs diff --git a/crates/test-artifacts/programs/secp256k1-mul/Cargo.toml b/crates/test-artifacts/programs/secp256k1-mul/Cargo.toml new file mode 100644 index 0000000000..4ed08c1f9b --- /dev/null +++ b/crates/test-artifacts/programs/secp256k1-mul/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "secp256k1-mul-test" +version = "1.1.0" +edition = "2021" +publish = false + +[dependencies] +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } +sp1-derive = { path = "../../../../crates/derive" } diff --git a/tests/secp256k1-mul/src/main.rs b/crates/test-artifacts/programs/secp256k1-mul/src/main.rs similarity index 100% rename from tests/secp256k1-mul/src/main.rs rename to crates/test-artifacts/programs/secp256k1-mul/src/main.rs diff --git a/tests/secp256r1-add/Cargo.toml b/crates/test-artifacts/programs/secp256r1-add/Cargo.toml similarity index 71% rename from tests/secp256r1-add/Cargo.toml rename to crates/test-artifacts/programs/secp256r1-add/Cargo.toml index aa89d51815..03926de266 100644 --- a/tests/secp256r1-add/Cargo.toml +++ b/crates/test-artifacts/programs/secp256r1-add/Cargo.toml @@ -5,9 +5,9 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } -sp1-lib = { path = "../../crates/zkvm/lib" } -sp1-curves = { path = "../../crates/curves" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } +sp1-lib = { path = "../../../../crates/zkvm/lib" } +sp1-curves = { path = "../../../../crates/curves" } common-test-utils = { path = "../common" } hex-literal = "0.4.1" num = { version = "0.4.1", default-features = false } diff --git a/tests/secp256r1-add/src/main.rs b/crates/test-artifacts/programs/secp256r1-add/src/main.rs similarity index 100% rename from tests/secp256r1-add/src/main.rs rename to crates/test-artifacts/programs/secp256r1-add/src/main.rs diff --git a/tests/secp256r1-decompress/Cargo.toml b/crates/test-artifacts/programs/secp256r1-decompress/Cargo.toml similarity index 65% rename from tests/secp256r1-decompress/Cargo.toml rename to crates/test-artifacts/programs/secp256r1-decompress/Cargo.toml index dd6984ced9..21bf76d699 100644 --- a/tests/secp256r1-decompress/Cargo.toml +++ b/crates/test-artifacts/programs/secp256r1-decompress/Cargo.toml @@ -5,4 +5,4 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } diff --git a/tests/secp256r1-decompress/src/main.rs b/crates/test-artifacts/programs/secp256r1-decompress/src/main.rs similarity index 100% rename from tests/secp256r1-decompress/src/main.rs rename to crates/test-artifacts/programs/secp256r1-decompress/src/main.rs diff --git a/tests/secp256r1-double/Cargo.toml b/crates/test-artifacts/programs/secp256r1-double/Cargo.toml similarity index 71% rename from tests/secp256r1-double/Cargo.toml rename to crates/test-artifacts/programs/secp256r1-double/Cargo.toml index 88c4299cad..9797ad1864 100644 --- a/tests/secp256r1-double/Cargo.toml +++ b/crates/test-artifacts/programs/secp256r1-double/Cargo.toml @@ -5,9 +5,9 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } -sp1-lib = { path = "../../crates/zkvm/lib" } -sp1-curves = { path = "../../crates/curves" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } +sp1-lib = { path = "../../../../crates/zkvm/lib" } +sp1-curves = { path = "../../../../crates/curves" } common-test-utils = { path = "../common" } hex-literal = "0.4.1" num = { version = "0.4.1", default-features = false } diff --git a/tests/secp256r1-double/src/main.rs b/crates/test-artifacts/programs/secp256r1-double/src/main.rs similarity index 100% rename from tests/secp256r1-double/src/main.rs rename to crates/test-artifacts/programs/secp256r1-double/src/main.rs diff --git a/tests/sha-compress/Cargo.toml b/crates/test-artifacts/programs/sha-compress/Cargo.toml similarity index 63% rename from tests/sha-compress/Cargo.toml rename to crates/test-artifacts/programs/sha-compress/Cargo.toml index c2c76a4411..2938af28b0 100644 --- a/tests/sha-compress/Cargo.toml +++ b/crates/test-artifacts/programs/sha-compress/Cargo.toml @@ -5,4 +5,4 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } diff --git a/tests/sha-compress/src/main.rs b/crates/test-artifacts/programs/sha-compress/src/main.rs similarity index 100% rename from tests/sha-compress/src/main.rs rename to crates/test-artifacts/programs/sha-compress/src/main.rs diff --git a/tests/sha-extend/Cargo.toml b/crates/test-artifacts/programs/sha-extend/Cargo.toml similarity index 63% rename from tests/sha-extend/Cargo.toml rename to crates/test-artifacts/programs/sha-extend/Cargo.toml index ddf51c1756..d5c383a16f 100644 --- a/tests/sha-extend/Cargo.toml +++ b/crates/test-artifacts/programs/sha-extend/Cargo.toml @@ -5,4 +5,4 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } diff --git a/tests/sha-extend/src/main.rs b/crates/test-artifacts/programs/sha-extend/src/main.rs similarity index 100% rename from tests/sha-extend/src/main.rs rename to crates/test-artifacts/programs/sha-extend/src/main.rs diff --git a/tests/sha2/Cargo.toml b/crates/test-artifacts/programs/sha2/Cargo.toml similarity index 77% rename from tests/sha2/Cargo.toml rename to crates/test-artifacts/programs/sha2/Cargo.toml index 88440b8c01..4cbde32cac 100644 --- a/tests/sha2/Cargo.toml +++ b/crates/test-artifacts/programs/sha2/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } hex-literal = "0.4.1" sha2 = { git = "https://github.com/succinctbot/RustCrypto-hashes.git" } hex = "0.4.3" diff --git a/tests/sha2/src/main.rs b/crates/test-artifacts/programs/sha2/src/main.rs similarity index 100% rename from tests/sha2/src/main.rs rename to crates/test-artifacts/programs/sha2/src/main.rs diff --git a/tests/tendermint-benchmark/Cargo.toml b/crates/test-artifacts/programs/tendermint-benchmark/Cargo.toml similarity index 88% rename from tests/tendermint-benchmark/Cargo.toml rename to crates/test-artifacts/programs/tendermint-benchmark/Cargo.toml index 38ea7f1b65..a8e89486cc 100644 --- a/tests/tendermint-benchmark/Cargo.toml +++ b/crates/test-artifacts/programs/tendermint-benchmark/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } serde_json = { workspace = true, default-features = false, features = ["alloc"] } serde = { workspace = true, default-features = false, features = ["derive"] } tendermint = { version = "0.34.0", default-features = false } diff --git a/tests/tendermint-benchmark/src/fixtures/1/next_validators.json b/crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/1/next_validators.json similarity index 100% rename from tests/tendermint-benchmark/src/fixtures/1/next_validators.json rename to crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/1/next_validators.json diff --git a/tests/tendermint-benchmark/src/fixtures/1/signed_header.json b/crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/1/signed_header.json similarity index 100% rename from tests/tendermint-benchmark/src/fixtures/1/signed_header.json rename to crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/1/signed_header.json diff --git a/tests/tendermint-benchmark/src/fixtures/1/validators.json b/crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/1/validators.json similarity index 100% rename from tests/tendermint-benchmark/src/fixtures/1/validators.json rename to crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/1/validators.json diff --git a/tests/tendermint-benchmark/src/fixtures/2/next_validators.json b/crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/2/next_validators.json similarity index 100% rename from tests/tendermint-benchmark/src/fixtures/2/next_validators.json rename to crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/2/next_validators.json diff --git a/tests/tendermint-benchmark/src/fixtures/2/signed_header.json b/crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/2/signed_header.json similarity index 100% rename from tests/tendermint-benchmark/src/fixtures/2/signed_header.json rename to crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/2/signed_header.json diff --git a/tests/tendermint-benchmark/src/fixtures/2/validators.json b/crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/2/validators.json similarity index 100% rename from tests/tendermint-benchmark/src/fixtures/2/validators.json rename to crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/2/validators.json diff --git a/tests/tendermint-benchmark/src/fixtures/small-1/next_validators.json b/crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/small-1/next_validators.json similarity index 100% rename from tests/tendermint-benchmark/src/fixtures/small-1/next_validators.json rename to crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/small-1/next_validators.json diff --git a/tests/tendermint-benchmark/src/fixtures/small-1/signed_header.json b/crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/small-1/signed_header.json similarity index 100% rename from tests/tendermint-benchmark/src/fixtures/small-1/signed_header.json rename to crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/small-1/signed_header.json diff --git a/tests/tendermint-benchmark/src/fixtures/small-1/validators.json b/crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/small-1/validators.json similarity index 100% rename from tests/tendermint-benchmark/src/fixtures/small-1/validators.json rename to crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/small-1/validators.json diff --git a/tests/tendermint-benchmark/src/fixtures/small-2/next_validators.json b/crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/small-2/next_validators.json similarity index 100% rename from tests/tendermint-benchmark/src/fixtures/small-2/next_validators.json rename to crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/small-2/next_validators.json diff --git a/tests/tendermint-benchmark/src/fixtures/small-2/signed_header.json b/crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/small-2/signed_header.json similarity index 100% rename from tests/tendermint-benchmark/src/fixtures/small-2/signed_header.json rename to crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/small-2/signed_header.json diff --git a/tests/tendermint-benchmark/src/fixtures/small-2/validators.json b/crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/small-2/validators.json similarity index 100% rename from tests/tendermint-benchmark/src/fixtures/small-2/validators.json rename to crates/test-artifacts/programs/tendermint-benchmark/src/fixtures/small-2/validators.json diff --git a/tests/tendermint-benchmark/src/main.rs b/crates/test-artifacts/programs/tendermint-benchmark/src/main.rs similarity index 100% rename from tests/tendermint-benchmark/src/main.rs rename to crates/test-artifacts/programs/tendermint-benchmark/src/main.rs diff --git a/tests/u256x2048-mul/Cargo.toml b/crates/test-artifacts/programs/u256x2048-mul/Cargo.toml similarity index 62% rename from tests/u256x2048-mul/Cargo.toml rename to crates/test-artifacts/programs/u256x2048-mul/Cargo.toml index 6e3be0d38d..cac74cafa8 100644 --- a/tests/u256x2048-mul/Cargo.toml +++ b/crates/test-artifacts/programs/u256x2048-mul/Cargo.toml @@ -5,8 +5,8 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } -sp1-derive = { path = "../../crates/derive" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } +sp1-derive = { path = "../../../../crates/derive" } num-bigint = "0.4.6" num = { version = "0.4.1" } rand = "0.8.5" diff --git a/tests/u256x2048-mul/src/main.rs b/crates/test-artifacts/programs/u256x2048-mul/src/main.rs similarity index 100% rename from tests/u256x2048-mul/src/main.rs rename to crates/test-artifacts/programs/u256x2048-mul/src/main.rs diff --git a/tests/uint256-arith/Cargo.toml b/crates/test-artifacts/programs/uint256-arith/Cargo.toml similarity index 55% rename from tests/uint256-arith/Cargo.toml rename to crates/test-artifacts/programs/uint256-arith/Cargo.toml index 8a3bd274d8..7ea91e234b 100644 --- a/tests/uint256-arith/Cargo.toml +++ b/crates/test-artifacts/programs/uint256-arith/Cargo.toml @@ -5,6 +5,6 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } -sp1-derive = { path = "../../crates/derive" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } +sp1-derive = { path = "../../../../crates/derive" } crypto-bigint = "0.6.0-pre.12" diff --git a/tests/uint256-arith/src/main.rs b/crates/test-artifacts/programs/uint256-arith/src/main.rs similarity index 100% rename from tests/uint256-arith/src/main.rs rename to crates/test-artifacts/programs/uint256-arith/src/main.rs diff --git a/tests/uint256-mul/Cargo.toml b/crates/test-artifacts/programs/uint256-mul/Cargo.toml similarity index 59% rename from tests/uint256-mul/Cargo.toml rename to crates/test-artifacts/programs/uint256-mul/Cargo.toml index 17a4e6b0ba..f867081005 100644 --- a/tests/uint256-mul/Cargo.toml +++ b/crates/test-artifacts/programs/uint256-mul/Cargo.toml @@ -7,6 +7,6 @@ publish = false [dependencies] rand = "0.8" num = { version = "0.4.1" } -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } -sp1-derive = { path = "../../crates/derive" } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint" } +sp1-derive = { path = "../../../../crates/derive" } bytemuck = "1.15.0" diff --git a/tests/uint256-mul/src/main.rs b/crates/test-artifacts/programs/uint256-mul/src/main.rs similarity index 100% rename from tests/uint256-mul/src/main.rs rename to crates/test-artifacts/programs/uint256-mul/src/main.rs diff --git a/tests/verify-proof/Cargo.toml b/crates/test-artifacts/programs/verify-proof/Cargo.toml similarity index 61% rename from tests/verify-proof/Cargo.toml rename to crates/test-artifacts/programs/verify-proof/Cargo.toml index 7551bd81f3..77c04e4664 100644 --- a/tests/verify-proof/Cargo.toml +++ b/crates/test-artifacts/programs/verify-proof/Cargo.toml @@ -5,6 +5,6 @@ edition = "2021" publish = false [dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint", features = ["verify"] } +sp1-zkvm = { path = "../../../../crates/zkvm/entrypoint", features = ["verify"] } hex = "0.4.3" sha2 = "0.10.8" diff --git a/tests/verify-proof/src/main.rs b/crates/test-artifacts/programs/verify-proof/src/main.rs similarity index 100% rename from tests/verify-proof/src/main.rs rename to crates/test-artifacts/programs/verify-proof/src/main.rs diff --git a/crates/test-artifacts/src/lib.rs b/crates/test-artifacts/src/lib.rs new file mode 100644 index 0000000000..8707526193 --- /dev/null +++ b/crates/test-artifacts/src/lib.rs @@ -0,0 +1,79 @@ +#![warn(clippy::pedantic)] + +//! This crate goal is to compile all programs in the `programs` folders to ELFs files, +//! and give an easy access to these ELFs from other crates, using the constants below. +//! +//! **Note:** If you added a new program, don't forget to add it to the workspace in the +//! `programs` folder to have if compiled to an ELF file. + +use sp1_build::include_elf; + +pub const FIBONACCI_ELF: &[u8] = include_elf!("fibonacci-program-tests"); + +pub const ED25519_ELF: &[u8] = include_elf!("ed25519-program"); + +pub const CYCLE_TRACKER_ELF: &[u8] = include_elf!("cycle-tracker-test"); + +pub const ED_ADD_ELF: &[u8] = include_elf!("ed-add-test"); + +pub const ED_DECOMPRESS_ELF: &[u8] = include_elf!("ed-decompress-test"); + +pub const KECCAK_PERMUTE_ELF: &[u8] = include_elf!("keccak-permute-test"); + +pub const KECCAK256_ELF: &[u8] = include_elf!("keccak256-test"); + +pub const SECP256K1_ADD_ELF: &[u8] = include_elf!("secp256k1-add-test"); + +pub const SECP256K1_DECOMPRESS_ELF: &[u8] = include_elf!("secp256k1-decompress-test"); + +pub const SECP256K1_DOUBLE_ELF: &[u8] = include_elf!("secp256k1-double-test"); + +pub const SECP256R1_ADD_ELF: &[u8] = include_elf!("secp256r1-add-test"); + +pub const SECP256R1_DECOMPRESS_ELF: &[u8] = include_elf!("secp256r1-decompress-test"); + +pub const SECP256R1_DOUBLE_ELF: &[u8] = include_elf!("secp256r1-double-test"); + +pub const SHA_COMPRESS_ELF: &[u8] = include_elf!("sha-compress-test"); + +pub const SHA_EXTEND_ELF: &[u8] = include_elf!("sha-extend-test"); + +pub const SHA2_ELF: &[u8] = include_elf!("sha2-test"); + +pub const BN254_ADD_ELF: &[u8] = include_elf!("bn254-add-test"); + +pub const BN254_DOUBLE_ELF: &[u8] = include_elf!("bn254-double-test"); + +pub const BN254_MUL_ELF: &[u8] = include_elf!("bn254-mul-test"); + +pub const SECP256K1_MUL_ELF: &[u8] = include_elf!("secp256k1-mul-test"); + +pub const BLS12381_ADD_ELF: &[u8] = include_elf!("bls12381-add-test"); + +pub const BLS12381_DOUBLE_ELF: &[u8] = include_elf!("bls12381-double-test"); + +pub const BLS12381_MUL_ELF: &[u8] = include_elf!("bls12381-mul-test"); + +pub const UINT256_MUL_ELF: &[u8] = include_elf!("biguint-mul-test"); + +pub const BLS12381_DECOMPRESS_ELF: &[u8] = include_elf!("bls-decompress-test"); + +pub const VERIFY_PROOF_ELF: &[u8] = include_elf!("verify-proof"); + +pub const PANIC_ELF: &[u8] = include_elf!("panic-test"); + +pub const BLS12381_FP_ELF: &[u8] = include_elf!("bls12381-fp-test"); + +pub const BLS12381_FP2_MUL_ELF: &[u8] = include_elf!("bls12381-fp2-mul-test"); + +pub const BLS12381_FP2_ADDSUB_ELF: &[u8] = include_elf!("bls12381-fp2-addsub-test"); + +pub const BN254_FP_ELF: &[u8] = include_elf!("bn254-fp-test"); + +pub const BN254_FP2_ADDSUB_ELF: &[u8] = include_elf!("bn254-fp2-addsub-test"); + +pub const BN254_FP2_MUL_ELF: &[u8] = include_elf!("bn254-fp2-mul-test"); + +pub const TENDERMINT_BENCHMARK_ELF: &[u8] = include_elf!("tendermint-benchmark-program"); + +pub const U256XU2048_MUL_ELF: &[u8] = include_elf!("u256x2048-mul"); diff --git a/examples/Cargo.lock b/examples/Cargo.lock index 9acc219708..53dd96cfd5 100644 --- a/examples/Cargo.lock +++ b/examples/Cargo.lock @@ -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]] @@ -4891,7 +4891,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]] @@ -6036,6 +6036,7 @@ dependencies = [ "reqwest", "reqwest-middleware", "serde", + "sp1-build", "sp1-core-executor", "sp1-core-machine", "sp1-cuda", @@ -6091,7 +6092,7 @@ 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)", + "substrate-bn-succinct", "thiserror-no-std", ] @@ -6258,9 +6259,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", diff --git a/examples/aggregation/program/elf/riscv32im-succinct-zkvm-elf b/examples/aggregation/program/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index a2da621a86..0000000000 Binary files a/examples/aggregation/program/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/examples/bls12381/program/elf/riscv32im-succinct-zkvm-elf b/examples/bls12381/program/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 6c65387fea..0000000000 Binary files a/examples/bls12381/program/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/examples/bn254/program/elf/riscv32im-succinct-zkvm-elf b/examples/bn254/program/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 0c62975fc4..0000000000 Binary files a/examples/bn254/program/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/examples/chess/program/elf/riscv32im-succinct-zkvm-elf b/examples/chess/program/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 2894eb1b33..0000000000 Binary files a/examples/chess/program/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/examples/cycle-tracking/program/elf/normal b/examples/cycle-tracking/program/elf/normal deleted file mode 100755 index db1fa3549c..0000000000 Binary files a/examples/cycle-tracking/program/elf/normal and /dev/null differ diff --git a/examples/cycle-tracking/program/elf/report b/examples/cycle-tracking/program/elf/report deleted file mode 100755 index 400f358765..0000000000 Binary files a/examples/cycle-tracking/program/elf/report and /dev/null differ diff --git a/examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf b/examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index c82f73b866..0000000000 Binary files a/examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/examples/fibonacci/script/bin/compressed.rs b/examples/fibonacci/script/bin/compressed.rs index 9cf4a50d79..9261d092f8 100644 --- a/examples/fibonacci/script/bin/compressed.rs +++ b/examples/fibonacci/script/bin/compressed.rs @@ -1,7 +1,7 @@ -use sp1_sdk::{utils, ProverClient, SP1Stdin}; +use sp1_sdk::{include_elf, utils, ProverClient, SP1Stdin}; /// The ELF we want to execute inside the zkVM. -const ELF: &[u8] = include_bytes!("../../program/elf/riscv32im-succinct-zkvm-elf"); +const ELF: &[u8] = include_elf!("fibonacci-program"); fn main() { // Setup logging. diff --git a/examples/fibonacci/script/bin/execute.rs b/examples/fibonacci/script/bin/execute.rs index 02b27994ba..5cf1efe1b2 100644 --- a/examples/fibonacci/script/bin/execute.rs +++ b/examples/fibonacci/script/bin/execute.rs @@ -1,7 +1,7 @@ -use sp1_sdk::{utils, ProverClient, SP1Stdin}; +use sp1_sdk::{include_elf, utils, ProverClient, SP1Stdin}; /// The ELF we want to execute inside the zkVM. -const ELF: &[u8] = include_bytes!("../../program/elf/riscv32im-succinct-zkvm-elf"); +const ELF: &[u8] = include_elf!("fibonacci-program"); fn main() { // Setup logging. diff --git a/examples/fibonacci/script/bin/groth16_bn254.rs b/examples/fibonacci/script/bin/groth16_bn254.rs index 3b4aae3cbd..06d5b0b95f 100644 --- a/examples/fibonacci/script/bin/groth16_bn254.rs +++ b/examples/fibonacci/script/bin/groth16_bn254.rs @@ -1,7 +1,7 @@ -use sp1_sdk::{utils, HashableKey, ProverClient, SP1Stdin}; +use sp1_sdk::{include_elf, utils, HashableKey, ProverClient, SP1Stdin}; /// The ELF we want to execute inside the zkVM. -const ELF: &[u8] = include_bytes!("../../program/elf/riscv32im-succinct-zkvm-elf"); +const ELF: &[u8] = include_elf!("fibonacci-program"); fn main() { // Setup logging. diff --git a/examples/fibonacci/script/bin/plonk_bn254.rs b/examples/fibonacci/script/bin/plonk_bn254.rs index f9dd90569f..8759293316 100644 --- a/examples/fibonacci/script/bin/plonk_bn254.rs +++ b/examples/fibonacci/script/bin/plonk_bn254.rs @@ -1,7 +1,7 @@ -use sp1_sdk::{utils, HashableKey, ProverClient, SP1Stdin}; +use sp1_sdk::{include_elf, utils, HashableKey, ProverClient, SP1Stdin}; /// The ELF we want to execute inside the zkVM. -const ELF: &[u8] = include_bytes!("../../program/elf/riscv32im-succinct-zkvm-elf"); +const ELF: &[u8] = include_elf!("fibonacci-program"); fn main() { // Setup logging. diff --git a/examples/io/program/elf/riscv32im-succinct-zkvm-elf b/examples/io/program/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 597cbb8d5e..0000000000 Binary files a/examples/io/program/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/examples/is-prime/program/elf/riscv32im-succinct-zkvm-elf b/examples/is-prime/program/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 8185dc3dff..0000000000 Binary files a/examples/is-prime/program/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/examples/json/program/elf/riscv32im-curta-zkvm-elf b/examples/json/program/elf/riscv32im-curta-zkvm-elf deleted file mode 100755 index 396eaeaf25..0000000000 Binary files a/examples/json/program/elf/riscv32im-curta-zkvm-elf and /dev/null differ diff --git a/examples/json/program/elf/riscv32im-succinct-zkvm-elf b/examples/json/program/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 74f4004c86..0000000000 Binary files a/examples/json/program/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/examples/patch-testing/program/elf/riscv32im-succinct-zkvm-elf b/examples/patch-testing/program/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 7dea910adf..0000000000 Binary files a/examples/patch-testing/program/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/examples/regex/program/elf/riscv32im-succinct-zkvm-elf b/examples/regex/program/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index d514b22b0e..0000000000 Binary files a/examples/regex/program/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/examples/riscv32im-succinct-zkvm-elf b/examples/riscv32im-succinct-zkvm-elf deleted file mode 100755 index b100efdd3f..0000000000 Binary files a/examples/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/examples/rsa/program/elf/riscv32im-succinct-zkvm-elf b/examples/rsa/program/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index d50cf9dff3..0000000000 Binary files a/examples/rsa/program/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/examples/rsp/program/elf/riscv32im-succinct-zkvm-elf b/examples/rsp/program/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 6c43fe0065..0000000000 Binary files a/examples/rsp/program/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/examples/ssz-withdrawals/program/elf/riscv32im-succinct-zkvm-elf b/examples/ssz-withdrawals/program/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index ebd2cdcdc1..0000000000 Binary files a/examples/ssz-withdrawals/program/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/examples/tendermint/program/elf/riscv32im-succinct-zkvm-elf b/examples/tendermint/program/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 371681cd5c..0000000000 Binary files a/examples/tendermint/program/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/bls12381-add/Cargo.toml b/tests/bls12381-add/Cargo.toml deleted file mode 100644 index 4f7134660a..0000000000 --- a/tests/bls12381-add/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "bls12381-add-test" -version = "1.1.0" -edition = "2021" -publish = false - -[dependencies] -common-test-utils = { path = "../common" } -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } -sp1-lib = { path = "../../crates/zkvm/lib" } -sp1-curves = { path = "../../crates/curves" } diff --git a/tests/bls12381-add/elf/riscv32im-succinct-zkvm-elf b/tests/bls12381-add/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index bba115ef9d..0000000000 Binary files a/tests/bls12381-add/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/bls12381-decompress/elf/riscv32im-succinct-zkvm-elf b/tests/bls12381-decompress/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 03acdb46c2..0000000000 Binary files a/tests/bls12381-decompress/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/bls12381-double/elf/riscv32im-succinct-zkvm-elf b/tests/bls12381-double/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index b8da0c0c5e..0000000000 Binary files a/tests/bls12381-double/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/bls12381-fp/elf/riscv32im-succinct-zkvm-elf b/tests/bls12381-fp/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index ae3399e676..0000000000 Binary files a/tests/bls12381-fp/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/bls12381-fp2-addsub/elf/riscv32im-succinct-zkvm-elf b/tests/bls12381-fp2-addsub/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 31c4ed4d21..0000000000 Binary files a/tests/bls12381-fp2-addsub/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/bls12381-fp2-mul/elf/riscv32im-succinct-zkvm-elf b/tests/bls12381-fp2-mul/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index ada874cdb8..0000000000 Binary files a/tests/bls12381-fp2-mul/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/bls12381-mul/Cargo.toml b/tests/bls12381-mul/Cargo.toml deleted file mode 100644 index 6ebaf41bd7..0000000000 --- a/tests/bls12381-mul/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "bls12381-mul-test" -version = "1.1.0" -edition = "2021" -publish = false - -[dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } -sp1-lib = { path = "../../crates/zkvm/lib" } -sp1-derive = { path = "../../crates/derive" } diff --git a/tests/bls12381-mul/elf/riscv32im-succinct-zkvm-elf b/tests/bls12381-mul/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 10056efc39..0000000000 Binary files a/tests/bls12381-mul/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/bn254-add/Cargo.toml b/tests/bn254-add/Cargo.toml deleted file mode 100644 index e22a7cf7fa..0000000000 --- a/tests/bn254-add/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "bn254-add-test" -version = "1.1.0" -edition = "2021" -publish = false - -[dependencies] -common-test-utils = { path = "../common" } -sp1-lib = { path = "../../crates/zkvm/lib" } -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } -sp1-curves = { path = "../../crates/curves" } diff --git a/tests/bn254-add/elf/riscv32im-succinct-zkvm-elf b/tests/bn254-add/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 4197f5e570..0000000000 Binary files a/tests/bn254-add/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/bn254-double/elf/riscv32im-succinct-zkvm-elf b/tests/bn254-double/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index d8ce2e4945..0000000000 Binary files a/tests/bn254-double/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/bn254-fp/elf/riscv32im-succinct-zkvm-elf b/tests/bn254-fp/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 157b571756..0000000000 Binary files a/tests/bn254-fp/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/bn254-fp2-addsub/elf/riscv32im-succinct-zkvm-elf b/tests/bn254-fp2-addsub/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 254f1e5338..0000000000 Binary files a/tests/bn254-fp2-addsub/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/bn254-fp2-mul/elf/riscv32im-succinct-zkvm-elf b/tests/bn254-fp2-mul/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 7f9ce49898..0000000000 Binary files a/tests/bn254-fp2-mul/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/bn254-mul/Cargo.toml b/tests/bn254-mul/Cargo.toml deleted file mode 100644 index 7853b90a68..0000000000 --- a/tests/bn254-mul/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "bn254-mul-test" -version = "1.1.0" -edition = "2021" -publish = false - -[dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } -sp1-lib = { path = "../../crates/zkvm/lib" } -sp1-derive = { path = "../../crates/derive" } diff --git a/tests/bn254-mul/elf/riscv32im-succinct-zkvm-elf b/tests/bn254-mul/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 0826d5be1e..0000000000 Binary files a/tests/bn254-mul/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/cycle-tracker/Cargo.toml b/tests/cycle-tracker/Cargo.toml deleted file mode 100644 index 577625885e..0000000000 --- a/tests/cycle-tracker/Cargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "cycle-tracker-test" -version = "1.1.0" -edition = "2021" -publish = false - -[dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } -sp1-derive = { path = "../../crates/derive" } diff --git a/tests/cycle-tracker/elf/riscv32im-succinct-zkvm-elf b/tests/cycle-tracker/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index d24493ae78..0000000000 Binary files a/tests/cycle-tracker/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/ed-add/elf/riscv32im-succinct-zkvm-elf b/tests/ed-add/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index ba53a59d77..0000000000 Binary files a/tests/ed-add/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/ed-decompress/elf/riscv32im-succinct-zkvm-elf b/tests/ed-decompress/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 817545c74d..0000000000 Binary files a/tests/ed-decompress/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/ed25519/elf/riscv32im-succinct-zkvm-elf b/tests/ed25519/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 8d569ec367..0000000000 Binary files a/tests/ed25519/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/fibonacci/elf/riscv32im-succinct-zkvm-elf b/tests/fibonacci/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 148ae8d903..0000000000 Binary files a/tests/fibonacci/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/hint-io/elf/riscv32im-succinct-zkvm-elf b/tests/hint-io/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 08e72217e3..0000000000 Binary files a/tests/hint-io/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/keccak-permute/elf/riscv32im-succinct-zkvm-elf b/tests/keccak-permute/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 3d5bc8f27b..0000000000 Binary files a/tests/keccak-permute/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/keccak256/elf/riscv32im-succinct-zkvm-elf b/tests/keccak256/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index e2ce61eedf..0000000000 Binary files a/tests/keccak256/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/panic/elf/riscv32im-succinct-zkvm-elf b/tests/panic/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 9b4339532b..0000000000 Binary files a/tests/panic/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/rand/elf/riscv32im-succinct-zkvm-elf b/tests/rand/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 486f5f4649..0000000000 Binary files a/tests/rand/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/secp256k1-add/Cargo.toml b/tests/secp256k1-add/Cargo.toml deleted file mode 100644 index 8133e8ea20..0000000000 --- a/tests/secp256k1-add/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "secp256k1-add-test" -version = "1.1.0" -edition = "2021" -publish = false - -[dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } -sp1-lib = { path = "../../crates/zkvm/lib" } -sp1-curves = { path = "../../crates/curves" } -common-test-utils = { path = "../common" } diff --git a/tests/secp256k1-add/elf/riscv32im-succinct-zkvm-elf b/tests/secp256k1-add/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index f05f5721be..0000000000 Binary files a/tests/secp256k1-add/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/secp256k1-decompress/elf/riscv32im-succinct-zkvm-elf b/tests/secp256k1-decompress/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 679964c0a6..0000000000 Binary files a/tests/secp256k1-decompress/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/secp256k1-double/elf/riscv32im-succinct-zkvm-elf b/tests/secp256k1-double/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 039a7c443a..0000000000 Binary files a/tests/secp256k1-double/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/secp256k1-mul/Cargo.toml b/tests/secp256k1-mul/Cargo.toml deleted file mode 100644 index 052c9f3d06..0000000000 --- a/tests/secp256k1-mul/Cargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "secp256k1-mul-test" -version = "1.1.0" -edition = "2021" -publish = false - -[dependencies] -sp1-zkvm = { path = "../../crates/zkvm/entrypoint" } -sp1-derive = { path = "../../crates/derive" } diff --git a/tests/secp256k1-mul/elf/riscv32im-succinct-zkvm-elf b/tests/secp256k1-mul/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index d407481757..0000000000 Binary files a/tests/secp256k1-mul/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/secp256r1-add/elf/riscv32im-succinct-zkvm-elf b/tests/secp256r1-add/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 7819093a3a..0000000000 Binary files a/tests/secp256r1-add/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/secp256r1-decompress/elf/riscv32im-succinct-zkvm-elf b/tests/secp256r1-decompress/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index d30ed5c96c..0000000000 Binary files a/tests/secp256r1-decompress/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/secp256r1-double/elf/riscv32im-succinct-zkvm-elf b/tests/secp256r1-double/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 0b3b6c6aa9..0000000000 Binary files a/tests/secp256r1-double/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/sha-compress/elf/riscv32im-succinct-zkvm-elf b/tests/sha-compress/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index caa4b8d7fc..0000000000 Binary files a/tests/sha-compress/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/sha-extend/elf/riscv32im-succinct-zkvm-elf b/tests/sha-extend/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 1f4b0f2854..0000000000 Binary files a/tests/sha-extend/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/sha2/elf/riscv32im-succinct-zkvm-elf b/tests/sha2/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index b8bcf3e71e..0000000000 Binary files a/tests/sha2/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/tendermint-benchmark/elf/riscv32im-succinct-zkvm-elf b/tests/tendermint-benchmark/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 9e70028015..0000000000 Binary files a/tests/tendermint-benchmark/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/u256x2048-mul/elf/riscv32im-succinct-zkvm-elf b/tests/u256x2048-mul/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 61b43e52e6..0000000000 Binary files a/tests/u256x2048-mul/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/uint256-arith/elf/riscv32im-succinct-zkvm-elf b/tests/uint256-arith/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 5f6f1e3e22..0000000000 Binary files a/tests/uint256-arith/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/uint256-mul/elf/riscv32im-succinct-zkvm-elf b/tests/uint256-mul/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index 886b86c07d..0000000000 Binary files a/tests/uint256-mul/elf/riscv32im-succinct-zkvm-elf and /dev/null differ diff --git a/tests/verify-proof/elf/riscv32im-succinct-zkvm-elf b/tests/verify-proof/elf/riscv32im-succinct-zkvm-elf deleted file mode 100755 index e982b30951..0000000000 Binary files a/tests/verify-proof/elf/riscv32im-succinct-zkvm-elf and /dev/null differ