-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: Set up node project based on incredible-squaring-avs * test: Add mocks * test: Add unit tests * test: Add integration tests * test: Add anvil test scripts and states * feat: Update bindings and add clean up to binding generation script * docs: Fix QuorumThresholdPercentage in docs * test: Add unit and integration test workflows * test: Print error on advanceChain error * test: Install npm dependencies in integration test workflow * fix: Fix utils setup contracts path * fix: Temporarily change quorum threshold denominator to 100 eigensdk currently hardcodes the denominator to 100 * test: Add contracts unit tests workflow * fix: Fix contracts path on bindings generation script * refactor: Rename cstaskmanager to taskmanager * feat: Update contract bindings
- Loading branch information
Showing
72 changed files
with
13,984 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: contracts-forge-tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
Test: | ||
name: Contracts Forge Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20.x' | ||
|
||
- name: Install npm dependencies | ||
run: npm ci | ||
working-directory: ./contracts/evm | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Install forge dependencies | ||
run: forge install | ||
working-directory: ./contracts/evm | ||
|
||
- name: Run tests | ||
run: forge test -vvv --no-match-contract FFI | ||
working-directory: ./contracts/evm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
name: integration-tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
Test: | ||
name: Integration Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21' | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20.x' | ||
|
||
- name: Install npm dependencies | ||
run: npm ci | ||
working-directory: ./contracts/evm | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
- name: Install forge dependencies | ||
run: forge install | ||
working-directory: ./contracts/evm | ||
|
||
- name: Test | ||
run: make tests-integration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: unit-tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
Test: | ||
name: Unit Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21' | ||
- name: Test | ||
run: make tests-unit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,34 @@ | ||
# If you prefer the allow list template instead of the deny list, see community template: | ||
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore | ||
# | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
# Go workspace file | ||
go.work | ||
coverage.html | ||
|
||
# log files | ||
logs.txt | ||
|
||
# compilation artifacts | ||
target | ||
|
||
# IDE | ||
.idea | ||
.idea | ||
|
||
# just for example | ||
id_rsa |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
############################# HELP MESSAGE ############################# | ||
# Make sure the help command stays first, so that it's printed by default when `make` is called without arguments | ||
.PHONY: help tests | ||
help: | ||
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
AGGREGATOR_ECDSA_PRIV_KEY=0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 | ||
CHALLENGER_ECDSA_PRIV_KEY=0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a | ||
|
||
CHAINID=31337 | ||
# Make sure to update this if the strategy address changes | ||
# check in contracts/script/output/${CHAINID}/sffl_avs_deployment_output.json | ||
STRATEGY_ADDRESS=0x7a2088a1bFc9d81c55368AE168C2C02570cB814F | ||
DEPLOYMENT_FILES_DIR=contracts/evm/script/output/${CHAINID} | ||
|
||
-----------------------------: ## | ||
|
||
___CONTRACTS___: ## | ||
|
||
deploy-eigenlayer-contracts-to-anvil-and-save-state: ## Deploy eigenlayer | ||
./tests/anvil/deploy-eigenlayer-save-anvil-state.sh | ||
|
||
deploy-sffl-contracts-to-anvil-and-save-state: ## Deploy avs | ||
./tests/anvil/deploy-avs-save-anvil-state.sh | ||
|
||
deploy-all-to-anvil-and-save-state: deploy-eigenlayer-contracts-to-anvil-and-save-state deploy-sffl-contracts-to-anvil-and-save-state ## deploy eigenlayer, shared avs contracts, and inc-sq contracts | ||
|
||
start-anvil-chain-with-el-and-avs-deployed: ## starts anvil from a saved state file (with el and avs contracts deployed) | ||
./tests/anvil/start-anvil-chain-with-el-and-avs-deployed.sh | ||
|
||
bindings: ## generates contract bindings | ||
cd contracts && ./generate-go-bindings.sh | ||
|
||
___DOCKER___: ## | ||
docker-build-and-publish-images: ## builds and publishes operator and aggregator docker images using Ko | ||
KO_DOCKER_REPO=ghcr.io/layr-labs/sffl ko build aggregator/cmd/main.go --preserve-import-paths | ||
KO_DOCKER_REPO=ghcr.io/layr-labs/sffl ko build operator/cmd/main.go --preserve-import-paths | ||
docker-start-everything: docker-build-and-publish-images ## starts aggregator and operator docker containers | ||
docker compose pull && docker compose up | ||
|
||
__CLI__: ## | ||
|
||
cli-setup-operator: send-fund cli-register-operator-with-eigenlayer cli-deposit-into-mocktoken-strategy cli-register-operator-with-avs ## registers operator with eigenlayer and avs | ||
|
||
cli-register-operator-with-eigenlayer: ## registers operator with delegationManager | ||
go run cli/main.go --config config-files/operator.anvil.yaml register-operator-with-eigenlayer | ||
|
||
cli-deposit-into-mocktoken-strategy: ## | ||
./scripts/deposit-into-mocktoken-strategy.sh | ||
|
||
cli-register-operator-with-avs: ## | ||
go run cli/main.go --config config-files/operator.anvil.yaml register-operator-with-avs | ||
|
||
cli-deregister-operator-with-avs: ## | ||
go run cli/main.go --config config-files/operator.anvil.yaml deregister-operator-with-avs | ||
|
||
cli-print-operator-status: ## | ||
go run cli/main.go --config config-files/operator.anvil.yaml print-operator-status | ||
|
||
send-fund: ## sends fund to the operator saved in tests/keys/test.ecdsa.key.json | ||
cast send 0x860B6912C2d0337ef05bbC89b0C2CB6CbAEAB4A5 --value 10ether --private-key 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 | ||
|
||
-----------------------------: ## | ||
# We pipe all zapper logs through https://github.com/maoueh/zap-pretty so make sure to install it | ||
# TODO: piping to zap-pretty only works when zapper environment is set to production, unsure why | ||
____OFFCHAIN_SOFTWARE___: ## | ||
start-aggregator: ## | ||
go run aggregator/cmd/main.go --config config-files/aggregator.yaml \ | ||
--sffl-deployment ${DEPLOYMENT_FILES_DIR}/sffl_avs_deployment_output.json \ | ||
--ecdsa-private-key ${AGGREGATOR_ECDSA_PRIV_KEY} \ | ||
2>&1 | zap-pretty | ||
|
||
start-operator: ## | ||
go run operator/cmd/main.go --config config-files/operator.anvil.yaml \ | ||
2>&1 | zap-pretty | ||
|
||
start-challenger: ## | ||
go run challenger/cmd/main.go --config config-files/challenger.yaml \ | ||
--sffl-deployment ${DEPLOYMENT_FILES_DIR}/sffl_avs_deployment_output.json \ | ||
--ecdsa-private-key ${CHALLENGER_ECDSA_PRIV_KEY} \ | ||
2>&1 | zap-pretty | ||
|
||
run-plugin: ## | ||
go run plugin/cmd/main.go --config config-files/operator.anvil.yaml | ||
-----------------------------: ## | ||
_____HELPER_____: ## | ||
mocks: ## generates mocks for tests | ||
go install go.uber.org/mock/[email protected] | ||
go generate ./... | ||
|
||
tests-unit: ## runs all unit tests | ||
go test $$(go list ./... | grep -v /integration) -coverprofile=coverage.out -covermode=atomic --timeout 15s | ||
go tool cover -html=coverage.out -o coverage.html | ||
|
||
tests-contract: ## runs all forge tests | ||
cd contracts && forge test | ||
|
||
tests-integration: ## runs all integration tests | ||
go test ./tests/integration/... -v -count=1 | ||
|
Oops, something went wrong.