Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update to v1.1.0 and add seperate execute #22

Merged
merged 4 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 'mock' for generating mock proofs locally, 'local' for generating proofs locally, 'network' for generating proofs using the proving network.
SP1_PROVER=mock
SP1_PROVER=local
# If using the proving network, set to your whitelisted private key. For more information, see:
# https://docs.succinct.xyz/prover-network/setup.html#key-setup
SP1_PRIVATE_KEY=
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
[submodule "contracts/lib/sp1-contracts"]
path = contracts/lib/sp1-contracts
url = https://github.com/succinctlabs/sp1-contracts
tag = v1.0.1
tag = v1.1.0
54 changes: 44 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,70 @@ that can generate a proof of any RISC-V program.
- [Rust](https://rustup.rs/)
- [SP1](https://succinctlabs.github.io/sp1/getting-started/install.html)

## Standard Proof Generation
## Running the Project

> [!WARNING]
> You will need at least 16GB RAM to generate the default proof.
There are three main ways to run this project: execute a program, generate a core proof, and
generate an EVM-compatible proof.

### Execute the Program

To run the program without generating a proof:

```sh
cd script
cargo run --release -- --execute
```

This will execute the program and display the output.

Generate the proof for your program using the standard prover.
### Generate a Core Proof

To generate a core proof for your program:

```sh
cd script
RUST_LOG=info cargo run --bin prove --release
cargo run --release -- --prove
```

## EVM-Compatible Proof Generation & Verification
### Generate an EVM-Compatible (PLONK) Proof

> [!WARNING]
> You will need at least 128GB RAM to generate the PLONK proof.

Generate the proof that is small enough to be verified on-chain and verifiable by the EVM. This command also generates a fixture that can be used to test the verification of SP1 zkVM proofs inside Solidity.
To generate a PLONK proof that is small enough to be verified on-chain and verifiable by the EVM:

```sh
cd script
RUST_LOG=info cargo run --bin prove --release -- --evm
cargo run --release --bin evm
```

This command also generates a fixture that can be used to test the verification of SP1 zkVM proofs
inside Solidity.

### Retrieve the Verification Key

To retrieve your `programVKey` for your on-chain contract, run the following command:

```sh
cargo run --release --bin vkey
```

## Using the Prover Network

Make a copy of the example environment file:
We highly recommend using the Succinct prover network for any non-trivial programs or benchmarking purposes. For more information, see the [setup guide](https://docs.succinct.xyz/prover-network/setup.html).

To get started, copy the example environment file:

```sh
cp .env.example .env
```

Then, set the `SP1_PROVER` environment variable to `network` and set the `SP1_PRIVATE_KEY` environment variable to your whitelisted private key. For more information, see the [setup guide](https://docs.succinct.xyz/prover-network/setup.html).
Then, set the `SP1_PROVER` environment variable to `network` and set the `SP1_PRIVATE_KEY`
environment variable to your whitelisted private key.

For example, to generate an EVM-compatible proof using the prover network, run the following
command:

```sh
SP1_PROVER=network SP1_PRIVATE_KEY=... cargo run --release --bin evm
```
4 changes: 2 additions & 2 deletions contracts/src/fixtures/fixture.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"a": 6765,
"b": 10946,
"n": 20,
"vkey": "0x001339c1685748575f12a28f70fc3c6dab68f547ec6641b7802b690d6ccfdbe5",
"vkey": "0x00b84bc28cca2115d6299b70825d7ec6117deb3981d1bbf21c3113f92dc18eb5",
"publicValues": "0x00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000001a6d0000000000000000000000000000000000000000000000000000000000002ac2",
"proof": "0xfedc1fcc1d9d8da95189f861c0cf6b333cd2f79bd87bc7739c713c0815d49122eb4fe0ab11e02fe5b29152b709abd5c02147127bf9e1a822733aaf91d138d8e18fd2b4131eebe031774abc7ba46ac1a385c6e94617f1a508c31050525a76433f85d2b4ff124d0f8a2c0e3148b98687fa79a4d745814297949a7d5cf2fbe825198c92b2a00eb0cf886a2a046f618871df69eb854ab9cd08f68854a290c0bf00da9333ccff0775ac8f6af93e5ebe289c062fbe61967228c55567d12d7d28f29660ca8bb3471370ee278d8e672b1e9a5c469fda8adb3460862e0a9029cc4b08504813fb044b27f748b45ab8a90fcd926c2321d98e0993408bfee03da472bede2700e5e261e8116b4c56a1e313963bcf62d5d32c3893dd8ebc18302b533f0440bf1c666713ae25e5b627daa509ff37982406bd3ab90b41e276275146e70be17e336ff3a0568a18f3812ef36e3f27727752eef2ddc346188d96bec24104af80f9934a41e4cdae21397be72786fe3e9b175aa7841ffa298b4ec1528facb6ba8f130a260e1b58d62e3e5cd9de2b32a22ffdf4ccc929572594da68ebd8e423d91a02679c7da4935308e071e9867e36bd553361d8d58fddd2a6cb764e481bf7d85146b84eeece2f652b9eb46874c7e5d196b70c6358ea7e4eb73ade7abbda732a5e9d9c6ba63f30c3242c7cde60037b062ed6e439fa501900d6438b6c831eb1779c779898832e4a3c1dec8852e4e07e053f0be141ce6c01933d0677365416249af26ed0c3af6ebe7f15fd0378a101b4207d5d863daf458ec6606e7512693a9f13ad9a2756a6830f6e09091b210cd92a30ab88bef35871c13cba993d59c22689455d8d0c3fcf08207013c3b40a000a0f3c6f31fdcfb4cfbc5224d0f7bb4424d81a86ce88cb97d95000013fe2c6bb93b6b1edc69153f321b42ba04fc2e89d7e39f61272be8552aa4ea21ad35c1f2f17bc5194c5bcb18bb60cdc020e2bc0bed3ccc8eea05f69ba0f5d0e08651169c75b9d2067ab60e29875a5b7f4c046ec4981840527731db3f1a2ad0c02207c6eb2b7cdad09450c4ba1701862bd942671781b5b7d23bb0785c6e9bbba1557ce8362b4297cf7635f2f3b66c096860443427b07efa4684531a9a023cf17127b22ef7fdb031515828b6362061575cd3fac41450670168f8e86edde9cad7f1f5339f25fa84f64da4bb23afbf1a664396549b0b42dc3f483e9b193e9a819ce"
"proof": "0xc430ff7f260ec07d5bc7aaa7f40ecce2529a1f7517a232cb6dfe71bda5205e79fb0e090e2cf5eb678d03adfef43dec7f919076dd47548321bf853fbe0451fea804169dca04309e083f8ded64c40c4fe018d25495fcadca19e2e3625c5e35c3ac89c71a3f2400618aec42ea7edfd3be3925791298e8b6e803c2e003cbab5259a1a63b2821136de9de013dcaf524aeca92bd77f3463e7925fa7050d02a77f5e8172da74f4a0b3bcb86fed554d084af9c1599f961ba65b4dd60bd02299d11f1b6956d5a403124c78bbed2d3d0c5af2acc79c57a8d9b6e4bb8226abd04ce096050d696fd93f01b26b5a1114ec1c5317c6caca14cc580358ead30bf53234fa5ed3de8023c98e019b9517c2e18ea6c3553a4d8b54a59651897d4bf1afcb73101a5a7295c5e90450ba2f0f71cfd1bb9e910bb97bb56f77118d3732623d8cb9ee792d38b10b080582f7ae4493c42f544af098f40d0948db857731513430f253c8a88f74098e03ffd1a524331e0801cd942b0744ad5f61531203356967e5eeceef0fe47cabcb5bbdb125c57ccfb010e06e9d7e739ddd1810ba61e3aedd7572653829ef3802c5516e921d2db577f969ba667098a71fd398e177ca2513a822a312dcbb9df393fa5572e1c42b34da0b1dd884825474a41940dacc91914a0cf183b55b738be434e744c912560828cbc15f863b35bea8c4a49d14da6f12d8422baa64b5a8b82aea3a6303c12e6782b64aaca45330f1040cc5e0f7bba4036fb5edeab2fddb7d1ab66cd44772a21cd24aab969c3ff1d1a0fcd42befd27d0f26380bfbe968a32b6ca718b75a020908705cf0be21ebb1d9ac5598e0b3eace0b4e43fb6ae8bfb752b7c951a467e1038671e1623d30955d3ad265dcfa28e71fa8739d27c083a0220dd7754acaa730f7b332c26c93cebc0651401459936e2ddbd0b086e67bdca6d6806c581c4458c2831023d95cfd5206c9d51902baff1db01f40ed1e53379c58fd9918b8b4b93240193ec7199608ab490c21208f919cb405a595f9e9a55a950d2aae6b09fe72875256e39a0cc9ea354cbd9b1bb829aca36fc28b7a5d55fc06c9d8f00e693b704292736f75b7556844eb7b96b67cce1f30434aeb2634b0bc36b33be8ba877bbf3a32a6630bd5d99ba8bd21eb9eaf0ea792340e1c8788ba2338725c27cef5a042a0918b200389157bc1352975661991d719f73785015f178f38bb6ec9d7dfb4cb0f7"
}
8 changes: 4 additions & 4 deletions program/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ edition = "2021"

[dependencies]
alloy-sol-types = "0.7.2"
sp1-zkvm = "1.0.1"
sp1-zkvm = "1.1.0"
Binary file modified program/elf/riscv32im-succinct-zkvm-elf
Binary file not shown.
4 changes: 2 additions & 2 deletions rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2024-06-13"
components = ["llvm-tools", "rustc-dev"]
channel = "1.79.0"
components = ["llvm-tools", "rustc-dev"]
64 changes: 34 additions & 30 deletions script/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions script/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@
version = "0.1.0"
name = "fibonacci-script"
edition = "2021"
default-run = "prove"
default-run = "fibonacci"

[[bin]]
name = "prove"
path = "src/bin/prove.rs"
name = "fibonacci"
path = "src/bin/main.rs"

[[bin]]
name = "evm"
path = "src/bin/evm.rs"

[[bin]]
name = "vkey"
path = "src/bin/vkey.rs"

[dependencies]
sp1-sdk = "1.0.1"
sp1-sdk = "1.1.0"
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
serde = { version = "1.0", default-features = false, features = ["derive"] }
clap = { version = "4.0", features = ["derive", "env"] }
Expand All @@ -23,4 +27,4 @@ alloy-sol-types = "0.7.2"
hex = "0.4.3"

[build-dependencies]
sp1-helper = "1.0.1"
sp1-helper = "1.1.0"
3 changes: 0 additions & 3 deletions script/rust-toolchain

This file was deleted.

Loading