You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

235 lines
8.7 KiB

[RPC] Static swagger (#3880) * manually swagging Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * three definitions with polymorphism Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * added blockchain and block Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * low quality generation, commit, block_response and validators Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * genesis and consensus states endpoints Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * fix indentation Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * consensus parameters Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * fix indentation Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * add height to consensus parameters endpoint Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * unconfirmed_txs and num_unconfirmed_txs Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * add missing query parameter Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * add ABCI queries Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * added index document for swagger documentation Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * add missing routes Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * contract tests added on CCI Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * contract tests job should be in the test suite Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * simplify requirements to test Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * typo Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * build is a prerequisite to start localnet Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * reduce nodejs size, move goodman to get_tools, add docs, fix comments Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * Update scripts/get_tools.sh That's cleaner, thanks! Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com> * xz not supported by cci image, let's keep it simple Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * REMOVE-indirect debug of CCI paths Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * dirty experiment, volume is empty but binary has been produced Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * dirty experiment, volume is empty but binary has been produced Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * dirty experiment going on Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * locally works, CCI have difficulties with second layaer containers volumes Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * restore experiment, use machine instead of docker for contract tests Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * simplify a bit Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * rollback on machine golang Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * Document the changes Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * Changelog Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * comments Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
5 years ago
[RPC] Static swagger (#3880) * manually swagging Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * three definitions with polymorphism Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * added blockchain and block Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * low quality generation, commit, block_response and validators Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * genesis and consensus states endpoints Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * fix indentation Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * consensus parameters Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * fix indentation Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * add height to consensus parameters endpoint Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * unconfirmed_txs and num_unconfirmed_txs Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * add missing query parameter Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * add ABCI queries Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * added index document for swagger documentation Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * add missing routes Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * contract tests added on CCI Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * contract tests job should be in the test suite Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * simplify requirements to test Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * typo Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * build is a prerequisite to start localnet Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * reduce nodejs size, move goodman to get_tools, add docs, fix comments Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * Update scripts/get_tools.sh That's cleaner, thanks! Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com> * xz not supported by cci image, let's keep it simple Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * REMOVE-indirect debug of CCI paths Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * dirty experiment, volume is empty but binary has been produced Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * dirty experiment, volume is empty but binary has been produced Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * dirty experiment going on Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * locally works, CCI have difficulties with second layaer containers volumes Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * restore experiment, use machine instead of docker for contract tests Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * simplify a bit Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * rollback on machine golang Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * Document the changes Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * Changelog Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * comments Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
5 years ago
  1. PACKAGES=$(shell go list ./...)
  2. OUTPUT?=build/tendermint
  3. BUILD_TAGS?='tendermint'
  4. LD_FLAGS = -X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse --short=8 HEAD` -s -w
  5. BUILD_FLAGS = -mod=readonly -ldflags "$(LD_FLAGS)"
  6. HTTPS_GIT := https://github.com/tendermint/tendermint.git
  7. DOCKER_BUF := docker run -v $(shell pwd):/workspace --workdir /workspace bufbuild/buf
  8. all: check build test install
  9. .PHONY: all
  10. # The below include contains the tools.
  11. include tools.mk
  12. include tests.mk
  13. ###############################################################################
  14. ### Build Tendermint ###
  15. ###############################################################################
  16. build:
  17. CGO_ENABLED=0 go build $(BUILD_FLAGS) -tags $(BUILD_TAGS) -o $(OUTPUT) ./cmd/tendermint/
  18. .PHONY: build
  19. build_c:
  20. CGO_ENABLED=1 go build $(BUILD_FLAGS) -tags "$(BUILD_TAGS) cleveldb" -o $(OUTPUT) ./cmd/tendermint/
  21. .PHONY: build_c
  22. build_race:
  23. CGO_ENABLED=1 go build -race $(BUILD_FLAGS) -tags $(BUILD_TAGS) -o $(OUTPUT) ./cmd/tendermint
  24. .PHONY: build_race
  25. install:
  26. CGO_ENABLED=0 go install $(BUILD_FLAGS) -tags $(BUILD_TAGS) ./cmd/tendermint
  27. .PHONY: install
  28. install_c:
  29. CGO_ENABLED=1 go install $(BUILD_FLAGS) -tags "$(BUILD_TAGS) cleveldb" ./cmd/tendermint
  30. .PHONY: install_c
  31. ###############################################################################
  32. ### Protobuf ###
  33. ###############################################################################
  34. proto-all: proto-gen proto-lint proto-check-breaking
  35. .PHONY: proto-all
  36. proto-gen:
  37. ## If you get the following error,
  38. ## "error while loading shared libraries: libprotobuf.so.14: cannot open shared object file: No such file or directory"
  39. ## See https://stackoverflow.com/a/25518702
  40. ## Note the $< here is substituted for the %.proto
  41. ## Note the $@ here is substituted for the %.pb.go
  42. @sh scripts/protocgen.sh
  43. .PHONY: proto-gen
  44. proto-gen-docker:
  45. @echo "Generating Protobuf files"
  46. @docker run -v $(shell pwd):/workspace --workdir /workspace tendermintdev/docker-build-proto sh ./scripts/protocgen.sh
  47. .PHONY: proto-gen-docker
  48. proto-lint:
  49. @$(DOCKER_BUF) check lint --error-format=json
  50. .PHONY: proto-lint
  51. proto-check-breaking:
  52. @$(DOCKER_BUF) check breaking --against-input .git#branch=master
  53. .PHONY: proto-check-breaking
  54. proto-check-breaking-ci:
  55. @$(DOCKER_BUF) check breaking --against-input $(HTTPS_GIT)#branch=master
  56. .PHONY: proto-check-breaking-ci
  57. ###############################################################################
  58. ### Build ABCI ###
  59. ###############################################################################
  60. build_abci:
  61. @go build -mod=readonly -i ./abci/cmd/...
  62. .PHONY: build_abci
  63. install_abci:
  64. @go install -mod=readonly ./abci/cmd/...
  65. .PHONY: install_abci
  66. ###############################################################################
  67. ### Distribution ###
  68. ###############################################################################
  69. # dist builds binaries for all platforms and packages them for distribution
  70. # TODO add abci to these scripts
  71. dist:
  72. @BUILD_TAGS=$(BUILD_TAGS) sh -c "'$(CURDIR)/scripts/dist.sh'"
  73. .PHONY: dist
  74. go-mod-cache: go.sum
  75. @echo "--> Download go modules to local cache"
  76. @go mod download
  77. .PHONY: go-mod-cache
  78. go.sum: go.mod
  79. @echo "--> Ensure dependencies have not been modified"
  80. @go mod verify
  81. @go mod tidy
  82. draw_deps:
  83. @# requires brew install graphviz or apt-get install graphviz
  84. go get github.com/RobotsAndPencils/goviz
  85. @goviz -i github.com/tendermint/tendermint/cmd/tendermint -d 3 | dot -Tpng -o dependency-graph.png
  86. .PHONY: draw_deps
  87. get_deps_bin_size:
  88. @# Copy of build recipe with additional flags to perform binary size analysis
  89. $(eval $(shell go build -work -a $(BUILD_FLAGS) -tags $(BUILD_TAGS) -o $(OUTPUT) ./cmd/tendermint/ 2>&1))
  90. @find $(WORK) -type f -name "*.a" | xargs -I{} du -hxs "{}" | sort -rh | sed -e s:${WORK}/::g > deps_bin_size.log
  91. @echo "Results can be found here: $(CURDIR)/deps_bin_size.log"
  92. .PHONY: get_deps_bin_size
  93. ###############################################################################
  94. ### Libs ###
  95. ###############################################################################
  96. # generates certificates for TLS testing in remotedb and RPC server
  97. gen_certs: clean_certs
  98. certstrap init --common-name "tendermint.com" --passphrase ""
  99. certstrap request-cert --common-name "server" -ip "127.0.0.1" --passphrase ""
  100. certstrap sign "server" --CA "tendermint.com" --passphrase ""
  101. mv out/server.crt rpc/lib/server/test.crt
  102. mv out/server.key rpc/lib/server/test.key
  103. rm -rf out
  104. .PHONY: gen_certs
  105. # deletes generated certificates
  106. clean_certs:
  107. rm -f rpc/lib/server/test.crt
  108. rm -f rpc/lib/server/test.key
  109. .PHONY: clean_certs
  110. ###############################################################################
  111. ### Formatting, linting, and vetting ###
  112. ###############################################################################
  113. format:
  114. find . -name '*.go' -type f -not -path "*.git*" -not -name '*.pb.go' -not -name '*pb_test.go' | xargs gofmt -w -s
  115. find . -name '*.go' -type f -not -path "*.git*" -not -name '*.pb.go' -not -name '*pb_test.go' | xargs goimports -w -local github.com/tendermint/tendermint
  116. .PHONY: format
  117. lint:
  118. @echo "--> Running linter"
  119. @golangci-lint run
  120. .PHONY: lint
  121. DESTINATION = ./index.html.md
  122. ###############################################################################
  123. ### Documentation ###
  124. ###############################################################################
  125. build-docs:
  126. cd docs && \
  127. while read p; do \
  128. (git checkout $${p} && npm install && VUEPRESS_BASE="/$${p}/" npm run build) ; \
  129. mkdir -p ~/output/$${p} ; \
  130. cp -r .vuepress/dist/* ~/output/$${p}/ ; \
  131. cp ~/output/$${p}/index.html ~/output ; \
  132. done < versions ;
  133. .PHONY: build-docs
  134. sync-docs:
  135. cd ~/output && \
  136. echo "role_arn = ${DEPLOYMENT_ROLE_ARN}" >> /root/.aws/config ; \
  137. echo "CI job = ${CIRCLE_BUILD_URL}" >> version.html ; \
  138. aws s3 sync . s3://${WEBSITE_BUCKET} --profile terraform --delete ; \
  139. aws cloudfront create-invalidation --distribution-id ${CF_DISTRIBUTION_ID} --profile terraform --path "/*" ;
  140. .PHONY: sync-docs
  141. ###############################################################################
  142. ### Docker image ###
  143. ###############################################################################
  144. build-docker:
  145. cp $(OUTPUT) DOCKER/tendermint
  146. docker build --label=tendermint --tag="tendermint/tendermint" DOCKER
  147. rm -rf DOCKER/tendermint
  148. .PHONY: build-docker
  149. ###############################################################################
  150. ### Local testnet using docker ###
  151. ###############################################################################
  152. # Build linux binary on other platforms
  153. build-linux: tools
  154. GOOS=linux GOARCH=amd64 $(MAKE) build
  155. .PHONY: build-linux
  156. build-docker-localnode:
  157. @cd networks/local && make
  158. .PHONY: build-docker-localnode
  159. # Runs `make build_c` from within an Amazon Linux (v2)-based Docker build
  160. # container in order to build an Amazon Linux-compatible binary. Produces a
  161. # compatible binary at ./build/tendermint
  162. build_c-amazonlinux:
  163. $(MAKE) -C ./DOCKER build_amazonlinux_buildimage
  164. docker run --rm -it -v `pwd`:/tendermint tendermint/tendermint:build_c-amazonlinux
  165. .PHONY: build_c-amazonlinux
  166. # Run a 4-node testnet locally
  167. localnet-start: localnet-stop build-docker-localnode
  168. @if ! [ -f build/node0/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/tendermint:Z tendermint/localnode testnet --config /etc/tendermint/config-template.toml --v 4 --o . --populate-persistent-peers --starting-ip-address 192.167.10.2; fi
  169. docker-compose up
  170. .PHONY: localnet-start
  171. # Stop testnet
  172. localnet-stop:
  173. docker-compose down
  174. .PHONY: localnet-stop
  175. # Build hooks for dredd, to skip or add information on some steps
  176. build-contract-tests-hooks:
  177. ifeq ($(OS),Windows_NT)
  178. go build -mod=readonly $(BUILD_FLAGS) -o build/contract_tests.exe ./cmd/contract_tests
  179. else
  180. go build -mod=readonly $(BUILD_FLAGS) -o build/contract_tests ./cmd/contract_tests
  181. endif
  182. .PHONY: build-contract-tests-hooks
  183. # Run a nodejs tool to test endpoints against a localnet
  184. # The command takes care of starting and stopping the network
  185. # prerequisits: build-contract-tests-hooks build-linux
  186. # the two build commands were not added to let this command run from generic containers or machines.
  187. # The binaries should be built beforehand
  188. contract-tests:
  189. dredd
  190. .PHONY: contract-tests