Skip to content

Commit 2e8796f

Browse files
feat(agg-mode): support risc0 stark proofs (#1874)
1 parent 837b4fb commit 2e8796f

29 files changed

+3762
-237
lines changed

.github/workflows/build-and-test-rust.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ jobs:
3131
source /home/runner/.bashrc
3232
~/.sp1/bin/sp1up
3333
34+
- name: Install risc0 toolchain
35+
run: |
36+
curl -L https://risczero.com/install | bash
37+
source ~/.bashrc
38+
~/.risc0/bin/rzup install
39+
3440
- name: Cache Rust dependencies
3541
uses: actions/cache@v3
3642
with:
@@ -70,7 +76,8 @@ jobs:
7076
- name: Run Clippy on AggregationMode
7177
run: |
7278
cd aggregation_mode
73-
cargo clippy --all -- -D warnings
79+
# We need to skip the build as clippy does not support the riscv32im-risc0-zkvm-elf target
80+
RISC0_SKIP_BUILD=1 cargo clippy --all -- -D warnings
7481
7582
test:
7683
runs-on: aligned-runner
@@ -89,6 +96,12 @@ jobs:
8996
source /home/runner/.bashrc
9097
~/.sp1/bin/sp1up
9198
99+
- name: Install risc0 toolchain
100+
run: |
101+
curl -L https://risczero.com/install | bash
102+
source ~/.bashrc
103+
~/.risc0/bin/rzup install
104+
92105
- name: Cache Rust dependencies
93106
uses: actions/cache@v3
94107
with:

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@
3434
[submodule "contracts/lib/sp1-contracts"]
3535
path = contracts/lib/sp1-contracts
3636
url = https://github.com/succinctlabs/sp1-contracts
37+
[submodule "contracts/lib/risc0-ethereum"]
38+
path = contracts/lib/risc0-ethereum
39+
url = https://github.com/risc0/risc0-ethereum

Makefile

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,21 @@ anvil_start_with_more_prefunded_accounts:
151151
anvil --load-state contracts/scripts/anvil/state/alignedlayer-deployed-anvil-state.json --block-time 7 -a 2000
152152

153153
__AGGREGATION_MODE__: ## ____
154-
start_proof_aggregator_local: ## Start the proof aggregator locally using Mock Verifier Contract
155-
cargo run --manifest-path ./aggregation_mode/Cargo.toml --release -- config-files/config-proof-aggregator-mock.yaml
156154

157-
start_proof_aggregator_local_with_proving: ## Start the proof aggregator locally using SP1 Verifier Contract
158-
cargo run --manifest-path ./aggregation_mode/Cargo.toml --release --features prove -- config-files/config-proof-aggregator.yaml
155+
is_aggregator_set:
156+
@if [ -z "$(AGGREGATOR)" ]; then \
157+
echo "Error: AGGREGATOR is not set. Please provide arg AGGREGATOR='sp1' or 'risc0'."; \
158+
exit 1; \
159+
fi
160+
161+
start_proof_aggregator_dev: is_aggregator_set ## Starts proof aggregator with mock proofs (DEV mode)
162+
AGGREGATOR=$(AGGREGATOR) RISC0_DEV_MODE=1 cargo run --manifest-path ./aggregation_mode/Cargo.toml --release -- config-files/config-proof-aggregator-mock.yaml
163+
164+
start_proof_aggregator: is_aggregator_set ## Starts proof aggregator with proving activated
165+
AGGREGATOR=$(AGGREGATOR) cargo run --manifest-path ./aggregation_mode/Cargo.toml --release --features prove -- config-files/config-proof-aggregator.yaml
166+
167+
start_proof_aggregator_gpu: is_aggregator_set ## Starts proof aggregator with proving + GPU acceleration (CUDA)
168+
AGGREGATOR=$(AGGREGATOR) SP1_PROVER=cuda cargo run --manifest-path ./aggregation_mode/Cargo.toml --release --features prove,gpu -- config-files/config-proof-aggregator.yaml
159169

160170
_AGGREGATOR_:
161171

@@ -699,11 +709,11 @@ deploy_proof_aggregator:
699709
@. contracts/scripts/.env.$(NETWORK) && . contracts/scripts/deploy_proof_aggregator.sh
700710

701711
build_aligned_contracts:
702-
@cd contracts/src/core && forge build
712+
@cd contracts/src/core && forge build --via-ir
703713

704714
show_aligned_error_codes:
705715
@echo "\nAlignedLayerServiceManager errors:"
706-
@cd contracts && forge inspect src/core/IAlignedLayerServiceManager.sol:IAlignedLayerServiceManager errors
716+
@cd contracts && forge inspect src/core/IAlignedLayerServiceManager.sol:IAlignedLayerServiceManager errors
707717
@echo "\nBatcherPaymentService errors:"
708718
@cd contracts && forge inspect src/core/BatcherPaymentService.sol:BatcherPaymentService errors
709719

0 commit comments

Comments
 (0)