-
Notifications
You must be signed in to change notification settings - Fork 62
/
Makefile
108 lines (87 loc) · 2.77 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
FOUNDRY_PROFILE=default
FORGE=FOUNDRY_PROFILE=$(FOUNDRY_PROFILE) forge
SOLC_VERSION=0.8.24
EVM_VERSION=paris
DOCKER=docker
ABIGEN="$(DOCKER) run -v .:/workspace -w /workspace -it ethereum/client-go:alltools-v1.11.6 abigen"
SOLHINT=npx solhint
SLITHER=slither
DOCKER_COMPOSE=$(DOCKER) compose
E2E_TEST_COMPOSE_FILE=./chains/compose.yml
TEST_BROADCAST_LOG_DIR=./broadcast/Deploy.s.sol
TEST_MNEMONIC="math razor capable expose worth grape metal sunset metal sudden usage scheme"
TEST_UPGRADEABLE=false
######## Development ########
.PHONY: build
build:
$(FORGE) build --sizes --skip test --use solc:$(SOLC_VERSION)
.PHONY: clean
clean:
$(FORGE) clean
.PHONY: fmt
fmt:
$(FORGE) fmt $(FORGE_FMT_OPTS)
.PHONY: lint
lint:
@$(SOLHINT) 'contracts/**/*.sol'
@$(MAKE) FORGE_FMT_OPTS=--check fmt
.PHONY: test
test:
TEST_UPGRADEABLE=$(TEST_UPGRADEABLE) $(FORGE) test -vvvv --gas-report --isolate --use solc:$(SOLC_VERSION)
.PHONY: snapshot
snapshot:
$(FORGE) snapshot -vvvv --gas-report --isolate --use solc:$(SOLC_VERSION)
.PHONY: coverage
coverage:
$(FORGE) coverage --use solc:$(SOLC_VERSION)
.PHONY: slither
slither:
@$(SLITHER) .
######## Protobuf ########
.PHONY: proto-sol
proto-sol:
ifndef SOLPB_DIR
$(error SOLPB_DIR is not specified)
else
./scripts/solpb.sh
endif
.PHONY: proto-go
proto-go:
ifndef SOLPB_DIR
$(error SOLPB_DIR is not specified)
else
$(DOCKER) run \
-v $(CURDIR):/workspace \
-v $(SOLPB_DIR):/solpb \
-e SOLPB_DIR=/solpb \
--workdir /workspace \
tendermintdev/sdk-proto-gen:v0.3 \
sh ./scripts/protocgen.sh
endif
.PHONY: proto-gen
proto-gen: proto-sol proto-go
######## Abigen ########
.PHONY: abigen
abigen: build
ABIGEN=$(ABIGEN) ./scripts/abigen.sh
######## E2E test ########
.PHONY: network-ibft2
network-ibft2:
$(DOCKER_COMPOSE) -f $(E2E_TEST_COMPOSE_FILE) up --detach --wait ibft2-testchain0 ibft2-testchain1
$(MAKE) deploy
.PHONY: network-qbft
network-qbft:
$(DOCKER_COMPOSE) -f $(E2E_TEST_COMPOSE_FILE) up --detach --wait qbft-testchain0 qbft-testchain1
$(MAKE) deploy
.PHONY: deploy
deploy:
TEST_UPGRADEABLE=$(TEST_UPGRADEABLE) TEST_MNEMONIC=$(TEST_MNEMONIC) $(FORGE) script --legacy --batch-size 5 --use solc:${SOLC_VERSION} --evm-version ${EVM_VERSION} --fork-url http://127.0.0.1:8645 --broadcast \
./tests/foundry/src/Deploy.s.sol
TEST_UPGRADEABLE=$(TEST_UPGRADEABLE) TEST_MNEMONIC=$(TEST_MNEMONIC) $(FORGE) script --legacy --batch-size 5 --use solc:${SOLC_VERSION} --evm-version ${EVM_VERSION} --fork-url http://127.0.0.1:8745 --broadcast \
./tests/foundry/src/Deploy.s.sol
.PHONY: network-down
network-down:
$(DOCKER_COMPOSE) -f $(E2E_TEST_COMPOSE_FILE) down
.PHONY: e2e-test
e2e-test:
TEST_UPGRADEABLE=$(TEST_UPGRADEABLE) TEST_MNEMONIC=$(TEST_MNEMONIC) TEST_BROADCAST_LOG_DIR=$(CURDIR)/$(TEST_BROADCAST_LOG_DIR) go test -v ./tests/e2e/... -count=1