From d09f4f503d7769c6456caa453ecea92c3cd80052 Mon Sep 17 00:00:00 2001 From: William Banfield <4561443+williambanfield@users.noreply.github.com> Date: Thu, 1 Dec 2022 11:21:28 -0500 Subject: [PATCH 1/5] e2e: create client when sending transaction (#9814) Fixes the issue observed in an [e2e test run](https://github.com/tendermint/tendermint/actions/runs/3588927225). The issue arises when the e2e runner process cannot connect to the remote node. In the previous version of this code, the runner would simply skip the transaction if the client couldn't connect. This pull request resurrects that behavior. --- #### 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 --- test/e2e/runner/load.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/test/e2e/runner/load.go b/test/e2e/runner/load.go index 735af4821..1989886b0 100644 --- a/test/e2e/runner/load.go +++ b/test/e2e/runner/load.go @@ -26,6 +26,7 @@ func Load(ctx context.Context, testnet *e2e.Testnet) error { ctx, cancel := context.WithCancel(ctx) defer cancel() + logger.Info("load", "msg", log.NewLazySprintf("Starting transaction load (%v workers)...", workerPoolSize)) started := time.Now() u := [16]byte(uuid.New()) // generate run ID on startup @@ -38,11 +39,7 @@ func Load(ctx context.Context, testnet *e2e.Testnet) error { } for w := 0; w < testnet.LoadTxConnections; w++ { - cli, err := n.Client() - if err != nil { - return err - } - go loadProcess(ctx, txCh, chSuccess, cli) + go loadProcess(ctx, txCh, chSuccess, n) } } @@ -123,10 +120,18 @@ func createTxBatch(ctx context.Context, txCh chan<- types.Tx, testnet *e2e.Testn // loadProcess processes transactions by sending transactions received on the txCh // to the client. -func loadProcess(ctx context.Context, txCh <-chan types.Tx, chSuccess chan<- struct{}, client *rpchttp.HTTP) { +func loadProcess(ctx context.Context, txCh <-chan types.Tx, chSuccess chan<- struct{}, n *e2e.Node) { + var client *rpchttp.HTTP var err error s := struct{}{} for tx := range txCh { + if client == nil { + client, err = n.Client() + if err != nil { + logger.Info("non-fatal error creating node client", "error", err) + continue + } + } if _, err = client.BroadcastTxSync(ctx, tx); err != nil { continue } From 0952a99f454a9936839a461cfc5f91c12546705a Mon Sep 17 00:00:00 2001 From: Thane Thomson Date: Thu, 1 Dec 2022 12:46:22 -0500 Subject: [PATCH 2/5] ci: Better Slack failures (#9812) The primary aim of this PR is to improve the failure messages we get a little. Seeing the latest commit is often useless, and it's probably better to just get a direct link to a list of commits for that specific branch so we can see what's been committed since the previous nightly run. This PR also makes one minor improvement in the use of the now-deprecated `set-output` syntax for workflows, upgrading it to use the new approach as per https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ --- #### PR checklist - [x] Tests written/updated, or no tests needed - [x] `CHANGELOG_PENDING.md` updated, or no changelog entry needed - [x] Updated relevant documentation (`docs/`) and code comments, or no documentation updates needed --- .github/workflows/docker.yml | 2 +- .github/workflows/e2e-nightly-34x.yml | 8 +++----- .github/workflows/e2e-nightly-37x.yml | 8 +++----- .github/workflows/e2e-nightly-main.yml | 4 ++-- .github/workflows/fuzz-nightly.yml | 2 +- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index e1f38d1a6..721a2717b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -33,7 +33,7 @@ jobs: if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then TAGS="$TAGS,${DOCKER_IMAGE}:${VERSION}" fi - echo ::set-output name=tags::${TAGS} + echo "tags=${TAGS}" >> $GITHUB_OUTPUT - name: Set up QEMU uses: docker/setup-qemu-action@master diff --git a/.github/workflows/e2e-nightly-34x.yml b/.github/workflows/e2e-nightly-34x.yml index 944ba13ef..8d89a20da 100644 --- a/.github/workflows/e2e-nightly-34x.yml +++ b/.github/workflows/e2e-nightly-34x.yml @@ -30,8 +30,7 @@ jobs: - name: Capture git repo info id: git-info run: | - echo "::set-output name=branch::`git branch --show-current`" - echo "::set-output name=commit::`git rev-parse HEAD`" + echo "branch=`git branch --show-current`" >> $GITHUB_OUTPUT - name: Build working-directory: test/e2e @@ -49,7 +48,6 @@ jobs: outputs: git-branch: ${{ steps.git-info.outputs.branch }} - git-commit: ${{ steps.git-info.outputs.commit }} e2e-nightly-fail: needs: e2e-nightly-test @@ -63,7 +61,7 @@ jobs: SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK BRANCH: ${{ needs.e2e-nightly-test.outputs.git-branch }} RUN_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - COMMIT_URL: "${{ github.server_url }}/${{ github.repository }}/commit/${{ needs.e2e-nightly-test.outputs.git-commit }}" + COMMITS_URL: "${{ github.server_url }}/${{ github.repository }}/commits/${{ needs.e2e-nightly-test.outputs.git-branch }}" with: payload: | { @@ -72,7 +70,7 @@ jobs: "type": "section", "text": { "type": "mrkdwn", - "text": ":skull: Nightly E2E tests for `${{ env.BRANCH }}` failed. See the <${{ env.RUN_URL }}|run details> and the <${{ env.COMMIT_URL }}|commit> related to the failure." + "text": ":skull: Nightly E2E tests for `${{ env.BRANCH }}` failed. See the <${{ env.RUN_URL }}|run details> and the <${{ env.COMMITS_URL }}|latest commits> possibly related to the failure." } } ] diff --git a/.github/workflows/e2e-nightly-37x.yml b/.github/workflows/e2e-nightly-37x.yml index 769a316b2..ebcc4a3fb 100644 --- a/.github/workflows/e2e-nightly-37x.yml +++ b/.github/workflows/e2e-nightly-37x.yml @@ -30,8 +30,7 @@ jobs: - name: Capture git repo info id: git-info run: | - echo "::set-output name=branch::`git branch --show-current`" - echo "::set-output name=commit::`git rev-parse HEAD`" + echo "branch=`git branch --show-current`" >> $GITHUB_OUTPUT - name: Build working-directory: test/e2e @@ -49,7 +48,6 @@ jobs: outputs: git-branch: ${{ steps.git-info.outputs.branch }} - git-commit: ${{ steps.git-info.outputs.commit }} e2e-nightly-fail: needs: e2e-nightly-test @@ -63,7 +61,7 @@ jobs: SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK BRANCH: ${{ needs.e2e-nightly-test.outputs.git-branch }} RUN_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - COMMIT_URL: "${{ github.server_url }}/${{ github.repository }}/commit/${{ needs.e2e-nightly-test.outputs.git-commit }}" + COMMITS_URL: "${{ github.server_url }}/${{ github.repository }}/commits/${{ needs.e2e-nightly-test.outputs.git-branch }}" with: payload: | { @@ -72,7 +70,7 @@ jobs: "type": "section", "text": { "type": "mrkdwn", - "text": ":skull: Nightly E2E tests for `${{ env.BRANCH }}` failed. See the <${{ env.RUN_URL }}|run details> and the <${{ env.COMMIT_URL }}|commit> related to the failure." + "text": ":skull: Nightly E2E tests for `${{ env.BRANCH }}` failed. See the <${{ env.RUN_URL }}|run details> and the <${{ env.COMMITS_URL }}|latest commits> possibly related to the failure." } } ] diff --git a/.github/workflows/e2e-nightly-main.yml b/.github/workflows/e2e-nightly-main.yml index dd8b7abbb..7f734367d 100644 --- a/.github/workflows/e2e-nightly-main.yml +++ b/.github/workflows/e2e-nightly-main.yml @@ -52,7 +52,7 @@ jobs: SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK BRANCH: ${{ github.ref_name }} RUN_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - COMMIT_URL: "${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}" + COMMITS_URL: "${{ github.server_url }}/${{ github.repository }}/commits/${{ github.ref_name }}" with: payload: | { @@ -61,7 +61,7 @@ jobs: "type": "section", "text": { "type": "mrkdwn", - "text": ":skull: Nightly E2E tests for `${{ env.BRANCH }}` failed. See the <${{ env.RUN_URL }}|run details> and the <${{ env.COMMIT_URL }}|commit> related to the failure." + "text": ":skull: Nightly E2E tests for `${{ env.BRANCH }}` failed. See the <${{ env.RUN_URL }}|run details> and the <${{ env.COMMITS_URL }}|latest commits> possibly related to the failure." } } ] diff --git a/.github/workflows/fuzz-nightly.yml b/.github/workflows/fuzz-nightly.yml index 0209501a1..e6c71db08 100644 --- a/.github/workflows/fuzz-nightly.yml +++ b/.github/workflows/fuzz-nightly.yml @@ -64,7 +64,7 @@ jobs: - name: Set crashers count working-directory: test/fuzz - run: echo "::set-output name=count::$(find . -type d -name 'crashers' | xargs -I % sh -c 'ls % | wc -l' | awk '{total += $1} END {print total}')" + run: echo "count=$(find . -type d -name 'crashers' | xargs -I % sh -c 'ls % | wc -l' | awk '{total += $1} END {print total}')" >> $GITHUB_OUTPUT id: set-crashers-count outputs: From 654e5652e4ce3c521895a97909712c0a5509e8fa Mon Sep 17 00:00:00 2001 From: William Banfield <4561443+williambanfield@users.noreply.github.com> Date: Fri, 2 Dec 2022 13:19:10 -0500 Subject: [PATCH 3/5] e2e: add defer to ensure waitgroup is finished. (#9822) * defer wait group completion * generate correct number of tx --- test/e2e/runner/load.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/e2e/runner/load.go b/test/e2e/runner/load.go index 1989886b0..b4478bf6d 100644 --- a/test/e2e/runner/load.go +++ b/test/e2e/runner/load.go @@ -92,10 +92,12 @@ func loadGenerate(ctx context.Context, txCh chan<- types.Tx, testnet *e2e.Testne // is canceled. func createTxBatch(ctx context.Context, txCh chan<- types.Tx, testnet *e2e.Testnet, id []byte) { wg := &sync.WaitGroup{} + genCh := make(chan struct{}) for i := 0; i < workerPoolSize; i++ { wg.Add(1) go func() { - for i := 0; i < testnet.LoadTxBatchSize; i++ { + defer wg.Done() + for range genCh { tx, err := payload.NewBytes(&payload.Payload{ Id: id, Size: uint64(testnet.LoadTxSizeBytes), @@ -112,9 +114,16 @@ func createTxBatch(ctx context.Context, txCh chan<- types.Tx, testnet *e2e.Testn return } } - wg.Done() }() } + for i := 0; i < testnet.LoadTxBatchSize; i++ { + select { + case genCh <- struct{}{}: + case <-ctx.Done(): + break + } + } + close(genCh) wg.Wait() } From 5ba0d131c461a469b2ad8eddf99aded18efcb3ff Mon Sep 17 00:00:00 2001 From: William Banfield <4561443+williambanfield@users.noreply.github.com> Date: Fri, 2 Dec 2022 13:37:33 -0500 Subject: [PATCH 4/5] e2e: setup testing for multi-version (#9819) This pull requests sets up the e2e tests to be able to support multiple versions within the same test network. This is achieved through a few simple changes: * Each node takes a `version` parameter in the testnet manifest. This dictates which version of the testapp to use. If not set, the locally available version is used. * Adds a `testapp-docker.yml` workflow that publishes the testapp to docker hub so that tagged versions may be available for use in a multi-version test network. This change does not actually add a testnetwork that does multi-version testing. Since no previous versions of the testapp have been published to dockerhub, there are not old versions available to test against. We'll either need to configure this after the next minor release which will trigger a testapp to be pushed to dockerhub, or push an image from the previous version of Tendermint so that the multiversion test has an old version to pull. #### 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 --- .../{docker.yml => tendermint-docker.yml} | 0 .github/workflows/testapp-docker.yml | 60 +++++++++++++++++++ test/e2e/Makefile | 2 +- test/e2e/pkg/infra/docker/docker.go | 2 +- test/e2e/pkg/manifest.go | 7 +++ test/e2e/pkg/testnet.go | 6 ++ 6 files changed, 75 insertions(+), 2 deletions(-) rename .github/workflows/{docker.yml => tendermint-docker.yml} (100%) create mode 100644 .github/workflows/testapp-docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/tendermint-docker.yml similarity index 100% rename from .github/workflows/docker.yml rename to .github/workflows/tendermint-docker.yml diff --git a/.github/workflows/testapp-docker.yml b/.github/workflows/testapp-docker.yml new file mode 100644 index 000000000..9e8e59a47 --- /dev/null +++ b/.github/workflows/testapp-docker.yml @@ -0,0 +1,60 @@ +name: Testapp Docker +# Build & Push rebuilds the Testapp docker image on every push to main and creation of tags +# and pushes the image to https://hub.docker.com/r/tendermint/testapp +on: + push: + branches: + - 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]+-alpha.[0-9]+" # e.g. v0.37.0-alpha.1, v0.38.0-alpha.10 + - "v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+" # e.g. v0.37.0-beta.1, v0.38.0-beta.10 + - "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+" # e.g. v0.37.0-rc1, v0.38.0-rc10 + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Prepare + id: prep + run: | + DOCKER_IMAGE=tendermint/testapp + VERSION=noop + if [[ $GITHUB_REF == refs/tags/* ]]; then + VERSION=${GITHUB_REF#refs/tags/} + elif [[ $GITHUB_REF == refs/heads/* ]]; then + VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g') + if [ "${{ github.event.repository.default_branch }}" = "$VERSION" ]; then + VERSION=latest + fi + fi + TAGS="${DOCKER_IMAGE}:${VERSION}" + if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then + TAGS="$TAGS,${DOCKER_IMAGE}:${VERSION}" + fi + echo "tags=${TAGS}" >> $GITHUB_OUTPUT + + - name: Set up QEMU + uses: docker/setup-qemu-action@master + with: + platforms: all + + - name: Set up Docker Build + uses: docker/setup-buildx-action@v2.2.1 + + - name: Login to DockerHub + if: ${{ github.event_name != 'pull_request' }} + uses: docker/login-action@v2.1.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Publish to Docker Hub + uses: docker/build-push-action@v3.2.0 + with: + context: . + file: ./test/e2e/docker/Dockerfile + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != 'beep_boop' }} + tags: ${{ steps.prep.outputs.tags }} diff --git a/test/e2e/Makefile b/test/e2e/Makefile index 8bafe7ca9..7a82f8236 100644 --- a/test/e2e/Makefile +++ b/test/e2e/Makefile @@ -1,7 +1,7 @@ all: docker generator runner docker: - docker build --tag tendermint/e2e-node -f docker/Dockerfile ../.. + docker build --tag tendermint/e2e-node --tag tendermint/e2e-node:local-version -f docker/Dockerfile ../.. # We need to build support for database backends into the app in # order to build a binary with a Tendermint node in it (for built-in diff --git a/test/e2e/pkg/infra/docker/docker.go b/test/e2e/pkg/infra/docker/docker.go index 04811aab5..5c118f03b 100644 --- a/test/e2e/pkg/infra/docker/docker.go +++ b/test/e2e/pkg/infra/docker/docker.go @@ -57,7 +57,7 @@ services: labels: e2e: true container_name: {{ .Name }} - image: tendermint/e2e-node + image: tendermint/e2e-node:{{ .Version }} {{- if eq .ABCIProtocol "builtin" }} entrypoint: /usr/bin/entrypoint-builtin {{- end }} diff --git a/test/e2e/pkg/manifest.go b/test/e2e/pkg/manifest.go index 814ae61c7..0a9a1da5f 100644 --- a/test/e2e/pkg/manifest.go +++ b/test/e2e/pkg/manifest.go @@ -81,6 +81,13 @@ type ManifestNode struct { // is generated), and seed nodes run in seed mode with the PEX reactor enabled. Mode string `toml:"mode"` + // Version specifies which version of Tendermint this node is. Specifying different + // versions for different nodes allows for testing the interaction of different + // node's compatibility. Note that in order to use a node at a particular version, + // there must be a docker image of the test app tagged with this version present + // on the machine where the test is being run. + Version string `toml:"version"` + // SyncApp specifies whether this node should use a synchronized application // with an unsynchronized local client. By default this is `false`, meaning // that the node will run an unsynchronized application with a synchronized diff --git a/test/e2e/pkg/testnet.go b/test/e2e/pkg/testnet.go index 8d0d674db..2bd16f8c1 100644 --- a/test/e2e/pkg/testnet.go +++ b/test/e2e/pkg/testnet.go @@ -79,6 +79,7 @@ type Testnet struct { // Node represents a Tendermint node in a testnet. type Node struct { Name string + Version string Testnet *Testnet Mode Mode SyncApp bool // Should we use a synchronized app with an unsynchronized local client? @@ -169,8 +170,13 @@ func LoadTestnet(manifest Manifest, fname string, ifd InfrastructureData) (*Test if !ok { return nil, fmt.Errorf("information for node '%s' missing from infrastucture data", name) } + v := nodeManifest.Version + if v == "" { + v = "local-version" + } node := &Node{ Name: name, + Version: v, Testnet: testnet, PrivvalKey: keyGen.Generate(manifest.KeyType), NodeKey: keyGen.Generate("ed25519"), From c3302b0dc985f4267fc511c98d84f99daade0bdd Mon Sep 17 00:00:00 2001 From: Lasaro Camargos Date: Sun, 4 Dec 2022 08:15:49 -0300 Subject: [PATCH 5/5] fixes abci-cli console help (#9821) * adds prepare and process proposal commands to console help * comment typo fix --- abci/cmd/abci-cli/abci-cli.go | 9 ++++++--- state/execution.go | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/abci/cmd/abci-cli/abci-cli.go b/abci/cmd/abci-cli/abci-cli.go index 4a4201943..ab0d52156 100644 --- a/abci/cmd/abci-cli/abci-cli.go +++ b/abci/cmd/abci-cli/abci-cli.go @@ -460,11 +460,14 @@ func cmdUnimplemented(cmd *cobra.Command, args []string) error { fmt.Println("Available commands:") fmt.Printf("%s: %s\n", echoCmd.Use, echoCmd.Short) - fmt.Printf("%s: %s\n", infoCmd.Use, infoCmd.Short) fmt.Printf("%s: %s\n", checkTxCmd.Use, checkTxCmd.Short) - fmt.Printf("%s: %s\n", deliverTxCmd.Use, deliverTxCmd.Short) - fmt.Printf("%s: %s\n", queryCmd.Use, queryCmd.Short) fmt.Printf("%s: %s\n", commitCmd.Use, commitCmd.Short) + fmt.Printf("%s: %s\n", deliverTxCmd.Use, deliverTxCmd.Short) + fmt.Printf("%s: %s\n", infoCmd.Use, infoCmd.Short) + fmt.Printf("%s: %s\n", queryCmd.Use, queryCmd.Short) + fmt.Printf("%s: %s\n", prepareProposalCmd.Use, prepareProposalCmd.Short) + fmt.Printf("%s: %s\n", processProposalCmd.Use, processProposalCmd.Short) + fmt.Println("Use \"[command] --help\" for more information about a command.") return nil diff --git a/state/execution.go b/state/execution.go index 234d81c0f..4ba630db7 100644 --- a/state/execution.go +++ b/state/execution.go @@ -93,7 +93,7 @@ func (blockExec *BlockExecutor) SetEventBus(eventBus types.BlockEventPublisher) // CreateProposalBlock calls state.MakeBlock with evidence from the evpool // and txs from the mempool. The max bytes must be big enough to fit the commit. -// Up to 1/10th of the block space is allcoated for maximum sized evidence. +// Up to 1/10th of the block space is allocated for maximum sized evidence. // The rest is given to txs, up to the max gas. // // Contract: application will not return more bytes than are sent over the wire.