forked from BLASTchain/blast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
187 lines (150 loc) · 5.13 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
COMPOSEFLAGS=-d
ITESTS_L2_HOST=http://localhost:9545
BEDROCK_TAGS_REMOTE?=origin
OP_STACK_GO_BUILDER?=us-docker.pkg.dev/oplabs-tools-artifacts/images/op-stack-go:latest
# Requires at least Python v3.9; specify a minor version below if needed
PYTHON?=python3
build: build-go build-ts
.PHONY: build
build-go: submodules bl-node bl-proposer bl-batcher
.PHONY: build-go
lint-go:
golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is" ./...
.PHONY: lint-go
build-ts: submodules
if [ -n "$$NVM_DIR" ]; then \
. $$NVM_DIR/nvm.sh && nvm use; \
fi
pnpm install
pnpm build
.PHONY: build-ts
ci-builder:
docker build -t ci-builder -f ops/docker/ci-builder/Dockerfile .
golang-docker:
# We don't use a buildx builder here, and just load directly into regular docker, for convenience.
GIT_COMMIT=$$(git rev-parse HEAD) \
GIT_DATE=$$(git show -s --format='%ct') \
IMAGE_TAGS=$$(git rev-parse HEAD),latest \
docker buildx bake \
--progress plain \
--load \
-f docker-bake.hcl \
bl-node bl-batcher bl-proposer bl-challenger
.PHONY: golang-docker
submodules:
git submodule update --init --recursive
.PHONY: submodules
bl-bindings:
make -C ./bl-bindings
.PHONY: bl-bindings
bl-node:
make -C ./bl-node bl-node
.PHONY: bl-node
generate-mocks-bl-node:
make -C ./bl-node generate-mocks
.PHONY: generate-mocks-bl-node
generate-mocks-bl-service:
make -C ./bl-service generate-mocks
.PHONY: generate-mocks-bl-service
bl-batcher:
make -C ./bl-batcher bl-batcher
.PHONY: bl-batcher
bl-proposer:
make -C ./bl-proposer bl-proposer
.PHONY: bl-proposer
bl-challenger:
make -C ./bl-challenger bl-challenger
.PHONY: bl-challenger
bl-program:
make -C ./bl-program bl-program
.PHONY: bl-program
cannon:
make -C ./cannon cannon
.PHONY: cannon
cannon-prestate: bl-program cannon
./cannon/bin/cannon load-elf --path bl-program/bin/bl-program-client.elf --out bl-program/bin/prestate.json --meta bl-program/bin/meta.json
./cannon/bin/cannon run --proof-at '=0' --stop-at '=1' --input bl-program/bin/prestate.json --meta bl-program/bin/meta.json --proof-fmt 'bl-program/bin/%d.json' --output ""
mv bl-program/bin/0.json bl-program/bin/prestate-proof.json
mod-tidy:
# Below GOPRIVATE line allows mod-tidy to be run immediately after
# releasing new versions. This bypasses the Go modules proxy, which
# can take a while to index new versions.
#
# See https://proxy.golang.org/ for more info.
export GOPRIVATE="github.com/ethereum-optimism" && go mod tidy
.PHONY: mod-tidy
clean:
rm -rf ./bin
.PHONY: clean
nuke: clean devnet-clean
git clean -Xdf
.PHONY: nuke
pre-devnet:
@if ! [ -x "$(command -v geth)" ]; then \
make install-geth; \
fi
@if [ ! -e bl-program/bin ]; then \
make cannon-prestate; \
fi
.PHONY: pre-devnet
devnet-up: pre-devnet
./ops/scripts/newer-file.sh .devnet/allocs-l1.json ./packages/contracts-bedrock \
|| make devnet-allocs
PYTHONPATH=./bedrock-devnet $(PYTHON) ./bedrock-devnet/main.py --monorepo-dir=.
.PHONY: devnet-up
# alias for devnet-up
devnet-up-deploy: devnet-up
devnet-test: pre-devnet
PYTHONPATH=./bedrock-devnet $(PYTHON) ./bedrock-devnet/main.py --monorepo-dir=. --test
.PHONY: devnet-test
devnet-down:
@(cd ./ops-bedrock && GENESIS_TIMESTAMP=$(shell date +%s) docker compose stop)
.PHONY: devnet-down
devnet-clean:
rm -rf ./packages/contracts-bedrock/deployments/devnetL1
rm -rf ./.devnet
cd ./ops-bedrock && docker compose down
docker image ls 'ops-bedrock*' --format='{{.Repository}}' | xargs -r docker rmi
docker volume ls --filter name=ops-bedrock --format='{{.Name}}' | xargs -r docker volume rm
.PHONY: devnet-clean
devnet-allocs: pre-devnet
PYTHONPATH=./bedrock-devnet $(PYTHON) ./bedrock-devnet/main.py --monorepo-dir=. --allocs
devnet-logs:
@(cd ./ops-bedrock && docker compose logs -f)
.PHONY: devnet-logs
test-unit:
make -C ./bl-node test
make -C ./bl-proposer test
make -C ./bl-batcher test
make -C ./bl-e2e test
pnpm test
.PHONY: test-unit
test-integration:
bash ./ops-bedrock/test-integration.sh \
./packages/contracts-bedrock/deployments/devnetL1
.PHONY: test-integration
# Remove the baseline-commit to generate a base reading & show all issues
semgrep:
$(eval DEV_REF := $(shell git rev-parse develop))
SEMGREP_REPO_NAME=BLASTchain/blast semgrep ci --baseline-commit=$(DEV_REF)
.PHONY: semgrep
clean-node-modules:
rm -rf node_modules
rm -rf packages/**/node_modules
tag-bedrock-go-modules:
./ops/scripts/tag-bedrock-go-modules.sh $(BEDROCK_TAGS_REMOTE) $(VERSION)
.PHONY: tag-bedrock-go-modules
update-op-geth:
./ops/scripts/update-op-geth.py
.PHONY: update-op-geth
bedrock-markdown-links:
docker run --init -it -v `pwd`:/input lycheeverse/lychee --verbose --no-progress --exclude-loopback \
--exclude twitter.com --exclude explorer.optimism.io --exclude linux-mips.org \
--exclude-mail /input/README.md "/input/specs/**/*.md"
install-geth:
./ops/scripts/geth-version-checker.sh && \
(echo "Geth versions match, not installing geth..."; true) || \
(echo "Versions do not match, installing geth!"; \
go install -v github.com/ethereum/go-ethereum/cmd/geth@$(shell cat .gethrc); \
echo "Installed geth!"; true)
.PHONY: install-geth