Skip to content

Commit

Permalink
Merge a9e2cbb into 916a171
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielbosio authored Oct 8, 2024
2 parents 916a171 + a9e2cbb commit 1928ba1
Show file tree
Hide file tree
Showing 93 changed files with 4,588 additions and 3,725 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build-rust-projects
name: build-and-test-rust-projects

on:
merge_group:
Expand Down Expand Up @@ -46,3 +46,30 @@ jobs:
run: |
cd batcher
cargo build --all
test:
runs-on: ubuntu-custom
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
override: true
- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
batcher/target
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-rust-
- name: Run tests
run: |
cd batcher
cargo test --all
59 changes: 40 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ OS := $(shell uname -s)
CONFIG_FILE?=config-files/config.yaml
AGG_CONFIG_FILE?=config-files/config-aggregator.yaml

OPERATOR_VERSION=v0.7.2
OPERATOR_VERSION=v0.8.0

ifeq ($(OS),Linux)
BUILD_ALL_FFI = $(MAKE) build_all_ffi_linux
Expand Down Expand Up @@ -112,7 +112,7 @@ operator_register_and_start: operator_full_registration operator_start

build_operator: deps
@echo "Building Operator..."
@go build -ldflags "-X main.Version=$(OPERATOR_VERSION)" -o ./operator/build/aligned-operator ./operator/cmd/main.go
@go build -ldflags "-X main.Version=$(OPERATOR_VERSION) -r $(LD_LIBRARY_PATH):$(CURDIR)/operator/risc_zero/lib" -o ./operator/build/aligned-operator ./operator/cmd/main.go
@echo "Operator built into /operator/build/aligned-operator"

update_operator:
Expand All @@ -121,6 +121,22 @@ update_operator:
@make build_operator
@./operator/build/aligned-operator --version

operator_valid_marshall_fuzz_macos:
@cd operator/pkg && go test -fuzz=FuzzValidMarshall -ldflags=-extldflags=-Wl,-ld_classic

operator_valid_marshall_fuzz_linux:
@cd operator/pkg && \
LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(CURDIR)/operator/risc_zero/lib \
go test -fuzz=FuzzValidMarshall

operator_marshall_unmarshall_fuzz_macos:
@cd operator/pkg && go test -fuzz=FuzzMarshalUnmarshal -ldflags=-extldflags=-Wl,-ld_classic

operator_marshall_unmarshall_fuzz_linux:
@cd operator/pkg && \
LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(CURDIR)/operator/risc_zero/lib \
go test -fuzz=FuzzMarshalUnmarshal

bindings:
cd contracts && ./generate-go-bindings.sh

Expand Down Expand Up @@ -159,6 +175,12 @@ operator_whitelist_devnet:
@echo "Operator address: $(OPERATOR_ADDRESS)"
RPC_URL="http://localhost:8545" PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" OUTPUT_PATH=./script/output/devnet/alignedlayer_deployment_output.json ./contracts/scripts/whitelist_operator.sh $(OPERATOR_ADDRESS)

operator_remove_devnet:
@echo "Removing operator"
$(eval OPERATOR_ADDRESS = $(shell yq -r '.operator.address' $(CONFIG_FILE)))
@echo "Operator address: $(OPERATOR_ADDRESS)"
RPC_URL="http://localhost:8545" PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" OUTPUT_PATH=./script/output/devnet/alignedlayer_deployment_output.json ./contracts/scripts/remove_operator.sh $(OPERATOR_ADDRESS)

operator_whitelist:
@echo "Whitelisting operator $(OPERATOR_ADDRESS)"
@. contracts/scripts/.env && . contracts/scripts/whitelist_operator.sh $(OPERATOR_ADDRESS)
Expand Down Expand Up @@ -226,7 +248,7 @@ batcher/target/release/aligned:


RPC_URL=http://localhost:8545
BATCHER_PAYMENTS_CONTRACT_ADDRESS=0x7969c5eD335650692Bc04293B07F5BF2e7A673C0
NETWORK=devnet # devnet | holesky-stage | holesky

batcher_send_sp1_task:
@echo "Sending SP1 fibonacci task to Batcher..."
Expand All @@ -236,7 +258,7 @@ batcher_send_sp1_task:
--vm_program ../../scripts/test_files/sp1/sp1_fibonacci.elf \
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657 \
--rpc_url $(RPC_URL) \
--payment_service_addr $(BATCHER_PAYMENTS_CONTRACT_ADDRESS)
--network $(NETWORK)

batcher_send_sp1_burst:
@echo "Sending SP1 fibonacci task to Batcher..."
Expand All @@ -247,7 +269,7 @@ batcher_send_sp1_burst:
--repetitions $(BURST_SIZE) \
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657 \
--rpc_url $(RPC_URL) \
--payment_service_addr $(BATCHER_PAYMENTS_CONTRACT_ADDRESS)
--network $(NETWORK)

batcher_send_infinite_sp1:
@echo "Sending infinite SP1 fibonacci task to Batcher..."
Expand All @@ -262,7 +284,7 @@ batcher_send_risc0_task:
--public_input ../../scripts/test_files/risc_zero/fibonacci_proof_generator/risc_zero_fibonacci.pub \
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657 \
--rpc_url $(RPC_URL) \
--payment_service_addr $(BATCHER_PAYMENTS_CONTRACT_ADDRESS)
--network $(NETWORK)

batcher_send_risc0_burst:
@echo "Sending Risc0 fibonacci task to Batcher..."
Expand All @@ -274,7 +296,7 @@ batcher_send_risc0_burst:
--repetitions $(BURST_SIZE) \
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657 \
--rpc_url $(RPC_URL) \
--payment_service_addr $(BATCHER_PAYMENTS_CONTRACT_ADDRESS)
--network $(NETWORK)

batcher_send_plonk_bn254_task: batcher/target/release/aligned
@echo "Sending Groth16Bn254 1!=0 task to Batcher..."
Expand All @@ -285,7 +307,7 @@ batcher_send_plonk_bn254_task: batcher/target/release/aligned
--vk ../../scripts/test_files/gnark_plonk_bn254_script/plonk.vk \
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657 \
--rpc_url $(RPC_URL) \
--payment_service_addr $(BATCHER_PAYMENTS_CONTRACT_ADDRESS)
--network $(NETWORK)

batcher_send_plonk_bn254_burst: batcher/target/release/aligned
@echo "Sending Groth16Bn254 1!=0 task to Batcher..."
Expand All @@ -297,7 +319,7 @@ batcher_send_plonk_bn254_burst: batcher/target/release/aligned
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657 \
--rpc_url $(RPC_URL) \
--repetitions 4 \
--payment_service_addr $(BATCHER_PAYMENTS_CONTRACT_ADDRESS)
--network $(NETWORK)

batcher_send_plonk_bls12_381_task: batcher/target/release/aligned
@echo "Sending Groth16 BLS12-381 1!=0 task to Batcher..."
Expand All @@ -308,7 +330,7 @@ batcher_send_plonk_bls12_381_task: batcher/target/release/aligned
--vk ../../scripts/test_files/gnark_plonk_bls12_381_script/plonk.vk \
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657 \
--rpc_url $(RPC_URL) \
--payment_service_addr $(BATCHER_PAYMENTS_CONTRACT_ADDRESS)
--network $(NETWORK)

batcher_send_plonk_bls12_381_burst: batcher/target/release/aligned
@echo "Sending Groth16 BLS12-381 1!=0 task to Batcher..."
Expand All @@ -320,8 +342,7 @@ batcher_send_plonk_bls12_381_burst: batcher/target/release/aligned
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657 \
--repetitions 15 \
--rpc_url $(RPC_URL) \
--payment_service_addr $(BATCHER_PAYMENTS_CONTRACT_ADDRESS)

--network $(NETWORK)

batcher_send_groth16_bn254_task: batcher/target/release/aligned
@echo "Sending Groth16Bn254 1!=0 task to Batcher..."
Expand All @@ -332,7 +353,7 @@ batcher_send_groth16_bn254_task: batcher/target/release/aligned
--vk ../../scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs/ineq_1_groth16.vk \
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657 \
--rpc_url $(RPC_URL) \
--payment_service_addr $(BATCHER_PAYMENTS_CONTRACT_ADDRESS)
--network $(NETWORK)

batcher_send_infinite_groth16: batcher/target/release/aligned ## Send a different Groth16 BN254 proof using the client every 3 seconds
@mkdir -p scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs
Expand All @@ -352,7 +373,7 @@ batcher_send_halo2_ipa_task: batcher/target/release/aligned
--public_input ../../scripts/test_files/halo2_ipa/pub_input.bin \
--vk ../../scripts/test_files/halo2_ipa/params.bin \
--rpc_url $(RPC_URL) \
--payment_service_addr $(BATCHER_PAYMENTS_CONTRACT_ADDRESS)
--network $(NETWORK)

batcher_send_halo2_ipa_task_burst_5: batcher/target/release/aligned
@echo "Sending Halo2 IPA 1!=0 task to Batcher..."
Expand All @@ -363,7 +384,7 @@ batcher_send_halo2_ipa_task_burst_5: batcher/target/release/aligned
--vk ../../scripts/test_files/halo2_ipa/params.bin \
--repetitions 5 \
--rpc_url $(RPC_URL) \
--payment_service_addr $(BATCHER_PAYMENTS_CONTRACT_ADDRESS)
--network $(NETWORK)

batcher_send_halo2_kzg_task: batcher/target/release/aligned
@echo "Sending Halo2 KZG 1!=0 task to Batcher..."
Expand All @@ -374,7 +395,7 @@ batcher_send_halo2_kzg_task: batcher/target/release/aligned
--vk ../../scripts/test_files/halo2_kzg/params.bin \
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657 \
--rpc_url $(RPC_URL) \
--payment_service_addr $(BATCHER_PAYMENTS_CONTRACT_ADDRESS)
--network $(NETWORK)

batcher_send_halo2_kzg_task_burst_5: batcher/target/release/aligned
@echo "Sending Halo2 KZG 1!=0 task to Batcher..."
Expand All @@ -386,7 +407,7 @@ batcher_send_halo2_kzg_task_burst_5: batcher/target/release/aligned
--repetitions 5 \
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657 \
--rpc_url $(RPC_URL) \
--payment_service_addr $(BATCHER_PAYMENTS_CONTRACT_ADDRESS)
--network $(NETWORK)

batcher_send_mina_task:
@echo "Sending Mina state task to Batcher..."
Expand Down Expand Up @@ -509,9 +530,9 @@ build_aligned_contracts:

show_aligned_error_codes:
@echo "\nAlignedLayerServiceManager errors:"
@cd contracts/src/core && forge inspect IAlignedLayerServiceManager.sol:IAlignedLayerServiceManager errors
@cd contracts && forge inspect src/core/IAlignedLayerServiceManager.sol:IAlignedLayerServiceManager errors
@echo "\nBatcherPaymentService errors:"
@cd contracts/src/core && forge inspect BatcherPaymentService.sol:BatcherPaymentService errors
@cd contracts && forge inspect src/core/BatcherPaymentService.sol:BatcherPaymentService errors

__BUILD__:
build_binaries:
Expand Down
Loading

0 comments on commit 1928ba1

Please sign in to comment.