forked from zeta-chain/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
704 lines (562 loc) · 27.1 KB
/
Makefile
File metadata and controls
704 lines (562 loc) · 27.1 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
.PHONY: build
PACKAGE_NAME := github.com/zeta-chain/node
NODE_VERSION ?= $(shell ./version.sh)
NODE_COMMIT := $(shell [ -z "${NODE_COMMIT}" ] && git log -1 --format='%H' || echo ${NODE_COMMIT} )
DOCKER ?= docker
# allow setting of NODE_COMPOSE_ARGS to pass additional args to docker compose
# useful for setting profiles and/ort optional overlays
# example: NODE_COMPOSE_ARGS="--profile monitoring -f docker-compose-persistent.yml"
DOCKER_COMPOSE ?= $(DOCKER) compose -f docker-compose.yml $(NODE_COMPOSE_ARGS)
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf
GOFLAGS := ""
GOPATH ?= '$(HOME)/go'
OLD_ZETACORED_VERSION := v36.0.1
OLD_ZETACLIENTD_VERSION := zetaclient_v37.0.3
OLD_ZETAE2E_VERSION := $(OLD_ZETACORED_VERSION)
OLD_ZETACORED_VERSION_MAJOR := $(shell echo $(OLD_ZETACORED_VERSION) | cut -d. -f1)
# common goreaser command definition
GOLANG_CROSS_VERSION ?= v1.22.7@sha256:24b2d75007f0ec8e35d01f3a8efa40c197235b200a1a91422d78b851f67ecce4
GORELEASER := $(DOCKER) run \
--rm \
--privileged \
-e CGO_ENABLED=1 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-w /go/src/$(PACKAGE_NAME) \
-e "GITHUB_TOKEN=${GITHUB_TOKEN}" \
ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION}
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=zetacore \
-X github.com/cosmos/cosmos-sdk/version.ServerName=zetacored \
-X github.com/cosmos/cosmos-sdk/version.ClientName=zetaclientd \
-X github.com/cosmos/cosmos-sdk/version.Version=$(NODE_VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(NODE_COMMIT) \
-X github.com/cosmos/cosmos-sdk/types.DBBackend=pebbledb \
-X github.com/zeta-chain/node/pkg/constant.Name=zetacored \
-X github.com/zeta-chain/node/pkg/constant.Version=$(NODE_VERSION) \
-X github.com/zeta-chain/node/pkg/constant.CommitHash=$(NODE_COMMIT) \
-buildid= \
-s -w
BUILD_FLAGS := -ldflags '$(ldflags)' -tags pebbledb,ledger
TEST_DIR ?= "./..."
TEST_BUILD_FLAGS := -tags pebbledb,ledger,test
export DOCKER_BUILDKIT := 1
# parameters for localnet docker compose files
# set defaults to empty to prevent docker warning
export E2E_ARGS := $(E2E_ARGS)
export TSS_MIGRATION_FLAG := $(TSS_MIGRATION_FLAG)
export CI := $(CI)
clean: clean-binaries clean-dir clean-test-dir clean-coverage
clean-binaries:
@rm -rf ${GOBIN}/zetacored
@rm -rf ${GOBIN}/zetaclientd
clean-dir:
@rm -rf ~/.zetacored
@rm -rf ~/.zetacore
all: install
go.sum: go.mod
@echo "--> Ensure dependencies have not been modified"
GO111MODULE=on go mod verify
###############################################################################
### Test commands ###
###############################################################################
test: clean-test-dir run-test
test-clean : clean-test-dir clean-testcache run-test
run-test:
@go test ${TEST_BUILD_FLAGS} ${TEST_DIR}
# Generate the test coverage
# "|| exit 1" is used to return a non-zero exit code if the tests fail
test-coverage:
@go test ${TEST_BUILD_FLAGS} -coverprofile coverage.out ${TEST_DIR} || exit 1
coverage-report: test-coverage
@go tool cover -html=coverage.out -o coverage.html
clean-coverage:
@rm -f coverage.out
@rm -f coverage.html
clean-test-dir:
@rm -rf x/crosschain/client/integrationtests/.zetacored
@rm -rf x/crosschain/client/querytests/.zetacored
@rm -rf x/observer/client/querytests/.zetacored
clean-testcache:
@go clean -testcache
###############################################################################
### Install commands ###
###############################################################################
build-testnet-ubuntu: go.sum
docker build -t zetacore-ubuntu --platform linux/amd64 -f ./Dockerfile-athens3-ubuntu .
docker create --name temp-container zetacore-ubuntu
docker cp temp-container:/go/bin/zetaclientd .
docker cp temp-container:/go/bin/zetacored .
docker rm temp-container
install: go.sum
@echo "--> Installing zetacored, zetaclientd, and zetaclientd-supervisor"
@go install -mod=readonly $(BUILD_FLAGS) ./cmd/zetacored
@go install -mod=readonly $(BUILD_FLAGS) ./cmd/zetaclientd
@go install -mod=readonly $(BUILD_FLAGS) ./cmd/zetaclientd-supervisor
install-zetaclient: go.sum
@echo "--> Installing zetaclientd"
@go install -mod=readonly $(BUILD_FLAGS) ./cmd/zetaclientd
install-zetacore: go.sum
@echo "--> Installing zetacored"
@go install -mod=readonly $(BUILD_FLAGS) ./cmd/zetacored
# running with race detector on will be slow
install-zetaclient-race-test-only-build: go.sum
@echo "--> Installing zetaclientd"
@go install -race -mod=readonly $(BUILD_FLAGS) ./cmd/zetaclientd
install-zetatool: go.sum
@echo "--> Installing zetatool"
@go install -mod=readonly $(BUILD_FLAGS) ./cmd/zetatool
###############################################################################
### Local network ###
###############################################################################
init:
./standalone-network/init.sh
run:
./standalone-network/run.sh
chain-init: clean install-zetacore init
chain-run: clean install-zetacore init run
chain-stop:
@killall zetacored
@killall tail
test-cctx:
./standalone-network/cctx-creator.sh
devnet-fork:
@echo "--> Running devnet fork script..."
@python3 contrib/devnet/devnet_fork.py --node-version $(OLD_ZETACORED_VERSION:v%=%)
DEVNET_UPGRADE_VERSION := v37.0.0
devnet-fork-upgrade:
@echo "--> Running devnet fork script with upgrade..."
@python3 contrib/devnet/devnet_fork.py --node-version $(OLD_ZETACORED_VERSION:v%=%) --upgrade-version $(DEVNET_UPGRADE_VERSION)
download-snapshot:
@echo "--> Downloading and caching snapshot..."
@python3 contrib/localnet/scripts_python/download_snapshot.py --chain-id $(or $(CHAIN_ID),athens_7001-1) --force
###############################################################################
### Linting ###
###############################################################################
# Make sure LATEST golangci-lint is installed
# go install github.com/golangci/golangci-lint/v2/cmd/[email protected]
lint-deps:
@if ! command -v golangci-lint &> /dev/null; then \
echo "Installing golangci-lint"; \
go install github.com/golangci/golangci-lint/v2/cmd/[email protected]; \
echo "golangci-lint installed successfully"; \
fi
lint: lint-deps
@GOFLAGS=$(GOFLAGS) go mod verify
@golangci-lint run
lint-gosec:
@bash ./scripts/gosec.sh
gosec:
gosec -exclude-dir=localnet ./...
fmt: lint-deps
@golangci-lint fmt
###############################################################################
### Generation commands ###
###############################################################################
protoVer=0.13.0
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace --user $(shell id -u):$(shell id -g) $(protoImageName)
proto-format:
@echo "--> Formatting Protobuf files"
@$(protoImage) find ./ -name "*.proto" -exec clang-format -i {} \;
.PHONY: proto-format
typescript: proto-format
@echo "--> Generating TypeScript bindings"
@bash ./scripts/protoc-gen-typescript.sh
.PHONY: typescript
proto-gen: proto-format
@echo "--> Removing old Go types "
@find . -name '*.pb.go' -type f -delete
@echo "--> Generating Protobuf files"
@$(protoImage) sh ./scripts/protoc-gen-go.sh
openapi: proto-format
@echo "--> Generating OpenAPI specs"
@bash ./scripts/protoc-gen-openapi.sh
.PHONY: openapi
specs:
@echo "--> Generating module documentation"
@go run ./scripts/gen-spec.go
.PHONY: specs
docs-zetacored:
@echo "--> Generating zetacored documentation"
@bash ./scripts/gen-docs-zetacored.sh
.PHONY: docs-zetacored
go-generate:
@echo "--> Generating Go files"
@bash ./scripts/go-generate.sh
.PHONY: go-generate
# generate also includes Go code formatting
generate: proto-gen openapi specs typescript docs-zetacored go-generate fmt
.PHONY: generate
###############################################################################
### Localnet ###
###############################################################################
e2e-images: zetanode orchestrator
start-localnet: e2e-images solana start-localnet-skip-build
start-localnet-skip-build:
@echo "--> Starting localnet"
export LOCALNET_MODE=setup-only && \
export E2E_ARGS="${E2E_ARGS} --setup-solana --setup-sui --setup-ton" && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) \
--profile solana \
--profile sui \
--profile ton \
--profile monitoring \
--profile dry \
up -d
# stop-localnet should include all profiles so other containers are also removed
stop-localnet:
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile all down --remove-orphans
# delete any volume ending in persist
clear-localnet-persistence:
$(DOCKER) volume rm $$($(DOCKER) volume ls -qf "label=localnet=true")
###############################################################################
### E2E tests ###
###############################################################################
ifdef ZETANODE_IMAGE
zetanode:
@echo "Pulling zetanode image"
$(DOCKER) pull $(ZETANODE_IMAGE)
$(DOCKER) tag $(ZETANODE_IMAGE) zetanode:latest
.PHONY: zetanode
else
zetanode:
@echo "Building zetanode"
$(DOCKER) build -t zetanode --build-arg NODE_VERSION=$(NODE_VERSION) --build-arg NODE_COMMIT=$(NODE_COMMIT) --target latest-runtime -f ./Dockerfile-localnet .
.PHONY: zetanode
endif
orchestrator:
@echo "Building e2e orchestrator"
$(DOCKER) build -t orchestrator -f contrib/localnet/orchestrator/Dockerfile.fastbuild .
.PHONY: orchestrator
install-zetae2e: go.sum
@echo "--> Installing zetae2e"
@go install -mod=readonly $(BUILD_FLAGS) ./cmd/zetae2e
.PHONY: install-zetae2e
solana:
@echo "Building solana docker image"
$(DOCKER) build -t solana-local -f contrib/localnet/solana/Dockerfile contrib/localnet/solana/
start-e2e-test: e2e-images
@echo "--> Starting e2e test"
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile dry up -d
start-e2e-test-4nodes: e2e-images
@echo "--> Starting e2e test with 4 nodes"
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile stress up -d
start-replace-observer: e2e-images solana
@echo "--> Starting e2e with observer replacement"
export E2E_ARGS="${E2E_ARGS} --test-solana --test-sui" && \
export LOCALNET_MODE=replace-observer && \
export OBSERVER_REPLACE_MODE=true && \
export REUSE_TSS_FROM=zetaclient2 && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile stress --profile replace-observer --profile sui --profile solana up -d
start-e2e-v2ZETA-test: e2e-images
@echo "--> Starting e2e test with V2 ZETA flows enabled"
export E2E_ARGS="${E2E_ARGS} --v2-zeta-flows" && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) up -d
start-skip-consensus-overwrite-test: e2e-images
@echo "--> Starting e2e test but skip overwriting the consensus timeout params on zetacore0"
cd contrib/localnet/ && SKIP_CONSENSUS_VALUES_OVERWRITE=true $(DOCKER_COMPOSE) up -d
start-staking-test: e2e-images
@echo "--> Starting e2e staking test"
export E2E_ARGS="${E2E_ARGS} --skip-regular --test-staking" && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) up -d
start-e2e-admin-test: e2e-images
@echo "--> Starting e2e admin test"
export E2E_ARGS="${E2E_ARGS} --skip-regular --test-admin" && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile eth2 up -d
start-e2e-performance-test: e2e-images solana
@echo "--> Starting e2e performance test"
export E2E_ARGS="${E2E_ARGS} --test-stress-eth --test-stress-solana --test-stress-sui" && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile stress up -d
start-e2e-performance-test-1k: e2e-images solana
@echo "--> Starting e2e performance test"
export E2E_ARGS="${E2E_ARGS} --test-stress-eth --test-stress-solana --test-stress-sui --iterations=1000" && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile solana --profile sui --profile stress up -d
start-stress-test-eth: e2e-images
@echo "--> Starting stress test for eth"
export E2E_ARGS="${E2E_ARGS} --test-stress-zevm --test-stress-eth --iterations=1000" && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile stress --profile monitoring --profile dry up -d
start-stress-test-solana: e2e-images solana
@echo "--> Starting stress test for solana"
export E2E_ARGS="${E2E_ARGS} --test-stress-solana --iterations=50" && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile solana --profile stress up -d
start-stress-test-sui: e2e-images
@echo "--> Starting stress test for sui"
export E2E_ARGS="${E2E_ARGS} --test-stress-sui --iterations=50" && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile sui --profile stress up -d
start-e2e-import-mainnet-test: e2e-images
@echo "--> Starting e2e import-data test"
export ZETACORED_IMPORT_GENESIS_DATA=true && \
export ZETACORED_START_PERIOD=15m && \
cd contrib/localnet/ && ./scripts/import-data.sh mainnet && $(DOCKER_COMPOSE) up -d
start-e2e-consensus-test: e2e-images
@echo "--> Starting e2e consensus test"
export ZETACORE1_IMAGE=ghcr.io/zeta-chain/zetanode:develop && \
export ZETACORE1_PLATFORM=linux/amd64 && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) up -d
start-tss-migration-add-observer: e2e-images solana
@echo "--> Starting tss migration test with add observer"
export E2E_ARGS="${E2E_ARGS} --test-solana --test-sui --test-ton" && \
export TSS_MIGRATION_FLAG="--tss-migration-add-observer" && \
export LOCALNET_MODE=tss-migrate && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile tss --profile solana --profile sui --profile ton up -d
start-tss-migration-remove-observer: e2e-images solana
@echo "--> Starting tss migration test with remove observer"
export E2E_ARGS="${E2E_ARGS} --test-solana --test-sui --test-ton" && \
export TSS_MIGRATION_FLAG="--tss-migration-remove-observer" && \
export LOCALNET_MODE=tss-migrate && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile tss --profile stress --profile solana --profile sui --profile ton up -d
start-solana-test: e2e-images solana
@echo "--> Starting solana test"
export E2E_ARGS="${E2E_ARGS} --skip-regular --test-solana" && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile solana --profile dry up -d
start-ton-test: e2e-images
@echo "--> Starting TON test"
export E2E_ARGS="${E2E_ARGS} --skip-regular --test-ton" && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile ton --profile dry up -d
start-sui-test: e2e-images
@echo "--> Starting sui test"
export E2E_ARGS="${E2E_ARGS} --skip-regular --test-sui" && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile sui --profile dry up -d
start-legacy-test: e2e-images
@echo "--> Starting e2e smart contracts legacy test"
export E2E_ARGS="${E2E_ARGS} --skip-regular --test-legacy" && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) up -d
###############################################################################
### Chaos Tests ###
###############################################################################
chaos-all: stop-localnet
@CHAOS_PROFILE=1 $(MAKE) start-e2e-test
chaos-stress-eth: stop-localnet
@export E2E_ARGS="${E2E_ARGS} --test-timeout=90m --receipt-timeout=30m --cctx-timeout=30m" && \
CHAOS_PROFILE=9 $(MAKE) start-stress-test-eth
chaos-inbound: stop-localnet
@export E2E_ARGS="${E2E_ARGS} --test-timeout=60m --receipt-timeout=20m --cctx-timeout=20m" && \
CHAOS_PROFILE=2 $(MAKE) start-e2e-test
chaos-outbound: stop-localnet
@CHAOS_PROFILE=3 $(MAKE) start-e2e-test
chaos-btc: stop-localnet
@CHAOS_PROFILE=4 $(MAKE) start-e2e-test
chaos-eth: stop-localnet
@CHAOS_PROFILE=5 $(MAKE) start-e2e-test
chaos-solana: stop-localnet
@CHAOS_PROFILE=6 $(MAKE) start-solana-test
chaos-sui: stop-localnet
@CHAOS_PROFILE=7 $(MAKE) start-sui-test
chaos-ton: stop-localnet
CHAOS_PROFILE=8 $(MAKE) start-ton-test
###############################################################################
### Upgrade Tests ###
###############################################################################
# build from source only if requested
# NODE_VERSION and NODE_COMMIT must be set as old-runtime depends on latest-runtime
ifdef UPGRADE_TEST_FROM_SOURCE
zetanode-upgrade: e2e-images
@echo "Building zetanode-upgrade from source"
$(DOCKER) build -t zetanode:old -f Dockerfile-localnet --target old-runtime-source \
--build-arg OLD_ZETACORED_VERSION='release/$(OLD_ZETACORED_VERSION_MAJOR)' \
--build-arg NODE_VERSION=$(NODE_VERSION) \
--build-arg NODE_COMMIT=$(NODE_COMMIT) \
.
else
zetanode-upgrade: e2e-images
@echo "Building zetanode-upgrade from binaries"
$(DOCKER) build -t zetanode:old -f Dockerfile-localnet --target old-runtime \
--build-arg OLD_ZETACORED_VERSION='https://github.com/zeta-chain/node/releases/download/$(OLD_ZETACORED_VERSION)' \
--build-arg OLD_ZETACLIENTD_VERSION='https://github.com/zeta-chain/node/releases/download/$(OLD_ZETACLIENTD_VERSION)' \
--build-arg OLD_ZETAE2E_VERSION='https://github.com/zeta-chain/node/releases/download/$(OLD_ZETAE2E_VERSION)' \
--build-arg NODE_VERSION=$(NODE_VERSION) \
--build-arg NODE_COMMIT=$(NODE_COMMIT) \
.
endif
.PHONY: zetanode-upgrade
start-upgrade-test: zetanode-upgrade solana
@echo "--> Starting upgrade test"
export LOCALNET_MODE=upgrade && \
export UPGRADE_HEIGHT=300 && \
export USE_ZETAE2E_ANTE=true && \
export E2E_ARGS="--test-solana --test-sui" && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile upgrade --profile solana --profile sui -f docker-compose-upgrade.yml up -d
# test zetaclientd-only light upgrade , the test does not wait for the upgrade height , but it is still used to signify that this is a light upgrade[height < 100 == light upgrade]
start-upgrade-test-zetaclient-light: zetanode-upgrade
@echo "--> Starting zetaclientd-only light upgrade test"
export LOCALNET_MODE=upgrade && \
export UPGRADE_HEIGHT=60 && \
export E2E_ARGS="--upgrade-contracts" && \
export USE_ZETAE2E_ANTE=true && \
export UPGRADE_ZETACLIENT_ONLY=true && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile upgrade-zetaclient -f docker-compose-upgrade.yml up -d
# test zetaclientd-only upgrade , the test does not wait for the upgrade height , but it is still used to signify that this is not a light upgrade[height > 100 == regular upgrade]
start-upgrade-test-zetaclient: zetanode-upgrade solana
@echo "--> Starting upgrade test"
export LOCALNET_MODE=upgrade && \
export UPGRADE_HEIGHT=260 && \
export E2E_ARGS="--test-solana --test-sui" && \
export UPGRADE_ZETACLIENT_ONLY=true && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile upgrade-zetaclient --profile solana --profile sui -f docker-compose-upgrade.yml up -d
start-upgrade-test-light: zetanode-upgrade
@echo "--> Starting light upgrade test (no ZetaChain state populating before upgrade)"
export LOCALNET_MODE=upgrade && \
export UPGRADE_HEIGHT=60 && \
export USE_ZETAE2E_ANTE=true && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile upgrade -f docker-compose-upgrade.yml up -d
start-upgrade-test-admin: zetanode-upgrade
@echo "--> Starting admin upgrade test"
export LOCALNET_MODE=upgrade && \
export UPGRADE_HEIGHT=90 && \
export E2E_ARGS="${E2E_ARGS} --skip-regular --test-admin" && \
export USE_ZETAE2E_ANTE=true && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile upgrade -f docker-compose-upgrade.yml up -d
start-upgrade-import-mainnet-test: zetanode-upgrade
@echo "--> Starting import-data upgrade test"
export LOCALNET_MODE=upgrade && \
export ZETACORED_IMPORT_GENESIS_DATA=true && \
export ZETACORED_START_PERIOD=15m && \
export UPGRADE_HEIGHT=225 && \
cd contrib/localnet/ && ./scripts/import-data.sh mainnet && $(DOCKER_COMPOSE) --profile upgrade -f docker-compose-upgrade.yml up -d
start-connector-migration-test: zetanode-upgrade
@echo "--> Starting migration test for v2 connector contracts"
export LOCALNET_MODE=upgrade && \
export UPGRADE_HEIGHT=60 && \
export USE_ZETAE2E_ANTE=true && \
export E2E_ARGS="${E2E_ARGS} --skip-regular --test-connector-migration --test-legacy" && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile upgrade -f docker-compose-upgrade.yml up -d
###############################################################################
### Simulation Tests ###
###############################################################################
BINDIR ?= $(GOPATH)/bin
SIMAPP = ./simulation
# Run sim is a cosmos tool which helps us to run multiple simulations in parallel.
runsim: $(BINDIR)/runsim
$(BINDIR)/runsim:
@echo 'Installing runsim...'
@TEMP_DIR=$$(mktemp -d) && \
cd $$TEMP_DIR && \
go install github.com/cosmos/tools/cmd/[email protected] && \
rm -rf $$TEMP_DIR || (echo 'Failed to install runsim' && exit 1)
@echo 'runsim installed successfully'
# Configuration parameters for simulation tests
# NumBlocks: Number of blocks to simulate
# BlockSize: Number of transactions in a block
# Commit: Whether to commit the block or not
# Period: Invariant check period
# Timeout: Timeout for the simulation test
define run-sim-test
@echo "Running $(1)"
@go test ${TEST_BUILD_FLAGS} -mod=readonly $(SIMAPP) -run $(2) -Enabled=true \
-NumBlocks=$(3) -BlockSize=$(4) -Commit=true -Period=0 -v -timeout $(5)
endef
test-sim-nondeterminism:
$(call run-sim-test,"non-determinism test",TestAppStateDeterminism,100,200,30m)
test-sim-fullappsimulation:
$(call run-sim-test,"TestFullAppSimulation",TestFullAppSimulation,100,200,30m)
test-sim-import-export:
$(call run-sim-test,"test-import-export",TestAppImportExport,50,100,30m)
test-sim-after-import:
$(call run-sim-test,"test-sim-after-import",TestAppSimulationAfterImport,100,200,30m)
test-sim-multi-seed-long: runsim
@echo "Running long multi-seed application simulation."
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 500 50 TestFullAppSimulation
test-sim-multi-seed-short: runsim
@echo "Running short multi-seed application simulation."
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 10 TestFullAppSimulation
test-sim-import-export-long: runsim
@echo "Running application import/export simulation. This may take several minutes"
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 500 50 TestAppImportExport
test-sim-after-import-long: runsim
@echo "Running application simulation-after-import. This may take several minute"
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 500 50 TestAppSimulationAfterImport
.PHONY: \
test-sim-nondeterminism \
test-sim-fullappsimulation \
test-sim-multi-seed-long \
test-sim-multi-seed-short \
test-sim-import-export \
test-sim-after-import \
test-sim-import-export-long \
test-sim-after-import-long
###############################################################################
### GoReleaser ###
###############################################################################
release-snapshot-zetacore:
$(GORELEASER) --config .goreleaser-zetacore.yaml --clean --skip=validate --skip=publish --snapshot
release-snapshot-zetaclient:
$(GORELEASER) --config .goreleaser-zetaclient.yaml --clean --skip=validate --skip=publish --snapshot
release-zetacore:
@if [ ! -f ".release-env" ]; then \
echo "\033[91m.release-env is required for release\033[0m";\
exit 1;\
fi
$(GORELEASER) --config .goreleaser-zetacore.yaml --clean --skip=validate
release-zetaclient:
@if [ ! -f ".release-env" ]; then \
echo "\033[91m.release-env is required for release\033[0m";\
exit 1;\
fi
$(GORELEASER) --config .goreleaser-zetaclient.yaml --clean --skip=validate
### Legacy release commands
# TODO: Remove once new separated zetaclientd/zetacored is fully adopted
# https://github.com/zeta-chain/node/issues/4327
release-snapshot:
$(GORELEASER) --clean --skip=validate --skip=publish --snapshot
release-build-only:
$(GORELEASER) --clean --skip=validate --skip=publish
release:
@if [ ! -f ".release-env" ]; then \
echo "\033[91m.release-env is required for release\033[0m";\
exit 1;\
fi
$(GORELEASER) --clean --skip=validate
###############################################################################
### Local Mainnet Development ###
###############################################################################
#ETHEREUM
start-eth-node-mainnet:
cd contrib/rpc/ethereum && DOCKER_TAG=$(DOCKER_TAG) docker-compose up
stop-eth-node-mainnet:
cd contrib/rpc/ethereum && DOCKER_TAG=$(DOCKER_TAG) docker-compose down
clean-eth-node-mainnet:
cd contrib/rpc/ethereum && DOCKER_TAG=$(DOCKER_TAG) docker-compose down -v
# Start mainnet node with cached snapshot (if available)
mainnet-node:
@$(MAKE) zetanode NODE_VERSION=$(OLD_VERSION:v%=%)
cd contrib/localnet/ && $(DOCKER) compose -p localnet -f docker-compose.yml up -d mainnet-node
# Start mainnet node with forced snapshot download
mainnet-node-force:
@$(MAKE) zetanode NODE_VERSION=$(OLD_VERSION:v%=%)
cd contrib/localnet/ && FORCE_DOWNLOAD=true $(DOCKER) compose -p localnet -f docker-compose.yml up -d mainnet-node
# Stop and remove mainnet node
mainnet-node-stop:
cd contrib/localnet/ && $(DOCKER) compose -p localnet -f docker-compose.yml down mainnet-node
###############################################################################
### Local Testnet Development ###
###############################################################################
# Start testnet node with cached snapshot (if available)
testnet-node:
@$(MAKE) zetanode NODE_VERSION=$(OLD_VERSION:v%=%)
cd contrib/localnet/ && $(DOCKER) compose -p localnet -f docker-compose.yml up -d testnet-node
# Start testnet node with forced snapshot download
testnet-node-force:
@$(MAKE) zetanode NODE_VERSION=$(OLD_VERSION:v%=%)
cd contrib/localnet/ && FORCE_DOWNLOAD=true $(DOCKER) compose -p localnet -f docker-compose.yml up -d testnet-node
# Stop and remove testnet node
testnet-node-stop:
cd contrib/localnet/ && $(DOCKER) compose -p localnet -f docker-compose.yml down testnet-node
###############################################################################
### Debug Tools ###
###############################################################################
# Start dry run zetaclientd in dry mode
# Usage: make zetaclient-dry ZETACORE_HOST=mainnet-node RPC_API_KEY_ALLTHATNODE=<your-api-key>
# Use zetaclientd version to build images for zetaclientd-dry
# ZETACLIENT_DRY_VERSION can be overridden
# make zetaclient-dry ZETACORE_HOST=testnet-node RPC_API_KEY_ALLTHATNODE=<api key> ZETACLIENT_DRY_VERSION=v38.0.0
ZETACLIENT_DRY_VERSION ?= $(subst zetaclient_,,$(OLD_ZETACLIENTD_VERSION))
zetaclient-dry:
$(DOCKER) build -t zetanode --build-arg NODE_VERSION=$(ZETACLIENT_DRY_VERSION) --target latest-runtime -f ./Dockerfile-localnet .
cd contrib/localnet/ && ZETACORE_HOST=$(ZETACORE_HOST) RPC_API_KEY_ALLTHATNODE=$(RPC_API_KEY_ALLTHATNODE) $(DOCKER) compose -p localnet -f docker-compose.yml up -d zetaclient-dry
filter-missed-btc: install-zetatool
zetatool filterdeposit btc --config ./tool/filter_missed_deposits/zetatool_config.json
filter-missed-eth: install-zetatool
zetatool filterdeposit eth \
--config ./tool/filter_missed_deposits/zetatool_config.json \
--evm-max-range 1000 \
--evm-start-block 19464041