-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: modularize bindings generation (#329)
- Loading branch information
1 parent
e5c3fb8
commit 9b3429c
Showing
2 changed files
with
82 additions
and
34 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 |
---|---|---|
@@ -1,35 +1,34 @@ | ||
############################# HELP MESSAGE ############################# | ||
# Make sure the help command stays first, so that it's printed by default when `make` is called without arguments | ||
.PHONY: help bindings mocks tests tests-cover fmt format-lines lint | ||
|
||
GO_LINES_IGNORED_DIRS=contracts | ||
GO_PACKAGES=./chainio/... ./crypto/... ./logging/... \ | ||
./types/... ./utils/... ./signer/... ./cmd/... \ | ||
./signerv2/... ./aws/... ./internal/... ./metrics/... \ | ||
./nodeapi/... ./cmd/... ./services/... ./testutils/... | ||
GO_FOLDERS=$(shell echo ${GO_PACKAGES} | sed -e "s/\.\///g" | sed -e "s/\/\.\.\.//g") | ||
|
||
.PHONY: help | ||
help: | ||
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
bindings: ## generates contract bindings | ||
cd contracts && rm -rf bindings/* && ./generate-bindings.sh | ||
|
||
eigenpod-bindings: ## generates contract bindings for eigenpod | ||
cd chainio/clients/eigenpod && ./generate.sh | ||
|
||
.PHONY: mocks | ||
mocks: ## generates mocks | ||
go install go.uber.org/mock/[email protected] | ||
go generate ./... | ||
|
||
.PHONY: tests | ||
tests: ## runs all tests | ||
go test -race ./... -timeout=1m | ||
|
||
.PHONY: tests-cover | ||
tests-cover: ## run all tests with test coverge | ||
go test -race ./... -coverprofile=coverage.out -covermode=atomic -v -count=1 | ||
go tool cover -html=coverage.out -o coverage.html | ||
open coverage.html | ||
|
||
godoc-port = 6060 | ||
.PHONY: godoc | ||
godoc: ## runs godoc server and opens in browser | ||
@echo "Starting godoc server on port $(godoc-port)..." | ||
@-godoc -http=:$(godoc-port) & echo $$! > godoc.pid | ||
|
@@ -42,22 +41,87 @@ godoc: ## runs godoc server and opens in browser | |
@# The read varname command will keep the make command running (waiting for input) until you press CTRL+C. | ||
@trap 'kill `cat godoc.pid` && rm -f godoc.pid' EXIT; read varname | ||
|
||
.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} | ||
|
||
.PHONY: lint | ||
lint: ## runs all linters | ||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | ||
golangci-lint run ./... | ||
|
||
|
||
___BINDINGS___: ## | ||
|
||
core_default := "DelegationManager IRewardsCoordinator ISlasher StrategyManager EigenPod EigenPodManager IStrategy IAVSDirectory" | ||
core_location := "./lib/eigenlayer-middleware/lib/eigenlayer-contracts" | ||
core_bindings_location := "../../../../bindings" | ||
|
||
middleware_default := "RegistryCoordinator IndexRegistry OperatorStateRetriever StakeRegistry BLSApkRegistry IBLSSignatureChecker ServiceManagerBase IERC20" | ||
middleware_location := "./lib/eigenlayer-middleware" | ||
middleware_bindings_location := "../../bindings" | ||
|
||
sdk_default := "MockAvsServiceManager ContractsRegistry" | ||
sdk_location := "." | ||
sdk_bindings_location := "./bindings" | ||
|
||
# To generate bindings for specific contracts, run `make core-bindings contracts="DelegationManager IRewardsCoordinator"` | ||
.PHONY: core-bindings ## generates core contracts bindings | ||
core-bindings: ## generates core bindings | ||
@echo "Starting core bindings generation" | ||
ifneq ($(contracts),) | ||
@echo "Contracts: $(contracts)" | ||
cd contracts && ./generate-bindings.sh $(core_location) $(contracts) $(core_bindings_location) | ||
else | ||
@echo "Contracts: $(core_default)" | ||
cd contracts && ./generate-bindings.sh $(core_location) $(core_default) $(core_bindings_location) | ||
endif | ||
|
||
# To generate bindings for specific contracts, run `make middleware-bindings contracts="RegistryCoordinator"` | ||
.PHONY: middleware-bindings ## generates middleware contracts bindings | ||
middleware-bindings: ## generates middleware bindings | ||
@echo "Starting middleware bindings generation" | ||
ifneq ($(contracts),) | ||
@echo "Contracts: $(contracts)" | ||
cd contracts && ./generate-bindings.sh $(middleware_location) $(contracts) $(middleware_bindings_location) | ||
else | ||
@echo "Contracts: $(middleware_default)" | ||
cd contracts && ./generate-bindings.sh $(middleware_location) $(middleware_default) $(middleware_bindings_location) | ||
endif | ||
|
||
# To generate bindings for specific contracts, run `make sdk-bindings contracts="MockAvsServiceManager"` | ||
.PHONY: sdk-bindings ## generates sdk contracts bindings | ||
sdk-bindings: ## generates sdk bindings | ||
@echo "Starting sdk bindings generation" | ||
ifneq ($(contracts),) | ||
@echo "Contracts: $(contracts)" | ||
cd contracts && ./generate-bindings.sh $(sdk_location) $(contracts) $(sdk_bindings_location) | ||
else | ||
@echo "Contracts: $(middleware_default)" | ||
cd contracts && ./generate-bindings.sh $(sdk_location) $(sdk_default) $(sdk_bindings_location) | ||
endif | ||
|
||
.PHONY: eigenpod-bindings | ||
eigenpod-bindings: ## generates contract bindings for eigenpod | ||
cd chainio/clients/eigenpod && ./generate.sh | ||
|
||
.PHONY: bindings | ||
bindings: ## generates all contract bindings | ||
rm -rf bindings/* && make core-bindings middleware-bindings sdk-bindings eigenpod-bindings | ||
|
||
|
||
___CONTRACTS___: ## | ||
|
||
deploy-contracts-to-anvil-and-save-state: ## | ||
.PHONY: deploy-contracts-to-anvil-and-save-state | ||
deploy-contracts-to-anvil-and-save-state: ## | ||
./contracts/anvil/deploy-contracts-save-anvil-state.sh | ||
|
||
.PHONY: start-anvil-with-contracts-deployed | ||
start-anvil-with-contracts-deployed: ## | ||
./contracts/anvil/start-anvil-chain-with-el-and-avs-deployed.sh |
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