-
Notifications
You must be signed in to change notification settings - Fork 135
Expand file tree
/
Copy pathMakefile
More file actions
169 lines (125 loc) · 6.26 KB
/
Copy pathMakefile
File metadata and controls
169 lines (125 loc) · 6.26 KB
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
158
159
160
161
162
163
164
165
166
167
168
169
############################# HELP MESSAGE #############################
# Make sure the help command stays first, so that it's printed by default when `make` is called without arguments
GO_LINES_IGNORED_DIRS=contracts
GO_PACKAGES=./aggregator/... ./challenger/... ./cli/... \
./common/... ./core/... ./metrics/... ./operator/... \
./plugin/... ./tests/... ./types/...
GO_FOLDERS=$(shell echo ${GO_PACKAGES} | sed -e "s/\.\///g" | sed -e "s/\/\.\.\.//g")
.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=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
CHAINID=31337
# Make sure to update this if the strategy address changes
# check in contracts/script/output/${CHAINID}/credible_squaring_avs_deployment_output.json
STRATEGY_ADDRESS=0x7a2088a1bFc9d81c55368AE168C2C02570cB814F
DEPLOYMENT_FILE=contracts/script/deployments/incredible-squaring/${CHAINID}.json
CORE_DEPLOYMENT_FILE=contracts/script/deployments/core/${CHAINID}.json
-----------------------------: ##
___CONTRACTS___: ##
build-contracts: ## builds all contracts
cd contracts && forge build
deploy-eigenlayer: ## Deploy eigenlayer
./tests/anvil/deploy-eigenlayer.sh
deploy-avs: ## Deploy avs
./tests/anvil/deploy-avs.sh
create-quorum:
./tests/anvil/create-quorum.sh
modify-allocations:
./tests/anvil/modify-allocations.sh
uam-permissions:
./tests/anvil/uam-permissions.sh
set-allocation-delay:
./tests/anvil/set-allocation-delay.sh
set-allocation-delay-and-modify-allocation: set-allocation-delay modify-allocations
deploy-all: deploy-eigenlayer deploy-avs uam-permissions create-quorum
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/incredible-squaring ko build aggregator/cmd/main.go --preserve-import-paths
KO_DOCKER_REPO=ghcr.io/layr-labs/incredible-squaring ko build operator/cmd/main.go --preserve-import-paths
docker-compose-up: ## runs docker compose pull first and then up
docker compose pull && docker compose up -d
__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 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --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 \
--credible-squaring-deployment ${DEPLOYMENT_FILE} \
--core-deployment ${CORE_DEPLOYMENT_FILE} \
--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 \
--credible-squaring-deployment ${DEPLOYMENT_FILE} \
--core-deployment ${CORE_DEPLOYMENT_FILE} \
--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/mockgen@v0.3.0
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
.PHONY: copy-env
copy-env:
@echo "Copying .env.example to .env..."
cp ./contracts/.env.example ./contracts/.env
.PHONY: dump-state
dump-state:
./tests/anvil/dump-state.sh
.PHONY: fmt
fmt: ## formats all go files
go fmt ./...
$(MAKE) format-lines
.PHONY: format-lines
format-lines: ## formats all go files with golines
go install github.com/segmentio/golines@latest
golines -w -m 120 --ignore-generated --shorten-comments --ignored-dirs=${GO_LINES_IGNORED_DIRS} ${GO_FOLDERS}
__REWARDS__: ##
SENDER_ADDR=0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266
TOKEN_ADDRESS=$(shell jq -r '.addresses.token' contracts/script/deployments/incredible-squaring/31337.json)
create-avs-distributions-root:
cd contracts && \
forge script script/SetupDistributions.s.sol --rpc-url http://localhost:8545 \
--broadcast --sig "runAVSRewards()" -v --sender ${SENDER_ADDR}
create-operator-directed-distributions-root:
cd contracts && \
forge script script/SetupDistributions.s.sol --rpc-url http://localhost:8545 \
--broadcast --sig "runOperatorDirected()" -v --sender ${SENDER_ADDR}
claim-distributions:
cd contracts && \
forge script script/SetupDistributions.s.sol --rpc-url http://localhost:8545 \
--broadcast --sig "executeProcessClaim()" -v --sender ${SENDER_ADDR}
get-deployed-token-address:
@echo "Deployed token Address: $(TOKEN_ADDRESS)"
claimer-account-token-balance:
cast balance --erc20 $(TOKEN_ADDRESS) 0x0000000000000000000000000000000000000001