diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index a387846a8..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,168 +0,0 @@ -version: 2.1 - -executors: - golang: - docker: - - image: tendermintdev/docker-tendermint-build - working_directory: /go/src/github.com/tendermint/tendermint - environment: - GOBIN: /tmp/bin - release: - machine: true - docs: - docker: - - image: tendermintdev/docker-website-deployment - environment: - AWS_REGION: us-east-1 - -commands: - run_test: - parameters: - script_path: - type: string - steps: - - attach_workspace: - at: /tmp/bin - - restore_cache: - name: "Restore source code cache" - keys: - - go-src-v1-{{ .Revision }} - - checkout - - restore_cache: - name: "Restore go modules cache" - keys: - - go-mod-v1-{{ checksum "go.sum" }} - - run: - name: "Running test" - command: | - bash << parameters.script_path >> -jobs: - setup_dependencies: - executor: golang - steps: - - checkout - - restore_cache: - name: "Restore go modules cache" - keys: - - go-mod-v1-{{ checksum "go.sum" }} - - run: - command: | - mkdir -p /tmp/bin - - run: - name: Cache go modules - command: make go-mod-cache - - run: - name: tools - command: make tools - - run: - name: "Build binaries" - command: make install install_abci - - save_cache: - name: "Save go modules cache" - key: go-mod-v1-{{ checksum "go.sum" }} - paths: - - "/go/pkg/mod" - - save_cache: - name: "Save source code cache" - key: go-src-v1-{{ .Revision }} - paths: - - ".git" - - persist_to_workspace: - root: "/tmp/bin" - paths: - - "." - - deploy_docs: - executor: docs - steps: - - checkout - - run: - name: "Pull versions" - command: git fetch origin v0.32 v0.33 - - run: - name: "Build docs" - command: make build-docs - - run: - name: "Sync to S3" - command: make sync-docs - - prepare_build: - executor: golang - steps: - - restore_cache: - name: "Restore source code cache" - keys: - - go-src-v1-{{ .Revision }} - - checkout - - run: - name: Get next release number - command: | - export LAST_TAG="`git describe --tags --abbrev=0 --match "${CIRCLE_BRANCH}.*"`" - echo "Last tag: ${LAST_TAG}" - if [ -z "${LAST_TAG}" ]; then - export LAST_TAG="${CIRCLE_BRANCH}" - echo "Last tag not found. Possibly fresh branch or feature branch. Setting ${LAST_TAG} as tag." - fi - export NEXT_TAG="`python -u scripts/release_management/bump-semver.py --version "${LAST_TAG}"`" - echo "Next tag: ${NEXT_TAG}" - echo "export CIRCLE_TAG=\"${NEXT_TAG}\"" > release-version.source - - run: - name: Build dependencies - command: make tools - - persist_to_workspace: - root: . - paths: - - "release-version.source" - - save_cache: - key: v2-release-deps-{{ checksum "go.sum" }} - paths: - - "/go/pkg/mod" - - # # Test RPC implementation against the swagger documented specs - # contract_tests: - # working_directory: /home/circleci/.go_workspace/src/github.com/tendermint/tendermint - # machine: - # image: circleci/classic:latest - # environment: - # GOBIN: /home/circleci/.go_workspace/bin - # GOPATH: /home/circleci/.go_workspace/ - # GOOS: linux - # GOARCH: amd64 - # parallelism: 1 - # steps: - # - checkout - # - run: - # name: Test RPC endpoints against swagger documentation - # command: | - # set -x - # export PATH=~/.local/bin:$PATH - # # install node and dredd - # ./scripts/get_nodejs.sh - # # build the binaries with a proper version of Go - # docker run --rm -v "$PWD":/go/src/github.com/tendermint/tendermint -w /go/src/github.com/tendermint/tendermint golang make build-linux build-contract-tests-hooks - # # This docker image works with go 1.7, we can install here the hook handler that contract-tests is going to use - # go get github.com/snikch/goodman/cmd/goodman - # make contract-tests - -workflows: - version: 2 - docs: - jobs: - - deploy_docs: - context: tendermint-docs - filters: - branches: - only: - - master - tags: - only: - - /^v.*/ - - deploy_docs: - context: tendermint-docs-staging - filters: - branches: - only: - - docs-staging - # - contract_tests: - # requires: - # - setup_dependencies diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index e99d57880..99455e0c4 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -1,13 +1,18 @@ --- -name: Bug Report +name: Bug report about: Create a report to help us squash bugs! --- **Tendermint version** (use `tendermint version` or `git rev-parse --verify HEAD` if installed from source): diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..08852d444 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: true +contact_links: + - name: Ask a question + url: https://github.com/tendermint/tendermint/discussions + about: Please ask and answer questions here diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md index 62c3e4f3a..77b20c09f 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.md +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -1,5 +1,5 @@ --- -name: Feature Request +name: Feature request about: Create a proposal to request a feature --- @@ -25,12 +25,3 @@ Are there any disadvantages of including this feature? --> ## Proposal - -____ - -#### For Admin Use - -- [ ] Not duplicate issue -- [ ] Appropriate labels applied -- [ ] Appropriate contributors tagged -- [ ] Contributor assigned/self-assigned diff --git a/.github/ISSUE_TEMPLATE/proposal.md b/.github/ISSUE_TEMPLATE/proposal.md index 45f0bff42..d255ad765 100644 --- a/.github/ISSUE_TEMPLATE/proposal.md +++ b/.github/ISSUE_TEMPLATE/proposal.md @@ -1,5 +1,5 @@ --- -name: Protocol Change Proposal +name: Protocol change proposal about: Create a proposal to request a change to the protocol --- @@ -26,12 +26,3 @@ Are there any disadvantages of including this change? --> ## Proposal - -____ - -#### For Admin Use - -- [ ] Not duplicate issue -- [ ] Appropriate labels applied -- [ ] Appropriate contributors tagged -- [ ] Contributor assigned/self-assigned diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 975ad1cf5..7ac4b15ca 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,7 +1,32 @@ -## Description + + +--- + +#### PR checklist + +- [ ] Tests written/updated, or no tests needed +- [ ] `CHANGELOG_PENDING.md` updated, or no changelog entry needed +- [ ] Updated relevant documentation (`docs/`) and code comments, or no + documentation updates needed diff --git a/.github/auto-comment.yml b/.github/auto-comment.yml deleted file mode 100644 index 604c2f878..000000000 --- a/.github/auto-comment.yml +++ /dev/null @@ -1,16 +0,0 @@ -pullRequestOpened: | - :wave: Thanks for creating a PR! - - Before we can merge this PR, please make sure that all the following items have been - checked off. If any of the checklist items are not applicable, please leave them but - write a little note why. - - - [ ] Wrote tests - - [ ] Updated CHANGELOG_PENDING.md - - [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work. - - [ ] Updated relevant documentation (`docs/`) and code comments - - [ ] Re-reviewed `Files changed` in the Github PR explorer - - [ ] Applied Appropriate Labels - - - Thank you for your contribution to Tendermint! :rocket: \ No newline at end of file diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 000000000..57c4bb160 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,25 @@ +coverage: + precision: 2 + round: down + range: "70...100" + status: + project: + default: + threshold: 20% + patch: off + changes: off + +github_checks: + annotations: false + +comment: false + +ignore: + - "docs" + - "DOCKER" + - "scripts" + - "**/*.pb.go" + - "libs/pubsub/query/query.peg.go" + - "*.md" + - "*.rst" + - "*.yml" diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..4a6c4bb6f --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,51 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: weekly + target-branch: "main" + open-pull-requests-limit: 10 + labels: + - T:dependencies + - S:automerge + + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: weekly + target-branch: "v0.34.x" + open-pull-requests-limit: 10 + labels: + - T:dependencies + - S:automerge + + - package-ecosystem: npm + directory: "/docs" + schedule: + interval: weekly + open-pull-requests-limit: 10 + + ################################### + ## + ## Update All Go Dependencies + + - package-ecosystem: gomod + directory: "/" + schedule: + interval: weekly + target-branch: "main" + open-pull-requests-limit: 10 + labels: + - T:dependencies + - S:automerge + + - package-ecosystem: gomod + directory: "/" + schedule: + interval: weekly + target-branch: "v0.34.x" + open-pull-requests-limit: 10 + labels: + - T:dependencies + - S:automerge diff --git a/.github/issue_template.md b/.github/issue_template.md new file mode 100644 index 000000000..13e5ac0b5 --- /dev/null +++ b/.github/issue_template.md @@ -0,0 +1,6 @@ + diff --git a/.github/linters/markdownlint.yml b/.github/linters/markdownlint.yml new file mode 100644 index 000000000..40aa57733 --- /dev/null +++ b/.github/linters/markdownlint.yml @@ -0,0 +1,15 @@ +# markdownlint configuration for Super-Linter +# - https://github.com/DavidAnson/markdownlint +# - https://github.com/github/super-linter + +# Default state for all rules +default: true + +# See https://github.com/DavidAnson/markdownlint#rules--aliases for rules +MD007: {"indent": 4} +MD013: false +MD024: {siblings_only: true} +MD025: false +MD033: {no-inline-html: false} +no-hard-tabs: false +whitespace: false diff --git a/.github/linters/yaml-lint.yml b/.github/linters/yaml-lint.yml new file mode 100644 index 000000000..e6fd77d11 --- /dev/null +++ b/.github/linters/yaml-lint.yml @@ -0,0 +1,9 @@ +--- +# Default rules for YAML linting from super-linter. +# See: See https://yamllint.readthedocs.io/en/stable/rules.html +extends: default +rules: + document-end: disable + document-start: disable + line-length: disable + truthy: disable diff --git a/.github/mergify.yml b/.github/mergify.yml index 257c3f5a7..270c06fbb 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -1,13 +1,13 @@ queue_rules: - name: default conditions: - - base=v0.34.x + - base=main - label=S:automerge pull_request_rules: - - name: Automerge to v0.34.x + - name: Automerge to main conditions: - - base=v0.34.x + - base=main - label=S:automerge actions: queue: @@ -17,3 +17,11 @@ pull_request_rules: {{ title }} (#{{ number }}) {{ body }} + - name: backport patches to v0.34.x branch + conditions: + - base=main + - label=S:backport-to-v0.34.x + actions: + backport: + branches: + - v0.34.x diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..d71c82447 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,82 @@ +name: Build +# Tests runs different tests (test_abci_apps, test_abci_cli, test_apps) +# This workflow runs on every push to main or release branch and every pull requests +# All jobs will pass without running if no *{.go, .mod, .sum} files have been modified +on: + pull_request: + push: + branches: + - main + - release/** + +jobs: + build: + name: Build + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + goarch: ["arm", "amd64"] + goos: ["linux"] + timeout-minutes: 5 + steps: + - uses: actions/setup-go@v3 + with: + go-version: "1.17" + - uses: actions/checkout@v3 + - uses: technote-space/get-diff-action@v6 + with: + PATTERNS: | + **/*.go + "!test/" + go.mod + go.sum + Makefile + - name: install + run: GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} make build + if: "env.GIT_DIFF != ''" + + test_abci_cli: + runs-on: ubuntu-latest + needs: build + timeout-minutes: 5 + steps: + - uses: actions/setup-go@v3 + with: + go-version: "1.17" + - uses: actions/checkout@v3 + - uses: technote-space/get-diff-action@v6 + with: + PATTERNS: | + **/*.go + go.mod + go.sum + - name: install + run: make install_abci + if: "env.GIT_DIFF != ''" + - run: abci/tests/test_cli/test.sh + shell: bash + if: "env.GIT_DIFF != ''" + + test_apps: + runs-on: ubuntu-latest + needs: build + timeout-minutes: 5 + steps: + - uses: actions/setup-go@v3 + with: + go-version: "1.17" + - uses: actions/checkout@v3 + - uses: technote-space/get-diff-action@v6 + with: + PATTERNS: | + **/*.go + go.mod + go.sum + - name: install + run: make install install_abci + if: "env.GIT_DIFF != ''" + - name: test_apps + run: test/app/test.sh + shell: bash + if: "env.GIT_DIFF != ''" diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml deleted file mode 100644 index bf12bc928..000000000 --- a/.github/workflows/coverage.yml +++ /dev/null @@ -1,123 +0,0 @@ -name: Test Coverage -on: - pull_request: - push: - branches: - - master - - release/** - -jobs: - split-test-files: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Create a file with all the pkgs - run: go list ./... > pkgs.txt - - name: Split pkgs into 4 files - run: split -d -n l/4 pkgs.txt pkgs.txt.part. - # cache multiple - - uses: actions/upload-artifact@v3 - with: - name: "${{ github.sha }}-00" - path: ./pkgs.txt.part.00 - - uses: actions/upload-artifact@v3 - with: - name: "${{ github.sha }}-01" - path: ./pkgs.txt.part.01 - - uses: actions/upload-artifact@v3 - with: - name: "${{ github.sha }}-02" - path: ./pkgs.txt.part.02 - - uses: actions/upload-artifact@v3 - with: - name: "${{ github.sha }}-03" - path: ./pkgs.txt.part.03 - - build-linux: - name: Build - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - goarch: ["arm", "amd64"] - timeout-minutes: 5 - steps: - - uses: actions/setup-go@v3 - with: - go-version: "^1.15.4" - - uses: actions/checkout@v3 - - uses: technote-space/get-diff-action@v6 - with: - PATTERNS: | - **/**.go - go.mod - go.sum - - name: install - run: GOOS=linux GOARCH=${{ matrix.goarch }} make build - if: "env.GIT_DIFF != ''" - - tests: - runs-on: ubuntu-latest - needs: split-test-files - strategy: - fail-fast: false - matrix: - part: ["00", "01", "02", "03"] - steps: - - uses: actions/setup-go@v3 - with: - go-version: "^1.15.4" - - uses: actions/checkout@v3 - - uses: technote-space/get-diff-action@v6 - with: - PATTERNS: | - **/**.go - go.mod - go.sum - - uses: actions/download-artifact@v3 - with: - name: "${{ github.sha }}-${{ matrix.part }}" - if: env.GIT_DIFF - - name: test & coverage report creation - run: | - cat pkgs.txt.part.${{ matrix.part }} | xargs go test -mod=readonly -timeout 8m -race -coverprofile=${{ matrix.part }}profile.out -covermode=atomic - if: env.GIT_DIFF - - uses: actions/upload-artifact@v3 - with: - name: "${{ github.sha }}-${{ matrix.part }}-coverage" - path: ./${{ matrix.part }}profile.out - - upload-coverage-report: - runs-on: ubuntu-latest - needs: tests - steps: - - uses: actions/checkout@v3 - - uses: technote-space/get-diff-action@v6 - with: - PATTERNS: | - **/**.go - go.mod - go.sum - - uses: actions/download-artifact@v3 - with: - name: "${{ github.sha }}-00-coverage" - if: env.GIT_DIFF - - uses: actions/download-artifact@v3 - with: - name: "${{ github.sha }}-01-coverage" - if: env.GIT_DIFF - - uses: actions/download-artifact@v3 - with: - name: "${{ github.sha }}-02-coverage" - if: env.GIT_DIFF - - uses: actions/download-artifact@v3 - with: - name: "${{ github.sha }}-03-coverage" - if: env.GIT_DIFF - - run: | - cat ./*profile.out | grep -v "mode: atomic" >> coverage.txt - if: env.GIT_DIFF - - uses: codecov/codecov-action@v3 - with: - file: ./coverage.txt - if: env.GIT_DIFF diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 7610ecedd..44681245e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,14 +1,13 @@ -name: Build & Push -# Build & Push rebuilds the tendermint docker image on every push to master and creation of tags -# and pushes the image to https://hub.docker.com/r/interchainio/simapp/tags +name: Docker +# Build & Push rebuilds the Tendermint docker image on every push to main and creation of tags +# and pushes the image to https://hub.docker.com/r/tendermint/tendermint on: - pull_request: push: branches: - - master + - main tags: - - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10 - - "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5 + - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10 + - "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5 jobs: build: @@ -39,18 +38,18 @@ jobs: with: platforms: all - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + - name: Set up Docker Build + uses: docker/setup-buildx-action@v2.0.0 - name: Login to DockerHub if: ${{ github.event_name != 'pull_request' }} - uses: docker/login-action@v2 + uses: docker/login-action@v2.0.0 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Publish to Docker Hub - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v3.1.0 with: context: . file: ./DOCKER/Dockerfile diff --git a/.github/workflows/docs-deployment.yml b/.github/workflows/docs-deployment.yml new file mode 100644 index 000000000..2b8437283 --- /dev/null +++ b/.github/workflows/docs-deployment.yml @@ -0,0 +1,62 @@ +# Build and deploy the docs.tendermint.com website content. +# The static content is published to GitHub Pages. +# +# For documentation build info, see docs/DOCS_README.md. +name: Build static documentation site +on: + workflow_dispatch: # allow manual updates + push: + branches: + - main + paths: + - docs/** + - spec/** + +jobs: + # This is split into two jobs so that the build, which runs npm, does not + # have write access to anything. The deploy requires write access to publish + # to the branch used by GitHub Pages, however, so we can't just make the + # whole workflow read-only. + build: + name: VuePress build + runs-on: ubuntu-latest + container: + image: alpine:latest + permissions: + contents: read + steps: + - name: Install generator dependencies + run: | + apk add --no-cache make bash git npm + - uses: actions/checkout@v3 + with: + # We need to fetch full history so the backport branches for previous + # versions will be available for the build. + fetch-depth: 0 + - name: Build documentation + run: | + git config --global --add safe.directory "$PWD" + make build-docs + - uses: actions/upload-artifact@v3 + with: + name: build-output + path: ~/output/ + + deploy: + name: Deploy to GitHub Pages + runs-on: ubuntu-latest + needs: build + permissions: + contents: write + steps: + - uses: actions/checkout@v3 + - uses: actions/download-artifact@v3 + with: + name: build-output + path: ~/output + - name: Deploy to GitHub Pages + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: 'docs-tendermint-com' + folder: ~/output + single-commit: true diff --git a/.github/workflows/docs-toc.yml b/.github/workflows/docs-toc.yml new file mode 100644 index 000000000..99570487a --- /dev/null +++ b/.github/workflows/docs-toc.yml @@ -0,0 +1,21 @@ +# TODO(thane): Re-enable once we've pulled in the ADRs and RFCs from master. +# Verify that important design docs have ToC entries. +#name: Check documentation ToC +#on: +# pull_request: +# push: +# branches: +# - main +# +#jobs: +# check: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# - uses: technote-space/get-diff-action@v6 +# with: +# PATTERNS: | +# docs/architecture/** +# docs/rfc/** +# - run: ./docs/presubmit.sh +# if: env.GIT_DIFF diff --git a/.github/workflows/e2e-manual.yml b/.github/workflows/e2e-manual.yml index f90f88cd3..e678cd812 100644 --- a/.github/workflows/e2e-manual.yml +++ b/.github/workflows/e2e-manual.yml @@ -1,4 +1,5 @@ -# Manually run randomly generated E2E testnets (as nightly). +# Runs randomly generated E2E testnets nightly on main +# manually run e2e tests name: e2e-manual on: workflow_dispatch: @@ -28,7 +29,7 @@ jobs: - name: Generate testnets working-directory: test/e2e # When changing -g, also change the matrix groups above - run: ./build/generator -g 4 -d networks/nightly/ + run: ./build/generator -g 5 -d networks/nightly/ - name: Run ${{ matrix.p2p }} p2p testnets working-directory: test/e2e diff --git a/.github/workflows/e2e-nightly-34x.yml b/.github/workflows/e2e-nightly-34x.yml index 6a46874ef..386982c37 100644 --- a/.github/workflows/e2e-nightly-34x.yml +++ b/.github/workflows/e2e-nightly-34x.yml @@ -1,12 +1,10 @@ -# Runs randomly generated E2E testnets nightly -# on the 0.34.x release branch +# Runs randomly generated E2E testnets nightly on the 0.34.x branch. -# !! If you change something in this file, you probably want -# to update the e2e-nightly-master workflow as well! +# !! This file should be kept in sync with the e2e-nightly-main.yml file, +# modulo changes to the version labels. name: e2e-nightly-34x on: - workflow_dispatch: # allow running workflow manually, in theory schedule: - cron: '0 2 * * *' @@ -17,13 +15,13 @@ jobs: strategy: fail-fast: false matrix: - group: ['00', '01', '02', '03'] + group: ['00', '01', '02', '03', "04"] runs-on: ubuntu-latest timeout-minutes: 60 steps: - uses: actions/setup-go@v3 with: - go-version: '^1.15.4' + go-version: '1.17' - uses: actions/checkout@v3 with: @@ -37,7 +35,7 @@ jobs: - name: Generate testnets working-directory: test/e2e # When changing -g, also change the matrix groups above - run: ./build/generator -g 4 -d networks/nightly + run: ./build/generator -g 2 -d networks/nightly - name: Run testnets in group ${{ matrix.group }} working-directory: test/e2e @@ -49,7 +47,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Notify Slack on failure - uses: rtCamp/action-slack-notify@f565a63638bd3615e76249bffab00fcb9dab90f7 + uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} SLACK_CHANNEL: tendermint-internal @@ -58,19 +56,3 @@ jobs: SLACK_COLOR: danger SLACK_MESSAGE: Nightly E2E tests failed on v0.34.x SLACK_FOOTER: '' - - e2e-nightly-success: # may turn this off once they seem to pass consistently - needs: e2e-nightly-test - if: ${{ success() }} - runs-on: ubuntu-latest - steps: - - name: Notify Slack on success - uses: rtCamp/action-slack-notify@f565a63638bd3615e76249bffab00fcb9dab90f7 - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - SLACK_CHANNEL: tendermint-internal - SLACK_USERNAME: Nightly E2E Tests - SLACK_ICON_EMOJI: ':white_check_mark:' - SLACK_COLOR: good - SLACK_MESSAGE: Nightly E2E tests passed on v0.34.x - SLACK_FOOTER: '' diff --git a/.github/workflows/e2e-nightly-master.yml b/.github/workflows/e2e-nightly-main.yml similarity index 60% rename from .github/workflows/e2e-nightly-master.yml rename to .github/workflows/e2e-nightly-main.yml index 70ddb5534..467909981 100644 --- a/.github/workflows/e2e-nightly-master.yml +++ b/.github/workflows/e2e-nightly-main.yml @@ -1,73 +1,73 @@ -# Runs randomly generated E2E testnets nightly on master +# Runs randomly generated E2E testnets nightly on main -# !! If you change something in this file, you probably want -# to update the e2e-nightly-34x workflow as well! +# !! Relevant changes to this file should be propagated to the e2e-nightly-x +# files for the supported backport branches, when appropriate, modulo version +# markers. -name: e2e-nightly-master +name: e2e-nightly-main on: - workflow_dispatch: # allow running workflow manually schedule: - cron: '0 2 * * *' jobs: - e2e-nightly-test-2: + e2e-nightly-test: # Run parallel jobs for the listed testnet groups (must match the # ./build/generator -g flag) strategy: fail-fast: false matrix: - group: ['00', '01', '02', '03'] + group: ['00', '01', '02', '03', "04"] runs-on: ubuntu-latest timeout-minutes: 60 steps: - uses: actions/setup-go@v3 with: - go-version: '1.15' + go-version: '1.17' - uses: actions/checkout@v3 - name: Build working-directory: test/e2e # Run make jobs in parallel, since we can't run steps in parallel. - run: make -j2 docker generator runner + run: make -j2 docker generator runner tests - name: Generate testnets working-directory: test/e2e # When changing -g, also change the matrix groups above - run: ./build/generator -g 4 -d networks/nightly + run: ./build/generator -g 5 -d networks/nightly/ - - name: Run testnets in group ${{ matrix.group }} + - name: Run ${{ matrix.p2p }} p2p testnets working-directory: test/e2e run: ./run-multiple.sh networks/nightly/*-group${{ matrix.group }}-*.toml - e2e-nightly-fail-2: - needs: e2e-nightly-test-2 + e2e-nightly-fail: + needs: e2e-nightly-test if: ${{ failure() }} runs-on: ubuntu-latest steps: - name: Notify Slack on failure - uses: rtCamp/action-slack-notify@f565a63638bd3615e76249bffab00fcb9dab90f7 + uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} SLACK_CHANNEL: tendermint-internal SLACK_USERNAME: Nightly E2E Tests SLACK_ICON_EMOJI: ':skull:' SLACK_COLOR: danger - SLACK_MESSAGE: Nightly E2E tests failed on master + SLACK_MESSAGE: Nightly E2E tests failed on main SLACK_FOOTER: '' - e2e-nightly-success: # may turn this off once they seem to pass consistently - needs: e2e-nightly-test-2 + e2e-nightly-success: # may turn this off once they seem to pass consistently + needs: e2e-nightly-test if: ${{ success() }} runs-on: ubuntu-latest steps: - name: Notify Slack on success - uses: rtCamp/action-slack-notify@f565a63638bd3615e76249bffab00fcb9dab90f7 + uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} SLACK_CHANNEL: tendermint-internal SLACK_USERNAME: Nightly E2E Tests SLACK_ICON_EMOJI: ':white_check_mark:' SLACK_COLOR: good - SLACK_MESSAGE: Nightly E2E tests passed on master + SLACK_MESSAGE: Nightly E2E tests passed on main SLACK_FOOTER: '' diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 91f1fd14f..a84c701d6 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -1,11 +1,12 @@ name: e2e -# Runs the CI end-to-end test network on all pushes to master or release branches +# Runs the CI end-to-end test network on all pushes to main or release branches # and every pull request, but only if any Go files have been changed. on: + workflow_dispatch: # allow running workflow manually pull_request: push: branches: - - master + - main - release/** jobs: @@ -15,7 +16,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: '^1.15.4' + go-version: '1.17' - uses: actions/checkout@v3 - uses: technote-space/get-diff-action@v6 with: @@ -27,15 +28,10 @@ jobs: - name: Build working-directory: test/e2e # Run two make jobs in parallel, since we can't run steps in parallel. - run: make -j2 docker runner + run: make -j2 docker runner tests if: "env.GIT_DIFF != ''" - name: Run CI testnet working-directory: test/e2e - run: ./build/runner -f networks/ci.toml + run: ./run-multiple.sh networks/ci.toml if: "env.GIT_DIFF != ''" - - - name: Emit logs on failure - if: ${{ failure() }} - working-directory: test/e2e - run: ./build/runner -f networks/ci.toml logs diff --git a/.github/workflows/fuzz-nightly.yml b/.github/workflows/fuzz-nightly.yml index 1208b45cd..49df2dd41 100644 --- a/.github/workflows/fuzz-nightly.yml +++ b/.github/workflows/fuzz-nightly.yml @@ -1,9 +1,13 @@ # Runs fuzzing nightly. -name: fuzz-nightly +name: Fuzz Tests on: - workflow_dispatch: # allow running workflow manually + workflow_dispatch: # allow running workflow manually schedule: - cron: '0 3 * * *' + pull_request: + branches: [main] + paths: + - "test/fuzz/**/*.go" jobs: fuzz-nightly-test: @@ -11,13 +15,13 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: '1.15' + go-version: '1.17' - uses: actions/checkout@v3 - name: Install go-fuzz working-directory: test/fuzz - run: go get -u github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build + run: go install github.com/dvyukov/go-fuzz/go-fuzz@latest github.com/dvyukov/go-fuzz/go-fuzz-build@latest - name: Fuzz mempool working-directory: test/fuzz @@ -49,14 +53,14 @@ jobs: with: name: crashers path: test/fuzz/**/crashers - retention-days: 1 + retention-days: 3 - name: Archive suppressions uses: actions/upload-artifact@v3 with: name: suppressions path: test/fuzz/**/suppressions - retention-days: 1 + retention-days: 3 - name: Set crashers count working-directory: test/fuzz @@ -72,7 +76,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Notify Slack if any crashers - uses: rtCamp/action-slack-notify@f565a63638bd3615e76249bffab00fcb9dab90f7 + uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} SLACK_CHANNEL: tendermint-internal diff --git a/.github/workflows/janitor.yml b/.github/workflows/janitor.yml new file mode 100644 index 000000000..ceb21941d --- /dev/null +++ b/.github/workflows/janitor.yml @@ -0,0 +1,16 @@ +name: Janitor +# Janitor cleans up previous runs of various workflows +# To add more workflows to cancel visit https://api.github.com/repos/tendermint/tendermint/actions/workflows and find the actions name +on: + pull_request: + +jobs: + cancel: + name: "Cancel Previous Runs" + runs-on: ubuntu-latest + timeout-minutes: 3 + steps: + - uses: styfle/cancel-workflow-action@0.10.0 + with: + workflow_id: 1041851,1401230,2837803 + access_token: ${{ github.token }} diff --git a/.github/workflows/linkchecker.yml b/.github/workflows/linkchecker.yml deleted file mode 100644 index e2ba80861..000000000 --- a/.github/workflows/linkchecker.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Check Markdown links -on: - schedule: - - cron: '* */24 * * *' -jobs: - markdown-link-check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: creachadair/github-action-markdown-link-check@master - with: - folder-path: "docs" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c0eb3ca4d..be1dde8b8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,12 +1,18 @@ -name: Lint -# Lint runs golangci-lint over the entire Tendermint repository -# This workflow is run on every pull request and push to master -# The `golangci` job will pass without running if no *.{go, mod, sum} files have been modified. +name: Golang Linter +# Lint runs golangci-lint over the entire Tendermint repository. +# +# This workflow is run on every pull request and push to main. +# +# The `golangci` job will pass without running if no *.{go, mod, sum} +# files have been modified. +# +# To run this locally, simply run `make lint` from the root of the repo. + on: pull_request: push: branches: - - master + - main jobs: golangci: name: golangci-lint @@ -16,7 +22,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: '^1.16' + go-version: '1.17' - uses: technote-space/get-diff-action@v6 with: PATTERNS: | @@ -25,7 +31,9 @@ jobs: go.sum - uses: golangci/golangci-lint-action@v3 with: - # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. + # Required: the version of golangci-lint is required and + # must be specified without patch version: we always use the + # latest patch version. version: v1.45 args: --timeout 10m github-token: ${{ secrets.github_token }} diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index be0f103b1..0caa6c679 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -1,14 +1,14 @@ -name: Lint +name: Markdown Linter on: push: branches: - - master + - main paths: - "**.md" - "**.yml" - "**.yaml" pull_request: - branches: [master] + branches: [main] paths: - "**.md" - "**.yml" @@ -21,12 +21,12 @@ jobs: - name: Checkout Code uses: actions/checkout@v3 - name: Lint Code Base - uses: docker://github/super-linter:v3 + uses: docker://github/super-linter:v4 env: - LINTER_RULES_PATH: . VALIDATE_ALL_CODEBASE: true - DEFAULT_BRANCH: master + DEFAULT_BRANCH: main GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} VALIDATE_MD: true VALIDATE_OPENAPI: true VALIDATE_YAML: true + YAML_CONFIG_FILE: yaml-lint.yml diff --git a/.github/workflows/markdown-links.yml b/.github/workflows/markdown-links.yml new file mode 100644 index 000000000..6aef1baf8 --- /dev/null +++ b/.github/workflows/markdown-links.yml @@ -0,0 +1,23 @@ +name: Check Markdown links + +on: + push: + branches: + - main + pull_request: + branches: [main] + +jobs: + markdown-link-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: technote-space/get-diff-action@v6 + with: + PATTERNS: | + **/**.md + - uses: creachadair/github-action-markdown-link-check@master + with: + check-modified-files-only: 'yes' + config-file: '.md-link-check.json' + if: env.GIT_DIFF diff --git a/.github/workflows/proto-lint.yml b/.github/workflows/proto-lint.yml index f7b6541cd..6e078c6f7 100644 --- a/.github/workflows/proto-lint.yml +++ b/.github/workflows/proto-lint.yml @@ -5,7 +5,7 @@ on: - 'proto/**' push: branches: - - v0.34.x + - main paths: - 'proto/**' diff --git a/.github/workflows/proto.yml b/.github/workflows/proto.yml deleted file mode 100644 index 6eec3f46f..000000000 --- a/.github/workflows/proto.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Protobuf -# Protobuf runs buf (https://buf.build/) lint and check-breakage -# This workflow is only run when a .proto file has been modified -on: - pull_request: - paths: - - "**.proto" -jobs: - proto-lint: - runs-on: ubuntu-latest - timeout-minutes: 4 - steps: - - uses: actions/checkout@v3 - - name: lint - run: make proto-lint - proto-breakage: - runs-on: ubuntu-latest - timeout-minutes: 4 - steps: - - uses: actions/checkout@v3 - - name: check-breakage - run: make proto-check-breaking-ci diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5bf5441ab..4197d0243 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ name: "Release" on: push: tags: - - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10 + - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10 jobs: goreleaser: @@ -16,12 +16,20 @@ jobs: - uses: actions/setup-go@v3 with: - go-version: '^1.15.4' + go-version: '1.17' - - run: echo https://github.com/tendermint/tendermint/blob/${GITHUB_REF#refs/tags/}/CHANGELOG.md#${GITHUB_REF#refs/tags/} > ../release_notes.md + - name: Build + uses: goreleaser/goreleaser-action@v3 + if: ${{ github.event_name == 'pull_request' }} + with: + version: latest + args: build --skip-validate # skip validate skips initial sanity checks in order to be able to fully run + + - run: echo https://github.com/tendermint/tendermint/blob/${GITHUB_REF#refs/tags/}/CHANGELOG.md#${GITHUB_REF#refs/tags/} > ../release_notes.md - - name: Run GoReleaser + - name: Release uses: goreleaser/goreleaser-action@v3 + if: startsWith(github.ref, 'refs/tags/') with: version: latest args: release --rm-dist --release-notes=../release_notes.md diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 6a03003cc..4089abfbc 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -13,6 +13,8 @@ jobs: stale-pr-message: "This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions." - days-before-stale: 10 - days-before-close: 4 + days-before-stale: -1 + days-before-close: -1 + days-before-pr-stale: 10 + days-before-pr-close: 4 exempt-pr-labels: "S:wip" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 67f63538c..1904c37ed 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,146 +1,34 @@ -name: Tests -# Tests runs different tests (test_abci_apps, test_abci_cli, test_apps) -# This workflow runs on every push to master or release branch and every pull requests -# All jobs will pass without running if no *{.go, .mod, .sum} files have been modified +name: Test on: pull_request: push: + paths: + - "**.go" branches: - - master + - main - release/** jobs: - cleanup-runs: + tests: runs-on: ubuntu-latest - steps: - - uses: rokroskar/workflow-run-cleanup-action@master - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'" - - build: - name: Build - runs-on: ubuntu-latest - timeout-minutes: 5 + strategy: + fail-fast: false + matrix: + part: ["00", "01", "02", "03", "04", "05"] steps: - uses: actions/setup-go@v3 with: - go-version: "^1.15.4" + go-version: "1.17" - uses: actions/checkout@v3 - uses: technote-space/get-diff-action@v6 with: PATTERNS: | **/**.go + "!test/" go.mod go.sum - - name: install - run: make install install_abci - if: "env.GIT_DIFF != ''" - - uses: actions/cache@v3 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - if: env.GIT_DIFF - # Cache binaries for use by other jobs - - uses: actions/cache@v3 - with: - path: ~/go/bin - key: ${{ runner.os }}-${{ github.sha }}-tm-binary - if: env.GIT_DIFF - - test_abci_apps: - runs-on: ubuntu-latest - needs: build - timeout-minutes: 5 - steps: - - uses: actions/setup-go@v3 - with: - go-version: "^1.15.4" - - uses: actions/checkout@v3 - - uses: technote-space/get-diff-action@v6 - with: - PATTERNS: | - **/**.go - go.mod - go.sum - - uses: actions/cache@v3 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - if: env.GIT_DIFF - - uses: actions/cache@v3 - with: - path: ~/go/bin - key: ${{ runner.os }}-${{ github.sha }}-tm-binary - if: env.GIT_DIFF - - name: test_abci_apps - run: abci/tests/test_app/test.sh - shell: bash - if: env.GIT_DIFF - - test_abci_cli: - runs-on: ubuntu-latest - needs: build - timeout-minutes: 5 - steps: - - uses: actions/setup-go@v3 - with: - go-version: "^1.15.4" - - uses: actions/checkout@v3 - - uses: technote-space/get-diff-action@v6 - with: - PATTERNS: | - **/**.go - go.mod - go.sum - - uses: actions/cache@v3 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - if: env.GIT_DIFF - - uses: actions/cache@v3 - with: - path: ~/go/bin - key: ${{ runner.os }}-${{ github.sha }}-tm-binary - if: env.GIT_DIFF - - run: abci/tests/test_cli/test.sh - shell: bash - if: env.GIT_DIFF - - test_apps: - runs-on: ubuntu-latest - needs: build - timeout-minutes: 5 - steps: - - uses: actions/setup-go@v3 - with: - go-version: "^1.15.4" - - uses: actions/checkout@v3 - - uses: technote-space/get-diff-action@v6 - with: - PATTERNS: | - **/**.go - go.mod - go.sum - - uses: actions/cache@v3 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - if: env.GIT_DIFF - - uses: actions/cache@v3 - with: - path: ~/go/bin - key: ${{ runner.os }}-${{ github.sha }}-tm-binary - if: env.GIT_DIFF - - name: test_apps - run: test/app/test.sh - shell: bash + Makefile + - name: Run Go Tests + run: | + make test-group-${{ matrix.part }} NUM_SPLIT=6 if: env.GIT_DIFF diff --git a/.gitignore b/.gitignore index ae00d966d..1e3cbce3c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,64 +1,57 @@ -*.swp -*.swo -.bak *.bak +*.iml +*.log +*.swo +*.swp +*/.glide +*/vendor .DS_Store -build/* -rpc/test/.tendermint -.tendermint -remote_dump +.bak +.idea/ .revision -vendor +.tendermint +.tendermint-lite +.terraform .vagrant -test/e2e/build -test/maverick/maverick -test/e2e/networks/*/ -test/p2p/data/ -test/logs +.vendor-new/ +.vscode/ +abci/abci-cli +addrbook.json +artifacts/* +build/* coverage.txt +docs/.vuepress/dist docs/_build docs/dist -docs/.vuepress/dist -*.log -abci-cli docs/node_modules/ +docs/spec +docs/.vuepress/public/rpc index.html.md - -scripts/wal2json/wal2json -scripts/cutWALUntil/cutWALUntil - -.idea/ -*.iml - -.vscode/ - libs/pubsub/query/fuzz_test/output +profile\.out +remote_dump +rpc/test/.tendermint +scripts/cutWALUntil/cutWALUntil +scripts/wal2json/wal2json shunit2 - -.tendermint-lite -addrbook.json - -*/vendor -.vendor-new/ -*/.glide -.terraform terraform.tfstate terraform.tfstate.backup terraform.tfstate.d -profile\.out +test/app/grpc_client test/e2e/build test/e2e/networks/*/ test/logs -test/maverick/maverick test/p2p/data/ vendor test/fuzz/**/corpus test/fuzz/**/crashers test/fuzz/**/suppressions test/fuzz/**/*.zip +proto/spec/**/*.pb.go *.aux *.bbl *.blg +*.log *.pdf *.gz *.dvi diff --git a/.golangci.yml b/.golangci.yml index 9d846393d..46aa61d6c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -8,14 +8,7 @@ linters: - dupl - errcheck - exportloopref - # - funlen - # - gochecknoglobals - # - gochecknoinits - # - gocognit - goconst - # - gocritic - # - gocyclo - # - godox - gofmt - goimports - revive @@ -23,48 +16,31 @@ linters: - gosimple - govet - ineffassign - # - interfacer - - lll - # - maligned - # - misspell + - misspell - nakedret - nolintlint - prealloc - staticcheck - structcheck - stylecheck - # - typecheck + - typecheck - unconvert - # - unparam - unused - varcheck - # - whitespace - # - wsl issues: exclude-rules: - path: _test\.go linters: - gosec - - linters: - - lll - source: "https://" max-same-issues: 50 linters-settings: dogsled: max-blank-identifiers: 3 - maligned: - suggest-new: true - # govet: - # check-shadowing: true - revive: + golint: min-confidence: 0 maligned: suggest-new: true misspell: locale: US - ignore-words: - - behaviour - - diff --git a/.goreleaser.yml b/.goreleaser.yml index 339abb8aa..28c6a017d 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -5,7 +5,7 @@ env: - GO111MODULE=on builds: - - id: "Tendermint" + - id: "tendermint" main: ./cmd/tendermint/main.go ldflags: - -s -w -X github.com/tendermint/tendermint/version.TMCoreSemVer={{ .Version }} @@ -26,3 +26,11 @@ checksum: release: name_template: "{{.Version}} (WARNING: BETA SOFTWARE)" + +archives: + - files: + - LICENSE + - README.md + - UPGRADING.md + - SECURITY.md + - CHANGELOG.md diff --git a/.markdownlint.yml b/.markdownlint.yml index 80e3be4ed..4cd68eaf8 100644 --- a/.markdownlint.yml +++ b/.markdownlint.yml @@ -1,4 +1,10 @@ +# markdownlint configuration +# https://github.com/DavidAnson/markdownlint + +# Default state for all rules default: true + +# See https://github.com/DavidAnson/markdownlint#rules--aliases for rules MD001: false MD007: {indent: 4} MD013: false diff --git a/.md-link-check.json b/.md-link-check.json new file mode 100644 index 000000000..6f47fa2c9 --- /dev/null +++ b/.md-link-check.json @@ -0,0 +1,6 @@ +{ + "retryOn429": true, + "retryCount": 5, + "fallbackRetryDelay": "30s", + "aliveStatusCodes": [200, 206, 503] +} diff --git a/.mergify.yml b/.mergify.yml deleted file mode 100644 index b1bef433d..000000000 --- a/.mergify.yml +++ /dev/null @@ -1,10 +0,0 @@ -pull_request_rules: - - name: Automerge to master - conditions: - - base=master - - label=S:automerge - actions: - merge: - method: squash - strict: true - commit_message: title+body diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 3a42e525f..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "protoc": { - "options": [ - "--proto_path=${workspaceRoot}/proto", - "--proto_path=${workspaceRoot}/third_party/proto" - ] - } -} diff --git a/Makefile b/Makefile index 19857983f..ac0f90851 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ PACKAGES=$(shell go list ./...) -OUTPUT?=build/tendermint +BUILDDIR?=$(CURDIR)/build +OUTPUT?=$(BUILDDIR)/tendermint BUILD_TAGS?=tendermint @@ -286,3 +287,25 @@ endif contract-tests: dredd .PHONY: contract-tests + +# Implements test splitting and running. This is pulled directly from +# the github action workflows for better local reproducibility. + +GO_TEST_FILES != find $(CURDIR) -name "*_test.go" + +# default to four splits by default +NUM_SPLIT ?= 4 + +$(BUILDDIR): + mkdir -p $@ + +# The format statement filters out all packages that don't have tests. +# Note we need to check for both in-package tests (.TestGoFiles) and +# out-of-package tests (.XTestGoFiles). +$(BUILDDIR)/packages.txt:$(GO_TEST_FILES) $(BUILDDIR) + go list -f "{{ if (or .TestGoFiles .XTestGoFiles) }}{{ .ImportPath }}{{ end }}" ./... | sort > $@ + +split-test-packages:$(BUILDDIR)/packages.txt + split -d -n l/$(NUM_SPLIT) $< $<. +test-group-%:split-test-packages + cat $(BUILDDIR)/packages.txt.$* | xargs go test -mod=readonly -timeout=5m -race -coverprofile=$(BUILDDIR)/$*.profile.out diff --git a/appveyor.yml b/appveyor.yml index 4aa8c2abb..afaab5b83 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,12 +1,12 @@ version: 1.0.{build} configuration: Release platform: -- x64 -- x86 + - x64 + - x86 clone_folder: c:\go\path\src\github.com\tendermint\tendermint before_build: -- cmd: set GOPATH=%GOROOT%\path -- cmd: set PATH=%GOPATH%\bin;%PATH% + - cmd: set GOPATH=%GOROOT%\path + - cmd: set PATH=%GOPATH%\bin;%PATH% build_script: -- cmd: make test + - cmd: make test test: off diff --git a/docker-compose.yml b/docker-compose.yml index ccc802040..647e1f202 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -63,6 +63,4 @@ networks: ipam: driver: default config: - - - subnet: 192.167.10.0/16 - + - subnet: 192.167.10.0/16 diff --git a/networks/remote/ansible/config.yml b/networks/remote/ansible/config.yml index 7b772fb70..6b88cb3c2 100644 --- a/networks/remote/ansible/config.yml +++ b/networks/remote/ansible/config.yml @@ -15,4 +15,3 @@ - config - unsafe_reset - start - diff --git a/networks/remote/ansible/install.yml b/networks/remote/ansible/install.yml index a57b4be44..9c191a938 100644 --- a/networks/remote/ansible/install.yml +++ b/networks/remote/ansible/install.yml @@ -8,4 +8,3 @@ - service: tendermint roles: - install - diff --git a/networks/remote/ansible/logzio.yml b/networks/remote/ansible/logzio.yml index 53f637f2f..3ce04988b 100644 --- a/networks/remote/ansible/logzio.yml +++ b/networks/remote/ansible/logzio.yml @@ -11,4 +11,3 @@ - JOURNALBEAT_BINARY: "{{lookup('env', 'GOPATH')}}/bin/journalbeat" roles: - logzio - diff --git a/networks/remote/ansible/reset.yml b/networks/remote/ansible/reset.yml index 63b1733c7..3c6e091c3 100644 --- a/networks/remote/ansible/reset.yml +++ b/networks/remote/ansible/reset.yml @@ -10,5 +10,3 @@ - stop - unsafe_reset - start - - diff --git a/networks/remote/ansible/restart.yml b/networks/remote/ansible/restart.yml index 71d4bc66d..ff98d03a6 100644 --- a/networks/remote/ansible/restart.yml +++ b/networks/remote/ansible/restart.yml @@ -9,4 +9,3 @@ roles: - stop - start - diff --git a/networks/remote/ansible/roles/config/tasks/main.yml b/networks/remote/ansible/roles/config/tasks/main.yml index a51098caa..b7d9b8edb 100644 --- a/networks/remote/ansible/roles/config/tasks/main.yml +++ b/networks/remote/ansible/roles/config/tasks/main.yml @@ -13,5 +13,4 @@ dest: "/home/{{service}}/.{{service}}/" owner: "{{service}}" group: "{{service}}" - loop: [ 0, 1, 2, 3, 4, 5, 6, 7 ] - + loop: [0, 1, 2, 3, 4, 5, 6, 7] diff --git a/networks/remote/ansible/roles/install/handlers/main.yml b/networks/remote/ansible/roles/install/handlers/main.yml index 16afbb618..689f5d82f 100644 --- a/networks/remote/ansible/roles/install/handlers/main.yml +++ b/networks/remote/ansible/roles/install/handlers/main.yml @@ -2,4 +2,3 @@ - name: reload services systemd: "name={{service}} daemon_reload=yes enabled=yes" - diff --git a/networks/remote/ansible/roles/install/tasks/main.yml b/networks/remote/ansible/roles/install/tasks/main.yml index 9e5a7524a..8b631769b 100644 --- a/networks/remote/ansible/roles/install/tasks/main.yml +++ b/networks/remote/ansible/roles/install/tasks/main.yml @@ -12,4 +12,3 @@ - name: Create service template: "src=systemd.service.j2 dest=/etc/systemd/system/{{service}}.service" notify: reload services - diff --git a/networks/remote/ansible/roles/logzio/handlers/main.yml b/networks/remote/ansible/roles/logzio/handlers/main.yml index 0b371fc51..f2a916b9a 100644 --- a/networks/remote/ansible/roles/logzio/handlers/main.yml +++ b/networks/remote/ansible/roles/logzio/handlers/main.yml @@ -5,4 +5,3 @@ - name: restart journalbeat service: name=journalbeat state=restarted - diff --git a/networks/remote/ansible/roles/logzio/tasks/main.yml b/networks/remote/ansible/roles/logzio/tasks/main.yml index ab3976f22..5131d98ac 100644 --- a/networks/remote/ansible/roles/logzio/tasks/main.yml +++ b/networks/remote/ansible/roles/logzio/tasks/main.yml @@ -24,4 +24,3 @@ notify: - reload daemon - restart journalbeat - diff --git a/networks/remote/ansible/roles/start/tasks/main.yml b/networks/remote/ansible/roles/start/tasks/main.yml index 6bc611c91..68b41f71f 100644 --- a/networks/remote/ansible/roles/start/tasks/main.yml +++ b/networks/remote/ansible/roles/start/tasks/main.yml @@ -2,4 +2,3 @@ - name: start service service: "name={{service}} state=started" - diff --git a/networks/remote/ansible/roles/status/tasks/main.yml b/networks/remote/ansible/roles/status/tasks/main.yml index 50170c746..4b6ac5ee6 100644 --- a/networks/remote/ansible/roles/status/tasks/main.yml +++ b/networks/remote/ansible/roles/status/tasks/main.yml @@ -7,4 +7,3 @@ - name: Result debug: var=status.stdout_lines - diff --git a/networks/remote/ansible/roles/stop/tasks/main.yml b/networks/remote/ansible/roles/stop/tasks/main.yml index 7db356f22..b32b0cea1 100644 --- a/networks/remote/ansible/roles/stop/tasks/main.yml +++ b/networks/remote/ansible/roles/stop/tasks/main.yml @@ -2,4 +2,3 @@ - name: stop service service: "name={{service}} state=stopped" - diff --git a/networks/remote/ansible/roles/unsafe_reset/tasks/main.yml b/networks/remote/ansible/roles/unsafe_reset/tasks/main.yml index 6ac1ec55a..59ae68d17 100644 --- a/networks/remote/ansible/roles/unsafe_reset/tasks/main.yml +++ b/networks/remote/ansible/roles/unsafe_reset/tasks/main.yml @@ -1,4 +1,3 @@ - command: "{{service}} unsafe_reset_all {{ (service != 'tendermint') | ternary('node','') }} --home /home/{{service}}/.{{service}}" become_user: "{{service}}" become: yes - diff --git a/networks/remote/ansible/start.yml b/networks/remote/ansible/start.yml index 2be07dc73..cc575de7a 100644 --- a/networks/remote/ansible/start.yml +++ b/networks/remote/ansible/start.yml @@ -8,4 +8,3 @@ - service: tendermint roles: - start - diff --git a/networks/remote/ansible/status.yml b/networks/remote/ansible/status.yml index a1721b87b..4a31be689 100644 --- a/networks/remote/ansible/status.yml +++ b/networks/remote/ansible/status.yml @@ -8,4 +8,3 @@ - service: tendermint roles: - status - diff --git a/networks/remote/ansible/stop.yml b/networks/remote/ansible/stop.yml index abc6031d5..e9e75c386 100644 --- a/networks/remote/ansible/stop.yml +++ b/networks/remote/ansible/stop.yml @@ -8,4 +8,3 @@ - service: tendermint roles: - stop - diff --git a/rpc/openapi/openapi.yaml b/rpc/openapi/openapi.yaml index 190def7e7..ef06f9e63 100644 --- a/rpc/openapi/openapi.yaml +++ b/rpc/openapi/openapi.yaml @@ -537,8 +537,7 @@ paths: type: array items: type: string - example: - ["f9baeaa15fedf5e1ef7448dd60f46c01f1a9e9c4@1.2.3.4:26656"] + example: "f9baeaa15fedf5e1ef7448dd60f46c01f1a9e9c4@1.2.3.4:26656" responses: "200": description: Dialing seeds in progress. See /net_info for details @@ -588,8 +587,7 @@ paths: type: array items: type: string - example: - ["f9baeaa15fedf5e1ef7448dd60f46c01f1a9e9c4@1.2.3.4:26656"] + example: "f9baeaa15fedf5e1ef7448dd60f46c01f1a9e9c4@1.2.3.4:26656" responses: "200": description: Dialing seeds in progress. See /net_info for details @@ -1674,7 +1672,7 @@ components: nullable: false items: $ref: "#/components/schemas/Event" - end_block: + end_block_events: type: array nullable: true items: @@ -1709,7 +1707,7 @@ components: power: type: string example: "300" - consensus_params_updates: + consensus_param_updates: $ref: "#/components/schemas/ConsensusParams" CommitResponse: @@ -2742,6 +2740,33 @@ components: type: string example: "Dialing seeds in progress. See /net_info for details" + BlockSearchResponse: + type: object + required: + - "jsonrpc" + - "id" + - "result" + properties: + jsonrpc: + type: string + example: "2.0" + id: + type: integer + example: 0 + result: + required: + - "blocks" + - "total_count" + properties: + blocks: + type: array + items: + $ref: "#/components/schemas/BlockComplete" + total_count: + type: integer + example: 2 + type: object + ###### Reuseable types ###### # Validator type with proposer prioirty diff --git a/spec/ivy-proofs/docker-compose.yml b/spec/ivy-proofs/docker-compose.yml index 1d4a8ffe1..e0612d4b1 100644 --- a/spec/ivy-proofs/docker-compose.yml +++ b/spec/ivy-proofs/docker-compose.yml @@ -5,4 +5,3 @@ services: volumes: - ./:/home/user/tendermint-proof:ro - ./output:/home/user/tendermint-proof/output:rw - diff --git a/tools/mintnet-kubernetes/README.rst b/tools/mintnet-kubernetes/README.rst deleted file mode 100644 index edf5e81e5..000000000 --- a/tools/mintnet-kubernetes/README.rst +++ /dev/null @@ -1,290 +0,0 @@ -Using Kubernetes -================ - -.. figure:: assets/t_plus_k.png - :alt: Tendermint plus Kubernetes - - Tendermint plus Kubernetes - -This should primarily be used for testing purposes or for -tightly-defined chains operated by a single stakeholder (see `the -security precautions <#security>`__). If your desire is to launch an -application with many stakeholders, consider using our set of Ansible -scripts. - -Quick Start ------------ - -For either platform, see the `requirements `__ - -MacOS -^^^^^ - -:: - - curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/kubectl - curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.18.0/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/ - minikube start - - git clone https://github.com/tendermint/tools.git && cd tools/mintnet-kubernetes/examples/basecoin && make create - -Linux -^^^^^ - -:: - - curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/kubectl - curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.18.0/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/ - minikube start - - git clone https://github.com/tendermint/tools.git && cd tools/mintnet-kubernetes/examples/basecoin && make create - -Verify it worked -~~~~~~~~~~~~~~~~ - -**Using a shell:** - -First wait until all the pods are ``Running``: - -``kubectl get pods -w -o wide -L tm`` - -then query the Tendermint app logs from the first pod: - -``kubectl logs -c tm -f tm-0`` - -finally, use our `Rest API `__ to fetch the status of the second pod's Tendermint app. - -Note we are using ``kubectl exec`` because pods are not exposed (and should not be) to the -outer network: - -``kubectl exec -c tm tm-0 -- curl -s http://tm-1.basecoin:26657/status | json_pp`` - -**Using the dashboard:** - -:: - - minikube dashboard - -Clean up -~~~~~~~~ - -:: - - make destroy - -Usage ------ - -Setup a Kubernetes cluster -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -- locally using `Minikube `__ -- on GCE with a single click in the web UI -- on AWS using `Kubernetes - Operations `__ -- on Linux machines (Digital Ocean) using - `kubeadm `__ -- on AWS, Azure, GCE or bare metal using `Kargo - (Ansible) `__ - -Please refer to `the official -documentation `__ -for overview and comparison of different options. - -Kubernetes on Digital Ocean -~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Available options: - -- `kubeadm (alpha) `__ -- `kargo `__ -- `rancher `__ -- `terraform `__ - -As you can see, there is no single tool for creating a cluster on DO. -Therefore, choose the one you know and comfortable working with. If you know -and used `terraform `__ before, then choose it. If you -know Ansible, then pick kargo. If none of these seem familiar to you, go with -``kubeadm``. Rancher is a beautiful UI for deploying and managing containers in -production. - -Kubernetes on Google Cloud Engine -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Review the `Official Documentation `__ for Kubernetes on Google Compute -Engine. - -**Create a cluster** - -The recommended way is to use `Google Container -Engine `__. You should be able -to create a fully fledged cluster with just a few clicks. - -**Connect to it** - -Install ``gcloud`` as a part of `Google Cloud SDK `__. - -Make sure you have credentials for GCloud by running ``gcloud auth login``. - -In order to make API calls against GCE, you must also run ``gcloud auth -application-default login``. - -Press ``Connect``: - -.. figure:: assets/gce1.png - -and execute the first command in your shell. Then start a proxy by -executing ``kubectl` proxy``. - -.. figure:: assets/gce2.png - -Now you should be able to run ``kubectl`` command to create resources, get -resource info, logs, etc. - -**Make sure you have Kubernetes >= 1.5, because you will be using -StatefulSets, which is a beta feature in 1.5.** - -Create a configuration file -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Download a template: - -:: - - curl -Lo app.yaml https://github.com/tendermint/tools/raw/master/mintnet-kubernetes/app.template.yaml - -Open ``app.yaml`` in your favorite editor and configure your app -container (navigate to ``- name: app``). Kubernetes DSL (Domain Specific -Language) is very simple, so it should be easy. You will need to set -Docker image, command and/or run arguments. Replace variables prefixed -with ``YOUR_APP`` with corresponding values. Set genesis time to now and -preferable chain ID in ConfigMap. - -Please note if you are changing ``replicas`` number, do not forget to -update ``validators`` set in ConfigMap. You will be able to scale the -cluster up or down later, but new pods (nodes) won't become validators -automatically. - -Deploy your application -^^^^^^^^^^^^^^^^^^^^^^^ - -:: - - kubectl create -f ./app.yaml - -Observe your cluster -^^^^^^^^^^^^^^^^^^^^ - -`web UI `__ - -The easiest way to access Dashboard is to use ``kubectl``. Run the following -command in your desktop environment: - -:: - - kubectl proxy - -``kubectl`` will handle authentication with apiserver and make Dashboard -available at http://localhost:8001/ui - -**shell** - -List all the pods: - -:: - - kubectl get pods -o wide -L tm - -StatefulSet details: - -:: - - kubectl describe statefulsets tm - -First pod details: - -:: - - kubectl describe pod tm-0 - -Tendermint app logs from the first pod: - -:: - - kubectl logs tm-0 -c tm -f - -App logs from the first pod: - -:: - - kubectl logs tm-0 -c app -f - -Status of the second pod's Tendermint app: - -:: - - kubectl exec -c tm tm-0 -- curl -s http://tm-1.:26657/status | json_pp - -Security --------- - -Due to the nature of Kubernetes, where you typically have a single -master, the master could be a SPOF (Single Point Of Failure). Therefore, -you need to make sure only authorized people can access it. And these -people themselves had taken basic measures in order not to get hacked. - -These are the best practices: - -- all access to the master is over TLS -- access to the API Server is X.509 certificate or token based -- etcd is not exposed directly to the cluster -- ensure that images are free of vulnerabilities - (`1 `__) -- ensure that only authorized images are used in your environment -- disable direct access to Kubernetes nodes (no SSH) -- define resource quota - -Resources: - -- https://kubernetes.io/docs/admin/accessing-the-api/ -- http://blog.kubernetes.io/2016/08/security-best-practices-kubernetes-deployment.html -- https://blog.openshift.com/securing-kubernetes/ - -Fault tolerance ---------------- - -Having a single master (API server) is a bad thing also because if -something happens to it, you risk being left without an access to the -application. - -To avoid that you can `run Kubernetes in multiple -zones `__, each zone -running an `API -server `__ and load -balance requests between them. Do not forget to make sure only one -instance of scheduler and controller-manager are running at once. - -Running in multiple zones is a lightweight version of a broader `Cluster -Federation feature `__. -Federated deployments could span across multiple regions (not zones). We -haven't tried this feature yet, so any feedback is highly appreciated! -Especially, related to additional latency and cost of exchanging data -between the regions. - -Resources: - -- https://kubernetes.io/docs/admin/high-availability/ - -Starting process ----------------- - -.. figure:: assets/statefulset.png - :alt: StatefulSet - - StatefulSet - -Init containers (``tm-gen-validator``) are run before all other -containers, creating public-private key pair for each pod. Every ``tm`` -container then asks other pods for their public keys, which are served -with nginx (``pub-key`` container). When ``tm`` container have all the -keys, it forms a genesis file and starts the Tendermint process. diff --git a/tools/mintnet-kubernetes/app.template.yaml b/tools/mintnet-kubernetes/app.template.yaml deleted file mode 100644 index 826b2e97f..000000000 --- a/tools/mintnet-kubernetes/app.template.yaml +++ /dev/null @@ -1,265 +0,0 @@ ---- -apiVersion: v1 -kind: Service -metadata: - annotations: - service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" - name: YOUR_APP_NAME - labels: - app: YOUR_APP_NAME -spec: - ports: - - port: 26656 - name: p2p - - port: 26657 - name: rpc - clusterIP: None - selector: - app: tm ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: tm-config -data: - seeds: "tm-0,tm-1,tm-2,tm-3" - validators: "tm-0,tm-1,tm-2,tm-3" - validator.power: "10" - genesis.json: |- - { - "genesis_time": "2017-01-02T10:10:10.164Z", - "chain_id": "chain-B5XXm5", - "validators": [], - "app_hash": "" - } - pub_key_nginx.conf: |- - server { - listen 80 default_server; - listen [::]:80 default_server ipv6only=on; - location /pub_key.json { root /usr/share/nginx/; } - } ---- -apiVersion: policy/v1beta1 -kind: PodDisruptionBudget -metadata: - name: tm-budget -spec: - selector: - matchLabels: - app: tm - minAvailable: 2 ---- -apiVersion: apps/v1beta1 -kind: StatefulSet -metadata: - name: tm -spec: - serviceName: YOUR_APP_NAME - replicas: 4 - template: - metadata: - labels: - app: tm - version: v1 - annotations: - pod.beta.kubernetes.io/init-containers: '[{ - "name": "tm-gen-validator", - "image": "tendermint/tendermint:0.10.0", - "imagePullPolicy": "IfNotPresent", - "command": ["bash", "-c", " - set -ex\n - if [ ! -f /tendermint/priv_validator.json ]; then\n - tendermint gen_validator > /tendermint/priv_validator.json\n - # pub_key.json will be served by pub-key container\n - cat /tendermint/priv_validator.json | jq \".pub_key\" > /tendermint/pub_key.json\n - fi\n - "], - "volumeMounts": [ - {"name": "tmdir", "mountPath": "/tendermint"} - ] - }]' - spec: - containers: - - name: tm - imagePullPolicy: IfNotPresent - image: tendermint/tendermint:0.10.0 - resources: - requests: - cpu: 50m - memory: 128Mi - limits: - cpu: 100m - memory: 256Mi - ports: - - containerPort: 26656 - name: p2p - - containerPort: 26657 - name: rpc - env: - - name: SEEDS - valueFrom: - configMapKeyRef: - name: tm-config - key: seeds - - name: VALIDATOR_POWER - valueFrom: - configMapKeyRef: - name: tm-config - key: validator.power - - name: VALIDATORS - valueFrom: - configMapKeyRef: - name: tm-config - key: validators - - name: TMHOME - value: /tendermint - command: - - bash - - "-c" - - | - set -ex - - # copy template - cp /etc/tendermint/genesis.json /tendermint/genesis.json - - # fill genesis file with validators - IFS=',' read -ra VALS_ARR <<< "$VALIDATORS" - fqdn_suffix=$(hostname -f | sed 's#[^.]*\.\(\)#\1#') - for v in "${VALS_ARR[@]}"; do - # wait until validator generates priv/pub key pair - set +e - - curl -s --fail "http://$v.$fqdn_suffix/pub_key.json" > /dev/null - ERR=$? - while [ "$ERR" != 0 ]; do - sleep 5 - curl -s --fail "http://$v.$fqdn_suffix/pub_key.json" > /dev/null - ERR=$? - done - set -e - - # add validator to genesis file along with its pub_key - curl -s "http://$v.$fqdn_suffix/pub_key.json" | jq ". as \$k | {pub_key: \$k, amount: $VALIDATOR_POWER, name: \"$v\"}" > pub_validator.json - cat /tendermint/genesis.json | jq ".validators |= .+ [$(cat pub_validator.json)]" > tmpgenesis && mv tmpgenesis /tendermint/genesis.json - rm pub_validator.json - done - - # construct seeds - IFS=',' read -ra SEEDS_ARR <<< "$SEEDS" - seeds=() - for s in "${SEEDS_ARR[@]}"; do - seeds+=("$s.$fqdn_suffix:26656") - done - seeds=$(IFS=','; echo "${seeds[*]}") - - tendermint node --p2p.seeds="$seeds" --moniker="`hostname`" --proxy_app="unix:///socks/app.sock" - volumeMounts: - - name: tmdir - mountPath: /tendermint - - mountPath: /etc/tendermint/genesis.json - name: configdir - subPath: genesis.json - - name: socksdir - mountPath: /socks - - - name: app - imagePullPolicy: IfNotPresent - image: YOUR_APP_IMAGE - args: ["--addr=\"unix:///socks/app.sock\""] - volumeMounts: - - name: socksdir - mountPath: /socks - - ######## OR ######## - # - # - name: app - # imagePullPolicy: IfNotPresent - # image: golang:1.7.5 - # resources: - # requests: - # cpu: YOUR_APP_CPU_REQ - # memory: YOUR_APP_MEM_REQ - # limits: - # cpu: YOUR_APP_CPU_LIMIT - # memory: YOUR_APP_MEM_LIMIT - # command: - # - bash - # - "-c" - # - | - # set -ex - - # go get -d YOUR_APP_PACKAGE - # cd $GOPATH/YOUR_APP_PACKAGE - # make install - # - # rm -f /socks/app.sock # remove old socket - - # YOUR_APP_EXEC --addr="unix:///socks/app.sock" - # volumeMounts: - # - name: socksdir - # mountPath: /socks - - ######## OPTIONALLY ######## - # - # - name: data - # imagePullPolicy: IfNotPresent - # image: golang:1.7.5 - # command: - # - bash - # - "-c" - # - | - # set -ex - # go get github.com/tendermint/merkleeyes/cmd/merkleeyes - # rm -f /socks/data.sock # remove old socket - # merkleeyes server --address="unix:///socks/data.sock" - # volumeMounts: - # - name: socksdir - # mountPath: /socks - - - name: pub-key - imagePullPolicy: IfNotPresent - image: nginx:1.11.9 - resources: - requests: - cpu: 10m - memory: 12Mi - limits: - cpu: 20m - memory: 24Mi - ports: - - containerPort: 80 - name: pub-key - command: - - bash - - "-c" - - | - set -ex - # fixes 403 Permission Denied (open() "/tendermint/pub_key.json" failed (13: Permission denied)) - # => we cannot serve from /tendermint, so we copy the file - mkdir -p /usr/share/nginx - cp /tendermint/pub_key.json /usr/share/nginx/pub_key.json - nginx -g "daemon off;" - volumeMounts: - - name: tmdir - mountPath: /tendermint - - mountPath: /etc/nginx/conf.d/pub_key.conf - name: configdir - subPath: pub_key_nginx.conf - - volumes: - - name: configdir - configMap: - name: tm-config - - name: socksdir - emptyDir: {} - - volumeClaimTemplates: - - metadata: - name: tmdir - annotations: - volume.alpha.kubernetes.io/storage-class: anything - spec: - accessModes: ["ReadWriteOnce"] - resources: - requests: - storage: 2Gi diff --git a/tools/mintnet-kubernetes/assets/gce1.png b/tools/mintnet-kubernetes/assets/gce1.png deleted file mode 100644 index 3bf3ad005..000000000 Binary files a/tools/mintnet-kubernetes/assets/gce1.png and /dev/null differ diff --git a/tools/mintnet-kubernetes/assets/gce2.png b/tools/mintnet-kubernetes/assets/gce2.png deleted file mode 100644 index 358dcc04b..000000000 Binary files a/tools/mintnet-kubernetes/assets/gce2.png and /dev/null differ diff --git a/tools/mintnet-kubernetes/assets/statefulset.png b/tools/mintnet-kubernetes/assets/statefulset.png deleted file mode 100644 index ac68d22b7..000000000 Binary files a/tools/mintnet-kubernetes/assets/statefulset.png and /dev/null differ diff --git a/tools/mintnet-kubernetes/assets/t_plus_k.png b/tools/mintnet-kubernetes/assets/t_plus_k.png deleted file mode 100644 index bee9fe56e..000000000 Binary files a/tools/mintnet-kubernetes/assets/t_plus_k.png and /dev/null differ diff --git a/tools/mintnet-kubernetes/examples/counter/Makefile b/tools/mintnet-kubernetes/examples/counter/Makefile deleted file mode 100644 index 6d54d57d6..000000000 --- a/tools/mintnet-kubernetes/examples/counter/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -create: - @echo "==> Creating deployment" - @kubectl create -f app.yaml - -destroy: - @echo "==> Destroying deployment" - @kubectl delete -f app.yaml - @kubectl delete pvc -l app=tm - -.PHONY: create destroy diff --git a/tools/mintnet-kubernetes/examples/counter/app.yaml b/tools/mintnet-kubernetes/examples/counter/app.yaml deleted file mode 100644 index 4565f9764..000000000 --- a/tools/mintnet-kubernetes/examples/counter/app.yaml +++ /dev/null @@ -1,214 +0,0 @@ ---- -apiVersion: v1 -kind: Service -metadata: - annotations: - service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" - name: counter - labels: - app: counter -spec: - ports: - - port: 26656 - name: p2p - - port: 26657 - name: rpc - clusterIP: None - selector: - app: tm ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: tm-config -data: - seeds: "tm-0,tm-1,tm-2,tm-3" - validators: "tm-0,tm-1,tm-2,tm-3" - validator.power: "10" - genesis.json: |- - { - "genesis_time": "2016-02-05T23:17:31.164Z", - "chain_id": "chain-B5XXm5", - "validators": [], - "app_hash": "" - } - pub_key_nginx.conf: |- - server { - listen 80 default_server; - listen [::]:80 default_server ipv6only=on; - location /pub_key.json { root /usr/share/nginx/; } - } ---- -apiVersion: policy/v1beta1 -kind: PodDisruptionBudget -metadata: - name: tm-budget -spec: - selector: - matchLabels: - app: tm - minAvailable: 2 ---- -apiVersion: apps/v1beta1 -kind: StatefulSet -metadata: - name: tm -spec: - serviceName: counter - replicas: 4 - template: - metadata: - labels: - app: tm - annotations: - pod.beta.kubernetes.io/init-containers: '[{ - "name": "tm-gen-validator", - "image": "tendermint/tendermint:0.10.0", - "imagePullPolicy": "IfNotPresent", - "command": ["bash", "-c", " - set -ex\n - if [ ! -f /tendermint/priv_validator.json ]; then\n - tendermint gen_validator > /tendermint/priv_validator.json\n - # pub_key.json will be served by pub-key container\n - cat /tendermint/priv_validator.json | jq \".pub_key\" > /tendermint/pub_key.json\n - fi\n - "], - "volumeMounts": [ - {"name": "tmdir", "mountPath": "/tendermint"} - ] - }]' - spec: - containers: - - name: tm - imagePullPolicy: IfNotPresent - image: tendermint/tendermint:0.10.0 - ports: - - containerPort: 26656 - name: p2p - - containerPort: 26657 - name: rpc - env: - - name: SEEDS - valueFrom: - configMapKeyRef: - name: tm-config - key: seeds - - name: VALIDATOR_POWER - valueFrom: - configMapKeyRef: - name: tm-config - key: validator.power - - name: VALIDATORS - valueFrom: - configMapKeyRef: - name: tm-config - key: validators - - name: TMHOME - value: /tendermint - command: - - bash - - "-c" - - | - set -ex - - # copy template - cp /etc/tendermint/genesis.json /tendermint/genesis.json - - # fill genesis file with validators - IFS=',' read -ra VALS_ARR <<< "$VALIDATORS" - fqdn_suffix=$(hostname -f | sed 's#[^.]*\.\(\)#\1#') - for v in "${VALS_ARR[@]}"; do - # wait until validator generates priv/pub key pair - set +e - - curl -s --fail "http://$v.$fqdn_suffix/pub_key.json" > /dev/null - ERR=$? - while [ "$ERR" != 0 ]; do - sleep 5 - curl -s --fail "http://$v.$fqdn_suffix/pub_key.json" > /dev/null - ERR=$? - done - set -e - - # add validator to genesis file along with its pub_key - curl -s "http://$v.$fqdn_suffix/pub_key.json" | jq ". as \$k | {pub_key: \$k, amount: $VALIDATOR_POWER, name: \"$v\"}" > pub_validator.json - cat /tendermint/genesis.json | jq ".validators |= .+ [$(cat pub_validator.json)]" > tmpgenesis && mv tmpgenesis /tendermint/genesis.json - rm pub_validator.json - done - - # construct seeds - IFS=',' read -ra SEEDS_ARR <<< "$SEEDS" - seeds=() - for s in "${SEEDS_ARR[@]}"; do - seeds+=("$s.$fqdn_suffix:26656") - done - seeds=$(IFS=','; echo "${seeds[*]}") - - tendermint node --p2p.seeds="$seeds" --moniker="`hostname`" --proxy_app="unix:///socks/app.sock" - volumeMounts: - - name: tmdir - mountPath: /tendermint - - mountPath: /etc/tendermint/genesis.json - name: tmconfigdir - subPath: genesis.json - - name: socksdir - mountPath: /socks - - - name: app - imagePullPolicy: IfNotPresent - image: golang:latest - command: - - bash - - "-c" - - | - set -ex - - go get github.com/tendermint/tendermint/abci/cmd/abci-cli - - rm -f /socks/app.sock # remove old socket - - abci-cli counter --serial=true --address="unix:///socks/app.sock" - volumeMounts: - - name: socksdir - mountPath: /socks - - - name: pub-key - imagePullPolicy: IfNotPresent - image: nginx:latest - ports: - - containerPort: 80 - name: pub-key - command: - - bash - - "-c" - - | - set -ex - # fixes 403 Permission Denied (open() "/tendermint/pub_key.json" failed (13: Permission denied)) - # => we cannot serve from /tendermint, so we copy the file - mkdir -p /usr/share/nginx - cp /tendermint/pub_key.json /usr/share/nginx/pub_key.json - nginx -g "daemon off;" - volumeMounts: - - name: tmdir - mountPath: /tendermint - - mountPath: /etc/nginx/conf.d/pub_key.conf - name: tmconfigdir - subPath: pub_key_nginx.conf - - volumes: - - name: tmconfigdir - configMap: - name: tm-config - - name: socksdir - emptyDir: {} - - volumeClaimTemplates: - - metadata: - name: tmdir - annotations: - volume.alpha.kubernetes.io/storage-class: anything - spec: - accessModes: ["ReadWriteOnce"] - resources: - requests: - storage: 2Gi diff --git a/tools/mintnet-kubernetes/examples/dummy/Makefile b/tools/mintnet-kubernetes/examples/dummy/Makefile deleted file mode 100644 index 825487fcd..000000000 --- a/tools/mintnet-kubernetes/examples/dummy/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -create: - @echo "==> Creating deployment" - @kubectl create -f app.yaml - @echo "==> Waiting 10s until it is probably ready" - @sleep 10 - @echo "==> Creating monitor and transacter pods" - @kubectl create -f tm-monitor-pod.yaml - @kubectl create -f transacter-pod.yaml - -destroy: - @echo "==> Destroying deployment" - @kubectl delete -f transacter-pod.yaml - @kubectl delete -f tm-monitor-pod.yaml - @kubectl delete -f app.yaml - @kubectl delete pvc -l app=tm - -.PHONY: create destroy diff --git a/tools/mintnet-kubernetes/examples/dummy/app.yaml b/tools/mintnet-kubernetes/examples/dummy/app.yaml deleted file mode 100644 index 5413bd501..000000000 --- a/tools/mintnet-kubernetes/examples/dummy/app.yaml +++ /dev/null @@ -1,196 +0,0 @@ ---- -apiVersion: v1 -kind: Service -metadata: - annotations: - service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" - name: dummy - labels: - app: dummy -spec: - ports: - - port: 26656 - name: p2p - - port: 26657 - name: rpc - clusterIP: None - selector: - app: tm ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: tm-config -data: - seeds: "tm-0,tm-1,tm-2,tm-3" - validators: "tm-0,tm-1,tm-2,tm-3" - validator.power: "10" - genesis.json: |- - { - "genesis_time": "2016-02-05T23:17:31.164Z", - "chain_id": "chain-B5XXm5", - "validators": [], - "app_hash": "" - } - pub_key_nginx.conf: |- - server { - listen 80 default_server; - listen [::]:80 default_server ipv6only=on; - location /pub_key.json { root /usr/share/nginx/; } - } ---- -apiVersion: policy/v1beta1 -kind: PodDisruptionBudget -metadata: - name: tm-budget -spec: - selector: - matchLabels: - app: tm - minAvailable: 2 ---- -apiVersion: apps/v1beta1 -kind: StatefulSet -metadata: - name: tm -spec: - serviceName: dummy - replicas: 4 - template: - metadata: - labels: - app: tm - annotations: - pod.beta.kubernetes.io/init-containers: '[{ - "name": "tm-gen-validator", - "image": "tendermint/tendermint:0.10.0", - "imagePullPolicy": "IfNotPresent", - "command": ["bash", "-c", " - set -ex\n - if [ ! -f /tendermint/priv_validator.json ]; then\n - tendermint gen_validator > /tendermint/priv_validator.json\n - # pub_key.json will be served by pub-key container\n - cat /tendermint/priv_validator.json | jq \".pub_key\" > /tendermint/pub_key.json\n - fi\n - "], - "volumeMounts": [ - {"name": "tmdir", "mountPath": "/tendermint"} - ] - }]' - spec: - containers: - - name: tm - imagePullPolicy: IfNotPresent - image: tendermint/tendermint:0.10.0 - ports: - - containerPort: 26656 - name: p2p - - containerPort: 26657 - name: rpc - env: - - name: SEEDS - valueFrom: - configMapKeyRef: - name: tm-config - key: seeds - - name: VALIDATOR_POWER - valueFrom: - configMapKeyRef: - name: tm-config - key: validator.power - - name: VALIDATORS - valueFrom: - configMapKeyRef: - name: tm-config - key: validators - - name: TMHOME - value: /tendermint - command: - - bash - - "-c" - - | - set -ex - - # copy template - cp /etc/tendermint/genesis.json /tendermint/genesis.json - - # fill genesis file with validators - IFS=',' read -ra VALS_ARR <<< "$VALIDATORS" - fqdn_suffix=$(hostname -f | sed 's#[^.]*\.\(\)#\1#') - for v in "${VALS_ARR[@]}"; do - # wait until validator generates priv/pub key pair - set +e - - curl -s --fail "http://$v.$fqdn_suffix/pub_key.json" > /dev/null - ERR=$? - while [ "$ERR" != 0 ]; do - sleep 5 - curl -s --fail "http://$v.$fqdn_suffix/pub_key.json" > /dev/null - ERR=$? - done - set -e - - # add validator to genesis file along with its pub_key - curl -s "http://$v.$fqdn_suffix/pub_key.json" | jq ". as \$k | {pub_key: \$k, amount: $VALIDATOR_POWER, name: \"$v\"}" > pub_validator.json - cat /tendermint/genesis.json | jq ".validators |= .+ [$(cat pub_validator.json)]" > tmpgenesis && mv tmpgenesis /tendermint/genesis.json - rm pub_validator.json - done - - # construct seeds - IFS=',' read -ra SEEDS_ARR <<< "$SEEDS" - seeds=() - for s in "${SEEDS_ARR[@]}"; do - seeds+=("$s.$fqdn_suffix:26656") - done - seeds=$(IFS=','; echo "${seeds[*]}") - - tendermint node --p2p.seeds="$seeds" --moniker="`hostname`" --proxy_app="dummy" - volumeMounts: - - name: tmdir - mountPath: /tendermint - - mountPath: /etc/tendermint/genesis.json - name: tmconfigdir - subPath: genesis.json - - name: socksdir - mountPath: /socks - - - name: pub-key - imagePullPolicy: IfNotPresent - image: nginx:latest - ports: - - containerPort: 80 - name: pub-key - command: - - bash - - "-c" - - | - set -ex - # fixes 403 Permission Denied (open() "/tendermint/pub_key.json" failed (13: Permission denied)) - # => we cannot serve from /tendermint, so we copy the file - mkdir -p /usr/share/nginx - cp /tendermint/pub_key.json /usr/share/nginx/pub_key.json - nginx -g "daemon off;" - volumeMounts: - - name: tmdir - mountPath: /tendermint - - mountPath: /etc/nginx/conf.d/pub_key.conf - name: tmconfigdir - subPath: pub_key_nginx.conf - - volumes: - - name: tmconfigdir - configMap: - name: tm-config - - name: socksdir - emptyDir: {} - - volumeClaimTemplates: - - metadata: - name: tmdir - annotations: - volume.alpha.kubernetes.io/storage-class: anything - spec: - accessModes: ["ReadWriteOnce"] - resources: - requests: - storage: 2Gi diff --git a/tools/mintnet-kubernetes/examples/dummy/tm-monitor-pod.yaml b/tools/mintnet-kubernetes/examples/dummy/tm-monitor-pod.yaml deleted file mode 100644 index fb0bf7236..000000000 --- a/tools/mintnet-kubernetes/examples/dummy/tm-monitor-pod.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -apiVersion: v1 -kind: Pod -metadata: - name: monitor -spec: - containers: - - name: monitor - image: tendermint/monitor - args: ["-listen-addr=tcp://0.0.0.0:26670", "tm-0.dummy:26657,tm-1.dummy:26657,tm-2.dummy:26657,tm-3.dummy:26657"] - ports: - - containerPort: 26670 - name: rpc diff --git a/tools/mintnet-kubernetes/examples/dummy/transacter-pod.yaml b/tools/mintnet-kubernetes/examples/dummy/transacter-pod.yaml deleted file mode 100644 index 6598e2a8b..000000000 --- a/tools/mintnet-kubernetes/examples/dummy/transacter-pod.yaml +++ /dev/null @@ -1,19 +0,0 @@ ---- -apiVersion: v1 -kind: Pod -metadata: - name: transacter -spec: - containers: - - name: transacter - image: tendermint/transacter - command: - - bash - - "-c" - - | - set -ex - while true - do - ./transact 100 "tm-0.dummy:26657" - sleep 1 - done