Skip to content

Commit abff009

Browse files
Merge d4b21f7 into 9588fd7
2 parents 9588fd7 + d4b21f7 commit abff009

File tree

102 files changed

+7947
-3015
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+7947
-3015
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: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ anvil_deploy_eigen_contracts:
7979
@echo "Deploying Eigen Contracts..."
8080
. contracts/scripts/anvil/deploy_eigen_contracts.sh
8181

82+
anvil_deploy_risc0_contracts:
83+
@echo "Deploying RISC0 Contracts..."
84+
. contracts/scripts/anvil/deploy_risc0_contracts.sh
85+
8286
anvil_deploy_sp1_contracts:
8387
@echo "Deploying SP1 Contracts..."
8488
. contracts/scripts/anvil/deploy_sp1_contracts.sh
@@ -155,11 +159,56 @@ anvil_start_with_more_prefunded_accounts:
155159
anvil --load-state contracts/scripts/anvil/state/alignedlayer-deployed-anvil-state.json --block-time 7 -a 2000
156160

157161
__AGGREGATION_MODE__: ## ____
158-
start_proof_aggregator_local: ## Start the proof aggregator locally using Mock Verifier Contract
159-
cargo run --manifest-path ./aggregation_mode/Cargo.toml --release -- config-files/config-proof-aggregator-mock.yaml
160162

161-
start_proof_aggregator_local_with_proving: ## Start the proof aggregator locally using SP1 Verifier Contract
162-
cargo run --manifest-path ./aggregation_mode/Cargo.toml --release --features prove -- config-files/config-proof-aggregator.yaml
163+
is_aggregator_set:
164+
@if [ -z "$(AGGREGATOR)" ]; then \
165+
echo "Error: AGGREGATOR is not set. Please provide arg AGGREGATOR='sp1' or 'risc0'."; \
166+
exit 1; \
167+
fi
168+
169+
reset_last_aggregated_block:
170+
@echo "Resetting last aggregated block..."
171+
@echo '{"last_aggregated_block":0}' > config-files/proof-aggregator.last_aggregated_block.json
172+
173+
start_proof_aggregator_dev: is_aggregator_set reset_last_aggregated_block ## Starts proof aggregator with mock proofs (DEV mode)
174+
AGGREGATOR=$(AGGREGATOR) RISC0_DEV_MODE=1 cargo run --manifest-path ./aggregation_mode/Cargo.toml --release --bin proof_aggregator -- config-files/config-proof-aggregator-mock.yaml
175+
176+
start_proof_aggregator: is_aggregator_set reset_last_aggregated_block ## Starts proof aggregator with proving activated
177+
AGGREGATOR=$(AGGREGATOR) cargo run --manifest-path ./aggregation_mode/Cargo.toml --release --features prove --bin proof_aggregator -- config-files/config-proof-aggregator.yaml
178+
179+
start_proof_aggregator_gpu: is_aggregator_set reset_last_aggregated_block ## Starts proof aggregator with proving + GPU acceleration (CUDA)
180+
AGGREGATOR=$(AGGREGATOR) SP1_PROVER=cuda cargo run --manifest-path ./aggregation_mode/Cargo.toml --release --features prove,gpu --bin proof_aggregator -- config-files/config-proof-aggregator.yaml
181+
182+
verify_aggregated_proof_sp1_holesky_stage:
183+
@echo "Verifying SP1 in aggregated proofs on holesky..."
184+
@cd batcher/aligned/ && \
185+
cargo run verify-agg-proof \
186+
--network holesky-stage \
187+
--from-block $(FROM_BLOCK) \
188+
--proving_system SP1 \
189+
--public_input ../../scripts/test_files/sp1/sp1_fibonacci_4_1_3.pub \
190+
--program-id-file ../../scripts/test_files/sp1/sp1_fibonacci_4_1_3.vk \
191+
--beacon_url $(BEACON_URL) \
192+
--rpc_url https://ethereum-holesky-rpc.publicnode.com
193+
194+
verify_aggregated_proof_risc0_holesky_stage:
195+
@echo "Verifying RISC0 in aggregated proofs on holesky..."
196+
@cd batcher/aligned/ && \
197+
cargo run verify-agg-proof \
198+
--network holesky-stage \
199+
--from-block $(FROM_BLOCK) \
200+
--proving_system Risc0 \
201+
--program-id-file ../../scripts/test_files/risc_zero/fibonacci_proof_generator/fibonacci_id_2_0.bin \
202+
--public_input ../../scripts/test_files/risc_zero/fibonacci_proof_generator/risc_zero_fibonacci_2_0.pub \
203+
--beacon_url $(BEACON_URL) \
204+
--rpc_url https://ethereum-holesky-rpc.publicnode.com
205+
206+
install_aggregation_mode: ## Install the aggregation mode with proving enabled
207+
cargo install --path aggregation_mode --features prove,gpu --bin proof_aggregator
208+
209+
agg_mode_write_program_ids: ## Write proof aggregator zkvm programs ids
210+
@cd aggregation_mode && \
211+
cargo run --release --bin write_program_image_id_vk_hash
163212

164213
_AGGREGATOR_:
165214

@@ -527,6 +576,11 @@ batcher_send_burst_groth16: batcher/target/release/aligned
527576
@mkdir -p scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs
528577
@./batcher/aligned/send_burst_tasks.sh $(BURST_SIZE) $(START_COUNTER)
529578

579+
batcher_send_proof_with_random_address:
580+
@cd batcher/aligned/ && ./send_proof_with_random_address.sh
581+
582+
batcher_send_burst_with_random_address:
583+
@cd batcher/aligned/ && ./send_burst_with_random_address.sh
530584

531585
__TASK_SENDER__:
532586
BURST_TIME_SECS ?= 3
@@ -704,12 +758,16 @@ deploy_proof_aggregator:
704758
@echo "Deploying ProofAggregator contract on $(NETWORK) network..."
705759
@. contracts/scripts/.env.$(NETWORK) && . contracts/scripts/deploy_proof_aggregator.sh
706760

761+
upgrade_proof_aggregator:
762+
@echo "Upgrading ProofAggregator Contract on $(NETWORK) network..."
763+
@. contracts/scripts/.env.$(NETWORK) && . contracts/scripts/upgrade_proof_aggregator.sh
764+
707765
build_aligned_contracts:
708-
@cd contracts/src/core && forge build
766+
@cd contracts/src/core && forge build --via-ir
709767

710768
show_aligned_error_codes:
711769
@echo "\nAlignedLayerServiceManager errors:"
712-
@cd contracts && forge inspect src/core/IAlignedLayerServiceManager.sol:IAlignedLayerServiceManager errors
770+
@cd contracts && forge inspect src/core/IAlignedLayerServiceManager.sol:IAlignedLayerServiceManager errors
713771
@echo "\nBatcherPaymentService errors:"
714772
@cd contracts && forge inspect src/core/BatcherPaymentService.sol:BatcherPaymentService errors
715773

0 commit comments

Comments
 (0)