Skip to content

Commit 0fac425

Browse files
taturosatiMauroToscanojotabulacios
authored
chore: update sp1 version + use compressed sp1 proofs + docs to generate sp1 proofs and verify them on aligned (#240)
Co-authored-by: Mauro Toscano <12560266+MauroToscano@users.noreply.github.com> Co-authored-by: jotabulacios <jbulacios@fi.uba.ar>
1 parent 41d0cca commit 0fac425

26 files changed

Lines changed: 3128 additions & 3127 deletions

File tree

.github/workflows/test-sp1.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,12 @@ jobs:
1111
test:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: Clear device space
15-
run: |
16-
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
17-
sudo rm -rf /usr/local/lib/android
18-
sudo rm -rf /opt/ghc
19-
sudo rm -rf /usr/local/.ghcup
20-
sudo rm -rf /usr/share/dotnet
21-
sudo rm -rf /opt/ghc
22-
sudo rm -rf "/usr/local/share/boost"
2314
- uses: actions/checkout@v4
2415
- uses: actions/setup-go@v5
2516
with:
2617
go-version: '1.22'
2718
cache: false
28-
19+
- name: Test SP1 Rust
20+
run: make test_sp1_rust_ffi
2921
- name: Test SP1 go bindings
3022
run: make test_sp1_go_bindings_linux

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,12 +403,10 @@ __SP1_FFI__: ##
403403
build_sp1_macos:
404404
@cd operator/sp1/lib && cargo build --release
405405
@cp operator/sp1/lib/target/release/libsp1_verifier_ffi.dylib operator/sp1/lib/libsp1_verifier.dylib
406-
@cp operator/sp1/lib/target/release/libsp1_verifier_ffi.a operator/sp1/lib/libsp1_verifier.a
407406

408407
build_sp1_linux:
409408
@cd operator/sp1/lib && cargo build --release
410409
@cp operator/sp1/lib/target/release/libsp1_verifier_ffi.so operator/sp1/lib/libsp1_verifier.so
411-
@cp operator/sp1/lib/target/release/libsp1_verifier_ffi.a operator/sp1/lib/libsp1_verifier.a
412410

413411
test_sp1_rust_ffi:
414412
@echo "Testing SP1 Rust FFI source code..."

README.md

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,8 +763,6 @@ If you want to have some data to see on it, you can start our infinite task send
763763
make batcher_send_burst_groth16
764764
```
765765

766-
</details>
767-
768766
## Tests
769767

770768
To run the go tests
@@ -773,6 +771,50 @@ To run the go tests
773771
make test
774772
```
775773

774+
# Verify Proofs
775+
776+
## SP1
777+
778+
### Dependencies
779+
This guide assumes that:
780+
- sp1 prover installed (instructions [here](https://succinctlabs.github.io/sp1/getting-started/install.html))
781+
- sp1 project to generate the proofs (instructions [here](https://succinctlabs.github.io/sp1/generating-proofs/setup.html))
782+
- aligned layer repository cloned:
783+
```bash
784+
git clone https://github.com/yetanotherco/aligned_layer.git
785+
```
786+
787+
### How to generate a proof
788+
789+
> AlignedLayer only verifies SP1 in compressed version.
790+
> You can check you are using compressed by opening script/src/main.rs
791+
and check that the proof is generated with `client.prove_compressed` instead of `client.prove`.
792+
793+
First, open a terminal and navigate to the script folder in the sp1 project directory
794+
795+
Then, run the following command to generate a proof:
796+
```bash
797+
cargo run --release
798+
```
799+
800+
### How to get the proof verified by AlignedLayer
801+
802+
After generating the proof, you will have to find two different files:
803+
- proof file: usually found under `script` directory, with the name `proof.json` or similar
804+
- elf file: usually found under `program/elf/` directory
805+
806+
Then, you can send the proof to the AlignedLayer network by running the following command
807+
from `batcher/client` folder inside the AlignedLayer repository directory:
808+
809+
```bash
810+
cargo run --release -- \
811+
--proving_system SP1 \
812+
--proof <proof_path> \
813+
--vm_program <vm_program_path> \
814+
--conn wss://batcher.alignedlayer.com \
815+
--proof_generator_addr <proof_generator_addr>
816+
```
817+
776818
## FAQ
777819

778820
### What is the objective of Aligned?

0 commit comments

Comments
 (0)