Skip to content

Commit

Permalink
v0.7.0 (#980)
Browse files Browse the repository at this point in the history
Co-authored-by: Julian Arce <52429267+JuArce@users.noreply.github.com>
Co-authored-by: Nicolas Rampoldi <58613770+NicolasRampoldi@users.noreply.github.com>
Co-authored-by: Urix <43704209+uri-99@users.noreply.github.com>
Co-authored-by: Gian <58370608+glpecile@users.noreply.github.com>
Co-authored-by: cliraa <113949669+cliraa@users.noreply.github.com>
Co-authored-by: Mariano A. Nicolini <mariano.nicolini.91@gmail.com>
Co-authored-by: Tatu <65305492+srosati@users.noreply.github.com>
Co-authored-by: Diego K <43053772+diegokingston@users.noreply.github.com>
Co-authored-by: PatStiles <33334338+PatStiles@users.noreply.github.com>
Co-authored-by: Tatu <65305492+taturosati@users.noreply.github.com>
Co-authored-by: taturosati <“taturosati@users.noreply.github.com”>
Co-authored-by: taturosati <taturosati@users.noreply.github.com>
Co-authored-by: Santos Rosati <rosatisantos@gmail.com>
  • Loading branch information
14 people authored Sep 19, 2024
1 parent 1876fd0 commit 453d9b4
Show file tree
Hide file tree
Showing 173 changed files with 9,881 additions and 2,296 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
run: make build_halo2_ipa_linux
- name: Build Merkle Tree bindings
run: make build_merkle_tree_linux
- name: Build Old Merkle Tree bindings
run: make build_merkle_tree_linux_old
- name: Build operator
run: go build operator/cmd/main.go
- name: Build aggregator
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: aligned-runner

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/explorer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
ssh -o "StrictHostKeyChecking=no" ${USERNAME}@${HOST_NAME} "
cd ${APP_DIR} &&
git fetch &&
git reset --hard HEAD &&
git clean -fd &&
git checkout ${REF} &&
git pull &&
sudo systemctl restart ${SERVICE_NAME}
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/lint-contracts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Lint contracts
on:
push:
branches: [main]
pull_request:
branches: ["*"]
paths:
- "contracts/src/core/*.sol"
- ".github/workflows/lint-contracts.yml"

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install dependencies
run: npm install
working-directory: contracts

- name: Run Solhint
run: npm run lint:sol
working-directory: contracts
52 changes: 26 additions & 26 deletions .github/workflows/test-risc-zero.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@ on:
pull_request:
branches: ["*"]
paths:
- 'operator/risc_zero/**'
- '.github/workflows/test-risc-zero.yml'
- "operator/risc_zero/**"
- ".github/workflows/test-risc-zero.yml"

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Clear device space
run: |
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/.ghcup
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: false
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Test Risc Zero Rust
run: make test_risc_zero_rust_ffi
- name: Test Risc Zero go bindings
run: make test_risc_zero_go_bindings_linux
test:
runs-on: ubuntu-latest
steps:
- name: Clear device space
run: |
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/.ghcup
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
cache: false
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Test Risc Zero Rust
run: make test_risc_zero_rust_ffi
- name: Test Risc Zero go bindings
run: make test_risc_zero_go_bindings_linux
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@
[submodule "examples/validating-public-input/contracts/lib/forge-std"]
path = examples/validating-public-input/contracts/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "contracts/lib/openzeppelin-contracts"]
path = contracts/lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "contracts/lib/openzeppelin-contracts-upgradeable"]
path = contracts/lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
81 changes: 68 additions & 13 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.5.2
OPERATOR_VERSION=v0.7.0

ifeq ($(OS),Linux)
BUILD_ALL_FFI = $(MAKE) build_all_ffi_linux
Expand Down Expand Up @@ -55,6 +55,10 @@ anvil_upgrade_aligned_contracts:
@echo "Upgrading Aligned Contracts..."
. contracts/scripts/anvil/upgrade_aligned_contracts.sh

anvil_upgrade_batcher_payment_service:
@echo "Upgrading BatcherPayments contract..."
. contracts/scripts/anvil/upgrade_batcher_payment_service.sh

anvil_upgrade_registry_coordinator:
@echo "Upgrading Registry Coordinator Contracts..."
. contracts/scripts/anvil/upgrade_registry_coordinator.sh
Expand All @@ -71,6 +75,17 @@ anvil_upgrade_index_registry:
@echo "Upgrading Index Registry Contracts..."
. contracts/scripts/anvil/upgrade_index_registry.sh

anvil_upgrade_add_aggregator:
@echo "Adding Aggregator to Aligned Contracts..."
. contracts/scripts/anvil/upgrade_add_aggregator_to_service_manager.sh

anvil_add_type_hash_to_batcher_payment_service:
@echo "Adding Type Hash to Batcher Payment Service..."
. contracts/scripts/anvil/upgrade_add_type_hash_to_batcher_payment_service.sh

lint_contracts:
@cd contracts && npm run lint:sol

anvil_start:
@echo "Starting Anvil..."
anvil --load-state contracts/scripts/anvil/state/alignedlayer-deployed-anvil-state.json
Expand Down Expand Up @@ -136,7 +151,7 @@ operator_register_with_eigen_layer:

operator_mint_mock_tokens:
@echo "Minting tokens"
. ./scripts/mint_mock_token.sh $(CONFIG_FILE) 1000
. ./scripts/mint_mock_token.sh $(CONFIG_FILE) 100000000000000000

operator_whitelist_devnet:
@echo "Whitelisting operator"
Expand All @@ -155,7 +170,7 @@ operator_deposit_into_mock_strategy:
@go run operator/cmd/main.go deposit-into-strategy \
--config $(CONFIG_FILE) \
--strategy-address $(STRATEGY_ADDRESS) \
--amount 1000
--amount 100000000000000000

operator_deposit_into_strategy:
@echo "Depositing into strategy"
Expand Down Expand Up @@ -229,7 +244,7 @@ batcher_send_sp1_burst:
--proving_system SP1 \
--proof ../../scripts/test_files/sp1/sp1_fibonacci.proof \
--vm_program ../../scripts/test_files/sp1/sp1_fibonacci.elf \
--repetitions 15 \
--repetitions $(BURST_SIZE) \
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657 \
--rpc_url $(RPC_URL) \
--payment_service_addr $(BATCHER_PAYMENTS_CONTRACT_ADDRESS)
Expand All @@ -256,7 +271,7 @@ batcher_send_risc0_burst:
--proof ../../scripts/test_files/risc_zero/fibonacci_proof_generator/risc_zero_fibonacci.proof \
--vm_program ../../scripts/test_files/risc_zero/fibonacci_proof_generator/fibonacci_id.bin \
--public_input ../../scripts/test_files/risc_zero/fibonacci_proof_generator/risc_zero_fibonacci.pub \
--repetitions 15 \
--repetitions $(BURST_SIZE) \
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657 \
--rpc_url $(RPC_URL) \
--payment_service_addr $(BATCHER_PAYMENTS_CONTRACT_ADDRESS)
Expand All @@ -281,6 +296,7 @@ batcher_send_plonk_bn254_burst: batcher/target/release/aligned
--vk ../../scripts/test_files/gnark_plonk_bn254_script/plonk.vk \
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657 \
--rpc_url $(RPC_URL) \
--repetitions 4 \
--payment_service_addr $(BATCHER_PAYMENTS_CONTRACT_ADDRESS)

batcher_send_plonk_bls12_381_task: batcher/target/release/aligned
Expand Down Expand Up @@ -426,6 +442,14 @@ upgrade_stake_registry: ## Upgrade Stake Registry
@echo "Upgrading Stake Registry..."
@. contracts/scripts/.env && . contracts/scripts/upgrade_stake_registry.sh

upgrade_add_aggregator: ## Add Aggregator to Aligned Contracts
@echo "Adding Aggregator to Aligned Contracts..."
@. contracts/scripts/.env && . contracts/scripts/upgrade_add_aggregator_to_service_manager.sh

upgrade_batcher_payments_add_type_hash: ## Add Type Hash to Batcher Payment Service
@echo "Adding Type Hash to Batcher Payment Service..."
@. contracts/scripts/.env && . contracts/scripts/upgrade_add_type_hash_to_batcher_payment_service.sh

deploy_verify_batch_inclusion_caller:
@echo "Deploying VerifyBatchInclusionCaller contract..."
@. examples/verify/.env && . examples/verify/scripts/deploy_verify_batch_inclusion_caller.sh
Expand All @@ -441,6 +465,12 @@ upgrade_batcher_payment_service:
build_aligned_contracts:
@cd contracts/src/core && forge build

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

__BUILD__:
build_binaries:
@echo "Building aggregator..."
Expand Down Expand Up @@ -497,6 +527,7 @@ test_risc_zero_go_bindings_macos: build_risc_zero_macos

test_risc_zero_go_bindings_linux: build_risc_zero_linux
@echo "Testing RISC Zero Go bindings..."
LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(CURDIR)/operator/risc_zero/lib \
go test ./operator/risc_zero/... -v

generate_risc_zero_fibonacci_proof:
Expand All @@ -510,15 +541,29 @@ build_merkle_tree_macos:
@cp operator/merkle_tree/lib/target/$(TARGET_REL_PATH)/libmerkle_tree.dylib operator/merkle_tree/lib/libmerkle_tree.dylib
@cp operator/merkle_tree/lib/target/$(TARGET_REL_PATH)/libmerkle_tree.a operator/merkle_tree/lib/libmerkle_tree.a

build_merkle_tree_macos_old:
@cd operator/merkle_tree_old/lib && cargo build $(RELEASE_FLAG)
@cp operator/merkle_tree_old/lib/target/$(TARGET_REL_PATH)/libmerkle_tree.dylib operator/merkle_tree_old/lib/libmerkle_tree.dylib
@cp operator/merkle_tree_old/lib/target/$(TARGET_REL_PATH)/libmerkle_tree.a operator/merkle_tree_old/lib/libmerkle_tree.a

build_merkle_tree_linux:
@cd operator/merkle_tree/lib && cargo build $(RELEASE_FLAG)
@cp operator/merkle_tree/lib/target/$(TARGET_REL_PATH)/libmerkle_tree.so operator/merkle_tree/lib/libmerkle_tree.so
@cp operator/merkle_tree/lib/target/$(TARGET_REL_PATH)/libmerkle_tree.a operator/merkle_tree/lib/libmerkle_tree.a

build_merkle_tree_linux_old:
@cd operator/merkle_tree_old/lib && cargo build $(RELEASE_FLAG)
@cp operator/merkle_tree_old/lib/target/$(TARGET_REL_PATH)/libmerkle_tree.so operator/merkle_tree_old/lib/libmerkle_tree.so
@cp operator/merkle_tree_old/lib/target/$(TARGET_REL_PATH)/libmerkle_tree.a operator/merkle_tree_old/lib/libmerkle_tree.a

test_merkle_tree_rust_ffi:
@echo "Testing Merkle Tree Rust FFI source code..."
@cd operator/merkle_tree/lib && RUST_MIN_STACK=83886080 cargo t --release

test_merkle_tree_rust_ffi_old:
@echo "Testing Old Merkle Tree Rust FFI source code..."
@cd operator/merkle_tree_old/lib && RUST_MIN_STACK=83886080 cargo t --release

test_merkle_tree_go_bindings_macos: build_merkle_tree_macos
@echo "Testing Merkle Tree Go bindings..."
go test ./operator/merkle_tree/... -v
Expand All @@ -527,6 +572,14 @@ test_merkle_tree_go_bindings_linux: build_merkle_tree_linux
@echo "Testing Merkle Tree Go bindings..."
go test ./operator/merkle_tree/... -v

test_merkle_tree_old_go_bindings_macos: build_merkle_tree_macos_old
@echo "Testing Old Merkle Tree Go bindings..."
go test ./operator/merkle_tree_old/... -v

test_merkle_tree_go_bindings_linux_old: build_merkle_tree_linux_old
@echo "Testing Merkle Tree Go bindings..."
go test ./operator/merkle_tree_old/... -v

__HALO2_KZG_FFI__: ##
build_halo2_kzg_macos:
@cd operator/halo2kzg/lib && cargo build $(RELEASE_FLAG)
Expand Down Expand Up @@ -601,6 +654,7 @@ build_all_ffi_macos: ## Build all FFIs for macOS
@$(MAKE) build_sp1_macos
@$(MAKE) build_risc_zero_macos
@$(MAKE) build_merkle_tree_macos
@$(MAKE) build_merkle_tree_macos_old
@$(MAKE) build_halo2_ipa_macos
@$(MAKE) build_halo2_kzg_macos
@echo "All macOS FFIs built successfully."
Expand All @@ -610,45 +664,46 @@ build_all_ffi_linux: ## Build all FFIs for Linux
@$(MAKE) build_sp1_linux
@$(MAKE) build_risc_zero_linux
@$(MAKE) build_merkle_tree_linux
@$(MAKE) build_merkle_tree_linux_old
@$(MAKE) build_halo2_ipa_linux
@$(MAKE) build_halo2_kzg_linux
@echo "All Linux FFIs built successfully."


__EXPLORER__:
run_explorer: run_db ecto_setup_db
run_explorer: explorer_run_db explorer_ecto_setup_db
@cd explorer/ && \
pnpm install --prefix assets && \
mix setup && \
./start.sh

build_db:
explorer_build_db:
@cd explorer && \
docker build -t explorer-postgres-image .

run_db: remove_db_container
explorer_run_db: explorer_remove_db_container
@cd explorer && \
docker run -d --name explorer-postgres-container -p 5432:5432 -v explorer-postgres-data:/var/lib/postgresql/data explorer-postgres-image

ecto_setup_db:
explorer_ecto_setup_db:
@cd explorer/ && \
./ecto_setup_db.sh

remove_db_container:
explorer_remove_db_container:
@cd explorer && \
docker stop explorer-postgres-container || true && \
docker rm explorer-postgres-container || true

clean_db: remove_db_container
explorer_clean_db: explorer_remove_db_container
@cd explorer && \
docker volume rm explorer-postgres-data || true

dump_db:
explorer_dump_db:
@cd explorer && \
docker exec -t explorer-postgres-container pg_dumpall -c -U explorer_user > dump.$$(date +\%Y\%m\%d_\%H\%M\%S).sql
@echo "Dumped database successfully to /explorer"

recover_db: run_db
explorer_recover_db: explorer_run_db
@read -p $$'\e[32mEnter the dump file to recover (e.g., dump.20230607_123456.sql): \e[0m' DUMP_FILE && \
cd explorer && \
docker cp $$DUMP_FILE explorer-postgres-container:/dump.sql && \
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- [Aligned Infrastructure Guide](#aligned-infrastructure-guide)
- [Submitting Proofs to Aligned](#submitting-proofs-to-aligned)
- [Integrating Aligned into your Project](#integrating-aligned-into-your-project)
- [Versioning and Networks](#versioning-and-networks)


## The Project
Expand Down Expand Up @@ -181,3 +182,11 @@ For submitting proofs generated by your own project to the network via CLI, see
## Integrating Aligned into your Project
If you are developing applications using Aligned, we offer a [Rust-SDK](docs/3_guides/1_SDK_how_to.md) for submitting proofs directly to the network within your applications.
## Versioning and Networks
Testnet code and documentation is always in sync with the default [Testnet Branch](https://github.com/yetanotherco/aligned_layer/tree/feat/testnet)
Releases are provided for each version of the testnet.
Latest version of the code, deployed on staging network, is always on [Staging Branch](https://github.com/yetanotherco/aligned_layer/tree/feat/staging)
Loading

0 comments on commit 453d9b4

Please sign in to comment.