-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
157 lines (125 loc) · 7.5 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
############################# 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}'
OPERATOR_BLS_KEY_PASS=fDUMDLmBROwlzzPXyIcy
OPERATOR_ECDSA_KEY_PASS=EnJuncq01CiVk9UbuBYl
AGGREGATOR_ECDSA_PRIV_KEY=0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6
CHALLENGER_ECDSA_PRIV_KEY=0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
INDEXER_NEAR_ENV=localnet
INDEXER_NEAR_HELPER_ACCOUNT=near
INDEXER_NEAR_CLI_LOCALNET_KEY_PATH=${HOME}/.near/localnet/validator_key.json
CHAINID=31337
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-rollup-sffl-contracts-to-anvil-and-save-state: ## Deploy rollup contracts
./tests/anvil/deploy-rollup-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-rollup-sffl-contracts-to-anvil-and-save-state ## deploy eigenlayer and avs 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
start-rollup-anvil-chain-with-avs-deployed: ## starts an anvil instance with the rollup avs contracts
./tests/anvil/start-rollup-anvil-chain-with-avs-deployed.sh
setup-near-da: export NEAR_ENV=$(INDEXER_NEAR_ENV)
setup-near-da: export NEAR_HELPER_ACCOUNT=$(INDEXER_NEAR_HELPER_ACCOUNT)
setup-near-da: export NEAR_CLI_LOCALNET_KEY_PATH=$(INDEXER_NEAR_CLI_LOCALNET_KEY_PATH)
setup-near-da:
near create-account da.test.near --masterAccount test.near
near deploy da.test.near ./tests/near/near_da_blob_store.wasm --initFunction "new" --initArgs "{}" --masterAccount test.near
bindings: ## generates contract bindings
cd contracts && ./generate-go-bindings.sh
___DOCKER___: ##
docker-fast-build-indexer:
docker build -t nffl-indexer -f ./indexer/Dockerfile --build-arg COMPILATION_MODE="" --build-arg TARGET="debug" .
docker-fast-build-fastnear-indexer:
docker build -t nffl-fast-indexer -f ./indexer/FastIndexer.dockerfile --build-arg COMPILATION_MODE="" --build-arg TARGET="debug" .
docker-build-indexer:
docker build -t nffl-indexer -f ./indexer/Dockerfile .
docker-build-fastnear-indexer:
docker build -t nffl-fast-indexer -f ./indexer/FastIndexer.dockerfile .
docker-build-relayer:
docker build -t nffl-test-relayer -f ./relayer/cmd/Dockerfile .
docker-build-aggregator:
docker build -t nffl-aggregator -f ./aggregator/cmd/Dockerfile .
docker-build-operator:
docker build -t nffl-operator -f ./operator/cmd/Dockerfile .
docker-build-plugin:
docker build -t nffl-operator-plugin -f ./plugin/cmd/Dockerfile .
docker-build-images: docker-build-indexer docker-build-relayer docker-build-aggregator docker-build-operator docker-build-plugin ## builds and publishes indexer, operator and aggregator docker images
docker-fast-build-images: docker-fast-build-indexer docker-build-relayer docker-build-aggregator docker-build-operator docker-build-plugin ## builds and publishes indexer, operator and aggregator docker images
docker-start-everything: docker-fast-build-images ## starts aggregator and operator docker containers
docker compose -f ./docker-compose.yml up
__CLI__: ##
cli-setup-operator: export OPERATOR_BLS_KEY_PASSWORD=$(OPERATOR_BLS_KEY_PASS)
cli-setup-operator: export OPERATOR_ECDSA_KEY_PASSWORD=$(OPERATOR_ECDSA_KEY_PASS)
cli-setup-operator: send-fund cli-register-operator-with-eigenlayer 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-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 first operator saved in tests/keys/ecdsa/*
cast send 0xD5A0359da7B310917d7760385516B2426E86ab7f --value 10ether --private-key 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 --rpc-url http://127.0.0.1:8545
-----------------------------: ##
# 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 \
--nffl-deployment ${DEPLOYMENT_FILES_DIR}/sffl_avs_deployment_output.json \
--ecdsa-private-key ${AGGREGATOR_ECDSA_PRIV_KEY} \
2>&1 | zap-pretty
start-operator: export OPERATOR_BLS_KEY_PASSWORD=fDUMDLmBROwlzzPXyIcy
start-operator: export OPERATOR_ECDSA_KEY_PASSWORD=EnJuncq01CiVk9UbuBYl
start-operator: ##
go run operator/cmd/main.go --config config-files/operator.anvil.yaml \
2>&1 | zap-pretty
start-indexer: ##
cargo run -p indexer --release -- --home-dir ~/.near/localnet init --chain-id localnet
cargo run -p indexer --release -- --home-dir ~/.near/localnet run --da-contract-ids da.test.near --rollup-ids 2 --rmq-address "amqp://127.0.0.1:5672"
start-test-relayer: ##
CGO_LDFLAGS="-L ./relayer/libs ${CGO_LDFLAGS}" go run relayer/cmd/main.go run-args --rpc-url ws://127.0.0.1:8546 --da-account-id da.test.near --key-path ~/.near-credentials/localnet/da.test.near.json
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) -race -count=1 -coverprofile=coverage.out -covermode=atomic
go tool cover -html=coverage.out -o coverage.html
tests-contract: ## runs all forge tests
cd contracts/evm && forge test --ffi
near-da-rpc-sys:
rm -rf relayer/libs && \
mkdir relayer/libs && \
git clone https://github.com/near/rollup-data-availability.git && \
cd rollup-data-availability && \
git checkout 6b7d76a28d7e3315c8b1c0f805cd665fc85dfd23 && \
make da-rpc-sys && \
cp gopkg/da-rpc/lib/* ../relayer/libs && \
cd .. && \
rm -rf rollup-data-availability
# TODO: Currently we cannot use the race detector with `integration_test.go`
tests-integration: ## runs all integration tests
go test ./tests/integration/integration_test.go -v -count=1
#go test ./tests/integration/registration_test.go -v -race -count=1
# test-integration-fastnear: ## runs fastnear integration test
# go test ./tests/integration/fastnear/fastnear_integration_test.go -v -count=1
## runs slither for solidity files
## You can install Slither by following the guide at https://github.com/crytic/slither/tree/master?tab=readme-ov-file#how-to-install
slither:
cd contracts/evm && slither .
## runs linter on all files
## TODO: For now, only Go files are linted
lint:
golangci-lint run