forked from qiwu7/polygon-rosetta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
146 lines (109 loc) · 4.43 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
.PHONY: deps build run lint run-mainnet-online run-mainnet-offline run-testnet-online \
run-testnet-offline check-comments add-license check-license shorten-lines \
spellcheck salus build-local format check-format update-tracer test coverage coverage-local \
update-bootstrap-balances mocks
ADDLICENSE_CMD=go run github.com/google/addlicense
ADDLICENCE_SCRIPT=${ADDLICENSE_CMD} -c "Coinbase, Inc." -l "apache" -v
BUILD_TARGET=bin
BUILD_SOURCE=main.go
SPELLCHECK_CMD=go run github.com/client9/misspell/cmd/misspell
GOLINES_CMD=go run github.com/segmentio/golines
GOLINT_CMD=go run golang.org/x/lint/golint
GOVERALLS_CMD=go run github.com/mattn/goveralls
GOIMPORTS_CMD=go run golang.org/x/tools/cmd/goimports
GO_PACKAGES=./services/... ./cmd/... ./configuration/... ./polygon/...
GO_FOLDERS=$(shell echo ${GO_PACKAGES} | sed -e "s/\.\///g" | sed -e "s/\/\.\.\.//g")
TEST_SCRIPT=go test ${GO_PACKAGES}
LINT_CONFIG=.golangci.yml
PWD=$(shell pwd)
NOFILE=100000
deps:
go get ./...
test:
${TEST_SCRIPT}
###############
#### build ####
###############
build-node-local:
docker-compose -p polygon -f dockerfiles/docker-compose.yml build heimdall bor
build-rosetta-local:
docker-compose -p polygon -f dockerfiles/docker-compose.yml build rosetta
build-local:
docker-compose -p polygon -f dockerfiles/docker-compose.yml build
build-rosetta-local-bin:
mkdir -p $(BUILD_TARGET) && GO build -o $(BUILD_TARGET) $(BUILD_SOURCE)
################
#### update ####
################
# This is the default JS tracer
update-tracer-js:
curl https://raw.githubusercontent.com/ethereum/go-ethereum/master/eth/tracers/js/internal/tracers/call_tracer_js.js -o polygon/call_tracer.js
update-tracer-legacy:
curl https://raw.githubusercontent.com/ethereum/go-ethereum/master/eth/tracers/js/internal/tracers/call_tracer_legacy.js -o polygon/call_tracer_legacy.js
# TODO: add native tracer as well
update-bootstrap-balances:
go run main.go utils:generate-bootstrap polygon/genesis_files/mainnet.json rosetta-cli-conf/mainnet/bootstrap_balances.json;
go run main.go utils:generate-bootstrap polygon/genesis_files/testnet.json rosetta-cli-conf/testnet/bootstrap_balances.json;
###############
#### run ######
###############
run-node-testnet:
NETWORK=TESTNET docker-compose -p polygon -f dockerfiles/docker-compose.yml up bor heimdall
run-node-mainnet:
NETWORK=MAINNET docker-compose -p polygon -f dockerfiles/docker-compose.yml up bor heimdall
run-mainnet-online:
NETWORK=MAINNET docker-compose -p polygon -f dockerfiles/docker-compose.yml up rosetta
run-mainnet-remote:
NETWORK=MAINNET BOR=$(bor) docker-compose -p polygon -f dockerfiles/docker-compose.yml up rosetta
run-mainnet-offline:
NETWORK=MAINNET docker-compose -p polygon -f dockerfiles/docker-compose.yml up rosetta_offline
run-testnet-online:
NETWORK=TESTNET docker-compose -p polygon -f dockerfiles/docker-compose.yml up rosetta
run-testnet-remote:
NETWORK=TESTNET BOR=$(bor) docker-compose -p polygon -f dockerfiles/docker-compose.yml up rosetta
run-testnet-offline:
NETWORK=TESTNET docker-compose -p polygon -f dockerfiles/docker-compose.yml up rosetta_offline
run-bin-mainnet-online:
NETWORK=MAINNET MODE=ONLINE PORT=3000 BOR=$(bor) bin/main run
run-bin-mainnet-offline:
NETWORK=MAINNET MODE=OFFLINE PORT=3001 bin/main run
run-bin-testnet-online:
NETWORK=TESTNET MODE=ONLINE PORT=3000 BOR=$(bor) bin/main run
run-bin-testnet-offline:
NETWORK=TESTNET MODE=OFFLINE PORT=3001 bin/main run
###############
#### stop #####
###############
down:
docker-compose -p polygon -f dockerfiles/docker-compose.yml down
check-comments:
${GOLINT_CMD} -set_exit_status ${GO_FOLDERS} .
lint: | check-comments
golangci-lint run -v --config $(LINT_CONFIG)
add-license:
${ADDLICENCE_SCRIPT} .
check-license:
${ADDLICENCE_SCRIPT} -check .
shorten-lines:
${GOLINES_CMD} -w --shorten-comments ${GO_FOLDERS} .
format:
gofmt -s -w -l .
${GOIMPORTS_CMD} -w .
check-format:
! gofmt -s -l . | read
! ${GOIMPORTS_CMD} -l . | read
spellcheck:
${SPELLCHECK_CMD} -error .
coverage:
if [ "${COVERALLS_TOKEN}" ]; then ${TEST_SCRIPT} -coverprofile=c.out -covermode=count; ${GOVERALLS_CMD} -coverprofile=c.out -repotoken ${COVERALLS_TOKEN}; fi
coverage-local:
${TEST_SCRIPT} -cover
mocks:
rm -rf mocks;
mockery --dir services --all --case underscore --outpkg services --output mocks/services;
mockery --dir polygon --all --case underscore --outpkg polygon --output mocks/polygon;
${ADDLICENCE_SCRIPT} .;
clean:
rm -rf bin;
rm -rf cli-data;
rm -rf polygon-data;