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.

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