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.

228 lines
8.1 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. all: check build test install
  8. .PHONY: all
  9. # The below include contains the tools.
  10. include tools.mk
  11. include tests.mk
  12. ###############################################################################
  13. ### Build Tendermint ###
  14. ###############################################################################
  15. build:
  16. CGO_ENABLED=0 go build $(BUILD_FLAGS) -tags $(BUILD_TAGS) -o $(OUTPUT) ./cmd/tendermint/
  17. .PHONY: build
  18. build_c:
  19. CGO_ENABLED=1 go build $(BUILD_FLAGS) -tags "$(BUILD_TAGS) cleveldb" -o $(OUTPUT) ./cmd/tendermint/
  20. .PHONY: build_c
  21. build_race:
  22. CGO_ENABLED=1 go build -race $(BUILD_FLAGS) -tags $(BUILD_TAGS) -o $(OUTPUT) ./cmd/tendermint
  23. .PHONY: build_race
  24. install:
  25. CGO_ENABLED=0 go install $(BUILD_FLAGS) -tags $(BUILD_TAGS) ./cmd/tendermint
  26. .PHONY: install
  27. install_c:
  28. CGO_ENABLED=1 go install $(BUILD_FLAGS) -tags "$(BUILD_TAGS) cleveldb" ./cmd/tendermint
  29. .PHONY: install_c
  30. ###############################################################################
  31. ### Protobuf ###
  32. ###############################################################################
  33. proto-all: proto-gen proto-lint proto-check-breaking
  34. .PHONY: proto-all
  35. proto-gen:
  36. ## If you get the following error,
  37. ## "error while loading shared libraries: libprotobuf.so.14: cannot open shared object file: No such file or directory"
  38. ## See https://stackoverflow.com/a/25518702
  39. ## Note the $< here is substituted for the %.proto
  40. ## Note the $@ here is substituted for the %.pb.go
  41. @sh scripts/protocgen.sh
  42. .PHONY: proto-gen
  43. proto-lint:
  44. @buf check lint --error-format=json
  45. .PHONY: proto-lint
  46. proto-check-breaking:
  47. @buf check breaking --against-input ".git#branch=master"
  48. .PHONY: proto-check-breaking
  49. proto-check-breaking-ci:
  50. @buf check breaking --against-input "$(HTTPS_GIT)#branch=master"
  51. .PHONY: proto-check-breaking-ci
  52. ###############################################################################
  53. ### Build ABCI ###
  54. ###############################################################################
  55. build_abci:
  56. @go build -mod=readonly -i ./abci/cmd/...
  57. .PHONY: build_abci
  58. install_abci:
  59. @go install -mod=readonly ./abci/cmd/...
  60. .PHONY: install_abci
  61. ###############################################################################
  62. ### Distribution ###
  63. ###############################################################################
  64. # dist builds binaries for all platforms and packages them for distribution
  65. # TODO add abci to these scripts
  66. dist:
  67. @BUILD_TAGS=$(BUILD_TAGS) sh -c "'$(CURDIR)/scripts/dist.sh'"
  68. .PHONY: dist
  69. go-mod-cache: go.sum
  70. @echo "--> Download go modules to local cache"
  71. @go mod download
  72. .PHONY: go-mod-cache
  73. go.sum: go.mod
  74. @echo "--> Ensure dependencies have not been modified"
  75. @go mod verify
  76. @go mod tidy
  77. draw_deps:
  78. @# requires brew install graphviz or apt-get install graphviz
  79. go get github.com/RobotsAndPencils/goviz
  80. @goviz -i github.com/tendermint/tendermint/cmd/tendermint -d 3 | dot -Tpng -o dependency-graph.png
  81. .PHONY: draw_deps
  82. get_deps_bin_size:
  83. @# Copy of build recipe with additional flags to perform binary size analysis
  84. $(eval $(shell go build -work -a $(BUILD_FLAGS) -tags $(BUILD_TAGS) -o $(OUTPUT) ./cmd/tendermint/ 2>&1))
  85. @find $(WORK) -type f -name "*.a" | xargs -I{} du -hxs "{}" | sort -rh | sed -e s:${WORK}/::g > deps_bin_size.log
  86. @echo "Results can be found here: $(CURDIR)/deps_bin_size.log"
  87. .PHONY: get_deps_bin_size
  88. ###############################################################################
  89. ### Libs ###
  90. ###############################################################################
  91. # generates certificates for TLS testing in remotedb and RPC server
  92. gen_certs: clean_certs
  93. certstrap init --common-name "tendermint.com" --passphrase ""
  94. certstrap request-cert --common-name "server" -ip "127.0.0.1" --passphrase ""
  95. certstrap sign "server" --CA "tendermint.com" --passphrase ""
  96. mv out/server.crt rpc/lib/server/test.crt
  97. mv out/server.key rpc/lib/server/test.key
  98. rm -rf out
  99. .PHONY: gen_certs
  100. # deletes generated certificates
  101. clean_certs:
  102. rm -f rpc/lib/server/test.crt
  103. rm -f rpc/lib/server/test.key
  104. .PHONY: clean_certs
  105. ###############################################################################
  106. ### Formatting, linting, and vetting ###
  107. ###############################################################################
  108. fmt:
  109. @go fmt ./...
  110. .PHONY: fmt
  111. lint:
  112. @echo "--> Running linter"
  113. @golangci-lint run
  114. .PHONY: lint
  115. DESTINATION = ./index.html.md
  116. ###############################################################################
  117. ### Documentation ###
  118. ###############################################################################
  119. build-docs:
  120. cd docs && \
  121. while read p; do \
  122. (git checkout $${p} && npm install && VUEPRESS_BASE="/$${p}/" npm run build) ; \
  123. mkdir -p ~/output/$${p} ; \
  124. cp -r .vuepress/dist/* ~/output/$${p}/ ; \
  125. cp ~/output/$${p}/index.html ~/output ; \
  126. done < versions ;
  127. .PHONY: build-docs
  128. sync-docs:
  129. cd ~/output && \
  130. echo "role_arn = ${DEPLOYMENT_ROLE_ARN}" >> /root/.aws/config ; \
  131. echo "CI job = ${CIRCLE_BUILD_URL}" >> version.html ; \
  132. aws s3 sync . s3://${WEBSITE_BUCKET} --profile terraform --delete ; \
  133. aws cloudfront create-invalidation --distribution-id ${CF_DISTRIBUTION_ID} --profile terraform --path "/*" ;
  134. .PHONY: sync-docs
  135. ###############################################################################
  136. ### Docker image ###
  137. ###############################################################################
  138. build-docker:
  139. cp $(OUTPUT) DOCKER/tendermint
  140. docker build --label=tendermint --tag="tendermint/tendermint" DOCKER
  141. rm -rf DOCKER/tendermint
  142. .PHONY: build-docker
  143. ###############################################################################
  144. ### Local testnet using docker ###
  145. ###############################################################################
  146. # Build linux binary on other platforms
  147. build-linux: tools
  148. GOOS=linux GOARCH=amd64 $(MAKE) build
  149. .PHONY: build-linux
  150. build-docker-localnode:
  151. @cd networks/local && make
  152. .PHONY: build-docker-localnode
  153. # Runs `make build_c` from within an Amazon Linux (v2)-based Docker build
  154. # container in order to build an Amazon Linux-compatible binary. Produces a
  155. # compatible binary at ./build/tendermint
  156. build_c-amazonlinux:
  157. $(MAKE) -C ./DOCKER build_amazonlinux_buildimage
  158. docker run --rm -it -v `pwd`:/tendermint tendermint/tendermint:build_c-amazonlinux
  159. .PHONY: build_c-amazonlinux
  160. # Run a 4-node testnet locally
  161. localnet-start: localnet-stop build-docker-localnode
  162. @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
  163. docker-compose up
  164. .PHONY: localnet-start
  165. # Stop testnet
  166. localnet-stop:
  167. docker-compose down
  168. .PHONY: localnet-stop
  169. # Build hooks for dredd, to skip or add information on some steps
  170. build-contract-tests-hooks:
  171. ifeq ($(OS),Windows_NT)
  172. go build -mod=readonly $(BUILD_FLAGS) -o build/contract_tests.exe ./cmd/contract_tests
  173. else
  174. go build -mod=readonly $(BUILD_FLAGS) -o build/contract_tests ./cmd/contract_tests
  175. endif
  176. .PHONY: build-contract-tests-hooks
  177. # Run a nodejs tool to test endpoints against a localnet
  178. # The command takes care of starting and stopping the network
  179. # prerequisits: build-contract-tests-hooks build-linux
  180. # the two build commands were not added to let this command run from generic containers or machines.
  181. # The binaries should be built beforehand
  182. contract-tests:
  183. dredd
  184. .PHONY: contract-tests