Skip to content

Commit 6abcc1b

Browse files
committed
feat: merkle tree proofs
1 parent 176d7e6 commit 6abcc1b

19 files changed

Lines changed: 272 additions & 472 deletions

Cargo.lock

Lines changed: 20 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[workspace]
2-
members = ["lib", "lib2", "lib3", "program", "script"]
2+
members = ["lib", "lib3", "program", "script"]
33
resolver = "2"
44

55
[workspace.dependencies]

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.PHONY: test-merkle-tree-lib build-program run-program execute-program-gen-core-proof-groth16 execute-program-gen-core-proof-plonk
2+
3+
test-merkle-tree-lib:
4+
@cd lib3 && cargo test
5+
6+
build-program:
7+
@cd program && cargo prove build
8+
9+
run-program:
10+
@cd script && cargo run --release -- --execute --data "a b c d" --index 2
11+
12+
# for these two cmds below, have Docker funning; also, know it might take a few minutes
13+
#
14+
# they could also auto-download image: "ghcr.io/succinctlabs/sp1-gnark:v3.0.0"
15+
#
16+
# from what I can see... if you don't have enough memory, docker run will fail after about ~10 minutes on my machine
17+
execute-program-gen-core-proof-groth16:
18+
@cd script && RUST_LOG=info cargo run --release --bin evm -- --data "a b c d" --index 2 --groth16
19+
execute-program-gen-core-proof-plonk:
20+
@cd script && RUST_LOG=info cargo run --release --bin evm -- --data "a b c d" --index 2 --plonk

README.md

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,34 @@
33
This is a template for creating an end-to-end [SP1](https://github.com/succinctlabs/sp1) project
44
that can generate a proof of any RISC-V program.
55

6+
# Shorthands
7+
8+
Use the `Makefile` to run the following commands from the root directory of the project:
9+
10+
```sh
11+
# runs tests on the merkle tree lib
12+
make test-merkle-tree-lib
13+
14+
# builds the main program (creates and sets `SP1_ELF_merkle-tree-program`)
15+
make build-program
16+
17+
# runs the main program with dummy data
18+
make run-program
19+
20+
### these output fixtures for evm-compatible proofs into
21+
### the ~/contracts/fixtures directory upon succesfully completing
22+
#
23+
# generates a core proof (more time-consuming) for groth16 + you need Docker running
24+
make execute-program-gen-core-proof-groth16
25+
# generates a core proof (more time-consuming) for plonk + you need Docker running
26+
make execute-program-gen-core-proof-plonk
27+
```
28+
629
## Requirements
730

831
- [Rust](https://rustup.rs/)
932
- [SP1](https://docs.succinct.xyz/getting-started/install.html)
33+
- Docker (for core proof generation)
1034

1135
## Running the Project
1236

@@ -73,7 +97,7 @@ cargo prove vkey --program fibonacci-program
7397

7498
## Using the Prover Network
7599

76-
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/generating-proofs/prover-network.html).
100+
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/generating-proofs/prover-network.html).~~ [this setup guide](https://docs.succinct.xyz/docs/generating-proofs/prover-network/key-setup).
77101

78102
To get started, copy the example environment file:
79103

@@ -91,6 +115,14 @@ command:
91115
SP1_PROVER=network SP1_PRIVATE_KEY=... cargo run --release --bin evm
92116
```
93117

94-
## Debugging Note
118+
## Notes
119+
120+
- If you are running this on MacOS M1 aarch64, don't use `zsh` as your shell. Use `bash` instead; `zsh` throws unintelligible errors.
121+
122+
## Next Steps
123+
124+
- Right now `~/lib` contains the old fibonacci program. `/~lib3` is the current refactoring effort to make this work for Merkle Trees.
125+
- There are some `.expect()` and `.unwrap()` calls in the code that should be handled more gracefully (marked with `// todo ...`s).
126+
- The `evm.rs` file should be generating fixtures for the EVM-compatible proof (output in `~/contracts/fixtures`), but I think my computer is running out of memory to do so; everything code-wise *seems* correct.
127+
- To deploy on their [Prover Network](https://docs.succinct.xyz/docs/generating-proofs/prover-network) you need to sign up for beta access! So, it could be worth [signing up for that](https://docs.google.com/forms/d/e/1FAIpQLSd-X9uH7G0bvXH_kjptnQtNil8L4dumrVPpFE4t8Ci1XT1GaQ/viewform) in case it takes a while. They claim this network is the best way to generate proofs for large, complex programs.
95128

96-
If you are running this on MacOS M1 aarch64, don't use `zsh` as your shell. Use `bash` instead; `zsh` throws unintelligible errors.

elf/riscv32im-succinct-zkvm-elf

97.3 KB
Binary file not shown.

lib2/Cargo.toml

Lines changed: 0 additions & 10 deletions
This file was deleted.

lib2/src/hash.rs

Lines changed: 0 additions & 59 deletions
This file was deleted.

lib2/src/lib.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

lib2/src/merkle_proof.rs

Lines changed: 0 additions & 16 deletions
This file was deleted.

lib2/src/merkle_tree.rs

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)