github.com/Finschia/finschia-sdk@v0.48.1/Makefile (about) 1 #!/usr/bin/make -f 2 3 PACKAGES_NOSIMULATION=$(shell go list ./... | grep -v '/simulation') 4 PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation') 5 VERSION := $(shell echo $(shell git describe --always) | sed 's/^v//') 6 COMMIT := $(shell git log -1 --format='%H') 7 LEDGER_ENABLED ?= true 8 BINDIR ?= $(GOPATH)/bin 9 BUILDDIR ?= $(CURDIR)/build 10 SIMAPP = ./simapp 11 MOCKS_DIR = $(CURDIR)/tests/mocks 12 HTTPS_GIT := https://github.com/Finschia/finschia-sdk.git 13 DOCKER := $(shell which docker) 14 DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf 15 CGO_ENABLED ?= 1 16 ARCH ?= x86_64 17 18 export GO111MODULE = on 19 20 # process build tags 21 22 build_tags = netgo 23 ifeq ($(LEDGER_ENABLED),true) 24 ifeq ($(OS),Windows_NT) 25 GCCEXE = $(shell where gcc.exe 2> NUL) 26 ifeq ($(GCCEXE),) 27 $(error gcc.exe not installed for ledger support, please install or set LEDGER_ENABLED=false) 28 else 29 build_tags += ledger 30 endif 31 else 32 UNAME_S = $(shell uname -s) 33 ifeq ($(UNAME_S),OpenBSD) 34 $(warning OpenBSD detected, disabling ledger support (https://github.com/cosmos/cosmos-sdk/issues/1988)) 35 else 36 GCC = $(shell command -v gcc 2> /dev/null) 37 ifeq ($(GCC),) 38 $(error gcc not installed for ledger support, please install or set LEDGER_ENABLED=false) 39 else 40 build_tags += ledger 41 endif 42 endif 43 endif 44 endif 45 46 # DB backend selection 47 ifeq (,$(filter $(LBM_BUILD_OPTIONS), cleveldb rocksdb boltdb badgerdb)) 48 BUILD_TAGS += goleveldb 49 DB_BACKEND = goleveldb 50 else 51 ifeq (cleveldb,$(findstring cleveldb,$(LBM_BUILD_OPTIONS))) 52 CGO_ENABLED=1 53 BUILD_TAGS += gcc cleveldb 54 DB_BACKEND = cleveldb 55 endif 56 ifeq (badgerdb,$(findstring badgerdb,$(LBM_BUILD_OPTIONS))) 57 BUILD_TAGS += badgerdb 58 DB_BACKEND = badgerdb 59 endif 60 ifeq (rocksdb,$(findstring rocksdb,$(LBM_BUILD_OPTIONS))) 61 CGO_ENABLED=1 62 BUILD_TAGS += gcc rocksdb 63 DB_BACKEND = rocksdb 64 endif 65 ifeq (boltdb,$(findstring boltdb,$(LBM_BUILD_OPTIONS))) 66 BUILD_TAGS += boltdb 67 DB_BACKEND = boltdb 68 endif 69 endif 70 71 # secp256k1 implementation selection 72 ifeq (libsecp256k1,$(findstring libsecp256k1,$(LBM_BUILD_OPTIONS))) 73 CGO_ENABLED=1 74 BUILD_TAGS += libsecp256k1 75 endif 76 77 build_tags += $(BUILD_TAGS) 78 build_tags := $(strip $(build_tags)) 79 80 whitespace := 81 whitespace += $(whitespace) 82 comma := , 83 build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags)) 84 85 # process linker flags 86 87 ldflags = -X github.com/Finschia/finschia-sdk/version.Name=sim \ 88 -X github.com/Finschia/finschia-sdk/version.AppName=simd \ 89 -X github.com/Finschia/finschia-sdk/version.Version=$(VERSION) \ 90 -X github.com/Finschia/finschia-sdk/version.Commit=$(COMMIT) \ 91 -X github.com/Finschia/finschia-sdk/types.DBBackend=$(DB_BACKEND) \ 92 -X "github.com/Finschia/finschia-sdk/version.BuildTags=$(build_tags_comma_sep)" 93 94 ifeq (,$(findstring nostrip,$(LBM_BUILD_OPTIONS))) 95 ldflags += -w -s 96 endif 97 ldflags += $(LDFLAGS) 98 ldflags := $(strip $(ldflags)) 99 100 BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)' 101 # check for nostrip option 102 ifeq (,$(findstring nostrip,$(LBM_BUILD_OPTIONS))) 103 BUILD_FLAGS += -trimpath 104 endif 105 106 all: tools build lint test 107 108 # The below include contains the tools and runsim targets. 109 include contrib/devtools/Makefile 110 111 ############################################################################### 112 ### Build ### 113 ############################################################################### 114 115 BUILD_TARGETS := build install 116 117 build: BUILD_ARGS=-o $(BUILDDIR)/ 118 119 build-docker: go.sum $(BUILDDIR)/ 120 docker build -t simapp:latest . --platform="linux/amd64" --build-arg ARCH=$(ARCH) 121 122 # todo: should be fix 123 build-linux: 124 GOOS=linux GOARCH=$(if $(findstring aarch64,$(shell uname -m)) || $(findstring arm64,$(shell uname -m)),arm64,amd64) LEDGER_ENABLED=false $(MAKE) build 125 126 $(BUILD_TARGETS): go.sum $(BUILDDIR)/ 127 CGO_CFLAGS=$(CGO_CFLAGS) CGO_LDFLAGS=$(CGO_LDFLAGS) CGO_ENABLED=$(CGO_ENABLED) go $@ -mod=readonly $(BUILD_FLAGS) $(BUILD_ARGS) ./... 128 129 $(BUILDDIR)/: 130 mkdir -p $(BUILDDIR)/ 131 132 cosmovisor: 133 $(MAKE) -C tools/cosmovisor test 134 135 .PHONY: build build-linux cosmovisor 136 137 mocks: $(MOCKS_DIR) 138 mockgen -source=client/account_retriever.go -package mocks -destination tests/mocks/account_retriever.go 139 mockgen -package mocks -destination tests/mocks/tendermint_tm_db_DB.go github.com/tendermint/tm-db DB 140 mockgen -source=types/module/module.go -package mocks -destination tests/mocks/types_module_module.go 141 mockgen -source=types/invariant.go -package mocks -destination tests/mocks/types_invariant.go 142 mockgen -source=types/router.go -package mocks -destination tests/mocks/types_router.go 143 mockgen -source=types/handler.go -package mocks -destination tests/mocks/types_handler.go 144 mockgen -package mocks -destination tests/mocks/grpc_server.go github.com/gogo/protobuf/grpc Server 145 mockgen -package mocks -destination tests/mocks/tendermint_tendermint_libs_log_DB.go github.com/Finschia/ostracon/libs/log Logger 146 mockgen -source=x/stakingplus/expected_keepers.go -package testutil -destination x/stakingplus/testutil/expected_keepers_mocks.go 147 .PHONY: mocks 148 149 $(MOCKS_DIR): 150 mkdir -p $(MOCKS_DIR) 151 152 distclean: clean tools-clean 153 clean: 154 rm -rf \ 155 $(BUILDDIR)/ \ 156 artifacts/ \ 157 tmp-swagger-gen/ 158 159 .PHONY: distclean clean 160 161 ############################################################################### 162 ### Tools & Dependencies ### 163 ############################################################################### 164 165 go.sum: go.mod 166 echo "Ensure dependencies have not been modified ..." >&2 167 go mod verify 168 go mod tidy 169 170 ############################################################################### 171 ### Documentation ### 172 ############################################################################### 173 174 update-swagger-docs: statik 175 $(BINDIR)/statik -src=client/docs/swagger-ui -dest=client/docs -f -m 176 @if [ -n "$(git status --porcelain)" ]; then \ 177 echo "\033[91mSwagger docs are out of sync!!!\033[0m";\ 178 exit 1;\ 179 else \ 180 echo "\033[92mSwagger docs are in sync\033[0m";\ 181 fi 182 .PHONY: update-swagger-docs 183 184 godocs: 185 @echo "--> Wait a few seconds and visit http://localhost:6060/pkg/github.com/Finschia/finschia-sdk/types" 186 godoc -http=:6060 187 188 # This builds a docs site for each branch/tag in `./docs/versions` 189 # and copies each site to a version prefixed path. The last entry inside 190 # the `versions` file will be the default root index.html. 191 build-docs: 192 @cd docs && \ 193 while read -r branch path_prefix; do \ 194 (git checkout $${branch} && npm install && VUEPRESS_BASE="/$${path_prefix}/" npm run build) ; \ 195 mkdir -p ~/output/$${path_prefix} ; \ 196 cp -r .vuepress/dist/* ~/output/$${path_prefix}/ ; \ 197 cp ~/output/$${path_prefix}/index.html ~/output ; \ 198 done < versions ; 199 200 sync-docs: 201 cd ~/output && \ 202 echo "role_arn = ${DEPLOYMENT_ROLE_ARN}" >> /root/.aws/config ; \ 203 echo "CI job = ${CIRCLE_BUILD_URL}" >> version.html ; \ 204 aws s3 sync . s3://${WEBSITE_BUCKET} --profile terraform --delete ; \ 205 aws cloudfront create-invalidation --distribution-id ${CF_DISTRIBUTION_ID} --profile terraform --path "/*" ; 206 .PHONY: sync-docs 207 208 ############################################################################### 209 ### Tests & Simulation ### 210 ############################################################################### 211 212 test: test-unit 213 test-all: test-unit test-ledger-mock test-race test-cover 214 215 TEST_PACKAGES=./... 216 TEST_TARGETS := test-unit test-unit-amino test-unit-proto test-ledger-mock test-race test-ledger test-race 217 218 # Test runs-specific rules. To add a new test target, just add 219 # a new rule, customise ARGS or TEST_PACKAGES ad libitum, and 220 # append the new rule to the TEST_TARGETS list. 221 test-unit: ARGS=-tags='cgo ledger test_ledger_mock norace goleveldb' 222 test-unit-amino: ARGS=-tags='ledger test_ledger_mock test_amino norace goleveldb' 223 test-ledger: ARGS=-tags='cgo ledger norace goleveldb' 224 test-ledger-mock: ARGS=-tags='ledger test_ledger_mock norace goleveldb' 225 test-race: ARGS=-race -tags='cgo ledger test_ledger_mock goleveldb' 226 test-race: TEST_PACKAGES=$(PACKAGES_NOSIMULATION) 227 $(TEST_TARGETS): run-tests 228 229 # check-* compiles and collects tests without running them 230 # note: go test -c doesn't support multiple packages yet (https://github.com/golang/go/issues/15513) 231 CHECK_TEST_TARGETS := check-test-unit check-test-unit-amino 232 check-test-unit: ARGS=-tags='cgo ledger test_ledger_mock norace' 233 check-test-unit-amino: ARGS=-tags='ledger test_ledger_mock test_amino norace' 234 $(CHECK_TEST_TARGETS): EXTRA_ARGS=-run=none 235 $(CHECK_TEST_TARGETS): run-tests 236 237 run-tests: 238 ifneq (,$(shell which tparse 2>/dev/null)) 239 go test -mod=readonly -json $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES) | tparse 240 else 241 go test -mod=readonly $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES) 242 endif 243 244 .PHONY: run-tests test test-all $(TEST_TARGETS) 245 246 test-sim-nondeterminism-short: 247 @echo "Running non-determinism test..." 248 @go test -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true \ 249 -NumBlocks=50 -BlockSize=100 -Commit=true -Period=0 -v -timeout 24h 250 251 test-sim-nondeterminism: 252 @echo "Running non-determinism test..." 253 @go test -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true \ 254 -NumBlocks=100 -BlockSize=200 -Commit=true -Period=0 -v -timeout 24h 255 256 test-sim-custom-genesis-fast: 257 @echo "Running custom genesis simulation..." 258 @echo "By default, ${HOME}/.gaiad/config/genesis.json will be used." 259 @go test -mod=readonly $(SIMAPP) -run TestFullAppSimulation -Genesis=${HOME}/.gaiad/config/genesis.json \ 260 -Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h 261 262 test-sim-import-export-short: runsim 263 @echo "Running application import/export simulation. This may take several minutes..." 264 @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 10 5 TestAppImportExport 265 266 test-sim-import-export: runsim 267 @echo "Running application import/export simulation. This may take several minutes..." 268 @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 5 TestAppImportExport 269 270 test-sim-after-import-short: runsim 271 @echo "Running application simulation-after-import. This may take several minutes..." 272 @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 10 5 TestAppSimulationAfterImport 273 274 test-sim-after-import: runsim 275 @echo "Running application simulation-after-import. This may take several minutes..." 276 @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 5 TestAppSimulationAfterImport 277 278 test-sim-custom-genesis-multi-seed: runsim 279 @echo "Running multi-seed custom genesis simulation..." 280 @echo "By default, ${HOME}/.gaiad/config/genesis.json will be used." 281 @$(BINDIR)/runsim -Genesis=${HOME}/.gaiad/config/genesis.json -SimAppPkg=$(SIMAPP) -ExitOnFail 400 5 TestFullAppSimulation 282 283 test-sim-multi-seed-long: runsim 284 @echo "Running long multi-seed application simulation. This may take awhile!" 285 @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 500 50 TestFullAppSimulation 286 287 # Seeds is from https://github.com/cosmos/tools/blob/master/cmd/runsim/main.go 288 test-sim-multi-seed-long-part1: runsim 289 @echo "Running long multi-seed application simulation. This may take awhile!" 290 @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail -Seeds="1,2,4,7,32,123,124,582,1893,2989,3012,4728" 500 50 TestFullAppSimulation 291 292 test-sim-multi-seed-long-part2: runsim 293 @echo "Running long multi-seed application simulation. This may take awhile!" 294 @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail -Seeds="37827,981928,87821,891823782,989182,89182391,11,22,44,77,99,2020" 500 50 TestFullAppSimulation 295 296 test-sim-multi-seed-long-part3: runsim 297 @echo "Running long multi-seed application simulation. This may take awhile!" 298 @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail -Seeds="3232,123123,124124,582582,18931893,29892989,30123012,47284728,7601778,8090485,977367484,491163361,424254581,673398983" 500 50 TestFullAppSimulation 299 300 test-sim-multi-seed-short: runsim 301 @echo "Running short multi-seed application simulation. This may take awhile!" 302 @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 20 10 TestFullAppSimulation 303 304 test-sim-benchmark-invariants: 305 @echo "Running simulation invariant benchmarks..." 306 @go test -mod=readonly $(SIMAPP) -benchmem -bench=BenchmarkInvariants -run=^$ \ 307 -Enabled=true -NumBlocks=1000 -BlockSize=200 \ 308 -Period=1 -Commit=true -Seed=57 -v -timeout 24h 309 310 .PHONY: \ 311 test-sim-nondeterminism \ 312 test-sim-custom-genesis-fast \ 313 test-sim-import-export \ 314 test-sim-after-import \ 315 test-sim-custom-genesis-multi-seed \ 316 test-sim-multi-seed-short \ 317 test-sim-multi-seed-long \ 318 test-sim-benchmark-invariants 319 320 SIM_NUM_BLOCKS ?= 500 321 SIM_BLOCK_SIZE ?= 200 322 SIM_COMMIT ?= true 323 324 test-sim-benchmark: 325 @echo "Running application benchmark for numBlocks=$(SIM_NUM_BLOCKS), blockSize=$(SIM_BLOCK_SIZE). This may take awhile!" 326 @go test -mod=readonly -benchmem -run=^$$ $(SIMAPP) -bench ^BenchmarkFullAppSimulation$$ \ 327 -Enabled=true -NumBlocks=$(SIM_NUM_BLOCKS) -BlockSize=$(SIM_BLOCK_SIZE) -Commit=$(SIM_COMMIT) -timeout 24h 328 329 test-sim-profile: 330 @echo "Running application benchmark for numBlocks=$(SIM_NUM_BLOCKS), blockSize=$(SIM_BLOCK_SIZE). This may take awhile!" 331 @go test -mod=readonly -benchmem -run=^$$ $(SIMAPP) -bench ^BenchmarkFullAppSimulation$$ \ 332 -Enabled=true -NumBlocks=$(SIM_NUM_BLOCKS) -BlockSize=$(SIM_BLOCK_SIZE) -Commit=$(SIM_COMMIT) -timeout 24h -cpuprofile cpu.out -memprofile mem.out 333 334 .PHONY: test-sim-profile test-sim-benchmark 335 336 test-cover: 337 @export VERSION=$(VERSION); bash -x contrib/test_cover.sh 338 .PHONY: test-cover 339 340 benchmark: 341 @go test -mod=readonly -bench=. $(PACKAGES_NOSIMULATION) 342 .PHONY: benchmark 343 344 ############################################################################### 345 ### Linting ### 346 ############################################################################### 347 348 lint: golangci-lint 349 golangci-lint run --out-format=tab 350 find . -name '*.go' -type f -not -path "*.git*" | xargs gofmt -d -s 351 352 golangci-lint: 353 @go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.2 354 355 lint-fix: golangci-lint 356 golangci-lint run --fix --out-format=tab --issues-exit-code=0 357 .PHONY: lint lint-fix golangci-lint 358 359 format: golangci-lint 360 find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -path "./tests/mocks/*" -not -name "*.pb.go" -not -name "*.pb.gw.go" -not -name "*.pulsar.go" -not -path "./crypto/keys/secp256k1/*" | xargs gofumpt -w -l 361 golangci-lint run --fix 362 .PHONY: format 363 364 ############################################################################### 365 ### Devdoc ### 366 ############################################################################### 367 368 DEVDOC_SAVE = docker commit `docker ps -a -n 1 -q` devdoc:local 369 370 devdoc-init: 371 $(DOCKER) run -it -v "$(CURDIR):/go/src/github.com/Finschia/finschia-sdk" -w "/go/src/github.com/Finschia/finschia-sdk" tendermint/devdoc echo 372 # TODO make this safer 373 $(call DEVDOC_SAVE) 374 375 devdoc: 376 $(DOCKER) run -it -v "$(CURDIR):/go/src/github.com/Finschia/finschia-sdk" -w "/go/src/github.com/Finschia/finschia-sdk" devdoc:local bash 377 378 devdoc-save: 379 # TODO make this safer 380 $(call DEVDOC_SAVE) 381 382 devdoc-clean: 383 docker rmi -f $$(docker images -f "dangling=true" -q) 384 385 devdoc-update: 386 docker pull tendermint/devdoc 387 388 .PHONY: devdoc devdoc-clean devdoc-init devdoc-save devdoc-update 389 390 ############################################################################### 391 ### easyjson ### 392 ############################################################################### 393 # easyjson must be used for types that are not registered in amino by RegisterConcrete. 394 easyjson-gen: 395 @echo "Generating easyjson files" 396 go install github.com/mailru/easyjson@v0.7.7 397 easyjson ./types/result.go 398 399 ############################################################################### 400 ### Protobuf ### 401 ############################################################################### 402 403 containerProtoVer=v0.2 404 containerProtoImage=tendermintdev/sdk-proto-gen:$(containerProtoVer) 405 containerProtoGen=cosmos-sdk-proto-gen-$(containerProtoVer) 406 containerProtoGenSwagger=cosmos-sdk-proto-gen-swagger-$(containerProtoVer) 407 containerProtoFmt=cosmos-sdk-proto-fmt-$(containerProtoVer) 408 409 proto-all: proto-format proto-lint proto-gen 410 411 proto-gen: 412 @echo "Generating Protobuf files" 413 @if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGen}$$"; then docker start -a $(containerProtoGen); else docker run --name $(containerProtoGen) -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) \ 414 sh ./scripts/protocgen.sh; fi 415 @go mod tidy 416 417 # This generates the SDK's custom wrapper for google.protobuf.Any. It should only be run manually when needed 418 proto-gen-any: 419 @echo "Generating Protobuf Any" 420 $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) sh ./scripts/protocgen-any.sh 421 422 proto-swagger-gen: 423 @echo "Generating Protobuf Swagger" 424 @if $(DOCKER) ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGenSwagger}$$"; then $(DOCKER) start -a $(containerProtoGenSwagger); else $(DOCKER) run --name $(containerProtoGenSwagger) -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) \ 425 sh ./scripts/protoc-swagger-gen.sh; fi 426 427 proto-format: 428 @echo "Formatting Protobuf files" 429 @$(DOCKER) run --rm -v $(CURDIR):/workspace \ 430 --workdir /workspace tendermintdev/docker-build-proto \ 431 find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \; 432 433 proto-lint: 434 @$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace cellink/clang-format-lint \ 435 --clang-format-executable /clang-format/clang-format9 -r --extensions proto --exclude ./third_party/* . 436 437 proto-check-breaking: 438 @$(DOCKER_BUF) breaking --against $(HTTPS_GIT)#branch=main 439 440 TM_URL = https://raw.githubusercontent.com/tendermint/tendermint/v0.34.22/proto/tendermint 441 GOGO_PROTO_URL = https://raw.githubusercontent.com/regen-network/protobuf/cosmos 442 COSMOS_PROTO_URL = https://raw.githubusercontent.com/regen-network/cosmos-proto/master 443 CONFIO_URL = https://raw.githubusercontent.com/confio/ics23/v0.6.3 444 445 TM_CRYPTO_TYPES = third_party/proto/tendermint/crypto 446 TM_ABCI_TYPES = third_party/proto/tendermint/abci 447 TM_TYPES = third_party/proto/tendermint/types 448 TM_VERSION = third_party/proto/tendermint/version 449 TM_LIBS = third_party/proto/tendermint/libs/bits 450 TM_P2P = third_party/proto/tendermint/p2p 451 452 GOGO_PROTO_TYPES = third_party/proto/gogoproto 453 COSMOS_PROTO_TYPES = third_party/proto/cosmos_proto 454 CONFIO_TYPES = third_party/proto/confio 455 456 proto-update-deps: 457 @mkdir -p $(GOGO_PROTO_TYPES) 458 @curl -sSL $(GOGO_PROTO_URL)/gogoproto/gogo.proto > $(GOGO_PROTO_TYPES)/gogo.proto 459 460 @mkdir -p $(COSMOS_PROTO_TYPES) 461 @curl -sSL $(COSMOS_PROTO_URL)/cosmos.proto > $(COSMOS_PROTO_TYPES)/cosmos.proto 462 463 ## Importing of tendermint protobuf definitions currently requires the 464 ## use of `sed` in order to build properly with cosmos-sdk's proto file layout 465 ## (which is the standard Buf.build FILE_LAYOUT) 466 ## Issue link: https://github.com/tendermint/tendermint/issues/5021 467 @mkdir -p $(TM_ABCI_TYPES) 468 @curl -sSL $(TM_URL)/abci/types.proto > $(TM_ABCI_TYPES)/types.proto 469 470 @mkdir -p $(TM_VERSION) 471 @curl -sSL $(TM_URL)/version/types.proto > $(TM_VERSION)/types.proto 472 473 @mkdir -p $(TM_TYPES) 474 @curl -sSL $(TM_URL)/types/types.proto > $(TM_TYPES)/types.proto 475 @curl -sSL $(TM_URL)/types/evidence.proto > $(TM_TYPES)/evidence.proto 476 @curl -sSL $(TM_URL)/types/params.proto > $(TM_TYPES)/params.proto 477 @curl -sSL $(TM_URL)/types/validator.proto > $(TM_TYPES)/validator.proto 478 @curl -sSL $(TM_URL)/types/block.proto > $(TM_TYPES)/block.proto 479 480 @mkdir -p $(TM_CRYPTO_TYPES) 481 @curl -sSL $(TM_URL)/crypto/proof.proto > $(TM_CRYPTO_TYPES)/proof.proto 482 @curl -sSL $(TM_URL)/crypto/keys.proto > $(TM_CRYPTO_TYPES)/keys.proto 483 484 @mkdir -p $(TM_LIBS) 485 @curl -sSL $(TM_URL)/libs/bits/types.proto > $(TM_LIBS)/types.proto 486 487 @mkdir -p $(TM_P2P) 488 @curl -sSL $(TM_URL)/p2p/types.proto > $(TM_P2P)/types.proto 489 490 @mkdir -p $(CONFIO_TYPES) 491 @curl -sSL $(CONFIO_URL)/proofs.proto > $(CONFIO_TYPES)/proofs.proto 492 ## insert go package option into proofs.proto file 493 ## Issue link: https://github.com/confio/ics23/issues/32 494 @sed -i '4ioption go_package = "github.com/confio/ics23/go";' $(CONFIO_TYPES)/proofs.proto 495 496 .PHONY: proto-all proto-gen proto-gen-any proto-swagger-gen proto-format proto-lint proto-check-breaking proto-update-deps 497 498 ############################################################################### 499 ### Localnet ### 500 ############################################################################### 501 502 localnet-build-env: 503 $(MAKE) -C contrib/images simd-env 504 505 localnet-build-dlv: 506 $(MAKE) -C contrib/images simd-dlv 507 508 localnet-build-nodes: 509 $(DOCKER) run --rm -v $(CURDIR)/.testnets:/data cosmossdk/simd \ 510 testnet init-files --v 4 -o /data --starting-ip-address 192.168.10.2 --keyring-backend=test 511 docker-compose up -d 512 513 localnet-stop: 514 docker-compose down 515 516 # localnet-start will run a 4-node testnet locally. The nodes are 517 # based off the docker images in: ./contrib/images/simd-env 518 localnet-start: localnet-stop localnet-build-env localnet-build-nodes 519 520 # localnet-debug will run a 4-node testnet locally in debug mode 521 # you can read more about the debug mode here: ./contrib/images/simd-dlv/README.md 522 localnet-debug: localnet-stop localnet-build-dlv localnet-build-nodes 523 524 .PHONY: localnet-start localnet-stop localnet-debug localnet-build-env \ 525 localnet-build-dlv localnet-build-nodes 526 527 ############################################################################### 528 ### rosetta ### 529 ############################################################################### 530 531 rosetta-data: 532 -docker container rm data_dir_build 533 docker build -t rosetta-ci:latest -f contrib/rosetta/node/Dockerfile . 534 docker run --name data_dir_build -t rosetta-ci:latest sh /rosetta/data.sh 535 docker cp data_dir_build:/tmp/data.tar.gz "$(CURDIR)/contrib/rosetta/node/data.tar.gz" 536 docker container rm data_dir_build 537 538 .PHONY: rosetta-data 539 540 ############################################################################### 541 ### release ### 542 ############################################################################### 543 544 GORELEASER_CONFIG ?= .goreleaser.yml 545 546 GORELEASER_BUILD_LDF = $(ldflags) 547 GORELEASER_BUILD_LDF := $(strip $(GORELEASER_BUILD_LDF)) 548 549 GORELEASER_SKIP_VALIDATE ?= false 550 GORELEASER_DEBUG ?= false 551 GORELEASER_IMAGE ?= goreleaser/goreleaser-cross:v1.21-v1.20.0 552 GORELEASER_RELEASE ?= false 553 GO_MOD_NAME := github.com/Finschia/finschia-sdk 554 555 ifeq ($(GORELEASER_RELEASE),true) 556 GORELEASER_SKIP_VALIDATE := false 557 GORELEASER_SKIP_PUBLISH := release --skip-publish=false 558 else 559 GORELEASER_SKIP_PUBLISH := --skip-publish=true 560 GORELEASER_SKIP_VALIDATE ?= false 561 GITHUB_TOKEN= 562 endif 563 564 ifeq ($(GORELEASER_MOUNT_CONFIG),true) 565 GORELEASER_IMAGE := -v $(HOME)/.docker/config.json:/root/.docker/config.json $(GORELEASER_IMAGE) 566 endif 567 568 release-snapshot: 569 docker run --rm \ 570 -e BUILD_TAGS="$(build_tags)" \ 571 -e BUILD_VARS='$(GORELEASER_BUILD_LDF)' \ 572 -e GITHUB_TOKEN="$(GITHUB_TOKEN)" \ 573 -v /var/run/docker.sock:/var/run/docker.sock \ 574 -v $(shell pwd):/go/src/$(GO_MOD_NAME) \ 575 -w /go/src/$(GO_MOD_NAME) \ 576 $(GORELEASER_IMAGE) \ 577 build --snapshot \ 578 -f "$(GORELEASER_CONFIG)" \ 579 --skip-validate=$(GORELEASER_SKIP_VALIDATE) \ 580 --debug=$(GORELEASER_DEBUG) \ 581 --clean 582 583 release: 584 docker run --rm \ 585 -e BUILD_TAGS="$(build_tags)" \ 586 -e BUILD_VARS='$(GORELEASER_BUILD_LDF)' \ 587 -e GITHUB_TOKEN="$(GITHUB_TOKEN)" \ 588 -v /var/run/docker.sock:/var/run/docker.sock \ 589 -v $(shell pwd):/go/src/$(GO_MOD_NAME) \ 590 -w /go/src/$(GO_MOD_NAME) \ 591 $(GORELEASER_IMAGE) \ 592 $(GORELEASER_SKIP_PUBLISH) \ 593 -f "$(GORELEASER_CONFIG)" \ 594 --skip-validate=$(GORELEASER_SKIP_VALIDATE) \ 595 --skip-announce=true \ 596 --debug=$(GORELEASER_DEBUG) \ 597 --clean 598 599 .PHONY: release-snapshot release