diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0108f040d..23e73e745 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -11,6 +11,17 @@ updates: - T:dependencies - S:automerge + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: weekly + day: monday + target-branch: "v0.34.x" + open-pull-requests-limit: 10 + labels: + - T:dependencies + - S:automerge + - package-ecosystem: github-actions directory: "/" schedule: @@ -27,7 +38,7 @@ updates: schedule: interval: weekly day: monday - target-branch: "v0.34.x" + target-branch: "v0.36.x" open-pull-requests-limit: 10 labels: - T:dependencies @@ -73,3 +84,13 @@ updates: labels: - T:dependencies - S:automerge + + - package-ecosystem: gomod + directory: "/" + schedule: + interval: daily + target-branch: "v0.36.x" + open-pull-requests-limit: 10 + labels: + - T:dependencies + - S:automerge diff --git a/.github/mergify.yml b/.github/mergify.yml index d13fb851f..6c703b8ce 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -33,3 +33,11 @@ pull_request_rules: backport: branches: - v0.35.x + - name: backport patches to v0.36.x branch + conditions: + - base=master + - label=S:backport-to-v0.36.x + actions: + backport: + branches: + - v0.36.x diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ce6958eab..bcfea1cba 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: "1.17" + go-version: "1.18" - uses: actions/checkout@v3 - uses: technote-space/get-diff-action@v6 with: @@ -43,7 +43,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: "1.17" + go-version: "1.18" - uses: actions/checkout@v3 - uses: technote-space/get-diff-action@v6 with: @@ -65,7 +65,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: "1.17" + go-version: "1.18" - uses: actions/checkout@v3 - uses: technote-space/get-diff-action@v6 with: diff --git a/.github/workflows/check-generated.yml b/.github/workflows/check-generated.yml index 3bf63b79c..d8c1a79f7 100644 --- a/.github/workflows/check-generated.yml +++ b/.github/workflows/check-generated.yml @@ -18,13 +18,16 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: '1.17' + go-version: '1.18' - uses: actions/checkout@v3 - name: "Check generated mocks" run: | set -euo pipefail + + readonly MOCKERY=2.12.3 # N.B. no leading "v" + curl -sL "https://github.com/vektra/mockery/releases/download/v${MOCKERY}/mockery_${MOCKERY}_Linux_x86_64.tar.gz" | tar -C /usr/local/bin -xzf - make mockery 2>/dev/null if ! git diff --stat --exit-code ; then @@ -41,7 +44,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: '1.17' + go-version: '1.18' - uses: actions/checkout@v3 with: diff --git a/.github/workflows/e2e-manual.yml b/.github/workflows/e2e-manual.yml index bab3fcf62..56a406b7a 100644 --- a/.github/workflows/e2e-manual.yml +++ b/.github/workflows/e2e-manual.yml @@ -11,13 +11,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.17' + go-version: '1.18' - uses: actions/checkout@v3 @@ -29,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 d7af7b347..db4268dda 100644 --- a/.github/workflows/e2e-nightly-34x.yml +++ b/.github/workflows/e2e-nightly-34x.yml @@ -1,8 +1,7 @@ -# 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-master.yml file, +# modulo changes to the version labels. name: e2e-nightly-34x on: @@ -22,7 +21,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: '1.17' + go-version: '1.18' - uses: actions/checkout@v3 with: diff --git a/.github/workflows/e2e-nightly-35x.yml b/.github/workflows/e2e-nightly-35x.yml index c397ead9c..04cd6c524 100644 --- a/.github/workflows/e2e-nightly-35x.yml +++ b/.github/workflows/e2e-nightly-35x.yml @@ -1,7 +1,7 @@ -# Runs randomly generated E2E testnets nightly on v0.35.x. +# Runs randomly generated E2E testnets nightly on the v0.35.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-master.yml file, +# modulo changes to the version labels. name: e2e-nightly-35x on: @@ -22,7 +22,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: '1.17' + go-version: '1.18' - uses: actions/checkout@v3 with: diff --git a/.github/workflows/e2e-nightly-36x.yml b/.github/workflows/e2e-nightly-36x.yml new file mode 100644 index 000000000..2067602e7 --- /dev/null +++ b/.github/workflows/e2e-nightly-36x.yml @@ -0,0 +1,74 @@ +# Runs randomly generated E2E testnets nightly on the v0.36.x branch. + +# !! This file should be kept in sync with the e2e-nightly-master.yml file, +# modulo changes to the version labels. + +name: e2e-nightly-36x +on: + schedule: + - cron: '0 2 * * *' + +jobs: + 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'] + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - uses: actions/setup-go@v3 + with: + go-version: '1.18' + + - uses: actions/checkout@v3 + with: + ref: 'v0.36.x' + + - 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 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 + + - name: Run testnets in group ${{ matrix.group }} + working-directory: test/e2e + run: ./run-multiple.sh networks/nightly/*-group${{ matrix.group }}-*.toml + + e2e-nightly-fail-2: + needs: e2e-nightly-test + if: ${{ failure() }} + runs-on: ubuntu-latest + steps: + - name: Notify Slack on failure + 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 v0.36.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@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 v0.36.x + SLACK_FOOTER: '' diff --git a/.github/workflows/e2e-nightly-master.yml b/.github/workflows/e2e-nightly-master.yml index fc1fff104..367364efb 100644 --- a/.github/workflows/e2e-nightly-master.yml +++ b/.github/workflows/e2e-nightly-master.yml @@ -1,7 +1,8 @@ # Runs randomly generated E2E testnets nightly on master -# !! 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 on: @@ -15,13 +16,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.17' + go-version: '1.18' - uses: actions/checkout@v3 @@ -33,7 +34,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.yml b/.github/workflows/e2e.yml index 6666999fc..9043efb03 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: '1.17' + go-version: '1.18' - uses: actions/checkout@v3 - uses: technote-space/get-diff-action@v6 with: diff --git a/.github/workflows/fuzz-nightly.yml b/.github/workflows/fuzz-nightly.yml index 0fcab9ae5..07941a734 100644 --- a/.github/workflows/fuzz-nightly.yml +++ b/.github/workflows/fuzz-nightly.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: '1.17' + go-version: '1.18' - uses: actions/checkout@v3 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 863d5ab10..f8b493a2e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: '^1.17' + go-version: '1.18' - uses: technote-space/get-diff-action@v6 with: PATTERNS: | diff --git a/.github/workflows/proto-lint.yml b/.github/workflows/proto-lint.yml index b1fbeab9d..f8fff89cc 100644 --- a/.github/workflows/proto-lint.yml +++ b/.github/workflows/proto-lint.yml @@ -15,7 +15,7 @@ jobs: timeout-minutes: 5 steps: - uses: actions/checkout@v3 - - uses: bufbuild/buf-setup-action@v1.4.0 + - uses: bufbuild/buf-setup-action@v1.5.0 - uses: bufbuild/buf-lint-action@v1 with: input: 'proto' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2e0cd548c..4b3e22446 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: - uses: actions/setup-go@v3 with: - go-version: '1.17' + go-version: '1.18' - name: Build uses: goreleaser/goreleaser-action@v3 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6ce8a4d34..e9e47e25b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: "1.17" + go-version: "1.18" - uses: actions/checkout@v3 - uses: technote-space/get-diff-action@v6 with: diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 6f10f6bfd..c3e191e7e 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -23,12 +23,14 @@ Special thanks to external contributors on this release: - [config] \#8222 default indexer configuration to null. (@creachadair) - [rpc] \#8570 rework timeouts to be per-method instead of global. (@creachadair) - [rpc] \#8624 deprecate `broadcast_tx_commit` and `braodcast_tx_sync` and `broadcast_tx_async` in favor of `braodcast_tx`. (@tychoish) + - [config] \#8654 remove deprecated `seeds` field from config. Users should switch to `bootstrap-peers` instead. (@cmwaters) - Apps - [tendermint/spec] \#7804 Migrate spec from [spec repo](https://github.com/tendermint/spec). - [abci] \#7984 Remove the locks preventing concurrent use of ABCI applications by Tendermint. (@tychoish) - [abci] \#8605 Remove info, log, events, gasUsed and mempoolError fields from ResponseCheckTx as they are not used by Tendermint. (@jmalicevic) + - [abci] \#8664 Move `app_hash` parameter from `Commit` to `FinalizeBlock`. (@sergio-mena) - P2P Protocol @@ -68,6 +70,8 @@ Special thanks to external contributors on this release: - [consensus] \#7711 Use the proposer timestamp for the first height instead of the genesis time. Chains will still start consensus at the genesis time. (@anca) - [cli] \#8281 Add a tool to update old config files to the latest version. (@creachadair) - [consenus] \#8514 move `RecheckTx` from the local node mempool config to a global `ConsensusParams` field in `BlockParams` (@cmwaters) +- [abci] ABCI++ [specified](https://github.com/tendermint/tendermint/tree/master/spec/abci%2B%2B). (@sergio-mena, @cmwaters, @josef-widder) +- [abci] ABCI++ [implemented](https://github.com/orgs/tendermint/projects/9). (@williambanfield, @thanethomson, @sergio-mena) ### IMPROVEMENTS diff --git a/UPGRADING.md b/UPGRADING.md index 60bd9a10f..13582e75b 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -21,6 +21,14 @@ For information on how ABCI++ works, see the In particular, the simplest way to upgrade your application is described [here](https://github.com/tendermint/tendermint/blob/master/spec/abci%2B%2B/abci++_tmint_expected_behavior_002_draft.md#adapting-existing-applications-that-use-abci). +#### Moving the `app_hash` parameter + +The Application's hash (or any data representing the Application's current +state) is known by the time `FinalizeBlock` finishes its execution. +Accordingly, the `app_hash` parameter has been moved from `ResponseCommit` to +`ResponseFinalizeBlock`, since it makes sense for the Application to return +this value as soon as is it known. + #### ABCI Mutex In previous versions of ABCI, Tendermint was prevented from making @@ -62,6 +70,11 @@ applications remains correct. turned on are not affected. Operators who wish to enable indexing for a new node, however, must now edit the `config.toml` explicitly. +- The function of seed nodes was modified in the past release. Now, seed nodes + are treated identically to any other peer, however they only run the PEX + reactor. Because of this `seeds` has been removed from the config. Users + should add any seed nodes in the list of `bootstrap-peers`. + ### RPC Changes Tendermint v0.36 adds a new RPC event subscription API. The existing event diff --git a/abci/cmd/abci-cli/abci-cli.go b/abci/cmd/abci-cli/abci-cli.go index b1b1b2c7e..b09f3c9a7 100644 --- a/abci/cmd/abci-cli/abci-cli.go +++ b/abci/cmd/abci-cli/abci-cli.go @@ -151,8 +151,10 @@ where example.file looks something like: check_tx 0x00 check_tx 0xff finalize_block 0x00 + commit check_tx 0x00 finalize_block 0x01 0x04 0xff + commit info `, Args: cobra.ExactArgs(0), @@ -298,23 +300,23 @@ func cmdTest(cmd *cobra.Command, args []string) error { return compose( []func() error{ func() error { return servertest.InitChain(ctx, client) }, - func() error { return servertest.Commit(ctx, client, nil) }, + func() error { return servertest.Commit(ctx, client) }, func() error { return servertest.FinalizeBlock(ctx, client, [][]byte{ []byte("abc"), }, []uint32{ code.CodeTypeBadNonce, - }, nil) + }, nil, nil) }, - func() error { return servertest.Commit(ctx, client, nil) }, + func() error { return servertest.Commit(ctx, client) }, func() error { return servertest.FinalizeBlock(ctx, client, [][]byte{ {0x00}, }, []uint32{ code.CodeTypeOK, - }, nil) + }, nil, []byte{0, 0, 0, 0, 0, 0, 0, 1}) }, - func() error { return servertest.Commit(ctx, client, []byte{0, 0, 0, 0, 0, 0, 0, 1}) }, + func() error { return servertest.Commit(ctx, client) }, func() error { return servertest.FinalizeBlock(ctx, client, [][]byte{ {0x00}, @@ -330,9 +332,9 @@ func cmdTest(cmd *cobra.Command, args []string) error { code.CodeTypeOK, code.CodeTypeOK, code.CodeTypeBadNonce, - }, nil) + }, nil, []byte{0, 0, 0, 0, 0, 0, 0, 5}) }, - func() error { return servertest.Commit(ctx, client, []byte{0, 0, 0, 0, 0, 0, 0, 5}) }, + func() error { return servertest.Commit(ctx, client) }, }) } @@ -494,7 +496,7 @@ func cmdInfo(cmd *cobra.Command, args []string) error { const codeBad uint32 = 10 -// Append a new tx to application +// Append new txs to application func cmdFinalizeBlock(cmd *cobra.Command, args []string) error { if len(args) == 0 { printResponse(cmd, args, response{ @@ -515,14 +517,19 @@ func cmdFinalizeBlock(cmd *cobra.Command, args []string) error { if err != nil { return err } + resps := make([]response, 0, len(res.TxResults)+1) for _, tx := range res.TxResults { - printResponse(cmd, args, response{ + resps = append(resps, response{ Code: tx.Code, Data: tx.Data, Info: tx.Info, Log: tx.Log, }) } + resps = append(resps, response{ + Data: res.AppHash, + }) + printResponse(cmd, args, resps...) return nil } @@ -552,13 +559,11 @@ func cmdCheckTx(cmd *cobra.Command, args []string) error { // Get application Merkle root hash func cmdCommit(cmd *cobra.Command, args []string) error { - res, err := client.Commit(cmd.Context()) + _, err := client.Commit(cmd.Context()) if err != nil { return err } - printResponse(cmd, args, response{ - Data: res.Data, - }) + printResponse(cmd, args, response{}) return nil } @@ -632,44 +637,46 @@ func makeKVStoreCmd(logger log.Logger) func(*cobra.Command, []string) error { //-------------------------------------------------------------------------------- -func printResponse(cmd *cobra.Command, args []string, rsp response) { +func printResponse(cmd *cobra.Command, args []string, rsps ...response) { if flagVerbose { fmt.Println(">", cmd.Use, strings.Join(args, " ")) } - // Always print the status code. - if rsp.Code == types.CodeTypeOK { - fmt.Printf("-> code: OK\n") - } else { - fmt.Printf("-> code: %d\n", rsp.Code) + for _, rsp := range rsps { + // Always print the status code. + if rsp.Code == types.CodeTypeOK { + fmt.Printf("-> code: OK\n") + } else { + fmt.Printf("-> code: %d\n", rsp.Code) - } + } - if len(rsp.Data) != 0 { - // Do no print this line when using the commit command - // because the string comes out as gibberish - if cmd.Use != "commit" { - fmt.Printf("-> data: %s\n", rsp.Data) + if len(rsp.Data) != 0 { + // Do no print this line when using the finalize_block command + // because the string comes out as gibberish + if cmd.Use != "finalize_block" { + fmt.Printf("-> data: %s\n", rsp.Data) + } + fmt.Printf("-> data.hex: 0x%X\n", rsp.Data) + } + if rsp.Log != "" { + fmt.Printf("-> log: %s\n", rsp.Log) } - fmt.Printf("-> data.hex: 0x%X\n", rsp.Data) - } - if rsp.Log != "" { - fmt.Printf("-> log: %s\n", rsp.Log) - } - if rsp.Query != nil { - fmt.Printf("-> height: %d\n", rsp.Query.Height) - if rsp.Query.Key != nil { - fmt.Printf("-> key: %s\n", rsp.Query.Key) - fmt.Printf("-> key.hex: %X\n", rsp.Query.Key) - } - if rsp.Query.Value != nil { - fmt.Printf("-> value: %s\n", rsp.Query.Value) - fmt.Printf("-> value.hex: %X\n", rsp.Query.Value) - } - if rsp.Query.ProofOps != nil { - fmt.Printf("-> proof: %#v\n", rsp.Query.ProofOps) + if rsp.Query != nil { + fmt.Printf("-> height: %d\n", rsp.Query.Height) + if rsp.Query.Key != nil { + fmt.Printf("-> key: %s\n", rsp.Query.Key) + fmt.Printf("-> key.hex: %X\n", rsp.Query.Key) + } + if rsp.Query.Value != nil { + fmt.Printf("-> value: %s\n", rsp.Query.Value) + fmt.Printf("-> value.hex: %X\n", rsp.Query.Value) + } + if rsp.Query.ProofOps != nil { + fmt.Printf("-> proof: %#v\n", rsp.Query.ProofOps) + } } } } diff --git a/abci/example/kvstore/kvstore.go b/abci/example/kvstore/kvstore.go index 61d129239..bbb2fbe34 100644 --- a/abci/example/kvstore/kvstore.go +++ b/abci/example/kvstore/kvstore.go @@ -196,7 +196,13 @@ func (app *Application) FinalizeBlock(_ context.Context, req *types.RequestFinal respTxs[i] = app.handleTx(tx) } - return &types.ResponseFinalizeBlock{TxResults: respTxs, ValidatorUpdates: app.ValUpdates}, nil + // Using a memdb - just return the big endian size of the db + appHash := make([]byte, 8) + binary.PutVarint(appHash, app.state.Size) + app.state.AppHash = appHash + app.state.Height++ + + return &types.ResponseFinalizeBlock{TxResults: respTxs, ValidatorUpdates: app.ValUpdates, AppHash: appHash}, nil } func (*Application) CheckTx(_ context.Context, req *types.RequestCheckTx) (*types.ResponseCheckTx, error) { @@ -207,14 +213,9 @@ func (app *Application) Commit(_ context.Context) (*types.ResponseCommit, error) app.mu.Lock() defer app.mu.Unlock() - // Using a memdb - just return the big endian size of the db - appHash := make([]byte, 8) - binary.PutVarint(appHash, app.state.Size) - app.state.AppHash = appHash - app.state.Height++ saveState(app.state) - resp := &types.ResponseCommit{Data: appHash} + resp := &types.ResponseCommit{} if app.RetainBlocks > 0 && app.state.Height >= app.RetainBlocks { resp.RetainHeight = app.state.Height - app.RetainBlocks + 1 } diff --git a/abci/tests/server/client.go b/abci/tests/server/client.go index eeae74746..cddb42ec0 100644 --- a/abci/tests/server/client.go +++ b/abci/tests/server/client.go @@ -32,25 +32,20 @@ func InitChain(ctx context.Context, client abciclient.Client) error { return nil } -func Commit(ctx context.Context, client abciclient.Client, hashExp []byte) error { - res, err := client.Commit(ctx) - data := res.Data +func Commit(ctx context.Context, client abciclient.Client) error { + _, err := client.Commit(ctx) if err != nil { fmt.Println("Failed test: Commit") fmt.Printf("error while committing: %v\n", err) return err } - if !bytes.Equal(data, hashExp) { - fmt.Println("Failed test: Commit") - fmt.Printf("Commit hash was unexpected. Got %X expected %X\n", data, hashExp) - return errors.New("commitTx failed") - } fmt.Println("Passed test: Commit") return nil } -func FinalizeBlock(ctx context.Context, client abciclient.Client, txBytes [][]byte, codeExp []uint32, dataExp []byte) error { +func FinalizeBlock(ctx context.Context, client abciclient.Client, txBytes [][]byte, codeExp []uint32, dataExp []byte, hashExp []byte) error { res, _ := client.FinalizeBlock(ctx, &types.RequestFinalizeBlock{Txs: txBytes}) + appHash := res.AppHash for i, tx := range res.TxResults { code, data, log := tx.Code, tx.Data, tx.Log if code != codeExp[i] { @@ -66,6 +61,11 @@ func FinalizeBlock(ctx context.Context, client abciclient.Client, txBytes [][]by return errors.New("FinalizeBlock error") } } + if !bytes.Equal(appHash, hashExp) { + fmt.Println("Failed test: FinalizeBlock") + fmt.Printf("Application hash was unexpected. Got %X expected %X\n", appHash, hashExp) + return errors.New("FinalizeBlock error") + } fmt.Println("Passed test: FinalizeBlock") return nil } diff --git a/abci/tests/test_cli/ex1.abci b/abci/tests/test_cli/ex1.abci index 09457189e..56355dc94 100644 --- a/abci/tests/test_cli/ex1.abci +++ b/abci/tests/test_cli/ex1.abci @@ -1,9 +1,8 @@ echo hello info -commit finalize_block "abc" -info commit +info query "abc" finalize_block "def=xyz" "ghi=123" commit diff --git a/abci/tests/test_cli/ex1.abci.out b/abci/tests/test_cli/ex1.abci.out index c004ab059..9a35290b0 100644 --- a/abci/tests/test_cli/ex1.abci.out +++ b/abci/tests/test_cli/ex1.abci.out @@ -8,26 +8,23 @@ -> data: {"size":0} -> data.hex: 0x7B2273697A65223A307D -> commit --> code: OK --> data.hex: 0x0000000000000000 - > finalize_block "abc" -> code: OK +-> code: OK +-> data.hex: 0x0200000000000000 + +> commit +-> code: OK > info -> code: OK -> data: {"size":1} -> data.hex: 0x7B2273697A65223A317D -> commit --> code: OK --> data.hex: 0x0200000000000000 - > query "abc" -> code: OK -> log: exists --> height: 2 +-> height: 1 -> key: abc -> key.hex: 616263 -> value: abc @@ -35,17 +32,17 @@ > finalize_block "def=xyz" "ghi=123" -> code: OK -> finalize_block "def=xyz" "ghi=123" -> code: OK +-> code: OK +-> data.hex: 0x0600000000000000 > commit -> code: OK --> data.hex: 0x0600000000000000 > query "def" -> code: OK -> log: exists --> height: 3 +-> height: 2 -> key: def -> key.hex: 646566 -> value: xyz diff --git a/abci/tests/test_cli/ex2.abci b/abci/tests/test_cli/ex2.abci index 90e99c2f9..1cabba151 100644 --- a/abci/tests/test_cli/ex2.abci +++ b/abci/tests/test_cli/ex2.abci @@ -1,7 +1,10 @@ check_tx 0x00 check_tx 0xff finalize_block 0x00 +commit check_tx 0x00 finalize_block 0x01 +commit finalize_block 0x04 +commit info diff --git a/abci/tests/test_cli/ex2.abci.out b/abci/tests/test_cli/ex2.abci.out index aab0b1966..e29a35368 100644 --- a/abci/tests/test_cli/ex2.abci.out +++ b/abci/tests/test_cli/ex2.abci.out @@ -6,15 +6,30 @@ > finalize_block 0x00 -> code: OK +-> code: OK +-> data.hex: 0x0200000000000000 + +> commit +-> code: OK > check_tx 0x00 -> code: OK > finalize_block 0x01 -> code: OK +-> code: OK +-> data.hex: 0x0400000000000000 + +> commit +-> code: OK > finalize_block 0x04 -> code: OK +-> code: OK +-> data.hex: 0x0600000000000000 + +> commit +-> code: OK > info -> code: OK diff --git a/abci/types/types.pb.go b/abci/types/types.pb.go index 77d515bbe..946cfa6af 100644 --- a/abci/types/types.pb.go +++ b/abci/types/types.pb.go @@ -2382,8 +2382,7 @@ func (m *ResponseDeliverTx) GetCodespace() string { type ResponseCommit struct { // reserve 1 - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` - RetainHeight int64 `protobuf:"varint,3,opt,name=retain_height,json=retainHeight,proto3" json:"retain_height,omitempty"` + RetainHeight int64 `protobuf:"varint,3,opt,name=retain_height,json=retainHeight,proto3" json:"retain_height,omitempty"` } func (m *ResponseCommit) Reset() { *m = ResponseCommit{} } @@ -2419,13 +2418,6 @@ func (m *ResponseCommit) XXX_DiscardUnknown() { var xxx_messageInfo_ResponseCommit proto.InternalMessageInfo -func (m *ResponseCommit) GetData() []byte { - if m != nil { - return m.Data - } - return nil -} - func (m *ResponseCommit) GetRetainHeight() int64 { if m != nil { return m.RetainHeight @@ -2871,7 +2863,6 @@ type ResponseFinalizeBlock struct { ValidatorUpdates []ValidatorUpdate `protobuf:"bytes,3,rep,name=validator_updates,json=validatorUpdates,proto3" json:"validator_updates"` ConsensusParamUpdates *types1.ConsensusParams `protobuf:"bytes,4,opt,name=consensus_param_updates,json=consensusParamUpdates,proto3" json:"consensus_param_updates,omitempty"` AppHash []byte `protobuf:"bytes,5,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` - RetainHeight int64 `protobuf:"varint,6,opt,name=retain_height,json=retainHeight,proto3" json:"retain_height,omitempty"` } func (m *ResponseFinalizeBlock) Reset() { *m = ResponseFinalizeBlock{} } @@ -2942,13 +2933,6 @@ func (m *ResponseFinalizeBlock) GetAppHash() []byte { return nil } -func (m *ResponseFinalizeBlock) GetRetainHeight() int64 { - if m != nil { - return m.RetainHeight - } - return 0 -} - type CommitInfo struct { Round int32 `protobuf:"varint,1,opt,name=round,proto3" json:"round,omitempty"` Votes []VoteInfo `protobuf:"bytes,2,rep,name=votes,proto3" json:"votes"` @@ -3845,13 +3829,13 @@ func init() { func init() { proto.RegisterFile("tendermint/abci/types.proto", fileDescriptor_252557cfdd89a31a) } var fileDescriptor_252557cfdd89a31a = []byte{ - // 3263 bytes of a gzipped FileDescriptorProto + // 3253 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x5a, 0xcd, 0x73, 0x23, 0xd5, 0x11, 0xd7, 0xe8, 0x5b, 0xad, 0xaf, 0xf1, 0xb3, 0x59, 0xb4, 0x62, 0xd7, 0x36, 0x43, 0x01, 0xcb, 0x02, 0x36, 0xf1, 0x66, 0x61, 0xc9, 0x42, 0x28, 0x5b, 0xd6, 0x46, 0xf6, 0x7a, 0x6d, 0x33, 0x96, 0x4d, 0x91, 0x0f, 0x86, 0xb1, 0xf4, 0x6c, 0x0d, 0x2b, 0x69, 0x86, 0x99, 0x91, 0x91, 0x39, 0x26, - 0xc5, 0x85, 0x43, 0xc2, 0x25, 0x95, 0xa4, 0x2a, 0xdc, 0x92, 0xaa, 0xe4, 0x3f, 0x48, 0x2e, 0x39, - 0xe5, 0xc0, 0x21, 0x07, 0x4e, 0xa9, 0x9c, 0x48, 0x0a, 0x6e, 0xf9, 0x07, 0x72, 0x4b, 0xa5, 0xde, + 0xc5, 0x85, 0x43, 0x8a, 0x4b, 0x2a, 0x49, 0x55, 0xb8, 0x25, 0x55, 0xc9, 0x7f, 0x90, 0x5c, 0x72, + 0xca, 0x81, 0x43, 0x0e, 0x9c, 0x52, 0x39, 0x91, 0x14, 0xdc, 0xf8, 0x07, 0x72, 0x4b, 0xa5, 0xde, 0xc7, 0x7c, 0x49, 0x33, 0xfa, 0x00, 0x8a, 0xaa, 0x54, 0x71, 0x9b, 0xd7, 0xd3, 0xdd, 0xef, 0xab, 0x5f, 0x77, 0xff, 0xfa, 0x3d, 0x78, 0xcc, 0xc6, 0xfd, 0x36, 0x36, 0x7b, 0x5a, 0xdf, 0x5e, 0x57, 0x4f, 0x5b, 0xda, 0xba, 0x7d, 0x69, 0x60, 0x6b, 0xcd, 0x30, 0x75, 0x5b, 0x47, 0x65, 0xef, 0xe7, @@ -3859,7 +3843,7 @@ var fileDescriptor_252557cfdd89a31a = []byte{ 0x31, 0xfe, 0xea, 0xb5, 0xf1, 0xdf, 0x0f, 0xf1, 0x25, 0xd7, 0x16, 0x10, 0xa6, 0xbd, 0xac, 0x1b, 0xaa, 0xa9, 0xf6, 0x9c, 0xdf, 0x2b, 0xe7, 0xba, 0x7e, 0xde, 0xc5, 0xeb, 0xb4, 0x75, 0x3a, 0x38, 0x5b, 0xb7, 0xb5, 0x1e, 0xb6, 0x6c, 0xb5, 0x67, 0x70, 0x86, 0xa5, 0x73, 0xfd, 0x5c, 0xa7, 0x9f, - 0xeb, 0xe4, 0x8b, 0x51, 0xa5, 0x3f, 0xe7, 0x20, 0x23, 0xe3, 0x77, 0x07, 0xd8, 0xb2, 0xd1, 0x06, + 0xeb, 0xe4, 0x8b, 0x51, 0xa5, 0xbf, 0xe4, 0x20, 0x23, 0xe3, 0x77, 0x07, 0xd8, 0xb2, 0xd1, 0x06, 0x24, 0x71, 0xab, 0xa3, 0x57, 0x84, 0x55, 0xe1, 0x46, 0x7e, 0xe3, 0xda, 0xda, 0xc8, 0xf0, 0xd7, 0x38, 0x5f, 0xbd, 0xd5, 0xd1, 0x1b, 0x31, 0x99, 0xf2, 0xa2, 0xdb, 0x90, 0x3a, 0xeb, 0x0e, 0xac, 0x4e, 0x25, 0x4e, 0x85, 0xae, 0x47, 0x09, 0xdd, 0x23, 0x4c, 0x8d, 0x98, 0xcc, 0xb8, 0x49, 0x57, @@ -3872,7 +3856,7 @@ var fileDescriptor_252557cfdd89a31a = []byte{ 0x39, 0x52, 0x96, 0x72, 0x35, 0x62, 0x32, 0xe7, 0x47, 0xfb, 0x50, 0xea, 0x6a, 0x96, 0xad, 0x58, 0x7d, 0xd5, 0xb0, 0x3a, 0xba, 0x6d, 0x55, 0xf2, 0x54, 0xc3, 0x93, 0x51, 0x1a, 0xf6, 0x34, 0xcb, 0x3e, 0x72, 0x98, 0x1b, 0x31, 0xb9, 0xd8, 0xf5, 0x13, 0x88, 0x3e, 0xfd, 0xec, 0x0c, 0x9b, 0xae, - 0xc2, 0x4a, 0x61, 0xb2, 0xbe, 0x03, 0xc2, 0xed, 0xc8, 0x13, 0x7d, 0xba, 0x9f, 0x80, 0x7e, 0x04, + 0xc2, 0x4a, 0x61, 0xb2, 0xbe, 0x03, 0xc2, 0xed, 0xc8, 0x13, 0x7d, 0xba, 0x9f, 0x80, 0x7e, 0x02, 0x8b, 0x5d, 0x5d, 0x6d, 0xbb, 0xea, 0x94, 0x56, 0x67, 0xd0, 0x7f, 0x58, 0x29, 0x52, 0xa5, 0xcf, 0x44, 0x0e, 0x52, 0x57, 0xdb, 0x8e, 0x8a, 0x1a, 0x11, 0x68, 0xc4, 0xe4, 0x85, 0xee, 0x28, 0x11, 0xbd, 0x05, 0x4b, 0xaa, 0x61, 0x74, 0x2f, 0x47, 0xb5, 0x97, 0xa8, 0xf6, 0x9b, 0x51, 0xda, 0x37, @@ -3892,9 +3876,9 @@ var fileDescriptor_252557cfdd89a31a = []byte{ 0x2e, 0xc9, 0x9b, 0xe8, 0x09, 0x28, 0xd2, 0x49, 0x28, 0xce, 0x7f, 0xe2, 0xe6, 0x92, 0x72, 0x81, 0x12, 0x4f, 0x38, 0xd3, 0x0a, 0xe4, 0x8d, 0x0d, 0xc3, 0x65, 0x49, 0x50, 0x16, 0x30, 0x36, 0x0c, 0x87, 0xe1, 0x71, 0x28, 0x90, 0x19, 0xbb, 0x1c, 0x49, 0xda, 0x49, 0x9e, 0xd0, 0x38, 0x8b, 0xf4, - 0xb7, 0x38, 0x88, 0xa3, 0xae, 0x0b, 0xdd, 0x81, 0x24, 0xf1, 0xe2, 0xdc, 0x21, 0x57, 0xd7, 0x98, + 0xf7, 0x38, 0x88, 0xa3, 0xae, 0x0b, 0xdd, 0x81, 0x24, 0xf1, 0xe2, 0xdc, 0x21, 0x57, 0xd7, 0x98, 0x8b, 0x5f, 0x73, 0x5c, 0xfc, 0x5a, 0xd3, 0x71, 0xf1, 0x5b, 0xd9, 0x4f, 0x3e, 0x5b, 0x89, 0x7d, - 0xf4, 0xcf, 0x15, 0x41, 0xa6, 0x12, 0xe8, 0x2a, 0x71, 0x58, 0xaa, 0xd6, 0x57, 0xb4, 0x36, 0x1d, + 0xf4, 0xaf, 0x15, 0x41, 0xa6, 0x12, 0xe8, 0x2a, 0x71, 0x58, 0xaa, 0xd6, 0x57, 0xb4, 0x36, 0x1d, 0x72, 0x8e, 0x78, 0x23, 0x55, 0xeb, 0xef, 0xb4, 0xd1, 0x1e, 0x88, 0x2d, 0xbd, 0x6f, 0xe1, 0xbe, 0x35, 0xb0, 0x14, 0x16, 0x42, 0xb8, 0x1b, 0x0e, 0x38, 0x53, 0x16, 0xc8, 0x6a, 0x0e, 0xe7, 0x21, 0x65, 0x94, 0xcb, 0xad, 0x20, 0x01, 0xdd, 0x03, 0xb8, 0x50, 0xbb, 0x5a, 0x5b, 0xb5, 0x75, 0xd3, @@ -3914,7 +3898,7 @@ var fileDescriptor_252557cfdd89a31a = []byte{ 0xe7, 0xf6, 0x2d, 0x98, 0x40, 0xcd, 0xde, 0x59, 0xb0, 0x2b, 0x90, 0x3e, 0xd3, 0xcd, 0x9e, 0x6a, 0x53, 0x65, 0x45, 0x99, 0xb7, 0xc8, 0x42, 0x32, 0x2f, 0x9e, 0xa0, 0x64, 0xd6, 0x90, 0x14, 0xb8, 0x1a, 0xe9, 0xbd, 0x89, 0x88, 0xd6, 0x6f, 0x63, 0xb6, 0xac, 0x45, 0x99, 0x35, 0x3c, 0x45, 0x6c, - 0xb0, 0xac, 0x41, 0xba, 0xb5, 0xe8, 0x5c, 0xa9, 0xfe, 0x9c, 0xcc, 0x5b, 0xd2, 0x1f, 0x13, 0x70, + 0xb0, 0xac, 0x41, 0xba, 0xb5, 0xe8, 0x5c, 0xa9, 0xfe, 0x9c, 0xcc, 0x5b, 0xd2, 0x9f, 0x12, 0x70, 0x25, 0xdc, 0x87, 0xa3, 0x55, 0x28, 0xf4, 0xd4, 0xa1, 0x62, 0x0f, 0xb9, 0xd9, 0x09, 0x74, 0xe3, 0xa1, 0xa7, 0x0e, 0x9b, 0x43, 0x66, 0x73, 0x22, 0x24, 0xec, 0xa1, 0x55, 0x89, 0xaf, 0x26, 0x6e, 0x14, 0x64, 0xf2, 0x89, 0x8e, 0x61, 0xa1, 0xab, 0xb7, 0xd4, 0xae, 0xd2, 0x55, 0x2d, 0x5b, 0xe1, @@ -3925,22 +3909,22 @@ var fileDescriptor_252557cfdd89a31a = []byte{ 0xc7, 0xbd, 0xa4, 0xe7, 0x76, 0x2f, 0x2f, 0xc0, 0x52, 0x1f, 0x0f, 0x6d, 0xdf, 0x18, 0x99, 0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 0x06, 0x51, 0x9f, 0x8a, - 0x54, 0x31, 0x05, 0xf3, 0x1e, 0x8c, 0x61, 0xde, 0xe2, 0x14, 0x85, 0x53, 0x40, 0xef, 0x8f, 0xc3, + 0x54, 0x31, 0x05, 0xf3, 0x1e, 0x8c, 0x61, 0xde, 0xe2, 0x14, 0x85, 0x53, 0x40, 0xef, 0x4f, 0xc3, 0x41, 0x6f, 0x34, 0x2c, 0xe5, 0xc3, 0x9c, 0x0d, 0xf5, 0x2a, 0x11, 0xa8, 0xb7, 0x1c, 0x89, 0xd0, 0x98, 0xfa, 0x99, 0x61, 0xef, 0x71, 0x08, 0xec, 0x65, 0x00, 0xf5, 0x46, 0xa4, 0xf2, 0x19, 0x70, 0xef, 0x71, 0x08, 0xee, 0x5d, 0x98, 0xaa, 0x76, 0x2a, 0xf0, 0xbd, 0x17, 0x04, 0xbe, 0x28, 0x22, @@ -3948,12 +3932,12 @@ var fileDescriptor_252557cfdd89a31a = []byte{ 0x0e, 0xe8, 0x7b, 0x30, 0x06, 0x7d, 0x97, 0xa6, 0x58, 0xda, 0xec, 0xd8, 0x37, 0x23, 0x66, 0x19, 0xea, 0xdd, 0x4d, 0x66, 0x41, 0xcc, 0x4b, 0xcf, 0x90, 0x40, 0x3c, 0xe2, 0xe1, 0x48, 0x4e, 0x8c, 0x4d, 0x53, 0x37, 0x39, 0x8a, 0x65, 0x0d, 0xe9, 0x06, 0xc1, 0x42, 0x9e, 0x37, 0x9b, 0x80, 0x93, - 0x29, 0xf6, 0xf0, 0x79, 0x30, 0xe9, 0x4f, 0x82, 0x27, 0x4b, 0x91, 0xb2, 0x1f, 0x47, 0xe5, 0x38, + 0x29, 0xf6, 0xf0, 0x79, 0x30, 0xe9, 0xcf, 0x82, 0x27, 0x4b, 0x91, 0xb2, 0x1f, 0x47, 0xe5, 0x38, 0x8e, 0xf2, 0xa1, 0xe7, 0x78, 0x10, 0x3d, 0xaf, 0x40, 0x9e, 0x60, 0x8a, 0x11, 0x60, 0xac, 0x1a, 0x2e, 0x30, 0xbe, 0x09, 0x0b, 0x34, 0x76, 0x32, 0x8c, 0xcd, 0x03, 0x52, 0x92, 0x06, 0xa4, 0x32, 0xf9, 0xc1, 0xd6, 0x85, 0x45, 0xa6, 0xe7, 0x61, 0xd1, 0xc7, 0xeb, 0x62, 0x15, 0x86, 0x12, 0x45, - 0x97, 0x7b, 0x93, 0x83, 0x96, 0xbf, 0x0a, 0xde, 0x0a, 0x79, 0x88, 0x3a, 0x0c, 0xfc, 0x0a, 0x5f, - 0x13, 0xf8, 0x8d, 0x7f, 0x69, 0xf0, 0xeb, 0xc7, 0x5e, 0x89, 0x20, 0xf6, 0xfa, 0x8f, 0xe0, 0xed, + 0x97, 0x7b, 0x93, 0x83, 0x96, 0xbf, 0x09, 0xde, 0x0a, 0x79, 0x88, 0x3a, 0x0c, 0xfc, 0x0a, 0xdf, + 0x10, 0xf8, 0x8d, 0x7f, 0x65, 0xf0, 0xeb, 0xc7, 0x5e, 0x89, 0x20, 0xf6, 0xfa, 0x8f, 0xe0, 0xed, 0x89, 0x0b, 0x65, 0x5b, 0x7a, 0x1b, 0x73, 0x34, 0x44, 0xbf, 0x49, 0x76, 0xd2, 0xd5, 0xcf, 0x39, 0xe6, 0x21, 0x9f, 0x84, 0xcb, 0x0d, 0x39, 0x39, 0x1e, 0x51, 0x5c, 0x20, 0xc5, 0x42, 0x3e, 0x07, 0x52, 0x22, 0x24, 0x1e, 0x62, 0x16, 0x20, 0x0a, 0x32, 0xf9, 0x24, 0x7c, 0xd4, 0xec, 0x78, 0xe8, @@ -3968,88 +3952,88 @@ var fileDescriptor_252557cfdd89a31a = []byte{ 0x67, 0x8b, 0xdb, 0xb8, 0xab, 0x5d, 0x60, 0x73, 0x8e, 0xc9, 0xcc, 0xb6, 0xb9, 0xcb, 0x21, 0x53, 0xf6, 0x51, 0xc8, 0xe8, 0x49, 0x6b, 0x60, 0xe1, 0x36, 0x2f, 0x99, 0xb8, 0x6d, 0xd4, 0x80, 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3, 0xf0, 0xe6, + 0x3c, 0x8f, 0x18, 0xab, 0x73, 0xdd, 0xfb, 0x10, 0x7b, 0x0e, 0x22, 0xc7, 0xd9, 0x1e, 0x35, 0x56, + 0x67, 0xbc, 0x00, 0xda, 0xaa, 0x7f, 0xf2, 0xf9, 0xb2, 0xf0, 0xe9, 0xe7, 0xcb, 0xc2, 0xbf, 0x3f, + 0x5f, 0x16, 0x3e, 0xfa, 0x62, 0x39, 0xf6, 0xe9, 0x17, 0xcb, 0xb1, 0x7f, 0x7e, 0xb1, 0x1c, 0xfb, + 0xf1, 0xb3, 0xe7, 0x9a, 0xdd, 0x19, 0x9c, 0xae, 0xb5, 0xf4, 0xde, 0xba, 0xff, 0x1d, 0x78, 0xd8, + 0xeb, 0xf3, 0xd3, 0x34, 0x0d, 0xa8, 0xb7, 0xfe, 0x17, 0x00, 0x00, 0xff, 0xff, 0x4c, 0xb4, 0x7f, + 0x53, 0x9d, 0x2e, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -6672,13 +6656,6 @@ func (m *ResponseCommit) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x18 } - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0x12 - } return len(dAtA) - i, nil } @@ -7069,11 +7046,6 @@ func (m *ResponseFinalizeBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.RetainHeight != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.RetainHeight)) - i-- - dAtA[i] = 0x30 - } if len(m.AppHash) > 0 { i -= len(m.AppHash) copy(dAtA[i:], m.AppHash) @@ -8734,10 +8706,6 @@ func (m *ResponseCommit) Size() (n int) { } var l int _ = l - l = len(m.Data) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } if m.RetainHeight != 0 { n += 1 + sovTypes(uint64(m.RetainHeight)) } @@ -8933,9 +8901,6 @@ func (m *ResponseFinalizeBlock) Size() (n int) { if l > 0 { n += 1 + l + sovTypes(uint64(l)) } - if m.RetainHeight != 0 { - n += 1 + sovTypes(uint64(m.RetainHeight)) - } return n } @@ -14238,40 +14203,6 @@ func (m *ResponseCommit) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: ResponseCommit: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RetainHeight", wireType) @@ -15509,25 +15440,6 @@ func (m *ResponseFinalizeBlock) Unmarshal(dAtA []byte) error { m.AppHash = []byte{} } iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RetainHeight", wireType) - } - m.RetainHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RetainHeight |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) diff --git a/cmd/tendermint/commands/compact.go b/cmd/tendermint/commands/compact.go new file mode 100644 index 000000000..eadd828ae --- /dev/null +++ b/cmd/tendermint/commands/compact.go @@ -0,0 +1,71 @@ +package commands + +import ( + "errors" + "path/filepath" + "sync" + + "github.com/spf13/cobra" + "github.com/syndtr/goleveldb/leveldb" + "github.com/syndtr/goleveldb/leveldb/opt" + "github.com/syndtr/goleveldb/leveldb/util" + + "github.com/tendermint/tendermint/config" + "github.com/tendermint/tendermint/libs/log" +) + +func MakeCompactDBCommand(cfg *config.Config, logger log.Logger) *cobra.Command { + cmd := &cobra.Command{ + Use: "experimental-compact-goleveldb", + Short: "force compacts the tendermint storage engine (only GoLevelDB supported)", + Long: ` +This is a temporary utility command that performs a force compaction on the state +and blockstores to reduce disk space for a pruning node. This should only be run +once the node has stopped. This command will likely be omitted in the future after +the planned refactor to the storage engine. + +Currently, only GoLevelDB is supported. + `, + RunE: func(cmd *cobra.Command, args []string) error { + if cfg.DBBackend != "goleveldb" { + return errors.New("compaction is currently only supported with goleveldb") + } + + compactGoLevelDBs(cfg.RootDir, logger) + return nil + }, + } + + return cmd +} + +func compactGoLevelDBs(rootDir string, logger log.Logger) { + dbNames := []string{"state", "blockstore"} + o := &opt.Options{ + DisableSeeksCompaction: true, + } + wg := sync.WaitGroup{} + + for _, dbName := range dbNames { + dbName := dbName + wg.Add(1) + go func() { + defer wg.Done() + dbPath := filepath.Join(rootDir, "data", dbName+".db") + store, err := leveldb.OpenFile(dbPath, o) + if err != nil { + logger.Error("failed to initialize tendermint db", "path", dbPath, "err", err) + return + } + defer store.Close() + + logger.Info("starting compaction...", "db", dbPath) + + err = store.CompactRange(util.Range{Start: nil, Limit: nil}) + if err != nil { + logger.Error("failed to compact tendermint db", "path", dbPath, "err", err) + } + }() + } + wg.Wait() +} diff --git a/cmd/tendermint/commands/key_migrate.go b/cmd/tendermint/commands/key_migrate.go index 6f8817fe1..723026da5 100644 --- a/cmd/tendermint/commands/key_migrate.go +++ b/cmd/tendermint/commands/key_migrate.go @@ -6,65 +6,18 @@ import ( "github.com/spf13/cobra" - cfg "github.com/tendermint/tendermint/config" + "github.com/tendermint/tendermint/config" "github.com/tendermint/tendermint/libs/log" "github.com/tendermint/tendermint/scripts/keymigrate" "github.com/tendermint/tendermint/scripts/scmigrate" ) -func MakeKeyMigrateCommand(conf *cfg.Config, logger log.Logger) *cobra.Command { +func MakeKeyMigrateCommand(conf *config.Config, logger log.Logger) *cobra.Command { cmd := &cobra.Command{ Use: "key-migrate", Short: "Run Database key migration", RunE: func(cmd *cobra.Command, args []string) error { - ctx, cancel := context.WithCancel(cmd.Context()) - defer cancel() - - contexts := []string{ - // this is ordered to put - // the more ephemeral tables first to - // forclose the possiblity of the - // ephemeral data overwriting later data - "tx_index", - "peerstore", - "light", - "blockstore", - "state", - "evidence", - } - - for idx, dbctx := range contexts { - logger.Info("beginning a key migration", - "dbctx", dbctx, - "num", idx+1, - "total", len(contexts), - ) - - db, err := cfg.DefaultDBProvider(&cfg.DBContext{ - ID: dbctx, - Config: conf, - }) - - if err != nil { - return fmt.Errorf("constructing database handle: %w", err) - } - - if err = keymigrate.Migrate(ctx, db); err != nil { - return fmt.Errorf("running migration for context %q: %w", - dbctx, err) - } - - if dbctx == "blockstore" { - if err := scmigrate.Migrate(ctx, db); err != nil { - return fmt.Errorf("running seen commit migration: %w", err) - - } - } - } - - logger.Info("completed database migration successfully") - - return nil + return RunDatabaseMigration(cmd.Context(), logger, conf) }, } @@ -73,3 +26,51 @@ func MakeKeyMigrateCommand(conf *cfg.Config, logger log.Logger) *cobra.Command { return cmd } + +func RunDatabaseMigration(ctx context.Context, logger log.Logger, conf *config.Config) error { + contexts := []string{ + // this is ordered to put + // the more ephemeral tables first to + // reduce the possibility of the + // ephemeral data overwriting later data + "tx_index", + "peerstore", + "light", + "blockstore", + "state", + "evidence", + } + + for idx, dbctx := range contexts { + logger.Info("beginning a key migration", + "dbctx", dbctx, + "num", idx+1, + "total", len(contexts), + ) + + db, err := config.DefaultDBProvider(&config.DBContext{ + ID: dbctx, + Config: conf, + }) + + if err != nil { + return fmt.Errorf("constructing database handle: %w", err) + } + + if err = keymigrate.Migrate(ctx, db); err != nil { + return fmt.Errorf("running migration for context %q: %w", + dbctx, err) + } + + if dbctx == "blockstore" { + if err := scmigrate.Migrate(ctx, db); err != nil { + return fmt.Errorf("running seen commit migration: %w", err) + + } + } + } + + logger.Info("completed database migration successfully") + + return nil +} diff --git a/cmd/tendermint/commands/reindex_event.go b/cmd/tendermint/commands/reindex_event.go index 6cec32738..34d07fdd5 100644 --- a/cmd/tendermint/commands/reindex_event.go +++ b/cmd/tendermint/commands/reindex_event.go @@ -193,7 +193,7 @@ func eventReIndex(cmd *cobra.Command, args eventReIndexArgs) error { return fmt.Errorf("not able to load block at height %d from the blockstore", i) } - r, err := args.stateStore.LoadABCIResponses(i) + r, err := args.stateStore.LoadFinalizeBlockResponses(i) if err != nil { return fmt.Errorf("not able to load ABCI Response at height %d from the statestore", i) } @@ -201,7 +201,7 @@ func eventReIndex(cmd *cobra.Command, args eventReIndexArgs) error { e := types.EventDataNewBlockHeader{ Header: b.Header, NumTxs: int64(len(b.Txs)), - ResultFinalizeBlock: *r.FinalizeBlock, + ResultFinalizeBlock: *r, } var batch *indexer.Batch @@ -213,7 +213,7 @@ func eventReIndex(cmd *cobra.Command, args eventReIndexArgs) error { Height: b.Height, Index: uint32(i), Tx: b.Data.Txs[i], - Result: *(r.FinalizeBlock.TxResults[i]), + Result: *(r.TxResults[i]), } _ = batch.Add(&tr) diff --git a/cmd/tendermint/commands/reindex_event_test.go b/cmd/tendermint/commands/reindex_event_test.go index 826fa0233..971cf1c87 100644 --- a/cmd/tendermint/commands/reindex_event_test.go +++ b/cmd/tendermint/commands/reindex_event_test.go @@ -16,7 +16,6 @@ import ( "github.com/tendermint/tendermint/internal/state/indexer" "github.com/tendermint/tendermint/internal/state/mocks" "github.com/tendermint/tendermint/libs/log" - prototmstate "github.com/tendermint/tendermint/proto/tendermint/state" "github.com/tendermint/tendermint/types" _ "github.com/lib/pq" // for the psql sink @@ -154,16 +153,14 @@ func TestReIndexEvent(t *testing.T) { On("IndexTxEvents", mock.AnythingOfType("[]*types.TxResult")).Return(nil) dtx := abcitypes.ExecTxResult{} - abciResp := &prototmstate.ABCIResponses{ - FinalizeBlock: &abcitypes.ResponseFinalizeBlock{ - TxResults: []*abcitypes.ExecTxResult{&dtx}, - }, + abciResp := &abcitypes.ResponseFinalizeBlock{ + TxResults: []*abcitypes.ExecTxResult{&dtx}, } mockStateStore. - On("LoadABCIResponses", base).Return(nil, errors.New("")).Once(). - On("LoadABCIResponses", base).Return(abciResp, nil). - On("LoadABCIResponses", height).Return(abciResp, nil) + On("LoadFinalizeBlockResponses", base).Return(nil, errors.New("")).Once(). + On("LoadFinalizeBlockResponses", base).Return(abciResp, nil). + On("LoadFinalizeBlockResponses", height).Return(abciResp, nil) testCases := []struct { startHeight int64 @@ -171,7 +168,7 @@ func TestReIndexEvent(t *testing.T) { reIndexErr bool }{ {base, height, true}, // LoadBlock error - {base, height, true}, // LoadABCIResponses error + {base, height, true}, // LoadFinalizeBlockResponses error {base, height, true}, // index block event error {base, height, true}, // index tx event error {base, base, false}, diff --git a/cmd/tendermint/commands/run_node.go b/cmd/tendermint/commands/run_node.go index 347a04034..f4d49b91e 100644 --- a/cmd/tendermint/commands/run_node.go +++ b/cmd/tendermint/commands/run_node.go @@ -63,7 +63,6 @@ func AddNodeFlags(cmd *cobra.Command, conf *cfg.Config) { "p2p.laddr", conf.P2P.ListenAddress, "node listen address. (0.0.0.0:0 means any interface, any port)") - cmd.Flags().String("p2p.seeds", conf.P2P.Seeds, "comma-delimited ID@host:port seed nodes") //nolint: staticcheck cmd.Flags().String("p2p.persistent-peers", conf.P2P.PersistentPeers, "comma-delimited ID@host:port persistent peers") cmd.Flags().Bool("p2p.upnp", conf.P2P.UPNP, "enable/disable UPNP port forwarding") cmd.Flags().Bool("p2p.pex", conf.P2P.PexReactor, "enable/disable Peer-Exchange") diff --git a/cmd/tendermint/commands/testnet.go b/cmd/tendermint/commands/testnet.go index 82c8cc6f9..5ba76621c 100644 --- a/cmd/tendermint/commands/testnet.go +++ b/cmd/tendermint/commands/testnet.go @@ -239,7 +239,6 @@ Example: for i := 0; i < nValidators+nNonValidators; i++ { nodeDir := filepath.Join(outputDir, fmt.Sprintf("%s%d", nodeDirPrefix, i)) config.SetRoot(nodeDir) - config.P2P.AllowDuplicateIP = true if populatePersistentPeers { persistentPeersWithoutSelf := make([]string, 0) for j := 0; j < len(persistentPeers); j++ { diff --git a/cmd/tendermint/main.go b/cmd/tendermint/main.go index 715e8e1d4..1be614aea 100644 --- a/cmd/tendermint/main.go +++ b/cmd/tendermint/main.go @@ -44,6 +44,7 @@ func main() { commands.MakeKeyMigrateCommand(conf, logger), debug.GetDebugCommand(logger), commands.NewCompletionCmd(rcmd, true), + commands.MakeCompactDBCommand(conf, logger), ) // NOTE: diff --git a/config/config.go b/config/config.go index 7d0a4915e..d875b8569 100644 --- a/config/config.go +++ b/config/config.go @@ -612,15 +612,6 @@ type P2PConfig struct { //nolint: maligned // Address to advertise to peers for them to dial ExternalAddress string `mapstructure:"external-address"` - // Comma separated list of seed nodes to connect to - // We only use these if we can’t connect to peers in the addrbook - // - // Deprecated: This value is not used by the new PEX reactor. Use - // BootstrapPeers instead. - // - // TODO(#5670): Remove once the p2p refactor is complete. - Seeds string `mapstructure:"seeds"` - // Comma separated list of peers to be added to the peer store // on startup. Either BootstrapPeers or PersistentPeers are // needed for peer discovery @@ -647,9 +638,6 @@ type P2PConfig struct { //nolint: maligned // other peers) PrivatePeerIDs string `mapstructure:"private-peer-ids"` - // Toggle to disable guard against peers connecting from the same ip. - AllowDuplicateIP bool `mapstructure:"allow-duplicate-ip"` - // Time to wait before flushing messages out on the connection FlushThrottleTimeout time.Duration `mapstructure:"flush-throttle-timeout"` @@ -666,10 +654,6 @@ type P2PConfig struct { //nolint: maligned HandshakeTimeout time.Duration `mapstructure:"handshake-timeout"` DialTimeout time.Duration `mapstructure:"dial-timeout"` - // Testing params. - // Force dial to fail - TestDialFail bool `mapstructure:"test-dial-fail"` - // Makes it possible to configure which queue backend the p2p // layer uses. Options are: "fifo" and "priority", // with the default being "priority". @@ -694,10 +678,8 @@ func DefaultP2PConfig() *P2PConfig { SendRate: 5120000, // 5 mB/s RecvRate: 5120000, // 5 mB/s PexReactor: true, - AllowDuplicateIP: false, HandshakeTimeout: 20 * time.Second, DialTimeout: 3 * time.Second, - TestDialFail: false, QueueType: "priority", } } @@ -724,7 +706,6 @@ func (cfg *P2PConfig) ValidateBasic() error { func TestP2PConfig() *P2PConfig { cfg := DefaultP2PConfig() cfg.ListenAddress = "tcp://127.0.0.1:36656" - cfg.AllowDuplicateIP = true cfg.FlushThrottleTimeout = 10 * time.Millisecond return cfg } diff --git a/config/toml.go b/config/toml.go index 0fac73cdd..cf6635d45 100644 --- a/config/toml.go +++ b/config/toml.go @@ -295,13 +295,6 @@ laddr = "{{ .P2P.ListenAddress }}" # example: 159.89.10.97:26656 external-address = "{{ .P2P.ExternalAddress }}" -# Comma separated list of seed nodes to connect to -# We only use these if we can’t connect to peers in the addrbook -# NOTE: not used by the new PEX reactor. Please use BootstrapPeers instead. -# TODO: Remove once p2p refactor is complete -# ref: https:#github.com/tendermint/tendermint/issues/5670 -seeds = "{{ .P2P.Seeds }}" - # Comma separated list of peers to be added to the peer store # on startup. Either BootstrapPeers or PersistentPeers are # needed for peer discovery @@ -326,9 +319,6 @@ pex = {{ .P2P.PexReactor }} # Warning: IPs will be exposed at /net_info, for more information https://github.com/tendermint/tendermint/issues/3055 private-peer-ids = "{{ .P2P.PrivatePeerIDs }}" -# Toggle to disable guard against peers connecting from the same ip. -allow-duplicate-ip = {{ .P2P.AllowDuplicateIP }} - # Peer connection configuration. handshake-timeout = "{{ .P2P.HandshakeTimeout }}" dial-timeout = "{{ .P2P.DialTimeout }}" diff --git a/docs/app-dev/abci-cli.md b/docs/app-dev/abci-cli.md index 8f916427d..109e3b9fb 100644 --- a/docs/app-dev/abci-cli.md +++ b/docs/app-dev/abci-cli.md @@ -169,46 +169,49 @@ Try running these commands: -> data: {"size":0} -> data.hex: 0x7B2273697A65223A307D -> commit --> code: OK --> data.hex: 0x0000000000000000 - > finalize_block "abc" -> code: OK +-> code: OK +-> data.hex: 0x0200000000000000 + +> commit +-> code: OK > info -> code: OK -> data: {"size":1} -> data.hex: 0x7B2273697A65223A317D -> commit --> code: OK --> data.hex: 0x0200000000000000 - > query "abc" -> code: OK -> log: exists --> height: 2 +-> height: 1 +-> key: abc +-> key.hex: 616263 -> value: abc -> value.hex: 616263 -> finalize_block "def=xyz" +> finalize_block "def=xyz" "ghi=123" -> code: OK +-> code: OK +-> code: OK +-> data.hex: 0x0600000000000000 > commit -> code: OK --> data.hex: 0x0400000000000000 > query "def" -> code: OK -> log: exists --> height: 3 +-> height: 2 +-> key: def +-> key.hex: 646566 -> value: xyz -> value.hex: 78797A ``` -Note that if we do `finalize_block "abc"` it will store `(abc, abc)`, but if -we do `finalize_block "abc=efg"` it will store `(abc, efg)`. +Note that if we do `finalize_block "abc" ...` it will store `(abc, abc)`, but if +we do `finalize_block "abc=efg" ...` it will store `(abc, efg)`. Similarly, you could put the commands in a file and run `abci-cli --verbose batch < myfile`. diff --git a/docs/package-lock.json b/docs/package-lock.json index 447c8c27d..7240aaa2d 100644 --- a/docs/package-lock.json +++ b/docs/package-lock.json @@ -13,7 +13,7 @@ }, "devDependencies": { "@vuepress/plugin-html-redirect": "^0.1.4", - "watchpack": "^2.3.1" + "watchpack": "^2.4.0" } }, "node_modules/@algolia/cache-browser-local-storage": { @@ -6210,9 +6210,9 @@ } }, "node_modules/eventsource": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-1.1.0.tgz", - "integrity": "sha512-VSJjT5oCNrFvCS6igjzPAt5hBzQ2qPBFIbJ03zLI9SE0mxwZpMw6BfJrbFHm1a141AavMEB8JHmBhWAd66PfCg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-1.1.1.tgz", + "integrity": "sha512-qV5ZC0h7jYIAOhArFJgSfdyz6rALJyb270714o7ZtNnw2WSJ+eexhKtE0O8LYPRsHZHf2osHKZBxGPvm3kPkCA==", "dependencies": { "original": "^1.0.0" }, @@ -13471,9 +13471,9 @@ } }, "node_modules/watchpack": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.3.1.tgz", - "integrity": "sha512-x0t0JuydIo8qCNctdDrn1OzH/qDzk2+rdCOC3YzumZ42fiMqmQ7T3xQurykYMhYfHaPHTp4ZxAx2NfUo1K6QaA==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", + "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", "dev": true, "dependencies": { "glob-to-regexp": "^0.4.1", @@ -19046,9 +19046,9 @@ "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==" }, "eventsource": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-1.1.0.tgz", - "integrity": "sha512-VSJjT5oCNrFvCS6igjzPAt5hBzQ2qPBFIbJ03zLI9SE0mxwZpMw6BfJrbFHm1a141AavMEB8JHmBhWAd66PfCg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-1.1.1.tgz", + "integrity": "sha512-qV5ZC0h7jYIAOhArFJgSfdyz6rALJyb270714o7ZtNnw2WSJ+eexhKtE0O8LYPRsHZHf2osHKZBxGPvm3kPkCA==", "requires": { "original": "^1.0.0" } @@ -24873,9 +24873,9 @@ } }, "watchpack": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.3.1.tgz", - "integrity": "sha512-x0t0JuydIo8qCNctdDrn1OzH/qDzk2+rdCOC3YzumZ42fiMqmQ7T3xQurykYMhYfHaPHTp4ZxAx2NfUo1K6QaA==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", + "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", "dev": true, "requires": { "glob-to-regexp": "^0.4.1", diff --git a/docs/package.json b/docs/package.json index 3200a5222..0563805c1 100644 --- a/docs/package.json +++ b/docs/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@vuepress/plugin-html-redirect": "^0.1.4", - "watchpack": "^2.3.1" + "watchpack": "^2.4.0" }, "scripts": { "preserve": "./pre.sh", diff --git a/docs/roadmap/roadmap.md b/docs/roadmap/roadmap.md index 90274ca1d..b95b43a60 100644 --- a/docs/roadmap/roadmap.md +++ b/docs/roadmap/roadmap.md @@ -90,7 +90,7 @@ Has the same feature set as V0.37 but with a focus towards testing, protocol cor ## Post 1.0 Work -- Improved block propagation with erasure coding and/or compact blocks. [More](https://github.com/tendermint/spec/issues/347) +- Improved block propagation with erasure coding and/or compact blocks. [More](https://github.com/tendermint/tendermint/issues/7932) - Consensus engine refactor - Fork accountability protocol - Bidirectional ABCI diff --git a/go.mod b/go.mod index a8c3a5ac8..5d005836f 100644 --- a/go.mod +++ b/go.mod @@ -23,21 +23,21 @@ require ( github.com/ory/dockertest v3.3.5+incompatible github.com/prometheus/client_golang v1.12.2 github.com/rs/cors v1.8.2 - github.com/rs/zerolog v1.26.1 + github.com/rs/zerolog v1.27.0 github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa github.com/spf13/cobra v1.4.0 github.com/spf13/viper v1.12.0 - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.7.2 github.com/tendermint/tm-db v0.6.6 golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 - golang.org/x/net v0.0.0-20220526153639-5463443f8c37 - golang.org/x/sync v0.0.0-20210220032951-036812b2e83c - google.golang.org/grpc v1.46.2 + golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 + golang.org/x/sync v0.0.0-20220513210516-0976fa681c29 + google.golang.org/grpc v1.47.0 pgregory.net/rapid v0.4.7 ) require ( - github.com/bufbuild/buf v1.5.0 + github.com/bufbuild/buf v1.4.0 github.com/creachadair/atomicfile v0.2.6 github.com/creachadair/taskgroup v0.3.2 github.com/golangci/golangci-lint v1.46.0 @@ -46,32 +46,6 @@ require ( gotest.tools v2.2.0+incompatible ) -require ( - github.com/GaijinEntertainment/go-exhaustruct/v2 v2.1.0 // indirect - github.com/bufbuild/connect-go v0.0.0-20220525141242-b79148bf7e44 // indirect - github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect - github.com/firefart/nonamedreturns v1.0.1 // indirect - github.com/gofrs/uuid v4.2.0+incompatible // indirect - github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/jdxcode/netrc v0.0.0-20210204082910-926c7f70242a // indirect - github.com/jhump/protocompile v0.0.0-20220216033700-d705409f108f // indirect - github.com/jhump/protoreflect v1.12.1-0.20220417024638-438db461d753 // indirect - github.com/klauspost/compress v1.15.5 // indirect - github.com/klauspost/pgzip v1.2.5 // indirect - github.com/lufeee/execinquery v1.0.0 // indirect - github.com/pelletier/go-toml/v2 v2.0.1 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - github.com/pkg/profile v1.6.0 // indirect - github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect - github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect - go.opencensus.io v0.23.0 // indirect - go.uber.org/atomic v1.9.0 // indirect - go.uber.org/multierr v1.8.0 // indirect - go.uber.org/zap v1.21.0 // indirect - golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e // indirect -) - require ( 4d63.com/gochecknoglobals v0.1.0 // indirect github.com/Antonboom/errname v0.1.6 // indirect @@ -79,6 +53,7 @@ require ( github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect github.com/DataDog/zstd v1.4.1 // indirect github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect + github.com/GaijinEntertainment/go-exhaustruct/v2 v2.1.0 // indirect github.com/Masterminds/semver v1.5.0 // indirect github.com/Microsoft/go-winio v0.5.1 // indirect github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect @@ -99,7 +74,7 @@ require ( github.com/charithe/durationcheck v0.0.9 // indirect github.com/chavacava/garif v0.0.0-20220316182200-5cad0b5181d4 // indirect github.com/containerd/continuity v0.2.1 // indirect - github.com/creachadair/tomledit v0.0.22 + github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect github.com/daixiang0/gci v0.3.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/denis-tingaikin/go-header v0.4.3 // indirect @@ -111,11 +86,12 @@ require ( github.com/dustin/go-humanize v1.0.0 // indirect github.com/esimonov/ifshort v1.0.4 // indirect github.com/ettle/strcase v0.1.1 // indirect - github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 // indirect + github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c // indirect github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect - github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 // indirect + github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 // indirect github.com/fatih/color v1.13.0 // indirect github.com/fatih/structtag v1.2.0 // indirect + github.com/firefart/nonamedreturns v1.0.1 // indirect github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/fzipp/gocyclo v0.5.1 // indirect github.com/go-critic/go-critic v0.6.3 // indirect @@ -129,6 +105,8 @@ require ( github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/gofrs/flock v0.8.1 // indirect + github.com/gofrs/uuid v4.2.0+incompatible // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/snappy v0.0.3 // indirect github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect @@ -151,19 +129,25 @@ require ( github.com/hashicorp/hcl v1.0.0 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/jdxcode/netrc v0.0.0-20210204082910-926c7f70242a // indirect github.com/jgautheron/goconst v1.5.1 // indirect + github.com/jhump/protocompile v0.0.0-20220216033700-d705409f108f // indirect + github.com/jhump/protoreflect v1.12.1-0.20220417024638-438db461d753 // indirect github.com/jingyugao/rowserrcheck v1.1.1 // indirect github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect github.com/jmhodges/levigo v1.0.0 // indirect github.com/julz/importas v0.1.0 // indirect github.com/kisielk/errcheck v1.6.0 // indirect github.com/kisielk/gotool v1.0.0 // indirect + github.com/klauspost/compress v1.15.1 // indirect + github.com/klauspost/pgzip v1.2.5 // indirect github.com/kulti/thelper v0.6.2 // indirect github.com/kunwardeep/paralleltest v1.0.3 // indirect github.com/kyoh86/exportloopref v0.1.8 // indirect github.com/ldez/gomoddirectives v0.2.3 // indirect github.com/ldez/tagliatelle v0.3.1 // indirect github.com/leonklingele/grouper v1.1.0 // indirect + github.com/lufeee/execinquery v1.0.0 // indirect github.com/magiconair/properties v1.8.6 // indirect github.com/maratori/testpackage v1.0.1 // indirect github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 // indirect @@ -185,16 +169,19 @@ require ( github.com/opencontainers/image-spec v1.0.2 // indirect github.com/opencontainers/runc v1.0.3 // indirect github.com/pelletier/go-toml v1.9.5 // indirect + github.com/pelletier/go-toml/v2 v2.0.1 // indirect github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d // indirect + github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pkg/errors v0.9.1 // indirect + github.com/pkg/profile v1.6.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polyfloyd/go-errorlint v0.0.0-20211125173453-6d6d39c5bb8b // indirect - github.com/prometheus/client_model v0.2.0 - github.com/prometheus/common v0.34.0 github.com/prometheus/procfs v0.7.3 // indirect github.com/quasilyte/go-ruleguard v0.3.16-0.20220213074421-6aa060fab41a // indirect github.com/quasilyte/gogrep v0.0.0-20220120141003-628d8b3623b5 // indirect github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 // indirect + github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/ryancurrah/gomodguard v1.2.3 // indirect github.com/ryanrolds/sqlclosecheck v0.3.0 // indirect github.com/sanposhiho/wastedassign/v2 v2.0.6 // indirect @@ -210,10 +197,10 @@ require ( github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect + github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect github.com/stretchr/objx v0.1.1 // indirect github.com/subosito/gotenv v1.3.0 // indirect github.com/sylvia7788/contextcheck v1.0.4 // indirect - github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca // indirect github.com/tdakkota/asciicheck v0.1.1 // indirect github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect github.com/tetafro/godot v1.4.11 // indirect @@ -227,20 +214,32 @@ require ( github.com/yeya24/promlinter v0.2.0 // indirect gitlab.com/bosi/decorder v0.2.1 // indirect go.etcd.io/bbolt v1.3.6 // indirect + go.opencensus.io v0.23.0 // indirect + go.uber.org/atomic v1.9.0 // indirect + go.uber.org/multierr v1.8.0 // indirect + go.uber.org/zap v1.21.0 // indirect + golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e // indirect golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect - golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 // indirect + golang.org/x/term v0.0.0-20220411215600-e5f449aeb171 // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/tools v0.1.11-0.20220316014157-77aa08bb151a // indirect golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df // indirect - google.golang.org/genproto v0.0.0-20220525015930-6ca3db687a9d // indirect + google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd // indirect google.golang.org/protobuf v1.28.0 // indirect gopkg.in/ini.v1 v1.66.4 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect honnef.co/go/tools v0.3.1 // indirect mvdan.cc/gofumpt v0.3.1 // indirect mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect mvdan.cc/unparam v0.0.0-20211214103731-d0ef000c54e5 // indirect ) + +require ( + github.com/creachadair/tomledit v0.0.22 + github.com/prometheus/client_model v0.2.0 + github.com/prometheus/common v0.34.0 + github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca +) diff --git a/go.sum b/go.sum index 4ca6a0389..bf2c4f067 100644 --- a/go.sum +++ b/go.sum @@ -177,10 +177,8 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/bufbuild/buf v1.5.0 h1:JHcWhMGMUEYJxXhbS8lJnAxfbuDaRIzuPB0DkAgTb9E= -github.com/bufbuild/buf v1.5.0/go.mod h1:dzEhpYNhRG0AzL/E9LlpzRki72XvvZO8b6FurWUa8Gc= -github.com/bufbuild/connect-go v0.0.0-20220525141242-b79148bf7e44 h1:aBc5SwEZ+BGrKpCJSKwb3heqoPVEBUcNYhyAX5XfH5Q= -github.com/bufbuild/connect-go v0.0.0-20220525141242-b79148bf7e44/go.mod h1:BajZGyRXK+Oq6Ddkm7atQ1Tu4W92OMpam7vyhFIf0ww= +github.com/bufbuild/buf v1.4.0 h1:GqE3a8CMmcFvWPzuY3Mahf9Kf3S9XgZ/ORpfYFzO+90= +github.com/bufbuild/buf v1.4.0/go.mod h1:mwHG7klTHnX+rM/ym8LXGl7vYpVmnwT96xWoRB4H5QI= github.com/butuzov/ireturn v0.1.1 h1:QvrO2QF2+/Cx1WA/vETCIYBKtRjc30vesdoPUNo1EbY= github.com/butuzov/ireturn v0.1.1/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= github.com/casbin/casbin/v2 v2.37.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= @@ -230,15 +228,15 @@ github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7 github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190620071333-e64a0ec8b42a/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creachadair/atomicfile v0.2.6 h1:FgYxYvGcqREApTY8Nxg8msM6P/KVKK3ob5h9FaRUTNg= github.com/creachadair/atomicfile v0.2.6/go.mod h1:BRq8Une6ckFneYXZQ+kO7p1ZZP3I2fzVzf28JxrIkBc= github.com/creachadair/command v0.0.0-20220426235536-a748effdf6a1/go.mod h1:bAM+qFQb/KwWyCc9MLC4U1jvn3XyakqP5QRkds5T6cY= @@ -298,12 +296,12 @@ github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStB github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= github.com/ettle/strcase v0.1.1 h1:htFueZyVeE1XNnMEfbqp5r67qAN/4r6ya1ysq8Q+Zcw= github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY= -github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= -github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= -github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= -github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= @@ -672,8 +670,8 @@ github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6 github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.13.5/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.15.5 h1:qyCLMz2JCrKADihKOh9FxnW3houKeNsp2h5OEz0QSEA= -github.com/klauspost/compress v1.15.5/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= +github.com/klauspost/compress v1.15.1 h1:y9FcTHGyrebwfP0ZZqFiaxTaiDnUrGkJkI+f583BL1A= +github.com/klauspost/compress v1.15.1/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE= github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -968,8 +966,9 @@ github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.2 h1:KCooALfAYGs415Cwu5ABvv9n9509fSiG5SQJn/AQo4U= github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.26.1 h1:/ihwxqH+4z8UxyI70wM1z9yCvkWcfz/a3mj48k/Zngc= github.com/rs/zerolog v1.26.1/go.mod h1:/wSSJWX7lVrsOwlbyTRSOJvqRlc+WjWlfes+CiJ+tmc= +github.com/rs/zerolog v1.27.0 h1:1T7qCieN22GVc8S4Q2yuexzBb1EqjbgjSH9RohbMjKs= +github.com/rs/zerolog v1.27.0/go.mod h1:7frBqO0oezxmnO7GF86FY++uy8I0Tk/If5ni1G9Qc0U= github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -1068,8 +1067,9 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/subosito/gotenv v1.3.0 h1:mjC+YW8QpAdXibNi+vNWgzmgBH4+5l5dCXv8cNysBLI= github.com/subosito/gotenv v1.3.0/go.mod h1:YzJjq/33h7nrwdY+iHMhEOEEbW0ovIz0tB6t6PwAXzs= @@ -1339,9 +1339,8 @@ golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 h1:NWy5+hlRbC7HK+PmcXVUmW1IMyFce7to56IUvhUFm7Y= golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220526153639-5463443f8c37 h1:lUkvobShwKsOesNfWWlCS5q7fnbG1MEliIzwu886fn8= -golang.org/x/net v0.0.0-20220526153639-5463443f8c37/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1373,7 +1372,6 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220513210516-0976fa681c29 h1:w8s32wxx3sY+OjLlv9qltkLU5yvJzxjjgiHWLjdIcw4= golang.org/x/sync v0.0.0-20220513210516-0976fa681c29/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1494,8 +1492,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 h1:CBpWXWQpIRjzmkkA+M7q9Fqnwd2mZr3AFqexg8YTfoM= -golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.0.0-20220411215600-e5f449aeb171 h1:EH1Deb8WZJ0xc0WK//leUHXcX9aLE5SymusoTmMZye8= +golang.org/x/term v0.0.0-20220411215600-e5f449aeb171/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1761,9 +1759,8 @@ google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd h1:e0TwkXOdbnH/1x5rc5MZ/VYyiZ4v+RdVfrGMqEwT68I= google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220525015930-6ca3db687a9d h1:8BnRR08DxAQ+e2pFx64Q3Ltg/AkrrxyG1LLa1WpomyA= -google.golang.org/genproto v0.0.0-20220525015930-6ca3db687a9d/go.mod h1:yKyY4AMRwFiC8yMMNaMi+RkCnjZJt9LoWuvhXjMs+To= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -1800,8 +1797,9 @@ google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ5 google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.47.0 h1:9n77onPX5F3qfFCqjy9dhn8PbNQsIKeVU04J9G7umt8= +google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1852,8 +1850,9 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA= gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/internal/consensus/mempool_test.go b/internal/consensus/mempool_test.go index 747d95750..ed11f6840 100644 --- a/internal/consensus/mempool_test.go +++ b/internal/consensus/mempool_test.go @@ -5,6 +5,7 @@ import ( "encoding/binary" "fmt" "os" + "sync" "testing" "time" @@ -136,8 +137,10 @@ func checkTxsRange(ctx context.Context, t *testing.T, cs *State, start, end int) for i := start; i < end; i++ { txBytes := make([]byte, 8) binary.BigEndian.PutUint64(txBytes, uint64(i)) - err := assertMempool(t, cs.txNotifier).CheckTx(ctx, txBytes, nil, mempool.TxInfo{}) + var rCode uint32 + err := assertMempool(t, cs.txNotifier).CheckTx(ctx, txBytes, func(r *abci.ResponseCheckTx) { rCode = r.Code }, mempool.TxInfo{}) require.NoError(t, err, "error after checkTx") + require.Equal(t, code.CodeTypeOK, rCode, "checkTx code is error, txBytes %X", txBytes) } } @@ -173,6 +176,7 @@ func TestMempoolTxConcurrentWithCommit(t *testing.T) { case msg := <-newBlockHeaderCh: headerEvent := msg.Data().(types.EventDataNewBlockHeader) n += headerEvent.NumTxs + logger.Info("new transactions", "nTxs", headerEvent.NumTxs, "total", n) case <-time.After(30 * time.Second): t.Fatal("Timed out waiting 30s to commit blocks with transactions") } @@ -202,10 +206,10 @@ func TestMempoolRmBadTx(t *testing.T) { resFinalize, err := app.FinalizeBlock(ctx, &abci.RequestFinalizeBlock{Txs: [][]byte{txBytes}}) require.NoError(t, err) assert.False(t, resFinalize.TxResults[0].IsErr(), fmt.Sprintf("expected no error. got %v", resFinalize)) + assert.True(t, len(resFinalize.AppHash) > 0) - resCommit, err := app.Commit(ctx) + _, err = app.Commit(ctx) require.NoError(t, err) - assert.True(t, len(resCommit.Data) > 0) emptyMempoolCh := make(chan struct{}) checkTxRespCh := make(chan struct{}) @@ -263,6 +267,7 @@ type CounterApplication struct { txCount int mempoolTxCount int + mu sync.Mutex } func NewCounterApplication() *CounterApplication { @@ -270,10 +275,16 @@ func NewCounterApplication() *CounterApplication { } func (app *CounterApplication) Info(_ context.Context, req *abci.RequestInfo) (*abci.ResponseInfo, error) { + app.mu.Lock() + defer app.mu.Unlock() + return &abci.ResponseInfo{Data: fmt.Sprintf("txs:%v", app.txCount)}, nil } func (app *CounterApplication) FinalizeBlock(_ context.Context, req *abci.RequestFinalizeBlock) (*abci.ResponseFinalizeBlock, error) { + app.mu.Lock() + defer app.mu.Unlock() + respTxs := make([]*abci.ExecTxResult, len(req.Txs)) for i, tx := range req.Txs { txValue := txAsUint64(tx) @@ -287,10 +298,21 @@ func (app *CounterApplication) FinalizeBlock(_ context.Context, req *abci.Reques app.txCount++ respTxs[i] = &abci.ExecTxResult{Code: code.CodeTypeOK} } - return &abci.ResponseFinalizeBlock{TxResults: respTxs}, nil + + res := &abci.ResponseFinalizeBlock{TxResults: respTxs} + + if app.txCount > 0 { + res.AppHash = make([]byte, 8) + binary.BigEndian.PutUint64(res.AppHash, uint64(app.txCount)) + } + + return res, nil } func (app *CounterApplication) CheckTx(_ context.Context, req *abci.RequestCheckTx) (*abci.ResponseCheckTx, error) { + app.mu.Lock() + defer app.mu.Unlock() + txValue := txAsUint64(req.Tx) if txValue != uint64(app.mempoolTxCount) { return &abci.ResponseCheckTx{ @@ -308,13 +330,11 @@ func txAsUint64(tx []byte) uint64 { } func (app *CounterApplication) Commit(context.Context) (*abci.ResponseCommit, error) { + app.mu.Lock() + defer app.mu.Unlock() + app.mempoolTxCount = app.txCount - if app.txCount == 0 { - return &abci.ResponseCommit{}, nil - } - hash := make([]byte, 8) - binary.BigEndian.PutUint64(hash, uint64(app.txCount)) - return &abci.ResponseCommit{Data: hash}, nil + return &abci.ResponseCommit{}, nil } func (app *CounterApplication) PrepareProposal(_ context.Context, req *abci.RequestPrepareProposal) (*abci.ResponsePrepareProposal, error) { diff --git a/internal/consensus/reactor.go b/internal/consensus/reactor.go index 18d5851a4..c353e0c73 100644 --- a/internal/consensus/reactor.go +++ b/internal/consensus/reactor.go @@ -509,10 +509,12 @@ OUTER_LOOP: return } + timer.Reset(r.state.config.PeerGossipSleepDuration) + select { case <-ctx.Done(): return - default: + case <-timer.C: } rs := r.getRoundState() @@ -560,13 +562,6 @@ OUTER_LOOP: "blockstoreBase", blockStoreBase, "blockstoreHeight", r.state.blockStore.Height(), ) - - timer.Reset(r.state.config.PeerGossipSleepDuration) - select { - case <-timer.C: - case <-ctx.Done(): - return - } } else { ps.InitProposalBlockParts(blockMeta.BlockID.PartSetHeader) } @@ -582,12 +577,6 @@ OUTER_LOOP: // if height and round don't match, sleep if (rs.Height != prs.Height) || (rs.Round != prs.Round) { - timer.Reset(r.state.config.PeerGossipSleepDuration) - select { - case <-timer.C: - case <-ctx.Done(): - return - } continue OUTER_LOOP } @@ -637,18 +626,7 @@ OUTER_LOOP: return } } - - continue OUTER_LOOP } - - // nothing to do -- sleep - timer.Reset(r.state.config.PeerGossipSleepDuration) - select { - case <-timer.C: - case <-ctx.Done(): - return - } - continue OUTER_LOOP } } diff --git a/internal/consensus/replay.go b/internal/consensus/replay.go index fac7c91ac..71c7ddd71 100644 --- a/internal/consensus/replay.go +++ b/internal/consensus/replay.go @@ -424,11 +424,11 @@ func (h *Handshaker) ReplayBlocks( case appBlockHeight == storeBlockHeight: // We ran Commit, but didn't save the state, so replayBlock with mock app. - abciResponses, err := h.stateStore.LoadABCIResponses(storeBlockHeight) + finalizeBlockResponses, err := h.stateStore.LoadFinalizeBlockResponses(storeBlockHeight) if err != nil { return nil, err } - mockApp, err := newMockProxyApp(h.logger, appHash, abciResponses) + mockApp, err := newMockProxyApp(h.logger, appHash, finalizeBlockResponses) if err != nil { return nil, err } diff --git a/internal/consensus/replay_stubs.go b/internal/consensus/replay_stubs.go index 407ec925e..60b96ae0c 100644 --- a/internal/consensus/replay_stubs.go +++ b/internal/consensus/replay_stubs.go @@ -9,7 +9,6 @@ import ( "github.com/tendermint/tendermint/internal/mempool" "github.com/tendermint/tendermint/internal/proxy" "github.com/tendermint/tendermint/libs/log" - tmstate "github.com/tendermint/tendermint/proto/tendermint/state" "github.com/tendermint/tendermint/types" ) @@ -52,7 +51,7 @@ func (emptyMempool) InitWAL() error { return nil } func (emptyMempool) CloseWAL() {} //----------------------------------------------------------------------------- -// mockProxyApp uses ABCIResponses to give the right results. +// mockProxyApp uses Responses to FinalizeBlock to give the right results. // // Useful because we don't want to call Commit() twice for the same block on // the real app. @@ -60,24 +59,24 @@ func (emptyMempool) CloseWAL() {} func newMockProxyApp( logger log.Logger, appHash []byte, - abciResponses *tmstate.ABCIResponses, + finalizeBlockResponses *abci.ResponseFinalizeBlock, ) (abciclient.Client, error) { return proxy.New(abciclient.NewLocalClient(logger, &mockProxyApp{ - appHash: appHash, - abciResponses: abciResponses, + appHash: appHash, + finalizeBlockResponses: finalizeBlockResponses, }), logger, proxy.NopMetrics()), nil } type mockProxyApp struct { abci.BaseApplication - appHash []byte - txCount int - abciResponses *tmstate.ABCIResponses + appHash []byte + txCount int + finalizeBlockResponses *abci.ResponseFinalizeBlock } func (mock *mockProxyApp) FinalizeBlock(_ context.Context, req *abci.RequestFinalizeBlock) (*abci.ResponseFinalizeBlock, error) { - r := mock.abciResponses.FinalizeBlock + r := mock.finalizeBlockResponses mock.txCount++ if r == nil { return &abci.ResponseFinalizeBlock{}, nil @@ -86,5 +85,5 @@ func (mock *mockProxyApp) FinalizeBlock(_ context.Context, req *abci.RequestFina } func (mock *mockProxyApp) Commit(context.Context) (*abci.ResponseCommit, error) { - return &abci.ResponseCommit{Data: mock.appHash}, nil + return &abci.ResponseCommit{}, nil } diff --git a/internal/consensus/replay_test.go b/internal/consensus/replay_test.go index 99d3c17a1..328dba040 100644 --- a/internal/consensus/replay_test.go +++ b/internal/consensus/replay_test.go @@ -1017,15 +1017,15 @@ type badApp struct { onlyLastHashIsWrong bool } -func (app *badApp) Commit(context.Context) (*abci.ResponseCommit, error) { +func (app *badApp) FinalizeBlock(_ context.Context, _ *abci.RequestFinalizeBlock) (*abci.ResponseFinalizeBlock, error) { app.height++ if app.onlyLastHashIsWrong { if app.height == app.numBlocks { - return &abci.ResponseCommit{Data: tmrand.Bytes(8)}, nil + return &abci.ResponseFinalizeBlock{AppHash: tmrand.Bytes(8)}, nil } - return &abci.ResponseCommit{Data: []byte{app.height}}, nil + return &abci.ResponseFinalizeBlock{AppHash: []byte{app.height}}, nil } else if app.allHashesAreWrong { - return &abci.ResponseCommit{Data: tmrand.Bytes(8)}, nil + return &abci.ResponseFinalizeBlock{AppHash: tmrand.Bytes(8)}, nil } panic("either allHashesAreWrong or onlyLastHashIsWrong must be set") diff --git a/internal/consensus/state_test.go b/internal/consensus/state_test.go index 797dcf59c..06f670544 100644 --- a/internal/consensus/state_test.go +++ b/internal/consensus/state_test.go @@ -1979,7 +1979,8 @@ func TestFinalizeBlockCalled(t *testing.T) { Status: abci.ResponseVerifyVoteExtension_ACCEPT, }, nil) } - m.On("FinalizeBlock", mock.Anything, mock.Anything).Return(&abci.ResponseFinalizeBlock{}, nil).Maybe() + r := &abci.ResponseFinalizeBlock{AppHash: []byte("the_hash")} + m.On("FinalizeBlock", mock.Anything, mock.Anything).Return(r, nil).Maybe() m.On("Commit", mock.Anything).Return(&abci.ResponseCommit{}, nil).Maybe() cs1, vss := makeState(ctx, t, makeStateArgs{config: config, application: m}) @@ -2060,7 +2061,8 @@ func TestExtendVoteCalledWhenEnabled(t *testing.T) { }, nil) } m.On("Commit", mock.Anything).Return(&abci.ResponseCommit{}, nil).Maybe() - m.On("FinalizeBlock", mock.Anything, mock.Anything).Return(&abci.ResponseFinalizeBlock{}, nil).Maybe() + r := &abci.ResponseFinalizeBlock{AppHash: []byte("myHash")} + m.On("FinalizeBlock", mock.Anything, mock.Anything).Return(r, nil).Maybe() c := factory.ConsensusParams() if !testCase.enabled { c.ABCI.VoteExtensionsEnableHeight = 0 @@ -2357,7 +2359,8 @@ func TestVoteExtensionEnableHeight(t *testing.T) { Status: abci.ResponseVerifyVoteExtension_ACCEPT, }, nil).Times(numValidators - 1) } - m.On("FinalizeBlock", mock.Anything, mock.Anything).Return(&abci.ResponseFinalizeBlock{}, nil).Maybe() + r := &abci.ResponseFinalizeBlock{AppHash: []byte("hashyHash")} + m.On("FinalizeBlock", mock.Anything, mock.Anything).Return(r, nil).Maybe() m.On("Commit", mock.Anything).Return(&abci.ResponseCommit{}, nil).Maybe() c := factory.ConsensusParams() c.ABCI.VoteExtensionsEnableHeight = testCase.enableHeight diff --git a/internal/consensus/ticker.go b/internal/consensus/ticker.go index 103c48efc..efb3f8fba 100644 --- a/internal/consensus/ticker.go +++ b/internal/consensus/ticker.go @@ -115,9 +115,9 @@ func (t *timeoutTicker) timeoutRoutine(ctx context.Context) { // NOTE time.Timer allows duration to be non-positive ti = newti t.timer.Reset(ti.Duration) - t.logger.Debug("Scheduled timeout", "dur", ti.Duration, "height", ti.Height, "round", ti.Round, "step", ti.Step) + t.logger.Debug("Internal state machine timeout scheduled", "duration", ti.Duration, "height", ti.Height, "round", ti.Round, "step", ti.Step) case <-t.timer.C: - t.logger.Info("Timed out", "dur", ti.Duration, "height", ti.Height, "round", ti.Round, "step", ti.Step) + t.logger.Debug("Internal state machine timeout elapsed ", "duration", ti.Duration, "height", ti.Height, "round", ti.Round, "step", ti.Step) // go routine here guarantees timeoutRoutine doesn't block. // Determinism comes from playback in the receiveRoutine. // We can eliminate it by merging the timeoutRoutine into receiveRoutine diff --git a/internal/evidence/pool.go b/internal/evidence/pool.go index 132c61f23..9b3e89173 100644 --- a/internal/evidence/pool.go +++ b/internal/evidence/pool.go @@ -22,6 +22,16 @@ import ( "github.com/tendermint/tendermint/types" ) +// key prefixes +// NB: Before modifying these, cross-check them with those in +// * internal/store/store.go [0..4, 13] +// * internal/state/store.go [5..8, 14] +// * internal/evidence/pool.go [9..10] +// * light/store/db/db.go [11..12] +// TODO(sergio): Move all these to their own package. +// TODO: what about these (they already collide): +// * scripts/scmigrate/migrate.go [3] +// * internal/p2p/peermanager.go [1] const ( // prefixes are unique across all tm db's prefixCommitted = int64(9) diff --git a/internal/inspect/inspect_test.go b/internal/inspect/inspect_test.go index 511dbc814..059e41e88 100644 --- a/internal/inspect/inspect_test.go +++ b/internal/inspect/inspect_test.go @@ -23,7 +23,6 @@ import ( indexermocks "github.com/tendermint/tendermint/internal/state/indexer/mocks" statemocks "github.com/tendermint/tendermint/internal/state/mocks" "github.com/tendermint/tendermint/libs/log" - "github.com/tendermint/tendermint/proto/tendermint/state" httpclient "github.com/tendermint/tendermint/rpc/client/http" "github.com/tendermint/tendermint/types" ) @@ -263,12 +262,10 @@ func TestBlockResults(t *testing.T) { testGasUsed := int64(100) stateStoreMock := &statemocks.Store{} // tmstate "github.com/tendermint/tendermint/proto/tendermint/state" - stateStoreMock.On("LoadABCIResponses", testHeight).Return(&state.ABCIResponses{ - FinalizeBlock: &abcitypes.ResponseFinalizeBlock{ - TxResults: []*abcitypes.ExecTxResult{ - { - GasUsed: testGasUsed, - }, + stateStoreMock.On("LoadFinalizeBlockResponses", testHeight).Return(&abcitypes.ResponseFinalizeBlock{ + TxResults: []*abcitypes.ExecTxResult{ + { + GasUsed: testGasUsed, }, }, }, nil) diff --git a/internal/p2p/router.go b/internal/p2p/router.go index 267d55a96..8b77541de 100644 --- a/internal/p2p/router.go +++ b/internal/p2p/router.go @@ -720,6 +720,15 @@ func (r *Router) handshakePeer( if err = peerInfo.Validate(); err != nil { return peerInfo, fmt.Errorf("invalid handshake NodeInfo: %w", err) } + + if peerInfo.Network != nodeInfo.Network { + if err := r.peerManager.store.Delete(peerInfo.NodeID); err != nil { + return peerInfo, fmt.Errorf("problem removing peer from store from incorrect network [%s]: %w", peerInfo.Network, err) + } + + return peerInfo, fmt.Errorf("connected to peer from wrong network, %q, removed from peer store", peerInfo.Network) + } + if types.NodeIDFromPubKey(peerKey) != peerInfo.NodeID { return peerInfo, fmt.Errorf("peer's public key did not match its node ID %q (expected %q)", peerInfo.NodeID, types.NodeIDFromPubKey(peerKey)) @@ -728,6 +737,7 @@ func (r *Router) handshakePeer( return peerInfo, fmt.Errorf("expected to connect with peer %q, got %q", expectID, peerInfo.NodeID) } + if err := nodeInfo.CompatibleWith(peerInfo); err != nil { return peerInfo, ErrRejected{ err: err, diff --git a/internal/rpc/core/blocks.go b/internal/rpc/core/blocks.go index 239344002..845eef7bb 100644 --- a/internal/rpc/core/blocks.go +++ b/internal/rpc/core/blocks.go @@ -187,23 +187,23 @@ func (env *Environment) BlockResults(ctx context.Context, req *coretypes.Request return nil, err } - results, err := env.StateStore.LoadABCIResponses(height) + results, err := env.StateStore.LoadFinalizeBlockResponses(height) if err != nil { return nil, err } var totalGasUsed int64 - for _, res := range results.FinalizeBlock.GetTxResults() { + for _, res := range results.GetTxResults() { totalGasUsed += res.GetGasUsed() } return &coretypes.ResultBlockResults{ Height: height, - TxsResults: results.FinalizeBlock.TxResults, + TxsResults: results.TxResults, TotalGasUsed: totalGasUsed, - FinalizeBlockEvents: results.FinalizeBlock.Events, - ValidatorUpdates: results.FinalizeBlock.ValidatorUpdates, - ConsensusParamUpdates: results.FinalizeBlock.ConsensusParamUpdates, + FinalizeBlockEvents: results.Events, + ValidatorUpdates: results.ValidatorUpdates, + ConsensusParamUpdates: results.ConsensusParamUpdates, }, nil } diff --git a/internal/rpc/core/blocks_test.go b/internal/rpc/core/blocks_test.go index d95338332..6ec400069 100644 --- a/internal/rpc/core/blocks_test.go +++ b/internal/rpc/core/blocks_test.go @@ -13,7 +13,6 @@ import ( abci "github.com/tendermint/tendermint/abci/types" sm "github.com/tendermint/tendermint/internal/state" "github.com/tendermint/tendermint/internal/state/mocks" - tmstate "github.com/tendermint/tendermint/proto/tendermint/state" "github.com/tendermint/tendermint/rpc/coretypes" ) @@ -70,19 +69,17 @@ func TestBlockchainInfo(t *testing.T) { } func TestBlockResults(t *testing.T) { - results := &tmstate.ABCIResponses{ - FinalizeBlock: &abci.ResponseFinalizeBlock{ - TxResults: []*abci.ExecTxResult{ - {Code: 0, Data: []byte{0x01}, Log: "ok", GasUsed: 10}, - {Code: 0, Data: []byte{0x02}, Log: "ok", GasUsed: 5}, - {Code: 1, Log: "not ok", GasUsed: 0}, - }, + results := &abci.ResponseFinalizeBlock{ + TxResults: []*abci.ExecTxResult{ + {Code: 0, Data: []byte{0x01}, Log: "ok", GasUsed: 10}, + {Code: 0, Data: []byte{0x02}, Log: "ok", GasUsed: 5}, + {Code: 1, Log: "not ok", GasUsed: 0}, }, } env := &Environment{} env.StateStore = sm.NewStore(dbm.NewMemDB()) - err := env.StateStore.SaveABCIResponses(100, results) + err := env.StateStore.SaveFinalizeBlockResponses(100, results) require.NoError(t, err) mockstore := &mocks.BlockStore{} mockstore.On("Height").Return(int64(100)) @@ -99,11 +96,11 @@ func TestBlockResults(t *testing.T) { {101, true, nil}, {100, false, &coretypes.ResultBlockResults{ Height: 100, - TxsResults: results.FinalizeBlock.TxResults, + TxsResults: results.TxResults, TotalGasUsed: 15, - FinalizeBlockEvents: results.FinalizeBlock.Events, - ValidatorUpdates: results.FinalizeBlock.ValidatorUpdates, - ConsensusParamUpdates: results.FinalizeBlock.ConsensusParamUpdates, + FinalizeBlockEvents: results.Events, + ValidatorUpdates: results.ValidatorUpdates, + ConsensusParamUpdates: results.ConsensusParamUpdates, }}, } diff --git a/internal/state/errors.go b/internal/state/errors.go index e8ad776f4..516b20e5f 100644 --- a/internal/state/errors.go +++ b/internal/state/errors.go @@ -46,7 +46,7 @@ type ( Height int64 } - ErrNoABCIResponsesForHeight struct { + ErrNoFinalizeBlockResponsesForHeight struct { Height int64 } ) @@ -102,6 +102,6 @@ func (e ErrNoConsensusParamsForHeight) Error() string { return fmt.Sprintf("could not find consensus params for height #%d", e.Height) } -func (e ErrNoABCIResponsesForHeight) Error() string { - return fmt.Sprintf("could not find results for height #%d", e.Height) +func (e ErrNoFinalizeBlockResponsesForHeight) Error() string { + return fmt.Sprintf("could not find FinalizeBlock responses for height #%d", e.Height) } diff --git a/internal/state/execution.go b/internal/state/execution.go index cc3e63d7a..2710478e6 100644 --- a/internal/state/execution.go +++ b/internal/state/execution.go @@ -14,7 +14,6 @@ import ( "github.com/tendermint/tendermint/internal/eventbus" "github.com/tendermint/tendermint/internal/mempool" "github.com/tendermint/tendermint/libs/log" - tmstate "github.com/tendermint/tendermint/proto/tendermint/state" tmtypes "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/tendermint/tendermint/types" ) @@ -206,7 +205,7 @@ func (blockExec *BlockExecutor) ApplyBlock( return state, ErrInvalidBlock(err) } startTime := time.Now().UnixNano() - finalizeBlockResponse, err := blockExec.appClient.FinalizeBlock( + fBlockRes, err := blockExec.appClient.FinalizeBlock( ctx, &abci.RequestFinalizeBlock{ Hash: block.Hash(), @@ -225,22 +224,29 @@ func (blockExec *BlockExecutor) ApplyBlock( return state, ErrProxyAppConn(err) } - abciResponses := &tmstate.ABCIResponses{ - FinalizeBlock: finalizeBlockResponse, - } + blockExec.logger.Info( + "finalized block", + "height", block.Height, + "num_txs_res", len(fBlockRes.TxResults), + "num_val_updates", len(fBlockRes.ValidatorUpdates), + "block_app_hash", fmt.Sprintf("%X", fBlockRes.AppHash), + ) // Save the results before we commit. - if err := blockExec.store.SaveABCIResponses(block.Height, abciResponses); err != nil { + err = blockExec.store.SaveFinalizeBlockResponses(block.Height, fBlockRes) + if err != nil && !errors.Is(err, ErrNoFinalizeBlockResponsesForHeight{block.Height}) { + // It is correct to have an empty ResponseFinalizeBlock for ApplyBlock, + // but not for saving it to the state store return state, err } // validate the validator updates and convert to tendermint types - err = validateValidatorUpdates(finalizeBlockResponse.ValidatorUpdates, state.ConsensusParams.Validator) + err = validateValidatorUpdates(fBlockRes.ValidatorUpdates, state.ConsensusParams.Validator) if err != nil { return state, fmt.Errorf("error in validator updates: %w", err) } - validatorUpdates, err := types.PB2TM.ValidatorUpdates(finalizeBlockResponse.ValidatorUpdates) + validatorUpdates, err := types.PB2TM.ValidatorUpdates(fBlockRes.ValidatorUpdates) if err != nil { return state, err } @@ -248,23 +254,23 @@ func (blockExec *BlockExecutor) ApplyBlock( blockExec.logger.Debug("updates to validators", "updates", types.ValidatorListString(validatorUpdates)) blockExec.metrics.ValidatorSetUpdates.Add(1) } - if finalizeBlockResponse.ConsensusParamUpdates != nil { + if fBlockRes.ConsensusParamUpdates != nil { blockExec.metrics.ConsensusParamUpdates.Add(1) } // Update the state with the block and responses. - rs, err := abci.MarshalTxResults(finalizeBlockResponse.TxResults) + rs, err := abci.MarshalTxResults(fBlockRes.TxResults) if err != nil { return state, fmt.Errorf("marshaling TxResults: %w", err) } h := merkle.HashFromByteSlices(rs) - state, err = state.Update(blockID, &block.Header, h, finalizeBlockResponse.ConsensusParamUpdates, validatorUpdates) + state, err = state.Update(blockID, &block.Header, h, fBlockRes.ConsensusParamUpdates, validatorUpdates) if err != nil { return state, fmt.Errorf("commit failed for application: %w", err) } // Lock mempool, commit app state, update mempoool. - appHash, retainHeight, err := blockExec.Commit(ctx, state, block, finalizeBlockResponse.TxResults) + retainHeight, err := blockExec.Commit(ctx, state, block, fBlockRes.TxResults) if err != nil { return state, fmt.Errorf("commit failed for application: %w", err) } @@ -273,7 +279,7 @@ func (blockExec *BlockExecutor) ApplyBlock( blockExec.evpool.Update(ctx, state, block.Evidence) // Update the app hash and save the state. - state.AppHash = appHash + state.AppHash = fBlockRes.AppHash if err := blockExec.store.Save(state); err != nil { return state, err } @@ -293,7 +299,7 @@ func (blockExec *BlockExecutor) ApplyBlock( // Events are fired after everything else. // NOTE: if we crash between Commit and Save, events wont be fired during replay - fireEvents(blockExec.logger, blockExec.eventBus, block, blockID, finalizeBlockResponse, validatorUpdates) + fireEvents(blockExec.logger, blockExec.eventBus, block, blockID, fBlockRes, validatorUpdates) return state, nil } @@ -338,7 +344,7 @@ func (blockExec *BlockExecutor) Commit( state State, block *types.Block, txResults []*abci.ExecTxResult, -) ([]byte, int64, error) { +) (int64, error) { blockExec.mempool.Lock() defer blockExec.mempool.Unlock() @@ -347,14 +353,14 @@ func (blockExec *BlockExecutor) Commit( err := blockExec.mempool.FlushAppConn(ctx) if err != nil { blockExec.logger.Error("client error during mempool.FlushAppConn", "err", err) - return nil, 0, err + return 0, err } // Commit block, get hash back res, err := blockExec.appClient.Commit(ctx) if err != nil { blockExec.logger.Error("client error during proxyAppConn.Commit", "err", err) - return nil, 0, err + return 0, err } // ResponseCommit has no error code - just data @@ -362,7 +368,7 @@ func (blockExec *BlockExecutor) Commit( "committed state", "height", block.Height, "num_txs", len(block.Txs), - "app_hash", fmt.Sprintf("%X", res.Data), + "block_app_hash", fmt.Sprintf("%X", block.AppHash), ) // Update mempool. @@ -376,7 +382,7 @@ func (blockExec *BlockExecutor) Commit( state.ConsensusParams.ABCI.RecheckTx, ) - return res.Data, res.RetainHeight, err + return res.RetainHeight, err } func buildLastCommitInfo(block *types.Block, store Store, initialHeight int64) abci.CommitInfo { @@ -530,7 +536,7 @@ func (state State) Update( // and update s.LastValidators and s.Validators. nValSet := state.NextValidators.Copy() - // Update the validator set with the latest abciResponses. + // Update the validator set with the latest responses to FinalizeBlock. lastHeightValsChanged := state.LastHeightValidatorsChanged if len(validatorUpdates) > 0 { err := nValSet.UpdateWithChangeSet(validatorUpdates) @@ -544,7 +550,7 @@ func (state State) Update( // Update validator proposer priority and set state variables. nValSet.IncrementProposerPriority(1) - // Update the params with the latest abciResponses. + // Update the params with the latest responses to FinalizeBlock. nextParams := state.ConsensusParams lastHeightParamsChanged := state.LastHeightConsensusParamsChanged if consensusParamUpdates != nil { @@ -708,15 +714,15 @@ func ExecCommitBlock( fireEvents(be.logger, be.eventBus, block, blockID, finalizeBlockResponse, validatorUpdates) } - // Commit block, get hash back - res, err := appConn.Commit(ctx) + // Commit block + _, err = appConn.Commit(ctx) if err != nil { - logger.Error("client error during proxyAppConn.Commit", "err", res) + logger.Error("client error during proxyAppConn.Commit", "err", err) return nil, err } - // ResponseCommit has no error or log, just data - return res.Data, nil + // ResponseCommit has no error or log + return finalizeBlockResponse.AppHash, nil } func (blockExec *BlockExecutor) pruneBlocks(retainHeight int64) (uint64, error) { diff --git a/internal/state/helpers_test.go b/internal/state/helpers_test.go index dec5afc66..354a2874f 100644 --- a/internal/state/helpers_test.go +++ b/internal/state/helpers_test.go @@ -19,7 +19,6 @@ import ( sf "github.com/tendermint/tendermint/internal/state/test/factory" "github.com/tendermint/tendermint/internal/test/factory" tmtime "github.com/tendermint/tendermint/libs/time" - tmstate "github.com/tendermint/tendermint/proto/tendermint/state" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/tendermint/tendermint/types" ) @@ -148,10 +147,10 @@ func makeHeaderPartsResponsesValPubKeyChange( t *testing.T, state sm.State, pubkey crypto.PubKey, -) (types.Header, types.BlockID, *tmstate.ABCIResponses) { +) (types.Header, types.BlockID, *abci.ResponseFinalizeBlock) { block := sf.MakeBlock(state, state.LastBlockHeight+1, new(types.Commit)) - abciResponses := &tmstate.ABCIResponses{} + finalizeBlockResponses := &abci.ResponseFinalizeBlock{} // If the pubkey is new, remove the old and add the new. _, val := state.NextValidators.GetByIndex(0) if !bytes.Equal(pubkey.Bytes(), val.PubKey.Bytes()) { @@ -160,58 +159,50 @@ func makeHeaderPartsResponsesValPubKeyChange( pbPk, err := encoding.PubKeyToProto(pubkey) require.NoError(t, err) - abciResponses.FinalizeBlock = &abci.ResponseFinalizeBlock{ - ValidatorUpdates: []abci.ValidatorUpdate{ - {PubKey: vPbPk, Power: 0}, - {PubKey: pbPk, Power: 10}, - }, + finalizeBlockResponses.ValidatorUpdates = []abci.ValidatorUpdate{ + {PubKey: vPbPk, Power: 0}, + {PubKey: pbPk, Power: 10}, } } - return block.Header, types.BlockID{Hash: block.Hash(), PartSetHeader: types.PartSetHeader{}}, abciResponses + return block.Header, types.BlockID{Hash: block.Hash(), PartSetHeader: types.PartSetHeader{}}, finalizeBlockResponses } func makeHeaderPartsResponsesValPowerChange( t *testing.T, state sm.State, power int64, -) (types.Header, types.BlockID, *tmstate.ABCIResponses) { +) (types.Header, types.BlockID, *abci.ResponseFinalizeBlock) { t.Helper() block := sf.MakeBlock(state, state.LastBlockHeight+1, new(types.Commit)) + finalizeBlockResponses := &abci.ResponseFinalizeBlock{} - abciResponses := &tmstate.ABCIResponses{} - - abciResponses.FinalizeBlock = &abci.ResponseFinalizeBlock{} // If the pubkey is new, remove the old and add the new. _, val := state.NextValidators.GetByIndex(0) if val.VotingPower != power { vPbPk, err := encoding.PubKeyToProto(val.PubKey) require.NoError(t, err) - abciResponses.FinalizeBlock = &abci.ResponseFinalizeBlock{ - ValidatorUpdates: []abci.ValidatorUpdate{ - {PubKey: vPbPk, Power: power}, - }, + finalizeBlockResponses.ValidatorUpdates = []abci.ValidatorUpdate{ + {PubKey: vPbPk, Power: power}, } } - return block.Header, types.BlockID{Hash: block.Hash(), PartSetHeader: types.PartSetHeader{}}, abciResponses + return block.Header, types.BlockID{Hash: block.Hash(), PartSetHeader: types.PartSetHeader{}}, finalizeBlockResponses } func makeHeaderPartsResponsesParams( t *testing.T, state sm.State, params *types.ConsensusParams, -) (types.Header, types.BlockID, *tmstate.ABCIResponses) { +) (types.Header, types.BlockID, *abci.ResponseFinalizeBlock) { t.Helper() block := sf.MakeBlock(state, state.LastBlockHeight+1, new(types.Commit)) pbParams := params.ToProto() - abciResponses := &tmstate.ABCIResponses{ - FinalizeBlock: &abci.ResponseFinalizeBlock{ConsensusParamUpdates: &pbParams}, - } - return block.Header, types.BlockID{Hash: block.Hash(), PartSetHeader: types.PartSetHeader{}}, abciResponses + finalizeBlockResponses := &abci.ResponseFinalizeBlock{ConsensusParamUpdates: &pbParams} + return block.Header, types.BlockID{Hash: block.Hash(), PartSetHeader: types.PartSetHeader{}}, finalizeBlockResponses } func randomGenesisDoc() *types.GenesisDoc { diff --git a/internal/state/mocks/store.go b/internal/state/mocks/store.go index d08ba4c9e..94d5614e6 100644 --- a/internal/state/mocks/store.go +++ b/internal/state/mocks/store.go @@ -4,8 +4,9 @@ package mocks import ( mock "github.com/stretchr/testify/mock" + abcitypes "github.com/tendermint/tendermint/abci/types" + state "github.com/tendermint/tendermint/internal/state" - tendermintstate "github.com/tendermint/tendermint/proto/tendermint/state" types "github.com/tendermint/tendermint/types" ) @@ -64,17 +65,15 @@ func (_m *Store) Load() (state.State, error) { return r0, r1 } -// LoadABCIResponses provides a mock function with given fields: _a0 -func (_m *Store) LoadABCIResponses(_a0 int64) (*tendermintstate.ABCIResponses, error) { +// LoadConsensusParams provides a mock function with given fields: _a0 +func (_m *Store) LoadConsensusParams(_a0 int64) (types.ConsensusParams, error) { ret := _m.Called(_a0) - var r0 *tendermintstate.ABCIResponses - if rf, ok := ret.Get(0).(func(int64) *tendermintstate.ABCIResponses); ok { + var r0 types.ConsensusParams + if rf, ok := ret.Get(0).(func(int64) types.ConsensusParams); ok { r0 = rf(_a0) } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*tendermintstate.ABCIResponses) - } + r0 = ret.Get(0).(types.ConsensusParams) } var r1 error @@ -87,15 +86,17 @@ func (_m *Store) LoadABCIResponses(_a0 int64) (*tendermintstate.ABCIResponses, e return r0, r1 } -// LoadConsensusParams provides a mock function with given fields: _a0 -func (_m *Store) LoadConsensusParams(_a0 int64) (types.ConsensusParams, error) { +// LoadFinalizeBlockResponses provides a mock function with given fields: _a0 +func (_m *Store) LoadFinalizeBlockResponses(_a0 int64) (*abcitypes.ResponseFinalizeBlock, error) { ret := _m.Called(_a0) - var r0 types.ConsensusParams - if rf, ok := ret.Get(0).(func(int64) types.ConsensusParams); ok { + var r0 *abcitypes.ResponseFinalizeBlock + if rf, ok := ret.Get(0).(func(int64) *abcitypes.ResponseFinalizeBlock); ok { r0 = rf(_a0) } else { - r0 = ret.Get(0).(types.ConsensusParams) + if ret.Get(0) != nil { + r0 = ret.Get(0).(*abcitypes.ResponseFinalizeBlock) + } } var r1 error @@ -159,12 +160,12 @@ func (_m *Store) Save(_a0 state.State) error { return r0 } -// SaveABCIResponses provides a mock function with given fields: _a0, _a1 -func (_m *Store) SaveABCIResponses(_a0 int64, _a1 *tendermintstate.ABCIResponses) error { +// SaveFinalizeBlockResponses provides a mock function with given fields: _a0, _a1 +func (_m *Store) SaveFinalizeBlockResponses(_a0 int64, _a1 *abcitypes.ResponseFinalizeBlock) error { ret := _m.Called(_a0, _a1) var r0 error - if rf, ok := ret.Get(0).(func(int64, *tendermintstate.ABCIResponses) error); ok { + if rf, ok := ret.Get(0).(func(int64, *abcitypes.ResponseFinalizeBlock) error); ok { r0 = rf(_a0, _a1) } else { r0 = ret.Error(0) diff --git a/internal/state/state_test.go b/internal/state/state_test.go index f38d37ea4..de1164c5d 100644 --- a/internal/state/state_test.go +++ b/internal/state/state_test.go @@ -21,7 +21,6 @@ import ( "github.com/tendermint/tendermint/crypto/merkle" sm "github.com/tendermint/tendermint/internal/state" statefactory "github.com/tendermint/tendermint/internal/state/test/factory" - tmstate "github.com/tendermint/tendermint/proto/tendermint/state" "github.com/tendermint/tendermint/types" ) @@ -102,8 +101,8 @@ func TestStateSaveLoad(t *testing.T) { loadedState, state) } -// TestABCIResponsesSaveLoad tests saving and loading ABCIResponses. -func TestABCIResponsesSaveLoad1(t *testing.T) { +// TestFinalizeBlockResponsesSaveLoad1 tests saving and loading responses to FinalizeBlock. +func TestFinalizeBlockResponsesSaveLoad1(t *testing.T) { tearDown, stateDB, state := setupTestCase(t) defer tearDown(t) stateStore := sm.NewStore(stateDB) @@ -113,28 +112,27 @@ func TestABCIResponsesSaveLoad1(t *testing.T) { // Build mock responses. block := statefactory.MakeBlock(state, 2, new(types.Commit)) - abciResponses := new(tmstate.ABCIResponses) dtxs := make([]*abci.ExecTxResult, 2) - abciResponses.FinalizeBlock = new(abci.ResponseFinalizeBlock) - abciResponses.FinalizeBlock.TxResults = dtxs + finalizeBlockResponses := new(abci.ResponseFinalizeBlock) + finalizeBlockResponses.TxResults = dtxs - abciResponses.FinalizeBlock.TxResults[0] = &abci.ExecTxResult{Data: []byte("foo"), Events: nil} - abciResponses.FinalizeBlock.TxResults[1] = &abci.ExecTxResult{Data: []byte("bar"), Log: "ok", Events: nil} + finalizeBlockResponses.TxResults[0] = &abci.ExecTxResult{Data: []byte("foo"), Events: nil} + finalizeBlockResponses.TxResults[1] = &abci.ExecTxResult{Data: []byte("bar"), Log: "ok", Events: nil} pbpk, err := encoding.PubKeyToProto(ed25519.GenPrivKey().PubKey()) require.NoError(t, err) - abciResponses.FinalizeBlock.ValidatorUpdates = []abci.ValidatorUpdate{{PubKey: pbpk, Power: 10}} + finalizeBlockResponses.ValidatorUpdates = []abci.ValidatorUpdate{{PubKey: pbpk, Power: 10}} - err = stateStore.SaveABCIResponses(block.Height, abciResponses) + err = stateStore.SaveFinalizeBlockResponses(block.Height, finalizeBlockResponses) require.NoError(t, err) - loadedABCIResponses, err := stateStore.LoadABCIResponses(block.Height) + loadedFinalizeBlockResponses, err := stateStore.LoadFinalizeBlockResponses(block.Height) require.NoError(t, err) - assert.Equal(t, abciResponses, loadedABCIResponses, - "ABCIResponses don't match:\ngot: %v\nexpected: %v\n", - loadedABCIResponses, abciResponses) + assert.Equal(t, finalizeBlockResponses, loadedFinalizeBlockResponses, + "FinalizeBlockResponses don't match:\ngot: %v\nexpected: %v\n", + loadedFinalizeBlockResponses, finalizeBlockResponses) } -// TestResultsSaveLoad tests saving and loading ABCI results. -func TestABCIResponsesSaveLoad2(t *testing.T) { +// TestFinalizeBlockResponsesSaveLoad2 tests saving and loading responses to FinalizeBlock. +func TestFinalizeBlockResponsesSaveLoad2(t *testing.T) { tearDown, stateDB, _ := setupTestCase(t) defer tearDown(t) @@ -190,32 +188,31 @@ func TestABCIResponsesSaveLoad2(t *testing.T) { // Query all before, this should return error. for i := range cases { h := int64(i + 1) - res, err := stateStore.LoadABCIResponses(h) + res, err := stateStore.LoadFinalizeBlockResponses(h) assert.Error(t, err, "%d: %#v", i, res) } // Add all cases. for i, tc := range cases { h := int64(i + 1) // last block height, one below what we save - responses := &tmstate.ABCIResponses{ - FinalizeBlock: &abci.ResponseFinalizeBlock{ - TxResults: tc.added, - }, + responses := &abci.ResponseFinalizeBlock{ + TxResults: tc.added, + AppHash: []byte("a_hash"), } - err := stateStore.SaveABCIResponses(h, responses) + err := stateStore.SaveFinalizeBlockResponses(h, responses) require.NoError(t, err) } - // Query all before, should return expected value. + // Query all after, should return expected value. for i, tc := range cases { h := int64(i + 1) - res, err := stateStore.LoadABCIResponses(h) + res, err := stateStore.LoadFinalizeBlockResponses(h) if assert.NoError(t, err, "%d", i) { t.Log(res) e, err := abci.MarshalTxResults(tc.expected) require.NoError(t, err) he := merkle.HashFromByteSlices(e) - rs, err := abci.MarshalTxResults(res.FinalizeBlock.TxResults) + rs, err := abci.MarshalTxResults(res.TxResults) hrs := merkle.HashFromByteSlices(rs) require.NoError(t, err) assert.Equal(t, he, hrs, "%d", i) @@ -282,12 +279,12 @@ func TestOneValidatorChangesSaveLoad(t *testing.T) { power++ } header, blockID, responses := makeHeaderPartsResponsesValPowerChange(t, state, power) - validatorUpdates, err = types.PB2TM.ValidatorUpdates(responses.FinalizeBlock.ValidatorUpdates) + validatorUpdates, err = types.PB2TM.ValidatorUpdates(responses.ValidatorUpdates) require.NoError(t, err) - rs, err := abci.MarshalTxResults(responses.FinalizeBlock.TxResults) + rs, err := abci.MarshalTxResults(responses.TxResults) require.NoError(t, err) h := merkle.HashFromByteSlices(rs) - state, err = state.Update(blockID, &header, h, responses.FinalizeBlock.ConsensusParamUpdates, validatorUpdates) + state, err = state.Update(blockID, &header, h, responses.ConsensusParamUpdates, validatorUpdates) require.NoError(t, err) err = stateStore.Save(state) require.NoError(t, err) @@ -1024,12 +1021,12 @@ func TestManyValidatorChangesSaveLoad(t *testing.T) { // Save state etc. var validatorUpdates []*types.Validator - validatorUpdates, err = types.PB2TM.ValidatorUpdates(responses.FinalizeBlock.ValidatorUpdates) + validatorUpdates, err = types.PB2TM.ValidatorUpdates(responses.ValidatorUpdates) require.NoError(t, err) - rs, err := abci.MarshalTxResults(responses.FinalizeBlock.TxResults) + rs, err := abci.MarshalTxResults(responses.TxResults) require.NoError(t, err) h := merkle.HashFromByteSlices(rs) - state, err = state.Update(blockID, &header, h, responses.FinalizeBlock.ConsensusParamUpdates, validatorUpdates) + state, err = state.Update(blockID, &header, h, responses.ConsensusParamUpdates, validatorUpdates) require.NoError(t, err) nextHeight := state.LastBlockHeight + 1 err = stateStore.Save(state) @@ -1104,12 +1101,12 @@ func TestConsensusParamsChangesSaveLoad(t *testing.T) { cp = params[changeIndex] } header, blockID, responses := makeHeaderPartsResponsesParams(t, state, &cp) - validatorUpdates, err = types.PB2TM.ValidatorUpdates(responses.FinalizeBlock.ValidatorUpdates) + validatorUpdates, err = types.PB2TM.ValidatorUpdates(responses.ValidatorUpdates) require.NoError(t, err) - rs, err := abci.MarshalTxResults(responses.FinalizeBlock.TxResults) + rs, err := abci.MarshalTxResults(responses.TxResults) require.NoError(t, err) h := merkle.HashFromByteSlices(rs) - state, err = state.Update(blockID, &header, h, responses.FinalizeBlock.ConsensusParamUpdates, validatorUpdates) + state, err = state.Update(blockID, &header, h, responses.ConsensusParamUpdates, validatorUpdates) require.NoError(t, err) err = stateStore.Save(state) diff --git a/internal/state/store.go b/internal/state/store.go index a41719c92..dda53f45e 100644 --- a/internal/state/store.go +++ b/internal/state/store.go @@ -26,15 +26,23 @@ const ( //------------------------------------------------------------------------ +// key prefixes // NB: Before modifying these, cross-check them with those in -// internal/store/store.go -// TODO(thane): Move these and the ones in internal/store/store.go to their own package. +// * internal/store/store.go [0..4, 13] +// * internal/state/store.go [5..8, 14] +// * internal/evidence/pool.go [9..10] +// * light/store/db/db.go [11..12] +// TODO(thane): Move all these to their own package. +// TODO: what about these (they already collide): +// * scripts/scmigrate/migrate.go [3] +// * internal/p2p/peermanager.go [1] const ( // prefixes are unique across all tm db's - prefixValidators = int64(5) - prefixConsensusParams = int64(6) - prefixABCIResponses = int64(7) - prefixState = int64(8) + prefixValidators = int64(5) + prefixConsensusParams = int64(6) + prefixABCIResponses = int64(7) // deprecated in v0.36 + prefixState = int64(8) + prefixFinalizeBlockResponses = int64(14) ) func encodeKey(prefix int64, height int64) []byte { @@ -57,6 +65,10 @@ func abciResponsesKey(height int64) []byte { return encodeKey(prefixABCIResponses, height) } +func finalizeBlockResponsesKey(height int64) []byte { + return encodeKey(prefixFinalizeBlockResponses, height) +} + // stateKey should never change after being set in init() var stateKey []byte @@ -81,14 +93,14 @@ type Store interface { Load() (State, error) // LoadValidators loads the validator set at a given height LoadValidators(int64) (*types.ValidatorSet, error) - // LoadABCIResponses loads the abciResponse for a given height - LoadABCIResponses(int64) (*tmstate.ABCIResponses, error) + // LoadFinalizeBlockResponses loads the responses to FinalizeBlock for a given height + LoadFinalizeBlockResponses(int64) (*abci.ResponseFinalizeBlock, error) // LoadConsensusParams loads the consensus params for a given height LoadConsensusParams(int64) (types.ConsensusParams, error) // Save overwrites the previous state with the updated one Save(State) error - // SaveABCIResponses saves ABCIResponses for a given height - SaveABCIResponses(int64, *tmstate.ABCIResponses) error + // SaveFinalizeBlockResponses saves responses to FinalizeBlock for a given height + SaveFinalizeBlockResponses(int64, *abci.ResponseFinalizeBlock) error // SaveValidatorSet saves the validator set at a given height SaveValidatorSets(int64, int64, *types.ValidatorSet) error // Bootstrap is used for bootstrapping state when not starting from a initial height. @@ -247,7 +259,7 @@ func (store dbStore) PruneStates(retainHeight int64) error { return err } - if err := store.pruneABCIResponses(retainHeight); err != nil { + if err := store.pruneFinalizeBlockResponses(retainHeight); err != nil { return err } @@ -338,10 +350,15 @@ func (store dbStore) pruneConsensusParams(retainHeight int64) error { ) } -// pruneABCIResponses calls a reverse iterator from base height to retain height batch deleting -// all abci responses in between -func (store dbStore) pruneABCIResponses(height int64) error { - return store.pruneRange(abciResponsesKey(1), abciResponsesKey(height)) +// pruneFinalizeBlockResponses calls a reverse iterator from base height to retain height +// batch deleting all responses to FinalizeBlock, and legacy ABCI responses, in between +func (store dbStore) pruneFinalizeBlockResponses(height int64) error { + err := store.pruneRange(finalizeBlockResponsesKey(1), finalizeBlockResponsesKey(height)) + if err == nil { + // Remove any stale legacy ABCI responses + err = store.pruneRange(abciResponsesKey(1), abciResponsesKey(height)) + } + return err } // pruneRange is a generic function for deleting a range of keys in reverse order. @@ -408,60 +425,63 @@ func (store dbStore) reverseBatchDelete(batch dbm.Batch, start, end []byte) ([]b //------------------------------------------------------------------------ -// LoadABCIResponses loads the ABCIResponses for the given height from the -// database. If not found, ErrNoABCIResponsesForHeight is returned. +// LoadFinalizeBlockResponses loads the responses to FinalizeBlock for the +// given height from the database. If not found, +// ErrNoFinalizeBlockResponsesForHeight is returned. // -// This is useful for recovering from crashes where we called app.Commit and -// before we called s.Save(). It can also be used to produce Merkle proofs of -// the result of txs. -func (store dbStore) LoadABCIResponses(height int64) (*tmstate.ABCIResponses, error) { - buf, err := store.db.Get(abciResponsesKey(height)) +// This is useful for recovering from crashes where we called app.Commit +// and before we called s.Save(). It can also be used to produce Merkle +// proofs of the result of txs. +func (store dbStore) LoadFinalizeBlockResponses(height int64) (*abci.ResponseFinalizeBlock, error) { + buf, err := store.db.Get(finalizeBlockResponsesKey(height)) if err != nil { return nil, err } if len(buf) == 0 { - - return nil, ErrNoABCIResponsesForHeight{height} + return nil, ErrNoFinalizeBlockResponsesForHeight{height} } - abciResponses := new(tmstate.ABCIResponses) - err = abciResponses.Unmarshal(buf) + finalizeBlockResponses := new(abci.ResponseFinalizeBlock) + err = finalizeBlockResponses.Unmarshal(buf) if err != nil { // DATA HAS BEEN CORRUPTED OR THE SPEC HAS CHANGED panic(fmt.Sprintf("data has been corrupted or its spec has changed: %+v", err)) } // TODO: ensure that buf is completely read. - return abciResponses, nil + return finalizeBlockResponses, nil } -// SaveABCIResponses persists the ABCIResponses to the database. +// SaveFinalizeBlockResponses persists to the database the responses to FinalizeBlock. // This is useful in case we crash after app.Commit and before s.Save(). // Responses are indexed by height so they can also be loaded later to produce // Merkle proofs. // // Exposed for testing. -func (store dbStore) SaveABCIResponses(height int64, abciResponses *tmstate.ABCIResponses) error { - return store.saveABCIResponses(height, abciResponses) +func (store dbStore) SaveFinalizeBlockResponses(height int64, finalizeBlockResponses *abci.ResponseFinalizeBlock) error { + return store.saveFinalizeBlockResponses(height, finalizeBlockResponses) } -func (store dbStore) saveABCIResponses(height int64, abciResponses *tmstate.ABCIResponses) error { +func (store dbStore) saveFinalizeBlockResponses(height int64, finalizeBlockResponses *abci.ResponseFinalizeBlock) error { var dtxs []*abci.ExecTxResult // strip nil values, - for _, tx := range abciResponses.FinalizeBlock.TxResults { + for _, tx := range finalizeBlockResponses.TxResults { if tx != nil { dtxs = append(dtxs, tx) } } - abciResponses.FinalizeBlock.TxResults = dtxs + finalizeBlockResponses.TxResults = dtxs - bz, err := abciResponses.Marshal() + bz, err := finalizeBlockResponses.Marshal() if err != nil { return err } + if len(bz) == 0 { + return ErrNoFinalizeBlockResponsesForHeight{height} + } - return store.db.SetSync(abciResponsesKey(height), bz) + return store.db.SetSync(finalizeBlockResponsesKey(height), bz) } // SaveValidatorSets is used to save the validator set over multiple heights. diff --git a/internal/state/store_test.go b/internal/state/store_test.go index 59084fd10..f6982b5bd 100644 --- a/internal/state/store_test.go +++ b/internal/state/store_test.go @@ -17,7 +17,6 @@ import ( sm "github.com/tendermint/tendermint/internal/state" "github.com/tendermint/tendermint/internal/test/factory" tmrand "github.com/tendermint/tendermint/libs/rand" - tmstate "github.com/tendermint/tendermint/proto/tendermint/state" "github.com/tendermint/tendermint/types" ) @@ -236,15 +235,14 @@ func TestPruneStates(t *testing.T) { err := stateStore.Save(state) require.NoError(t, err) - err = stateStore.SaveABCIResponses(h, &tmstate.ABCIResponses{ - FinalizeBlock: &abci.ResponseFinalizeBlock{ - TxResults: []*abci.ExecTxResult{ - {Data: []byte{1}}, - {Data: []byte{2}}, - {Data: []byte{3}}, - }, + err = stateStore.SaveFinalizeBlockResponses(h, &abci.ResponseFinalizeBlock{ + TxResults: []*abci.ExecTxResult{ + {Data: []byte{1}}, + {Data: []byte{2}}, + {Data: []byte{3}}, }, - }) + }, + ) require.NoError(t, err) } @@ -265,9 +263,9 @@ func TestPruneStates(t *testing.T) { require.NoError(t, err, h) require.NotNil(t, params, h) - abci, err := stateStore.LoadABCIResponses(h) + finRes, err := stateStore.LoadFinalizeBlockResponses(h) require.NoError(t, err, h) - require.NotNil(t, abci, h) + require.NotNil(t, finRes, h) } emptyParams := types.ConsensusParams{} @@ -291,9 +289,9 @@ func TestPruneStates(t *testing.T) { require.Equal(t, emptyParams, params, h) } - abci, err := stateStore.LoadABCIResponses(h) + finRes, err := stateStore.LoadFinalizeBlockResponses(h) require.Error(t, err, h) - require.Nil(t, abci, h) + require.Nil(t, finRes, h) } }) } diff --git a/internal/store/store.go b/internal/store/store.go index 1ba7e398d..eacbd73aa 100644 --- a/internal/store/store.go +++ b/internal/store/store.go @@ -650,8 +650,14 @@ func (bs *BlockStore) Close() error { // key prefixes // NB: Before modifying these, cross-check them with those in -// internal/state/store.go -// TODO(thane): Move these and the ones in internal/state/store.go to their own package. +// * internal/store/store.go [0..4, 13] +// * internal/state/store.go [5..8, 14] +// * internal/evidence/pool.go [9..10] +// * light/store/db/db.go [11..12] +// TODO(thane): Move all these to their own package. +// TODO: what about these (they already collide): +// * scripts/scmigrate/migrate.go [3] --> Looks OK, as it is also called "SeenCommit" +// * internal/p2p/peermanager.go [1] const ( // prefixes are unique across all tm db's prefixBlockMeta = int64(0) @@ -659,7 +665,7 @@ const ( prefixBlockCommit = int64(2) prefixSeenCommit = int64(3) prefixBlockHash = int64(4) - prefixExtCommit = int64(9) // 5..8 are used by state/store + prefixExtCommit = int64(13) ) func blockMetaKey(height int64) []byte { diff --git a/light/store/db/db.go b/light/store/db/db.go index c364e1709..17ee6766d 100644 --- a/light/store/db/db.go +++ b/light/store/db/db.go @@ -13,6 +13,16 @@ import ( "github.com/tendermint/tendermint/types" ) +// key prefixes +// NB: Before modifying these, cross-check them with those in +// * internal/store/store.go [0..4, 13] +// * internal/state/store.go [5..8, 14] +// * internal/evidence/pool.go [9..10] +// * light/store/db/db.go [11..12] +// TODO(sergio): Move all these to their own package. +// TODO: what about these (they already collide): +// * scripts/scmigrate/migrate.go [3] +// * internal/p2p/peermanager.go [1] const ( prefixLightBlock = int64(11) prefixSize = int64(12) diff --git a/node/setup.go b/node/setup.go index 8089ea466..51a048249 100644 --- a/node/setup.go +++ b/node/setup.go @@ -223,11 +223,13 @@ func createPeerManager( maxConns = 64 } + maxUpgradeConns := uint16(4) + options := p2p.PeerManagerOptions{ SelfAddress: selfAddr, MaxConnected: maxConns, - MaxConnectedUpgrade: 4, - MaxPeers: 1000, + MaxConnectedUpgrade: maxUpgradeConns, + MaxPeers: maxUpgradeConns + 2*maxConns, MinRetryTime: 250 * time.Millisecond, MaxRetryTime: 30 * time.Minute, MaxRetryTimePersistent: 5 * time.Minute, diff --git a/privval/utils.go b/privval/utils.go index 1d6681b45..a2cbbf501 100644 --- a/privval/utils.go +++ b/privval/utils.go @@ -27,13 +27,17 @@ func IsConnTimeout(err error) bool { // NewSignerListener creates a new SignerListenerEndpoint using the corresponding listen address func NewSignerListener(listenAddr string, logger log.Logger) (*SignerListenerEndpoint, error) { - var listener net.Listener - protocol, address := tmnet.ProtocolAndAddress(listenAddr) + if protocol != "unix" && protocol != "tcp" { //nolint:goconst + return nil, fmt.Errorf("unsupported address family %q, want unix or tcp", protocol) + } + ln, err := net.Listen(protocol, address) if err != nil { return nil, err } + + var listener net.Listener switch protocol { case "unix": listener = NewUnixListener(ln) @@ -41,13 +45,8 @@ func NewSignerListener(listenAddr string, logger log.Logger) (*SignerListenerEnd // TODO: persist this key so external signer can actually authenticate us listener = NewTCPListener(ln, ed25519.GenPrivKey()) default: - return nil, fmt.Errorf( - "wrong listen address: expected either 'tcp' or 'unix' protocols, got %s", - protocol, - ) + panic("invalid protocol: " + protocol) // semantically unreachable } - pve := NewSignerListenerEndpoint(logger.With("module", "privval"), listener) - - return pve, nil + return NewSignerListenerEndpoint(logger.With("module", "privval"), listener), nil } diff --git a/proto/tendermint/abci/types.proto b/proto/tendermint/abci/types.proto index 771c56a8f..aa9e3fcbe 100644 --- a/proto/tendermint/abci/types.proto +++ b/proto/tendermint/abci/types.proto @@ -249,7 +249,6 @@ message ResponseDeliverTx { message ResponseCommit { // reserve 1 - bytes data = 2; int64 retain_height = 3; } @@ -332,7 +331,6 @@ message ResponseFinalizeBlock { repeated ValidatorUpdate validator_updates = 3 [(gogoproto.nullable) = false]; tendermint.types.ConsensusParams consensus_param_updates = 4; bytes app_hash = 5; - int64 retain_height = 6; } //---------------------------------------- diff --git a/proto/tendermint/state/types.pb.go b/proto/tendermint/state/types.pb.go index af5c64ecf..7d86d936f 100644 --- a/proto/tendermint/state/types.pb.go +++ b/proto/tendermint/state/types.pb.go @@ -9,8 +9,7 @@ import ( proto "github.com/gogo/protobuf/proto" _ "github.com/gogo/protobuf/types" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - types "github.com/tendermint/tendermint/abci/types" - types1 "github.com/tendermint/tendermint/proto/tendermint/types" + types "github.com/tendermint/tendermint/proto/tendermint/types" version "github.com/tendermint/tendermint/proto/tendermint/version" io "io" math "math" @@ -30,64 +29,17 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// ABCIResponses retains the responses -// of the various ABCI calls during block processing. -// It is persisted to disk for each height before calling Commit. -type ABCIResponses struct { - FinalizeBlock *types.ResponseFinalizeBlock `protobuf:"bytes,2,opt,name=finalize_block,json=finalizeBlock,proto3" json:"finalize_block,omitempty"` -} - -func (m *ABCIResponses) Reset() { *m = ABCIResponses{} } -func (m *ABCIResponses) String() string { return proto.CompactTextString(m) } -func (*ABCIResponses) ProtoMessage() {} -func (*ABCIResponses) Descriptor() ([]byte, []int) { - return fileDescriptor_ccfacf933f22bf93, []int{0} -} -func (m *ABCIResponses) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ABCIResponses) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ABCIResponses.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ABCIResponses) XXX_Merge(src proto.Message) { - xxx_messageInfo_ABCIResponses.Merge(m, src) -} -func (m *ABCIResponses) XXX_Size() int { - return m.Size() -} -func (m *ABCIResponses) XXX_DiscardUnknown() { - xxx_messageInfo_ABCIResponses.DiscardUnknown(m) -} - -var xxx_messageInfo_ABCIResponses proto.InternalMessageInfo - -func (m *ABCIResponses) GetFinalizeBlock() *types.ResponseFinalizeBlock { - if m != nil { - return m.FinalizeBlock - } - return nil -} - // ValidatorsInfo represents the latest validator set, or the last height it changed type ValidatorsInfo struct { - ValidatorSet *types1.ValidatorSet `protobuf:"bytes,1,opt,name=validator_set,json=validatorSet,proto3" json:"validator_set,omitempty"` - LastHeightChanged int64 `protobuf:"varint,2,opt,name=last_height_changed,json=lastHeightChanged,proto3" json:"last_height_changed,omitempty"` + ValidatorSet *types.ValidatorSet `protobuf:"bytes,1,opt,name=validator_set,json=validatorSet,proto3" json:"validator_set,omitempty"` + LastHeightChanged int64 `protobuf:"varint,2,opt,name=last_height_changed,json=lastHeightChanged,proto3" json:"last_height_changed,omitempty"` } func (m *ValidatorsInfo) Reset() { *m = ValidatorsInfo{} } func (m *ValidatorsInfo) String() string { return proto.CompactTextString(m) } func (*ValidatorsInfo) ProtoMessage() {} func (*ValidatorsInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ccfacf933f22bf93, []int{1} + return fileDescriptor_ccfacf933f22bf93, []int{0} } func (m *ValidatorsInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -116,7 +68,7 @@ func (m *ValidatorsInfo) XXX_DiscardUnknown() { var xxx_messageInfo_ValidatorsInfo proto.InternalMessageInfo -func (m *ValidatorsInfo) GetValidatorSet() *types1.ValidatorSet { +func (m *ValidatorsInfo) GetValidatorSet() *types.ValidatorSet { if m != nil { return m.ValidatorSet } @@ -132,15 +84,15 @@ func (m *ValidatorsInfo) GetLastHeightChanged() int64 { // ConsensusParamsInfo represents the latest consensus params, or the last height it changed type ConsensusParamsInfo struct { - ConsensusParams types1.ConsensusParams `protobuf:"bytes,1,opt,name=consensus_params,json=consensusParams,proto3" json:"consensus_params"` - LastHeightChanged int64 `protobuf:"varint,2,opt,name=last_height_changed,json=lastHeightChanged,proto3" json:"last_height_changed,omitempty"` + ConsensusParams types.ConsensusParams `protobuf:"bytes,1,opt,name=consensus_params,json=consensusParams,proto3" json:"consensus_params"` + LastHeightChanged int64 `protobuf:"varint,2,opt,name=last_height_changed,json=lastHeightChanged,proto3" json:"last_height_changed,omitempty"` } func (m *ConsensusParamsInfo) Reset() { *m = ConsensusParamsInfo{} } func (m *ConsensusParamsInfo) String() string { return proto.CompactTextString(m) } func (*ConsensusParamsInfo) ProtoMessage() {} func (*ConsensusParamsInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ccfacf933f22bf93, []int{2} + return fileDescriptor_ccfacf933f22bf93, []int{1} } func (m *ConsensusParamsInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -169,11 +121,11 @@ func (m *ConsensusParamsInfo) XXX_DiscardUnknown() { var xxx_messageInfo_ConsensusParamsInfo proto.InternalMessageInfo -func (m *ConsensusParamsInfo) GetConsensusParams() types1.ConsensusParams { +func (m *ConsensusParamsInfo) GetConsensusParams() types.ConsensusParams { if m != nil { return m.ConsensusParams } - return types1.ConsensusParams{} + return types.ConsensusParams{} } func (m *ConsensusParamsInfo) GetLastHeightChanged() int64 { @@ -192,7 +144,7 @@ func (m *Version) Reset() { *m = Version{} } func (m *Version) String() string { return proto.CompactTextString(m) } func (*Version) ProtoMessage() {} func (*Version) Descriptor() ([]byte, []int) { - return fileDescriptor_ccfacf933f22bf93, []int{3} + return fileDescriptor_ccfacf933f22bf93, []int{2} } func (m *Version) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -241,23 +193,23 @@ type State struct { ChainID string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` InitialHeight int64 `protobuf:"varint,14,opt,name=initial_height,json=initialHeight,proto3" json:"initial_height,omitempty"` // LastBlockHeight=0 at genesis (ie. block(H=0) does not exist) - LastBlockHeight int64 `protobuf:"varint,3,opt,name=last_block_height,json=lastBlockHeight,proto3" json:"last_block_height,omitempty"` - LastBlockID types1.BlockID `protobuf:"bytes,4,opt,name=last_block_id,json=lastBlockId,proto3" json:"last_block_id"` - LastBlockTime time.Time `protobuf:"bytes,5,opt,name=last_block_time,json=lastBlockTime,proto3,stdtime" json:"last_block_time"` + LastBlockHeight int64 `protobuf:"varint,3,opt,name=last_block_height,json=lastBlockHeight,proto3" json:"last_block_height,omitempty"` + LastBlockID types.BlockID `protobuf:"bytes,4,opt,name=last_block_id,json=lastBlockId,proto3" json:"last_block_id"` + LastBlockTime time.Time `protobuf:"bytes,5,opt,name=last_block_time,json=lastBlockTime,proto3,stdtime" json:"last_block_time"` // LastValidators is used to validate block.LastCommit. // Validators are persisted to the database separately every time they change, // so we can query for historical validator sets. // Note that if s.LastBlockHeight causes a valset change, // we set s.LastHeightValidatorsChanged = s.LastBlockHeight + 1 + 1 // Extra +1 due to nextValSet delay. - NextValidators *types1.ValidatorSet `protobuf:"bytes,6,opt,name=next_validators,json=nextValidators,proto3" json:"next_validators,omitempty"` - Validators *types1.ValidatorSet `protobuf:"bytes,7,opt,name=validators,proto3" json:"validators,omitempty"` - LastValidators *types1.ValidatorSet `protobuf:"bytes,8,opt,name=last_validators,json=lastValidators,proto3" json:"last_validators,omitempty"` - LastHeightValidatorsChanged int64 `protobuf:"varint,9,opt,name=last_height_validators_changed,json=lastHeightValidatorsChanged,proto3" json:"last_height_validators_changed,omitempty"` + NextValidators *types.ValidatorSet `protobuf:"bytes,6,opt,name=next_validators,json=nextValidators,proto3" json:"next_validators,omitempty"` + Validators *types.ValidatorSet `protobuf:"bytes,7,opt,name=validators,proto3" json:"validators,omitempty"` + LastValidators *types.ValidatorSet `protobuf:"bytes,8,opt,name=last_validators,json=lastValidators,proto3" json:"last_validators,omitempty"` + LastHeightValidatorsChanged int64 `protobuf:"varint,9,opt,name=last_height_validators_changed,json=lastHeightValidatorsChanged,proto3" json:"last_height_validators_changed,omitempty"` // Consensus parameters used for validating blocks. // Changes returned by EndBlock and updated after Commit. - ConsensusParams types1.ConsensusParams `protobuf:"bytes,10,opt,name=consensus_params,json=consensusParams,proto3" json:"consensus_params"` - LastHeightConsensusParamsChanged int64 `protobuf:"varint,11,opt,name=last_height_consensus_params_changed,json=lastHeightConsensusParamsChanged,proto3" json:"last_height_consensus_params_changed,omitempty"` + ConsensusParams types.ConsensusParams `protobuf:"bytes,10,opt,name=consensus_params,json=consensusParams,proto3" json:"consensus_params"` + LastHeightConsensusParamsChanged int64 `protobuf:"varint,11,opt,name=last_height_consensus_params_changed,json=lastHeightConsensusParamsChanged,proto3" json:"last_height_consensus_params_changed,omitempty"` // Merkle root of the results from executing prev block LastResultsHash []byte `protobuf:"bytes,12,opt,name=last_results_hash,json=lastResultsHash,proto3" json:"last_results_hash,omitempty"` // the latest AppHash we've received from calling abci.Commit() @@ -268,7 +220,7 @@ func (m *State) Reset() { *m = State{} } func (m *State) String() string { return proto.CompactTextString(m) } func (*State) ProtoMessage() {} func (*State) Descriptor() ([]byte, []int) { - return fileDescriptor_ccfacf933f22bf93, []int{4} + return fileDescriptor_ccfacf933f22bf93, []int{3} } func (m *State) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -325,11 +277,11 @@ func (m *State) GetLastBlockHeight() int64 { return 0 } -func (m *State) GetLastBlockID() types1.BlockID { +func (m *State) GetLastBlockID() types.BlockID { if m != nil { return m.LastBlockID } - return types1.BlockID{} + return types.BlockID{} } func (m *State) GetLastBlockTime() time.Time { @@ -339,21 +291,21 @@ func (m *State) GetLastBlockTime() time.Time { return time.Time{} } -func (m *State) GetNextValidators() *types1.ValidatorSet { +func (m *State) GetNextValidators() *types.ValidatorSet { if m != nil { return m.NextValidators } return nil } -func (m *State) GetValidators() *types1.ValidatorSet { +func (m *State) GetValidators() *types.ValidatorSet { if m != nil { return m.Validators } return nil } -func (m *State) GetLastValidators() *types1.ValidatorSet { +func (m *State) GetLastValidators() *types.ValidatorSet { if m != nil { return m.LastValidators } @@ -367,11 +319,11 @@ func (m *State) GetLastHeightValidatorsChanged() int64 { return 0 } -func (m *State) GetConsensusParams() types1.ConsensusParams { +func (m *State) GetConsensusParams() types.ConsensusParams { if m != nil { return m.ConsensusParams } - return types1.ConsensusParams{} + return types.ConsensusParams{} } func (m *State) GetLastHeightConsensusParamsChanged() int64 { @@ -396,7 +348,6 @@ func (m *State) GetAppHash() []byte { } func init() { - proto.RegisterType((*ABCIResponses)(nil), "tendermint.state.ABCIResponses") proto.RegisterType((*ValidatorsInfo)(nil), "tendermint.state.ValidatorsInfo") proto.RegisterType((*ConsensusParamsInfo)(nil), "tendermint.state.ConsensusParamsInfo") proto.RegisterType((*Version)(nil), "tendermint.state.Version") @@ -406,87 +357,49 @@ func init() { func init() { proto.RegisterFile("tendermint/state/types.proto", fileDescriptor_ccfacf933f22bf93) } var fileDescriptor_ccfacf933f22bf93 = []byte{ - // 717 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4d, 0x6f, 0xd3, 0x4a, - 0x14, 0x8d, 0x5f, 0x3f, 0x92, 0x4c, 0x9a, 0xa4, 0x6f, 0xfa, 0x16, 0x69, 0xfa, 0xea, 0xe4, 0x45, - 0x8f, 0xaa, 0x62, 0xe1, 0x48, 0xb0, 0x40, 0x6c, 0x90, 0x9a, 0x54, 0x50, 0x4b, 0x05, 0x81, 0x8b, - 0xba, 0x60, 0x81, 0x35, 0x71, 0x26, 0xf6, 0x08, 0xc7, 0xb6, 0x3c, 0x93, 0xf2, 0xb1, 0x67, 0xdf, - 0x2d, 0xff, 0xa8, 0xcb, 0x2e, 0x59, 0x15, 0x48, 0xff, 0x08, 0x9a, 0x0f, 0xdb, 0x93, 0x84, 0x45,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, 0x4c, 0xbd, 0x80, 0xbc, 0x43, 0x9e, 0x78, 0x86, - 0x99, 0xb3, 0x75, 0xa1, 0x9d, 0xa0, 0x05, 0x76, 0x42, 0x44, 0x99, 0x1b, 0x60, 0xe2, 0x07, 0xcc, - 0xf5, 0x02, 0x14, 0xf9, 0x78, 0x2c, 0xbc, 0xae, 0x39, 0x7f, 0x73, 0xe8, 0x44, 0x20, 0x43, 0x09, - 0xf4, 0xbe, 0x18, 0x60, 0x67, 0xc8, 0xdd, 0x46, 0x74, 0x46, 0x5f, 0x8a, 0x16, 0x0a, 0x33, 0x0e, - 0xd8, 0xf6, 0xb2, 0xb0, 0x2b, 0x5b, 0xab, 0xfc, 0xfc, 0xb7, 0xea, 0x67, 0x49, 0x60, 0xb0, 0x7e, - 0x75, 0xd3, 0x29, 0x39, 0x4d, 0x6f, 0x31, 0xfc, 0xdb, 0xde, 0x02, 0x50, 0x3e, 0x97, 0x6f, 0x07, - 0x8f, 0x40, 0x35, 0x57, 0x53, 0x3e, 0xf6, 0x75, 0x1f, 0xea, 0x8d, 0x0b, 0x27, 0xca, 0x43, 0x91, - 0x05, 0xdb, 0xa0, 0x42, 0xe3, 0x09, 0x7b, 0x8f, 0x52, 0x2c, 0x4a, 0x56, 0x9d, 0xfc, 0xdc, 0xfb, - 0xb1, 0x09, 0x36, 0xce, 0xf8, 0x28, 0xc3, 0xc7, 0xa0, 0xac, 0xb4, 0x54, 0x99, 0x5d, 0x6b, 0x79, - 0xdc, 0x2d, 0x65, 0x4a, 0x95, 0xc8, 0xf8, 0xf0, 0x00, 0x54, 0xbc, 0x00, 0x91, 0xc8, 0x25, 0xf2, - 0x4e, 0xd5, 0x41, 0x6d, 0x7e, 0xd3, 0x29, 0x0f, 0x79, 0xcc, 0x3e, 0x76, 0xca, 0x02, 0xb4, 0xc7, - 0xf0, 0x1e, 0x68, 0x90, 0x88, 0x30, 0x82, 0x42, 0xd5, 0x89, 0x56, 0x43, 0x74, 0xa0, 0xae, 0xa2,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0xab, 0x6b, 0x1c, 0x6e, 0xc9, 0x41, 0x74, 0x64, 0xfc, 0x04, 0xd1, - 0x00, 0xee, 0x82, 0x0a, 0x4a, 0x12, 0x49, 0xa9, 0x0b, 0x4a, 0x19, 0x25, 0x09, 0x87, 0x06, 0xaf, - 0xae, 0xe6, 0xa6, 0x71, 0x3d, 0x37, 0x8d, 0xef, 0x73, 0xd3, 0xb8, 0xbc, 0x35, 0x4b, 0xd7, 0xb7, - 0x66, 0xe9, 0xeb, 0xad, 0x59, 0x7a, 0xf3, 0xc8, 0x27, 0x2c, 0x98, 0x8d, 0x2c, 0x2f, 0x9e, 0xf6, - 0xf5, 0xbf, 0xf5, 0xe2, 0xa7, 0xfc, 0xb6, 0x2c, 0x7f, 0x95, 0x46, 0x9b, 0x22, 0xfe, 0xf0, 0x67, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0xe8, 0x4c, 0x4d, 0xb0, 0x06, 0x00, 0x00, -} - -func (m *ABCIResponses) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ABCIResponses) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ABCIResponses) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.FinalizeBlock != nil { - { - size, err := m.FinalizeBlock.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil + // 662 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4f, 0x6f, 0xd3, 0x30, + 0x1c, 0x6d, 0xd8, 0x9f, 0xb6, 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x23, 0xc4, 0x22, 0x7b, 0xab, + 0x67, 0x1d, 0x6c, 0xa9, 0x20, 0x7a, 0xaa, 0x7e, 0x84, 0x58, 0x04, 0x77, 0x41, 0x0d, 0xa5, 0xa9, + 0xa2, 0x34, 0x25, 0xa5, 0x8a, 0xd2, 0x54, 0x40, 0x83, 0xf7, 0x97, 0x73, 0xc7, 0xba, 0x9a, 0x3b, + 0xd6, 0xaf, 0xb9, 0x63, 0x5d, 0xdc, 0x38, 0x95, 0xab, 0x1b, 0xa7, 0xf2, 0xe3, 0xc6, 0xa9, 0x7c, + 0x7c, 0x11, 0x12, 0x1e, 0xcd, 0xc6, 0xee, 0x84, 0x4e, 0xfb, 0xe6, 0x67, 0xb7, 0xfc, 0xa9, 0x3e, + 0xef, 0xcb, 0x7f, 0x0c, 0xe3, 0x4d, 0x59, 0x7f, 0xfe, 0x27, 0x00, 0x00, 0xff, 0xff, 0x3f, 0xca, + 0x73, 0xb6, 0x33, 0x06, 0x00, 0x00, } func (m *ValidatorsInfo) Marshal() (dAtA []byte, err error) { @@ -702,12 +615,12 @@ func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x32 } - n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LastBlockTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.LastBlockTime):]) - if err9 != nil { - return 0, err9 + n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LastBlockTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.LastBlockTime):]) + if err8 != nil { + return 0, err8 } - i -= n9 - i = encodeVarintTypes(dAtA, i, uint64(n9)) + i -= n8 + i = encodeVarintTypes(dAtA, i, uint64(n8)) i-- dAtA[i] = 0x2a { @@ -756,19 +669,6 @@ func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *ABCIResponses) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.FinalizeBlock != nil { - l = m.FinalizeBlock.Size() - n += 1 + l + sovTypes(uint64(l)) - } - return n -} - func (m *ValidatorsInfo) Size() (n int) { if m == nil { return 0 @@ -873,92 +773,6 @@ func sovTypes(x uint64) (n int) { func sozTypes(x uint64) (n int) { return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *ABCIResponses) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ABCIResponses: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ABCIResponses: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FinalizeBlock", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.FinalizeBlock == nil { - m.FinalizeBlock = &types.ResponseFinalizeBlock{} - } - if err := m.FinalizeBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *ValidatorsInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1018,7 +832,7 @@ func (m *ValidatorsInfo) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ValidatorSet == nil { - m.ValidatorSet = &types1.ValidatorSet{} + m.ValidatorSet = &types.ValidatorSet{} } if err := m.ValidatorSet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1490,7 +1304,7 @@ func (m *State) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.NextValidators == nil { - m.NextValidators = &types1.ValidatorSet{} + m.NextValidators = &types.ValidatorSet{} } if err := m.NextValidators.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1526,7 +1340,7 @@ func (m *State) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Validators == nil { - m.Validators = &types1.ValidatorSet{} + m.Validators = &types.ValidatorSet{} } if err := m.Validators.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1562,7 +1376,7 @@ func (m *State) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.LastValidators == nil { - m.LastValidators = &types1.ValidatorSet{} + m.LastValidators = &types.ValidatorSet{} } if err := m.LastValidators.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/proto/tendermint/state/types.proto b/proto/tendermint/state/types.proto index 35eab761d..5bcbfbf41 100644 --- a/proto/tendermint/state/types.proto +++ b/proto/tendermint/state/types.proto @@ -4,20 +4,12 @@ package tendermint.state; option go_package = "github.com/tendermint/tendermint/proto/tendermint/state"; import "gogoproto/gogo.proto"; -import "tendermint/abci/types.proto"; import "tendermint/types/types.proto"; import "tendermint/types/validator.proto"; import "tendermint/types/params.proto"; import "tendermint/version/types.proto"; import "google/protobuf/timestamp.proto"; -// ABCIResponses retains the responses -// of the various ABCI calls during block processing. -// It is persisted to disk for each height before calling Commit. -message ABCIResponses { - tendermint.abci.ResponseFinalizeBlock finalize_block = 2; -} - // ValidatorsInfo represents the latest validator set, or the last height it changed message ValidatorsInfo { tendermint.types.ValidatorSet validator_set = 1; diff --git a/rpc/jsonrpc/server/http_json_handler.go b/rpc/jsonrpc/server/http_json_handler.go index 2eeded2d7..4f9e28faa 100644 --- a/rpc/jsonrpc/server/http_json_handler.go +++ b/rpc/jsonrpc/server/http_json_handler.go @@ -81,9 +81,15 @@ func makeJSONRPCHandler(funcMap map[string]*RPCFunc, logger log.Logger) http.Han } } +func ensureBodyClose(next http.HandlerFunc) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + defer r.Body.Close() + next(w, r) + } +} + func handleInvalidJSONRPCPaths(next http.HandlerFunc) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - // Since the pattern "/" matches all paths not matched by other registered patterns, // we check whether the path is indeed "/", otherwise return a 404 error if r.URL.Path != "/" { http.NotFound(w, r) diff --git a/rpc/jsonrpc/server/http_json_handler_test.go b/rpc/jsonrpc/server/http_json_handler_test.go index 77c74ffbc..dd4a9d8e2 100644 --- a/rpc/jsonrpc/server/http_json_handler_test.go +++ b/rpc/jsonrpc/server/http_json_handler_test.go @@ -223,7 +223,7 @@ func TestRPCNotificationInBatch(t *testing.T) { func TestUnknownRPCPath(t *testing.T) { mux := testMux() - req, _ := http.NewRequest("GET", "http://localhost/unknownrpcpath", nil) + req, _ := http.NewRequest("GET", "http://localhost/unknownrpcpath", strings.NewReader("")) rec := httptest.NewRecorder() mux.ServeHTTP(rec, req) res := rec.Result() diff --git a/rpc/jsonrpc/server/rpc_func.go b/rpc/jsonrpc/server/rpc_func.go index 1fff323d7..947f8be5b 100644 --- a/rpc/jsonrpc/server/rpc_func.go +++ b/rpc/jsonrpc/server/rpc_func.go @@ -26,11 +26,11 @@ func RegisterRPCFuncs(mux *http.ServeMux, funcMap map[string]*RPCFunc, logger lo if fn.ws { continue // skip websocket endpoints, not usable via GET calls } - mux.HandleFunc("/"+name, makeHTTPHandler(fn, logger)) + mux.HandleFunc("/"+name, ensureBodyClose(makeHTTPHandler(fn, logger))) } // Endpoints for POST. - mux.HandleFunc("/", handleInvalidJSONRPCPaths(makeJSONRPCHandler(funcMap, logger))) + mux.HandleFunc("/", ensureBodyClose(handleInvalidJSONRPCPaths(makeJSONRPCHandler(funcMap, logger)))) } // Function introspection diff --git a/scripts/confix/plan.go b/scripts/confix/plan.go index a0ceef937..706343338 100644 --- a/scripts/confix/plan.go +++ b/scripts/confix/plan.go @@ -228,4 +228,10 @@ var plan = transform.Plan{ T: transform.Remove(parser.Key{"mempool", "recheck"}), ErrorOK: true, }, + { + // Since https://github.com/tendermint/tendermint/pull/8654. + Desc: "Remove the seeds option from the [p2p] section", + T: transform.Remove(parser.Key{"p2p", "seeds"}), + ErrorOK: true, + }, } diff --git a/scripts/confix/testdata/diff-35-36.txt b/scripts/confix/testdata/diff-35-36.txt index 76f541b28..298c53056 100644 --- a/scripts/confix/testdata/diff-35-36.txt +++ b/scripts/confix/testdata/diff-35-36.txt @@ -16,6 +16,7 @@ -M p2p.max-num-inbound-peers -M p2p.max-num-outbound-peers -M p2p.persistent-peers-max-dial-period +-M p2p.seeds -M p2p.unconditional-peer-ids -M p2p.use-legacy +M rpc.event-log-max-items diff --git a/scripts/confix/testdata/v36-config.toml b/scripts/confix/testdata/v36-config.toml index 0182ab14c..612f46ece 100644 --- a/scripts/confix/testdata/v36-config.toml +++ b/scripts/confix/testdata/v36-config.toml @@ -157,7 +157,7 @@ experimental-disable-websocket = false # the latest (up to EventLogMaxItems) will be available for subscribers to # fetch via the /events method. If 0 (the default) the event log and the # /events RPC method are disabled. -event-log-window-size = "0s" +event-log-window-size = "30s" # The maxiumum number of events that may be retained by the event log. If # this value is 0, no upper limit is set. Otherwise, items in excess of @@ -221,13 +221,6 @@ laddr = "tcp://0.0.0.0:26656" # example: 159.89.10.97:26656 external-address = "" -# Comma separated list of seed nodes to connect to -# We only use these if we can’t connect to peers in the addrbook -# NOTE: not used by the new PEX reactor. Please use BootstrapPeers instead. -# TODO: Remove once p2p refactor is complete -# ref: https:#github.com/tendermint/tendermint/issues/5670 -seeds = "" - # Comma separated list of peers to be added to the peer store # on startup. Either BootstrapPeers or PersistentPeers are # needed for peer discovery diff --git a/scripts/mockery_generate.sh b/scripts/mockery_generate.sh index 382c277bb..2d6f40e63 100755 --- a/scripts/mockery_generate.sh +++ b/scripts/mockery_generate.sh @@ -1,3 +1,15 @@ #!/bin/sh +# +# Invoke Mockery v2 to update generated mocks for the given type. +# +# This script runs a locally-installed "mockery" if available, otherwise it +# runs the published Docker container. This legerdemain is so that the CI build +# and a local build can work off the same script. +# +if ! which mockery ; then + mockery() { + docker run --rm -v "$PWD":/w --workdir=/w vektra/mockery:v2.12.3 + } +fi -go run github.com/vektra/mockery/v2 --disable-version-string --case underscore --name $* +mockery --disable-version-string --case underscore --name "$@" diff --git a/test/e2e/app/app.go b/test/e2e/app/app.go index 788f296b7..771b72643 100644 --- a/test/e2e/app/app.go +++ b/test/e2e/app/app.go @@ -210,6 +210,7 @@ func (app *Application) FinalizeBlock(_ context.Context, req *abci.RequestFinali return &abci.ResponseFinalizeBlock{ TxResults: txs, ValidatorUpdates: valUpdates, + AppHash: app.state.Finalize(), Events: []abci.Event{ { Type: "val_updates", @@ -233,7 +234,7 @@ func (app *Application) Commit(_ context.Context) (*abci.ResponseCommit, error) app.mu.Lock() defer app.mu.Unlock() - height, hash, err := app.state.Commit() + height, err := app.state.Commit() if err != nil { panic(err) } @@ -253,7 +254,6 @@ func (app *Application) Commit(_ context.Context) (*abci.ResponseCommit, error) retainHeight = int64(height - app.cfg.RetainBlocks + 1) } return &abci.ResponseCommit{ - Data: hash, RetainHeight: retainHeight, }, nil } diff --git a/test/e2e/app/state.go b/test/e2e/app/state.go index 17d8cd75f..91b1a32d5 100644 --- a/test/e2e/app/state.go +++ b/test/e2e/app/state.go @@ -137,8 +137,8 @@ func (s *State) Set(key, value string) { } } -// Commit commits the current state. -func (s *State) Commit() (uint64, []byte, error) { +// Finalize is called after applying a block, updating the height and returning the new app_hash +func (s *State) Finalize() []byte { s.Lock() defer s.Unlock() switch { @@ -150,13 +150,20 @@ func (s *State) Commit() (uint64, []byte, error) { s.Height = 1 } s.Hash = hashItems(s.Values, s.Height) + return s.Hash +} + +// Commit commits the current state. +func (s *State) Commit() (uint64, error) { + s.Lock() + defer s.Unlock() if s.persistInterval > 0 && s.Height%s.persistInterval == 0 { err := s.save() if err != nil { - return 0, nil, err + return 0, err } } - return s.Height, s.Hash, nil + return s.Height, nil } func (s *State) Rollback() error { diff --git a/test/e2e/generator/generate.go b/test/e2e/generator/generate.go index 0e8470111..01e04a418 100644 --- a/test/e2e/generator/generate.go +++ b/test/e2e/generator/generate.go @@ -14,14 +14,14 @@ var ( // testnetCombinations defines global testnet options, where we generate a // separate testnet for each combination (Cartesian product) of options. testnetCombinations = map[string][]interface{}{ - "topology": {"single", "quad", "large"}, - "initialHeight": {0, 1000}, + "topology": {"single", "quad", "large"}, "initialState": { map[string]string{}, map[string]string{"initial01": "a", "initial02": "b", "initial03": "c"}, }, "validators": {"genesis", "initchain"}, "abci": {"builtin", "outofprocess"}, + "txSize": {1024, 2048, 4096, 8192}, } // The following specify randomly chosen values for testnet nodes. @@ -63,11 +63,11 @@ var ( } // the following specify random chosen values for the entire testnet - evidence = uniformChoice{0, 1, 10} - txSize = uniformChoice{1024, 4096} // either 1kb or 4kb - ipv6 = uniformChoice{false, true} - keyType = uniformChoice{types.ABCIPubKeyTypeEd25519, types.ABCIPubKeyTypeSecp256k1} - abciDelays = uniformChoice{"none", "small", "large"} + initialHeight = uniformChoice{0, 1000} + evidence = uniformChoice{0, 1, 10} + ipv6 = uniformChoice{false, true} + keyType = uniformChoice{types.ABCIPubKeyTypeEd25519, types.ABCIPubKeyTypeSecp256k1} + abciDelays = uniformChoice{"none", "small", "large"} voteExtensionEnableHeightOffset = uniformChoice{int64(0), int64(10), int64(100)} voteExtensionEnabled = uniformChoice{true, false} @@ -109,7 +109,6 @@ type Options struct { func generateTestnet(r *rand.Rand, opt map[string]interface{}) (e2e.Manifest, error) { manifest := e2e.Manifest{ IPv6: ipv6.Choose(r).(bool), - InitialHeight: int64(opt["initialHeight"].(int)), InitialState: opt["initialState"].(map[string]string), Validators: &map[string]int64{}, ValidatorUpdates: map[string]map[string]int64{}, @@ -117,9 +116,11 @@ func generateTestnet(r *rand.Rand, opt map[string]interface{}) (e2e.Manifest, er KeyType: keyType.Choose(r).(string), Evidence: evidence.Choose(r).(int), QueueType: "priority", - TxSize: txSize.Choose(r).(int), + TxSize: opt["txSize"].(int), } + manifest.InitialHeight = int64(initialHeight.Choose(r).(int)) + if voteExtensionEnabled.Choose(r).(bool) { manifest.VoteExtensionsEnableHeight = manifest.InitialHeight + voteExtensionEnableHeightOffset.Choose(r).(int64) } diff --git a/test/e2e/node/main.go b/test/e2e/node/main.go index 94c1af1ab..57e92aa9a 100644 --- a/test/e2e/node/main.go +++ b/test/e2e/node/main.go @@ -68,35 +68,37 @@ func run(ctx context.Context, configFile string) error { return err } - // Start remote signer (must start before node if running builtin). - if cfg.PrivValServer != "" { - if err = startSigner(ctx, logger, cfg); err != nil { - logger.Error("starting signer", - "server", cfg.PrivValServer, - "err", err) - return err + if cfg.Mode == string(e2e.ModeLight) { + err = startLightNode(ctx, logger, cfg) + } else { + // Start remote signer (must start before node if running builtin). + if cfg.PrivValServer != "" { + if err = startSigner(ctx, logger, cfg); err != nil { + logger.Error("starting signer", + "server", cfg.PrivValServer, + "err", err) + return err + } + if cfg.Protocol == "builtin" { + time.Sleep(1 * time.Second) + } } - if cfg.Protocol == "builtin" { - time.Sleep(1 * time.Second) + + // Start app server. + switch cfg.Protocol { + case "socket", "grpc": + err = startApp(ctx, logger, cfg) + case "builtin": + if cfg.Mode == string(e2e.ModeSeed) { + err = startSeedNode(ctx) + } else { + err = startNode(ctx, cfg) + } + default: + err = fmt.Errorf("invalid protocol %q", cfg.Protocol) } } - // Start app server. - switch cfg.Protocol { - case "socket", "grpc": - err = startApp(ctx, logger, cfg) - case "builtin": - switch cfg.Mode { - case string(e2e.ModeLight): - err = startLightNode(ctx, logger, cfg) - case string(e2e.ModeSeed): - err = startSeedNode(ctx) - default: - err = startNode(ctx, cfg) - } - default: - err = fmt.Errorf("invalid protocol %q", cfg.Protocol) - } if err != nil { logger.Error("starting node", "protocol", cfg.Protocol, diff --git a/test/e2e/pkg/testnet.go b/test/e2e/pkg/testnet.go index 0e87466b0..a5c8dffd6 100644 --- a/test/e2e/pkg/testnet.go +++ b/test/e2e/pkg/testnet.go @@ -310,6 +310,12 @@ func (t Testnet) Validate() error { default: return errors.New("unsupported KeyType") } + switch t.ABCIProtocol { + case ProtocolBuiltin, ProtocolUNIX, ProtocolTCP, ProtocolGRPC: + default: + return fmt.Errorf("invalid ABCI protocol setting %q", t.ABCIProtocol) + } + for _, node := range t.Nodes { if err := node.Validate(t); err != nil { return fmt.Errorf("invalid node %q: %w", node.Name, err) diff --git a/test/e2e/runner/setup.go b/test/e2e/runner/setup.go index 5887f13ef..9e6e5cc18 100644 --- a/test/e2e/runner/setup.go +++ b/test/e2e/runner/setup.go @@ -322,14 +322,6 @@ func MakeConfig(node *e2e.Node) (*config.Config, error) { } } - cfg.P2P.Seeds = "" //nolint: staticcheck - for _, seed := range node.Seeds { - if len(cfg.P2P.Seeds) > 0 { //nolint: staticcheck - cfg.P2P.Seeds += "," //nolint: staticcheck - } - cfg.P2P.Seeds += seed.AddressP2P(true) //nolint: staticcheck - } - cfg.P2P.PersistentPeers = "" for _, peer := range node.PersistentPeers { if len(cfg.P2P.PersistentPeers) > 0 { @@ -362,6 +354,7 @@ func MakeAppConfig(node *e2e.Node) ([]byte, error) { "vote_extension_delay_ms": node.Testnet.VoteExtensionDelayMS, "finalize_block_delay_ms": node.Testnet.FinalizeBlockDelayMS, } + switch node.Testnet.ABCIProtocol { case e2e.ProtocolUNIX: cfg["listen"] = AppAddressUNIX diff --git a/test/fuzz/oss-fuzz-build.sh b/test/fuzz/oss-fuzz-build.sh index 836253d4d..528290c18 100755 --- a/test/fuzz/oss-fuzz-build.sh +++ b/test/fuzz/oss-fuzz-build.sh @@ -1,5 +1,6 @@ #!/bin/bash - +# This script is invoked by OSS-Fuzz to run fuzz tests against Tendermint core. +# See https://github.com/google/oss-fuzz/blob/master/projects/tendermint/build.sh set -euo pipefail export FUZZ_ROOT="github.com/tendermint/tendermint" @@ -8,12 +9,12 @@ build_go_fuzzer() { local function="$1" local fuzzer="$2" - gotip run github.com/orijtech/otils/corpus2ossfuzz@latest -o "$OUT"/"$fuzzer"_seed_corpus.zip -corpus test/fuzz/tests/testdata/fuzz/"$function" + go run github.com/orijtech/otils/corpus2ossfuzz@latest -o "$OUT"/"$fuzzer"_seed_corpus.zip -corpus test/fuzz/tests/testdata/fuzz/"$function" compile_native_go_fuzzer "$FUZZ_ROOT"/test/fuzz/tests "$function" "$fuzzer" } -gotip get github.com/AdamKorcz/go-118-fuzz-build/utils -gotip get github.com/prometheus/common/expfmt@v0.32.1 +go get github.com/AdamKorcz/go-118-fuzz-build/utils +go get github.com/prometheus/common/expfmt@v0.32.1 build_go_fuzzer FuzzP2PSecretConnection fuzz_p2p_secretconnection