Git Product home page Git Product logo

sp1's Introduction

SP1

Telegram Chat

SP1 is a performant, 100% open-source, contributor-friendly zero-knowledge virtual machine (zkVM) that can prove the execution of arbitrary Rust (or any LLVM-compiled language) programs. SP1 democratizes access to ZKPs by allowing developers to use programmable truth with popular programming languages.

SP1 is inspired by the open-source software movement and takes a collaborative approach towards building the best zkVM for rollups, coprocessors and other ZKP applications. We envision a diversity of contributors integrating the latest ZK innovations, creating a zkVM that is performant, customizable and will stand the test of time.

Install | Docs | Examples

For Developers: Build with SP1

Note that SP1 is still in alpha and is not yet ready for production use.

Today, developers can write programs, including complex, large programs like a ZK Tendermint light client, in Rust (with std support), generate proofs and verify them. Most Rust crates should be supported and can be used seamlessly by your program. Example programs can be found in the examples folder.

To get started, make sure you have Rust installed. Then follow the installation guide in the SP1 book and read the getting started section.

For developers looking for inspiration on what to build, check out the open issues with the showcase label to see what sorts of programs that showcase the capabilities of SP1 are interesting to hack on.

For Contributors

Open-source is a core part of SP1's ethos and key to its advantages. We wish to cultivate a vibrant community of open-source contributors that span individuals, teams and geographies. If you want to contribute, or follow along with contributor discussion, you can use our main Telegram to chat with us. Our contributor guidelines can be found in CONTRIBUTING.md.

Find a list of good first issues in the open issues of this repo. We are always looking for contributors interested in tasks big and small, including minor chores across the codebase, optimizing performance, adding precompiles for commonly used cryptographic operations, adding documentation, creating new example programs and more. Please reach out in the Telegram chat if interested!

Roadmap

Today, SP1 can generate and verify proofs for Rust programs that have been compiled to RISC-V. SP1 supports proving of programs of arbitrary length by using a unique "shared challenges" argument that allows the prover to shard a long computation into small shards, and then generate a global proof that these shards are properly connected together.

The main priorities in the next few months are performance optimizations, getting the core zkVM constraint logic audited, as well as wrapping the SP1 STARK proof into a SNARK proof that is cheaply verifiable in the EVM (by adapting similar previous work done by the Succinct Team).

Acknowledgements

We would like to acknowledge the projects below whose previous work has been instrumental in making this project a reality:

  • Plonky3: The SP1's prover is powered by the Plonky3 toolkit.
  • Valida: The SP1 cross-table lookup architecture, prover, borrow macro, and chip design are inspired by Valida.
  • RISC0: The SP1 Rust toolchain and install/build scripts for the toolchain borrow code from RISC0.

Tips

We recommend you install the rust-analyzer extension. Note that if you use cargo prove new inside a monorepo, you will need to add the manifest file to rust-analyzer.linkedProjects to get full IDE support.

sp1's People

Contributors

0xkanekiken avatar brozorec avatar ceciliaz030 avatar chiefbiiko avatar corddry avatar ctian1 avatar delehef avatar divide-by-0 avatar dlubarov avatar dr-frmr avatar dynm avatar dyxushuai avatar gskapka avatar hidenori-shinohara avatar i-m-aditya avatar jtguibas avatar kayleegeorge avatar kevjue avatar mattstam avatar mvid avatar preston-evans98 avatar puma314 avatar qiweiii avatar ratankaliani avatar rkdud007 avatar sinasab avatar sladuca avatar spartucus avatar standstaff avatar tamirhemo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sp1's Issues

Cannot compile `ring` crate

The ring crate fails to compile with sp1.

The ring crate appears to be heavily depended on by a lot of crypto libraries, including Helios which is referenced in issue #229.

The ring crate specifically says (here) to:

# Avoid putting the Android tools in `$PATH`

However spi1 itself does so with its own set of android cmdline tools.

Reproduce:

cargo prove new test && \
cd test/program && \
cargo add ring && \
cargo prove build

[feat] Please use different features to use different code

When I try to compile sp1's verifier into wasm, I get a bunch of the same errors. This error is caused by sp1 relying on the reqwest network library, as the mio crate is under the reqwest crate in output of cargo tree.

error[E0599]: no method named `reregister` found for struct `IoSource<std::net::UdpSocket>` in the current scope
   --> /Users/flyq/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/net/udp.rs:631:20
    |
631 |         self.inner.reregister(registry, token, interests)
    |                    ^^^^^^^^^^ method not found in `IoSource<UdpSocket>`
    |
   ::: /Users/flyq/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/io_source.rs:62:1
    |
62  | pub struct IoSource<T> {
    | ---------------------- method `reregister` not found for this struct
    |
    = help: items from traits can only be used if the trait is implemented and in scope
note: `Source` defines an item `reregister`, perhaps you need to implement it
   --> /Users/flyq/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/source.rs:75:1
    |
75  | pub trait Source {
    | ^^^^^^^^^^^^^^^^

   Compiling typenum v1.17.0
   Compiling serde_json v1.0.116

Refer to rics0, which also relies on the reqwest network library, but the reqwest is only used under the dep:bonsai-sdk feature:

[features]
client = [
  "dep:bincode",
  "dep:bonsai-sdk",
  "dep:bytes",
  "dep:prost",
  "dep:prost-build",
  "dep:protobuf-src",
  "dep:tempfile",
  "std",
]

https://github.com/risc0/risc0/blob/c809f313d9ac84927c5fc683fe12f01c777fecf7/risc0/zkvm/Cargo.toml#L106-L115
So, when I use like this, it can compile to wasm:

risc0-zkvm = { version = "0.21.0", default-features = false, features = ["std"] }

Add `ignore-rust-version` flag to `sp1-helper`

Add ignore-rust-version flag compatibility to sp1-helper. When crates such as alloy require a Rust version greater than the Succinct Rust toolchain's version, we need to run cargo prove build --ignore-rust-version.

However, sp1-helper does not have compatibility for this, so developers need to manually run cargo prove build --ignore-rust-version to get their programs to compile.

Specifically, optionally configure a flag to be added to this command:

sp1/helper/src/lib.rs

Lines 64 to 70 in e413e82

let mut cmd = Command::new("cargo");
cmd.current_dir(program_dir)
.args(["prove", "build"])
.env("CARGO_MANIFEST_DIR", program_dir.as_ref())
.env_remove("RUSTC")
.stdout(Stdio::piped())
.stderr(Stdio::piped());

Showcase Request: Optimized Tendermint ZK Light Client

Right now, the Tendermint example program verifies all signatures in a block. However, it's performance can significantly improved by early exiting from the verification of signatures once enough of the stake weight has been verified (2/3).

This would involve modifying the Tendermint-rs library to early exit and also creating a utility method for retrieving the signatures from top-validators by stake weight.

Has anyone able to successfully run it on MacOS?

Issue

sp1up: installing sp1 (version nightly, tag nightly)
sp1up: downloading latest cargo-prove
curl: (7) Failed to connect to pub-e4d9616fb885415597ff4c4d2b476ffb.r2.dev port 443: Connection refused

sp1up: command failed: download https://pub-e4d9616fb885415597ff4c4d2b476ffb.r2.dev/cargo_prove_nightly_darwin_amd64.tar.gz

env

macOS ventura 13.0.1

steps taken

tried with both option for installation but no luck.
tried brew update, reinstall [email protected], rebooting etc

Proof format

What exactly is the format of the data field in the json proof file generated after creating a proof?

I would like to be able to extract values. My assumption was that it looks like a Vec, which should be decoded with String::from_utf8() but I do not have any luck with this.

A pointer on what to do or some documentation about the proof structure would super helpful if this exists, I could not find it on the page.

Outdated call to `Perm::new`

It seems that this prove.rs has not been updated to take this commit in Plonky3 (which updates the Perm::new function with a external_constants: Vec<[F; WIDTH]> argument) into account.

error[E0061]: this function takes 5 arguments but 4 arguments were supplied
   --> [myhome]/.cargo/git/checkouts/sp1-20c98843a1ffc860/08f5a8e/core/src/utils/prove.rs:423:24
    |
423 |             let perm = Perm::new(8, 22, RC_16_30.to_vec(), DiffusionMatrixBabybear);
    |                        ^^^^^^^^^    --  -----------------  ----------------------- an argument of type `Vec<BabyBear>` is missing
    |                                     |   |
    |                                     |   expected `usize`, found `Vec<[BabyBear; 16]>`
    |                                     expected `Vec<[BabyBear; 16]>`, found `{integer}`
    |
note: associated function defined here
   --> /Users/franklin/.cargo/git/checkouts/plonky3-2a8c63bcd5ef83b0/7e4f7af/poseidon2/src/lib.rs:48:12
    |
48  |     pub fn new(
    |            ^^^
help: did you mean
    |
423 |             let perm = Perm::new(8, RC_16_30.to_vec(), 22, /* Vec<BabyBear> */, DiffusionMatrixBabybear);
    |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

`reth-primitives` patched crates incompatible with `sp1-sdk`

Currently, the following Cargo.toml fails to build

[workspace]
[package]
version = "0.1.0"
name = "my-package"
edition = "2021"

[dependencies]
reth-primitives = { git = "https://github.com/sp1-patches/reth", default-features = false, branch = "sp1-reth" }
sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git" }

with error

error: failed to select a version for c-kzg.
    ... required by package revm-primitives v2.0.0 (https://github.com/sp1-patches/revm.git?branch=patch-v5.0.0#c993e0d6)
    ... which satisfies git dependency revm-primitives of package reth-primitives v0.1.0-alpha.18 (https://github.com/sp1-patches/reth?branch=sp1-reth#3b31e8b3)
    ... which satisfies git dependency reth-primitives of package invariant-proof-script v0.1.0 (/Users/plaferriere/code/invariant-proof/script)
versions that meet the requirements ^0.4.1 are: 0.4.2, 0.4.1
the package c-kzg links to the native library ckzg, but it conflicts with a previous package which links to ckzg as well:
package c-kzg v1.0.0
    ... which satisfies dependency c-kzg = "^1.0" of package alloy-eips v0.1.0 (https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda4)
    ... which satisfies git dependency alloy-eips of package alloy v0.1.0 (https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda4)
    ... which satisfies git dependency alloy of package sp1-sdk v0.1.0 (https://github.com/succinctlabs/sp1.git#12c841b2)
    ... which satisfies git dependency sp1-sdk of package invariant-proof-script v0.1.0 (/Users/plaferriere/code/invariant-proof/script)
Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the links = "ckzg" value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.
failed to select a version for c-kzg which could resolve this conflict

Showcase Request: Linear Regression

It would be cool to make a showcase of how SP1 can be used for applications involving data analysis & machine learning. This can be useful for on-chain protocols that want to estimate protocol parameters (such as liquidation thresholds), using statistical methods.

You can look at the linreg crate for how you could use it inside SP1.

ring crate does not compile

Currently, the ring crate does not compile due to it having a C-based dependency.

cargo prove build
   Compiling ring v0.17.8
   Compiling sp1-precompiles v0.1.0 (https://github.com/succinctlabs/sp1.git#09570ab1)
The following warnings were emitted during compilation:

warning: [email protected]: error: unknown target triple 'riscv32im-succinct-zkvm-elf', please use -triple or -arch

error: failed to run custom build command for `ring v0.17.8

Generating ed25519 example proof failed with OOM even set SAVE_DISK_THRESHOLD = 1

Os info

uname -a
Linux jl16p 6.5.0-18-generic #18~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb  7 11:40:03 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Memory

free
               total        used        free      shared  buff/cache   available
Mem:        15506328     1802732    12757900       29268      945696    13345932
Swap:        2097148     1388716      708432

kernel message

[18003.856356] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/user.slice/user-1000.slice/[email protected]/app.slice/snap.alacritty.alacritty-003ba7f4-2976-42da-ac0e-def6be088e93.scope,task=ed25519-script,pid=178448,uid=1000
[18003.856416] Out of memory: Killed process 178448 (ed25519-script) total-vm:17117176kB, anon-rss:13945536kB, file-rss:1536kB, shmem-rss:0kB, UID:1000 pgtables:28708kB oom_score_adj:0

Precompile: Add secp256r1 precompiles

SP1 already has support for secp256k1 precompiles used in ECDSA signature verification. It would be good to add similar precompiles for secp256r1. This would involve

  • implementing the secp256r1 parameters, similar to secp256k1 parameters
  • adding a new chip with the secp256r1 parameters
  • creating extern syscalls to utilize these new precompiles
  • writing tests for these syscalls to verify they work correctly

The precompile system of SP1 is not well documented at present, so this would require the contributor to be able to figure out how things work with minimal documentation.

Proofs created using different ELF files still pass with client.verify(ELF, proof)

Steps to reproduce:

  1. Create proof using fibonacci example and write to file "proof-with-io.json"
  2. Change fibonacci example to another program, ex) change the addition to multiplication to generate NEW_ELF
  3. Pass NEW_ELF and load old proof from file from no. 1:
    client.verify(NEW_ELF, &proof).expect("verification failed)

This always returns (). I think this should return true/false, and this case above should return false

Json Example dependency is missing

Hi Succinctlabs team
When I run cargo check & & cargo clippy in the examples/json/lib directory, I get the following error

Checking lib v0.1.0 (/root/rustcode/sp1/examples/json/lib)
error: cannot find derive macro `Serialize` in this scope
  --> src/lib.rs:12:10
   |
12 | #[derive(Serialize, Deserialize, Debug)]
   |          ^^^^^^^^^
   |
note: `Serialize` is imported here, but it is only a trait, without a derive macro
  --> src/lib.rs:3:26
   |
3  | use serde::{Deserialize, Serialize};
   |                          ^^^^^^^^^

error: cannot find derive macro `Deserialize` in this scope
  --> src/lib.rs:12:21
   |
12 | #[derive(Serialize, Deserialize, Debug)]
   |                     ^^^^^^^^^^^
   |
note: `Deserialize` is imported here, but it is only a trait, without a derive macro
  --> src/lib.rs:3:13
   |
3  | use serde::{Deserialize, Serialize};
   |             ^^^^^^^^^^^

error: cannot find derive macro `Serialize` in this scope
 --> src/lib.rs:5:10
  |
5 | #[derive(Serialize, Deserialize, Debug)]
  |          ^^^^^^^^^
  |
note: `Serialize` is imported here, but it is only a trait, without a derive macro
 --> src/lib.rs:3:26
  |
3 | use serde::{Deserialize, Serialize};
  |                          ^^^^^^^^^

error: cannot find derive macro `Deserialize` in this scope
 --> src/lib.rs:5:21
  |
5 | #[derive(Serialize, Deserialize, Debug)]
  |                     ^^^^^^^^^^^
  |
note: `Deserialize` is imported here, but it is only a trait, without a derive macro
 --> src/lib.rs:3:13
  |
3 | use serde::{Deserialize, Serialize};
  |             ^^^^^^^^^^^

error: could not compile `lib` (lib) due to 4 previous errors

Then I added the following dependencies to the Cargo.toml file and the problem was solved.

[workspace]
[package]
version = "0.1.0"
name = "lib"
edition = "2021"


[dependencies]
serde = "1.0.196"
serde_derive ="1.0.197"

And the lib/src/lib.rs

use serde_derive::{Deserialize,Serialize};

This may not be a serious bug, but I hope to help you improve test code. If you don't have time to deal with it I can propose a PR.
My best regards.

Bytes IO result in verification failed: NonZeroCumulativeSum

When I'm trying to write some bytes

let mut stdin = SP1Stdin::new();
let n = [1, 2, 3];
stdin.write_slice(&n);

and then read them like this

let n = sp1_zkvm::io::read_vec();

I get the following error:

thread 'main' panicked at src/main.rs:34:38:
verification failed: NonZeroCumulativeSum
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: btc_sp1_script::main

A repo to reproduce (a slight modification to the quickstart example): https://github.com/akalmykov/btc_sp1

cargo prove --version
cargo-prove sp1 (14bd4b2 2024-03-30T00:16:34.204221449Z)

Ubuntu 22.04, x86

Fibonacci example in SP1 Book Quickstart hits overflow with `i32`

Going through the quickstart here, I noticed that the Fibonacci program uses i32 numbers for a and b, and in the default number of runs (500) this results in major overflow. I was concerned that the proof had an issue until I saw that the program was using i32. I also noticed that the values in the quickstart output didn't match what I actually got -- maybe they were generated when the code was slightly different? Also, the quickstart claims that a proof-with-pis.json file will be generated, which should say proof-with-io.json I think.

With the current code, the output will only be "correct" for the first few dozen fibonacci numbers. If a and b are typed as u128, it will work up to n=186. To get past there, need to use BigInt or something like that, but I ran into a bunch of rust-lld errors when I tried to add that library to the example.

I understand if this is considered okay for the example, given that the program technically still does the 'work' involved in calculating the numbers. It's nice that the example code is simple and doesn't use any libraries. It was just a bit confusing seeing the "wrong" values pop out. Maybe switching to u128 and a simple disclaimer for n>186 would suffice?

confusing constants

sp1/core/src/stark/prover.rs#163

for _ in 0..2 {
    permutation_challenges.push(challenger.sample_ext_element());
}

sp1/core/src/stark/verifier.rs#80

let permutation_challenges = (0..2)
    .map(|_| challenger.sample_ext_element::<SC::Challenge>())
    .collect::<Vec<_>>();

why 2 is used here, could be better if we give a comment or use a meaningful constant

Runtime error on mac M1

Problem

I'm trying to run the sample repo (https://github.com/Sofianel5/zk-img-editor) locally. I followed the steps mentioned in the quickstart (https://succinctlabs.github.io/sp1/getting-started/quickstart.html).

However, running this using RUST_LOG=info cargo run --release --bin=example produces a runtime error:

    Finished release [optimized] target(s) in 2.93s
     Running `target/release/example`
2024-02-26T03:27:32.293092Z  INFO runtime.run(...):load memory: close time.busy=2.02ms time.idle=23.3µs
2024-02-26T03:27:33.604143Z  INFO runtime.run(...): stderr: thread '    
2024-02-26T03:27:33.604202Z  INFO runtime.run(...): stderr: main    
2024-02-26T03:27:33.604207Z  INFO runtime.run(...): stderr: ' panicked at    
2024-02-26T03:27:33.604220Z  INFO runtime.run(...): stderr: /Users/xenowits/.cargo/git/checkouts/sp1-20c98843a1ffc860/e19f742/zkvm/src/precompiles/io.rs    
2024-02-26T03:27:33.604222Z  INFO runtime.run(...): stderr: :    
2024-02-26T03:27:33.604232Z  INFO runtime.run(...): stderr: 49    
2024-02-26T03:27:33.604236Z  INFO runtime.run(...): stderr: :    
2024-02-26T03:27:33.604245Z  INFO runtime.run(...): stderr: 12    
2024-02-26T03:27:33.604249Z  INFO runtime.run(...): stderr: :    
2024-02-26T03:27:33.604256Z  INFO runtime.run(...): stderr: called `Result::unwrap()` on an `Err` value: Custom("Invalid size 4275708995826292716: sizes must fit in a usize (0 to 4294967295)") 

Specs

I’m running this on Macbook Pro M1, 16GB, rustc 1.77.0-nightly

Documentation: sp1 relies on OpenSSL 3 as well as OpenSSL 1.1.1

Installation says Make sure you have Rust and OpenSSL 1.1 installed. But this is not correct. It actually also requires libssl.so.3 file which indicates the requirement of OpenSSL 3 (package libssl3 in Debian/Ubuntu).

Suggestion:

- Make sure you have Rust and OpenSSL 1.1 installed.
+ Make sure you have Rust, OpenSSL 1.1 and OpenSSL 3 installed.

The rest of the contents is the "proof" of my suggestion.


The following error message reported by sp1up indicates the need of libssl.so.3 file:

sp1up: installing sp1 (version nightly, tag nightly)
sp1up: downloading latest cargo-prove
################################################################################################################# 100.0%
/home/user/.sp1/bin/cargo-prove: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory
sp1up: command failed: /home/user/.sp1/bin/cargo-prove prove --version
sp1up: installed -
sp1up: installing rust toolchain
/home/user/.sp1/bin/cargo-prove: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory
sp1up: command failed: /home/user/.sp1/bin/cargo-prove prove install-toolchain

This web page shows the file list of the libssl3 package of version 3.1.5 (on which libssl-dev relies), where libssl.so.3 file is contained.

https://packages.debian.org/trixie/amd64/libssl3/filelist

I've reproduce the installation procedure on Debian 11 (whose OpenSSL version is 1.1.1) and Debian 13 (OpenSSL 3.1.5 for now). Both Linux distributions have libssl-dev and rust toolchain installed. In Debian 13 it behaves correctly while in Debian 11 the error prompt above shows.

Debian 13 (has OpenSSL 3, so sp1up does not fail):

user@localhost:~$ apt list --installed | grep -i libssl
libssl-dev/testing,now 3.1.5-1 amd64 [installed]
libssl3/testing,now 3.1.5-1 amd64 [installed]

user@localhost:~$ openssl version
OpenSSL 3.1.5 30 Jan 2024 (Library: OpenSSL 3.1.5 30 Jan 2024)

user@localhost:~$ rustc --version
rustc 1.76.0 (07dca489a 2024-02-04)

Debian 11 (doesn't have OpenSSL 3, so sp1up fails):

user@debian:~$ apt --installed list | grep -i libssl
libssl-dev/oldstable,now 1.1.1w-0+deb11u1 amd64 [installed]
libssl1.1/oldstable,now 1.1.1w-0+deb11u1 amd64 [installed]

user@debian:~$ openssl version
OpenSSL 1.1.1w  11 Sep 2023

user@debian:~$ rustc --version
rustc 1.76.0 (07dca489a 2024-02-04)

Build error with `cargo prove build-toolchain`

I followed the building-from-source document to install SP1, I get an error when doing cargo prove build-toolchain.

Here is the OS context:

% sw_vers
ProductName:		macOS
ProductVersion:		14.3
BuildVersion:		23D56

% uname -m
x86_64

Here are the logs:


niu@Spartucus cli % cargo prove build-toolchain
No SP1_BUILD_DIR detected, cloning rust.
No GITHUB_ACCESS_TOKEN detected. If you get throttled by Github, set it to bypass the rate limit.
Cloning into 'rust'...
remote: Enumerating objects: 2425039, done.
remote: Counting objects: 100% (7778/7778), done.
remote: Compressing objects: 100% (93/93), done.
remote: Total 2425039 (delta 7736), reused 7694 (delta 7685), pack-reused 2417261
Receiving objects: 100% (2425039/2425039), 1.14 GiB | 5.66 MiB/s, done.
Resolving deltas: 100% (1901494/1901494), done.
Updating files: 100% (44291/44291), done.
Already on 'rustc-1.75'
Your branch is up to date with 'origin/rustc-1.75'.
HEAD is now at 99671f9ea25 rename curta to succinct
Submodule 'library/backtrace' (https://github.com/rust-lang/backtrace-rs.git) registered for path 'library/backtrace'
Submodule 'library/stdarch' (https://github.com/rust-lang/stdarch.git) registered for path 'library/stdarch'
Submodule 'src/doc/book' (https://github.com/rust-lang/book.git) registered for path 'src/doc/book'
Submodule 'src/doc/edition-guide' (https://github.com/rust-lang/edition-guide.git) registered for path 'src/doc/edition-guide'
Submodule 'src/doc/embedded-book' (https://github.com/rust-embedded/book.git) registered for path 'src/doc/embedded-book'
Submodule 'src/doc/nomicon' (https://github.com/rust-lang/nomicon.git) registered for path 'src/doc/nomicon'
Submodule 'src/doc/reference' (https://github.com/rust-lang/reference.git) registered for path 'src/doc/reference'
Submodule 'src/doc/rust-by-example' (https://github.com/rust-lang/rust-by-example.git) registered for path 'src/doc/rust-by-example'
Submodule 'src/doc/rustc-dev-guide' (https://github.com/rust-lang/rustc-dev-guide.git) registered for path 'src/doc/rustc-dev-guide'
Submodule 'src/llvm-project' (https://github.com/rust-lang/llvm-project.git) registered for path 'src/llvm-project'
Submodule 'src/tools/cargo' (https://github.com/rust-lang/cargo.git) registered for path 'src/tools/cargo'
Cloning into '/Users/niu/work/code/zkvm/sp1/cli/rust/library/backtrace'...
remote: Enumerating objects: 149, done.        
remote: Counting objects: 100% (149/149), done.        
remote: Compressing objects: 100% (113/113), done.        
remote: Total 149 (delta 6), reused 99 (delta 5), pack-reused 0        
Receiving objects: 100% (149/149), 113.86 KiB | 588.00 KiB/s, done.
Resolving deltas: 100% (6/6), done.
Cloning into '/Users/niu/work/code/zkvm/sp1/cli/rust/library/stdarch'...
remote: Enumerating objects: 312, done.        
remote: Counting objects: 100% (312/312), done.        
remote: Compressing objects: 100% (258/258), done.        
remote: Total 312 (delta 50), reused 134 (delta 21), pack-reused 0        
Receiving objects: 100% (312/312), 1.18 MiB | 3.23 MiB/s, done.
Resolving deltas: 100% (50/50), done.
Cloning into '/Users/niu/work/code/zkvm/sp1/cli/rust/src/doc/book'...
remote: Enumerating objects: 2475, done.        
remote: Counting objects: 100% (2475/2475), done.        
remote: Compressing objects: 100% (1399/1399), done.        
remote: Total 2475 (delta 617), reused 2139 (delta 591), pack-reused 0        
Receiving objects: 100% (2475/2475), 3.52 MiB | 7.44 MiB/s, done.
Resolving deltas: 100% (617/617), done.
Cloning into '/Users/niu/work/code/zkvm/sp1/cli/rust/src/doc/edition-guide'...
remote: Enumerating objects: 48, done.        
remote: Counting objects: 100% (48/48), done.        
remote: Compressing objects: 100% (38/38), done.        
remote: Total 48 (delta 5), reused 19 (delta 5), pack-reused 0        
Receiving objects: 100% (48/48), 44.83 KiB | 483.00 KiB/s, done.
Resolving deltas: 100% (5/5), done.
Cloning into '/Users/niu/work/code/zkvm/sp1/cli/rust/src/doc/embedded-book'...
fatal: unable to access 'https://github.com/rust-embedded/book.git/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 
fatal: clone of 'https://github.com/rust-embedded/book.git' into submodule path '/Users/niu/work/code/zkvm/sp1/cli/rust/src/doc/embedded-book' failed
Failed to clone 'src/doc/embedded-book'. Retry scheduled
Cloning into '/Users/niu/work/code/zkvm/sp1/cli/rust/src/doc/nomicon'...
remote: Enumerating objects: 81, done.        
remote: Counting objects: 100% (81/81), done.        
remote: Compressing objects: 100% (77/77), done.        
remote: Total 81 (delta 0), reused 27 (delta 0), pack-reused 0        
Receiving objects: 100% (81/81), 146.97 KiB | 723.00 KiB/s, done.
Cloning into '/Users/niu/work/code/zkvm/sp1/cli/rust/src/doc/reference'...
remote: Enumerating objects: 145, done.        
remote: Counting objects: 100% (145/145), done.        
remote: Compressing objects: 100% (136/136), done.        
remote: Total 145 (delta 0), reused 42 (delta 0), pack-reused 0        
Receiving objects: 100% (145/145), 271.02 KiB | 1.06 MiB/s, done.
Cloning into '/Users/niu/work/code/zkvm/sp1/cli/rust/src/doc/rust-by-example'...
remote: Enumerating objects: 265, done.        
remote: Counting objects: 100% (265/265), done.        
remote: Compressing objects: 100% (252/252), done.        
remote: Total 265 (delta 0), reused 108 (delta 0), pack-reused 0        
Receiving objects: 100% (265/265), 185.03 KiB | 1.11 MiB/s, done.
Cloning into '/Users/niu/work/code/zkvm/sp1/cli/rust/src/doc/rustc-dev-guide'...
remote: Enumerating objects: 244, done.        
remote: Counting objects: 100% (244/244), done.        
remote: Compressing objects: 100% (233/233), done.        
remote: Total 244 (delta 3), reused 104 (delta 3), pack-reused 0        
Receiving objects: 100% (244/244), 2.21 MiB | 4.44 MiB/s, done.
Resolving deltas: 100% (3/3), done.
Cloning into '/Users/niu/work/code/zkvm/sp1/cli/rust/src/llvm-project'...
remote: Enumerating objects: 3, done.        
remote: Counting objects: 100% (3/3), done.        
remote: Compressing objects: 100% (2/2), done.        
remote: Total 3 (delta 0), reused 2 (delta 0), pack-reused 0        
Receiving objects: 100% (3/3), done.
Cloning into '/Users/niu/work/code/zkvm/sp1/cli/rust/src/tools/cargo'...
remote: Enumerating objects: 2309, done.        
remote: Counting objects: 100% (2309/2309), done.        
remote: Compressing objects: 100% (1564/1564), done.        
remote: Total 2309 (delta 615), reused 1602 (delta 508), pack-reused 0        
Receiving objects: 100% (2309/2309), 4.01 MiB | 4.02 MiB/s, done.
Resolving deltas: 100% (615/615), done.
Cloning into '/Users/niu/work/code/zkvm/sp1/cli/rust/src/doc/embedded-book'...
remote: Enumerating objects: 85, done.        
remote: Counting objects: 100% (85/85), done.        
remote: Compressing objects: 100% (75/75), done.        
remote: Total 85 (delta 0), reused 30 (delta 0), pack-reused 0        
Receiving objects: 100% (85/85), 655.52 KiB | 1.59 MiB/s, done.
remote: Enumerating objects: 4649, done.
remote: Counting objects: 100% (4649/4649), done.
remote: Compressing objects: 100% (1408/1408), done.
remote: Total 4543 (delta 3005), reused 4408 (delta 2942), pack-reused 0
Receiving objects: 100% (4543/4543), 1.16 MiB | 4.28 MiB/s, done.
Resolving deltas: 100% (3005/3005), completed with 69 local objects.
From https://github.com/rust-lang/backtrace-rs
 * branch            6145fe6bac65c38375f1216a565a6cc7deb89a2d -> FETCH_HEAD
Submodule path 'library/backtrace': checked out '6145fe6bac65c38375f1216a565a6cc7deb89a2d'
remote: Enumerating objects: 16795, done.
remote: Counting objects: 100% (16794/16794), done.
remote: Compressing objects: 100% (3952/3952), done.
remote: Total 16533 (delta 12354), reused 16120 (delta 12011), pack-reused 0
Receiving objects: 100% (16533/16533), 11.26 MiB | 18.10 MiB/s, done.
Resolving deltas: 100% (12354/12354), completed with 181 local objects.
From https://github.com/rust-lang/stdarch
 * branch              f4528dd6e85d97bb802240d7cd048b6e1bf72540 -> FETCH_HEAD
Submodule path 'library/stdarch': checked out 'f4528dd6e85d97bb802240d7cd048b6e1bf72540'
remote: Enumerating objects: 31753, done.
remote: Counting objects: 100% (31744/31744), done.
remote: Compressing objects: 100% (9574/9574), done.
remote: Total 30418 (delta 20709), reused 29718 (delta 20028), pack-reused 0
Receiving objects: 100% (30418/30418), 32.75 MiB | 16.67 MiB/s, done.
Resolving deltas: 100% (20709/20709), completed with 485 local objects.
From https://github.com/rust-lang/book
 * branch              5b6c1ceaa62ecbd6caef08df39b33b3938e99deb -> FETCH_HEAD
Submodule path 'src/doc/book': checked out '5b6c1ceaa62ecbd6caef08df39b33b3938e99deb'
remote: Enumerating objects: 2668, done.
remote: Counting objects: 100% (2668/2668), done.
remote: Compressing objects: 100% (898/898), done.
remote: Total 2638 (delta 1724), reused 2566 (delta 1692), pack-reused 0
Receiving objects: 100% (2638/2638), 474.28 KiB | 1.44 MiB/s, done.
Resolving deltas: 100% (1724/1724), completed with 22 local objects.
From https://github.com/rust-lang/edition-guide
 * branch            34fca48ed284525b2f124bf93c51af36d6685492 -> FETCH_HEAD
Submodule path 'src/doc/edition-guide': checked out '34fca48ed284525b2f124bf93c51af36d6685492'
remote: Enumerating objects: 2372, done.
remote: Counting objects: 100% (2372/2372), done.
remote: Compressing objects: 100% (781/781), done.
remote: Total 2310 (delta 1499), reused 2220 (delta 1426), pack-reused 0
Receiving objects: 100% (2310/2310), 615.25 KiB | 1.65 MiB/s, done.
Resolving deltas: 100% (1499/1499), completed with 48 local objects.
From https://github.com/rust-embedded/book
 * branch            22bca3d0f6e9b9b556689b54ce96f25b46ecd1b3 -> FETCH_HEAD
Submodule path 'src/doc/embedded-book': checked out '22bca3d0f6e9b9b556689b54ce96f25b46ecd1b3'
remote: Enumerating objects: 2726, done.
remote: Counting objects: 100% (2726/2726), done.
remote: Compressing objects: 100% (887/887), done.
remote: Total 2661 (delta 1889), reused 2504 (delta 1753), pack-reused 0
Receiving objects: 100% (2661/2661), 1.14 MiB | 3.85 MiB/s, done.
Resolving deltas: 100% (1889/1889), completed with 54 local objects.
From https://github.com/rust-lang/nomicon
 * branch            1842257814919fa62e81bdecd5e8f95be2839dbb -> FETCH_HEAD
Submodule path 'src/doc/nomicon': checked out '1842257814919fa62e81bdecd5e8f95be2839dbb'
remote: Enumerating objects: 11362, done.
remote: Counting objects: 100% (11362/11362), done.
remote: Compressing objects: 100% (3222/3222), done.
remote: Total 11233 (delta 8260), reused 10841 (delta 7980), pack-reused 0
Receiving objects: 100% (11233/11233), 3.71 MiB | 9.25 MiB/s, done.
Resolving deltas: 100% (8260/8260), completed with 113 local objects.
From https://github.com/rust-lang/reference
 * branch            cd8193e972f61b92117095fc73b67af767b4d6bc -> FETCH_HEAD
Submodule path 'src/doc/reference': checked out 'cd8193e972f61b92117095fc73b67af767b4d6bc'
remote: Enumerating objects: 14471, done.
remote: Counting objects: 100% (14471/14471), done.
remote: Compressing objects: 100% (6205/6205), done.
remote: Total 14228 (delta 8138), reused 13867 (delta 7802), pack-reused 0
Receiving objects: 100% (14228/14228), 3.21 MiB | 7.85 MiB/s, done.
Resolving deltas: 100% (8138/8138), completed with 195 local objects.
From https://github.com/rust-lang/rust-by-example
 * branch            311b84962016b28c75525c86e7b3f49fd9101a39 -> FETCH_HEAD
Submodule path 'src/doc/rust-by-example': checked out '311b84962016b28c75525c86e7b3f49fd9101a39'
remote: Enumerating objects: 11460, done.
remote: Counting objects: 100% (11460/11460), done.
remote: Compressing objects: 100% (2833/2833), done.
remote: Total 11261 (delta 8543), reused 11022 (delta 8324), pack-reused 0
Receiving objects: 100% (11261/11261), 3.12 MiB | 4.33 MiB/s, done.
Resolving deltas: 100% (8543/8543), completed with 172 local objects.
From https://github.com/rust-lang/rustc-dev-guide
 * branch            77dbe5782b2488af3bb489ad702eaff438f465bf -> FETCH_HEAD
Submodule path 'src/doc/rustc-dev-guide': checked out '77dbe5782b2488af3bb489ad702eaff438f465bf'
remote: Enumerating objects: 5462408, done.
remote: Counting objects: 100% (5462408/5462408), done.
remote: Compressing objects: 100% (925157/925157), done.
remote: Total 5462406 (delta 4455758), reused 5462387 (delta 4455751), pack-reused 0
Receiving objects: 100% (5462406/5462406), 1.74 GiB | 16.32 MiB/s, done.
Resolving deltas: 100% (4455758/4455758), done.
From https://github.com/rust-lang/llvm-project
 * branch                      2c4de6c2492d5530de3f19f41d8f88ba984c2fe2 -> FETCH_HEAD
Submodule path 'src/llvm-project': checked out '2c4de6c2492d5530de3f19f41d8f88ba984c2fe2'
remote: Enumerating objects: 120572, done.
remote: Counting objects: 100% (120565/120565), done.
remote: Compressing objects: 100% (31574/31574), done.
remote: Total 119281 (delta 86169), reused 118279 (delta 85327), pack-reused 0
Receiving objects: 100% (119281/119281), 36.32 MiB | 15.36 MiB/s, done.
Resolving deltas: 100% (86169/86169), completed with 668 local objects.
From https://github.com/rust-lang/cargo
 * branch                1d8b05cdd1287c64467306cf3ca2c8ac60c11eb0 -> FETCH_HEAD
Submodule path 'src/tools/cargo': checked out '1d8b05cdd1287c64467306cf3ca2c8ac60c11eb0'
Submodule path 'src/doc/embedded-book': checked out '22bca3d0f6e9b9b556689b54ce96f25b46ecd1b3'
downloading https://static.rust-lang.org/dist/2023-11-16/rust-std-1.74.0-x86_64-apple-darwin.tar.xz
######################################################################################################################################### 100.0%
downloading https://static.rust-lang.org/dist/2023-11-16/rustc-1.74.0-x86_64-apple-darwin.tar.xz
######################################################################################################################################### 100.0%
downloading https://static.rust-lang.org/dist/2023-11-16/cargo-1.74.0-x86_64-apple-darwin.tar.xz
######################################################################################################################################### 100.0%
extracting /Users/niu/work/code/zkvm/sp1/cli/rust/build/cache/2023-11-16/rustc-1.74.0-x86_64-apple-darwin.tar.xz
extracting /Users/niu/work/code/zkvm/sp1/cli/rust/build/cache/2023-11-16/rust-std-1.74.0-x86_64-apple-darwin.tar.xz
extracting /Users/niu/work/code/zkvm/sp1/cli/rust/build/cache/2023-11-16/cargo-1.74.0-x86_64-apple-darwin.tar.xz
Building bootstrap
error: current package believes it's in a workspace when it's not:
current:   /Users/niu/work/code/zkvm/sp1/cli/rust/src/bootstrap/Cargo.toml
workspace: /Users/niu/work/code/zkvm/sp1/Cargo.toml

this may be fixable by adding `cli/rust/src/bootstrap` to the `workspace.members` array of the manifest located at: /Users/niu/work/code/zkvm/sp1/Cargo.toml
Alternatively, to keep it out of the workspace, add the package to the `workspace.exclude` array, or add an empty `[workspace]` table to the package's manifest.
failed to run: /Users/niu/work/code/zkvm/sp1/cli/rust/build/x86_64-apple-darwin/stage0/bin/cargo build --manifest-path /Users/niu/work/code/zkvm/sp1/cli/rust/src/bootstrap/Cargo.toml
Build completed unsuccessfully in 0:00:16
Building bootstrap
error: current package believes it's in a workspace when it's not:
current:   /Users/niu/work/code/zkvm/sp1/cli/rust/src/bootstrap/Cargo.toml
workspace: /Users/niu/work/code/zkvm/sp1/Cargo.toml

this may be fixable by adding `cli/rust/src/bootstrap` to the `workspace.members` array of the manifest located at: /Users/niu/work/code/zkvm/sp1/Cargo.toml
Alternatively, to keep it out of the workspace, add the package to the `workspace.exclude` array, or add an empty `[workspace]` table to the package's manifest.
failed to run: /Users/niu/work/code/zkvm/sp1/cli/rust/build/x86_64-apple-darwin/stage0/bin/cargo build --manifest-path /Users/niu/work/code/zkvm/sp1/cli/rust/src/bootstrap/Cargo.toml
Build completed unsuccessfully in 0:00:00
info: no toolchain installed for 'succinct'
Succesfully removed existing toolchain.
thread 'main' panicked at cli/src/commands/build_toolchain.rs:98:43:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Proof serialization/deserialization doesn't seem to be symmetric

Apologies if I'm missing something -- I couldn't find exactly where the deserialization is/should be occurring for the SP1ProofWithIO struct.

I'm attempting to share the proofs generated by the example programs, in this case the Chess example which writes proof_with_io.json to disk. However, when trying to deserialize the JSON to a proof, I get an error:

Error("invalid type: string \"01000..proof bytes...616d\", expected struct Proof", line: 1, column: 2662627)

I added this code inside the chess example to produce the error:

let proof = SP1Prover::prove(ELF, stdin).expect("proving failed");

let proof_json = serde_json::to_string(&proof).expect("serialization failed");
let mut proof = serde_json::from_str::<SP1ProofWithIO<BabyBearBlake3>>(&proof_json)
        .expect("deserialization failed");

Am I missing a required step, or is the Proof deserialization possibly missing an impl somewhere?

Rand: How does it work for hashmaps

How does Rand work for Sp1?

We weren't sure at the workshop. Are the random bytes hardcoded for now?

Should this be based on repeated (non-cryptographic) hashing of the public input? That way we can get deterministic traces, but still not-so-vulnerable worst case performance for things like Hashmap insertion

Enable `cargo prove build` to handle arbitrary Rust flags

All Rust feature flags should work with cargo prove build.

Currently, we only support --ignore-rust-version.

sp1/cli/src/build.rs

Lines 17 to 24 in e413e82

#[derive(Parser)]
pub(crate) struct BuildArgs {
#[clap(long, action, help = "Ignore Rust version check.")]
pub(crate) docker: bool,
#[clap(long, action, help = "Ignore Rust version check.")]
pub(crate) ignore_rust_version: bool,
}

Showcase Request: Ethereum ZK Light Client with Helios

ZK light clients for trust-minimized bridging are one of the important use-cases of ZKPs. There are several ZK Ethereum Light Client implementations that exist, written in Circom and other ZK-specific languages, but they are hard to modify and decipher.

Helios is a Rust implementation of an Ethereum light client that can be utilized inside SP1 to create a maintainable, readable Ethereum ZK Light Client.

Does sp1 support recursive verification?

I am trying to do recursive verification (verify a proof in the other proof).

I write a recursive proof demo according to my understanding of sp1, but seems the verification is always successful even I give a wrong variable to stdin. And it panics when I try to read something from proof.stdout.

In my demo, riscv32im-succinct-zkvm-elf-plain is plain fibonacci verification while riscv32im-succinct-zkvm-elf is recursive ELF that verify the other proof.

Do I get something wrong? Or sp1 does not support recursive proof? If not, could someone share an example? Thanks.

Incorrect template program

The default program generated by cargo prove new [...] uses the non-existing sp1_zkvm::io::write instead of sp1_zkvm::io::commit.

Documentation: document the process of adding a custom precompile

SP1 is built to be easily customizable, with the ability for developers to add custom precompiles. The documentation around this is scarce and it would be helpful for there to be better docs around the process of adding a precompile and what steps need taken.

Compilation Issue with `serial` Feature

While working on #321, I encountered a verification error that I believe is due to an unsatisfied AIR constraint.

Here's a screenshot of the error:

Screenshot 2024-02-28 at 11 34 49 PM

I found a section in the codebase that allows for the evaluation of all AIR constraints. This functionality is not enabled by default and is only turned on when compiling the codebase without the perf flag and disabling the default features.

pub fn debug_constraints<SC: StarkGenericConfig>(
chip: &RiscvChip<SC>,
preprocessed: Option<&RowMajorMatrix<SC::Val>>,
main: &RowMajorMatrix<SC::Val>,
perm: &RowMajorMatrix<SC::Challenge>,
perm_challenges: &[SC::Challenge],
) where

Attempting to compile the code with the serial feature (and default features turned off) resulted in compilation failure. This issue arises because the serial flag disables the rayon features, yet the module in question relies on rayon by default.

// The permutation trace is actually the multiplicative inverse of the RLC's we computed above.
permutation_trace_values
.chunks_mut(chunk_rate)
.par_bridge()
.for_each(|chunk| batch_multiplicative_inverse_inplace(chunk));

Failed to run custom command

Keep getting this error when following the quickstart guide:

error: failed to run custom build command for sp1-recursion-compiler v0.1.0 (https://github.com/succinctlabs/sp1.git#ab103ee5)`

Caused by:
process didn't exit successfully: /mnt/c/Users/L_Mea/rust/launcher/docker_tf/_fib/script/target/release/build/sp1-recursion-compiler-8fe03ec0ce5bde5c/build-script-build (exit status: 101)
--- stdout
go build main.go`

this occurs on the /script cargo run --release step.

Showcase Request: Stateless EVM Coprocessor

Today, onchain applications are highly restricted in what computations they can do because of Ethereum's high gas costs. With ZKPs, developers can make use of more powerful compute in their onchain application by utilizing a "coprocessor": a method of moving computation off-chain and then verifying a succinct proof of this computation onchain (for only ~200k gas).

With SP1, it is trivial to implement your coprocessor logic in Rust. But a lot of Solidity developers are used to writing their code in Solidity and might not want to use Rust for their coprocessor. But, there is an easy way to enable Solidity coprocessors with SP1: we can use the revm interpreter to execute EVM bytecode inside SP1 and prove valid execution of Solidity functions.

You can look at this repo for inspiration on how to use revm and its InMemoryDb to verify execution of stateless EVM bytecode.

A great demo example would be showing how SP1 can prove valid execution of a Solidity library (as libraries are stateless) using the revm interpreter and other EVM-related Rust crates.

Fibonacci example for large N

My goal is to generate a proof for a sufficiently computationally expensive statement.
To this end, I'm increasing the N in the Fibonacci example.

For N << 10^6, proof generation finishes quickly.
For N ~= 10^6, proof generation takes ~1 minute and peaks at 30 GB RAM usage.
For N ~= 10^7, it crashes with OOM (using up 55 GB right before the crash).

Seems surprising given that N=10^7 Fibonacci should be a much simpler task than running reth? Any guesses why the crash?
Macbook Pro, M3 Max, 36 GB RAM.

Error while building example program

vivek@vivek-System-Product-Name:~/dev/sp1/examples/ed25519/program$ cargo prove build
   Compiling sp1-zkvm v0.1.0 (/home/vivek/dev/sp1/zkvm/entrypoint)
error: invalid arch name 'rv32i2p0_m2p0', unsupported version number 2.0 for extension 'i'
        .attribute      5, "rv32i2p0_m2p0"
                           ^
error: instruction requires the following: 'M' (Integer Multiplication and Division) or 'Zmmul' (Integer Multiplication)
        mul     a1, a1, a4
        ^
error: invalid arch name 'rv32i2p0_m2p0', unsupported version number 2.0 for extension 'i'
        .attribute      5, "rv32i2p0_m2p0"
                           ^
error: invalid arch name 'rv32i2p0_m2p0', unsupported version number 2.0 for extension 'i'
        .attribute      5, "rv32i2p0_m2p0"
                           ^
error: instruction requires the following: 'M' (Integer Multiplication and Division) or 'Zmmul' (Integer Multiplication)
        mul     a1, a1, a4
        ^
error: invalid arch name 'rv32i2p0_m2p0', unsupported version number 2.0 for extension 'i'
        .attribute      5, "rv32i2p0_m2p0"
                           ^
error: invalid arch name 'rv32i2p0_m2p0', unsupported version number 2.0 for extension 'i'
    |
note: instantiated into assembly here
   --> <inline asm>:206:16
    |
206 |     .attribute    5, "rv32i2p0_m2p0"
    |                      ^

error: instruction requires the following: 'M' (Integer Multiplication and Division) or 'Zmmul' (Integer Multiplication)
    |
note: instantiated into assembly here
   --> <inline asm>:236:2
    |
236 |     mul    a1, a1, a4
    |     ^

error: invalid arch name 'rv32i2p0_m2p0', unsupported version number 2.0 for extension 'i'
    |
note: instantiated into assembly here
   --> <inline asm>:487:16
    |
487 |     .attribute    5, "rv32i2p0_m2p0"
    |                      ^

error: could not compile `sp1-zkvm` (lib) due to 3 previous errors

sp1_zkvm::io::write_slice() not found

The docs state that for returning bytes, we should do the following:

let mut my_slice = [0_u8; 32]; sp1_zkvm::io::write_slice(&my_slice);

but when trying this myself, I get the error "write_slice not found"

Building project fails with "Error loading target specification"

I just installed sp1 on a Mac (Apple M2), but I'm unable to build the fibonacci example, it fails with Error loading target specification: Could not find specification for target "riscv32im-succinct-zkvm-elf".

Steps:

> curl -L https://sp1.succinct.xyz | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    15    0    15    0     0     40      0 --:--:-- --:--:-- --:--:--    40
100  2143  100  2143    0     0   3408      0 --:--:-- --:--:-- --:--:--  3408
Installing sp1up...
######################################################################## 100.0%

Detected your preferred shell is zsh and added sp1up to PATH. Run 'source /Users/peter/.zshenv' or start a new terminal session to use sp1up.
Then, simply run 'sp1up' to install SP1.

> sp1up

.______  ._______ ._______ ._______ ._______ ._______ ._______ ._______ ._______

   _____  ____  ___
  / ___/ / __ \<  /
  \__ \ / /_/ // /                        A performant, 100% open-source,
 ___/ // ____// /                              general-purpose zkVM.  
/____//_/    /_/   

._______ ._______ ._______ ._______ ._______ ._______ ._______ ._______ ._______ 

Repo       : https://github.com/succinctlabs/sp1
Book       : https://succinctlabs.github.io/sp1
Telegram   : https://t.me/succinct_sp1

._______ ._______ ._______ ._______ ._______ ._______ ._______ ._______ ._______ 

sp1up: installing sp1 (version nightly, tag nightly)
sp1up: downloading latest cargo-prove
############################################################################################################################################################################################################ 100.0%
sp1up: installed - cargo-prove sp1 (fe8df5e 2024-04-01T00:19:27.500296000Z)
sp1up: installing rust toolchain
Successfully cleaned up ~/.sp1 directory.
Successfully created ~/.sp1 directory.
Downloading https://github.com/succinctlabs/rust/releases/download/succinct-v2024-02-24.1/rust-toolchain-aarch64-apple-darwin.tar.gz
Downloaded https://github.com/succinctlabs/rust/releases/download/succinct-v2024-02-24.1/rust-toolchain-aarch64-apple-darwin.tar.gz to /Users/peter/.sp1/rust-toolchain-aarch64-apple-darwin.tar.gz
  [00:01:00] [###################################################################################################################################################################] 308.96MB/308.96MB (5.15MB/s, 0s)
info: uninstalling toolchain 'succinct'
info: toolchain 'succinct' uninstalled
Successfully removed existing toolchain.
Successfully linked toolchain to rustup.
sp1up: installed rust toolchain
sp1up: done!

> cargo prove --version
cargo-prove sp1 (fe8df5e 2024-04-01T00:19:27.500296000Z)

> rustc --print target-list | grep zkvm
riscv32im-risc0-zkvm-elf

> rustup toolchain list | grep succ
succinct

> cargo prove build
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `rustc - --crate-name ___ --print=file-names -C passes=loweratomic -C link-arg=-Ttext=0x00200800 -C panic=abort --target riscv32im-succinct-zkvm-elf --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg` (exit status: 1)
  --- stderr
  error: Error loading target specification: Could not find specification for target "riscv32im-succinct-zkvm-elf". Run `rustc --print target-list` for a list of built-in targets

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.