diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 59a1be47b7f9..1411ed22a892 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2,12 +2,75 @@ # NOTE: Order is important; the last matching pattern takes the most precedence -# Primary repo maintainers +# Cosmos SDK Codeowners -* @cosmos/sdk-core-dev +# Core team as default owners -# CODEOWNERS for docs configuration +* @cosmos/sdk-core-dev +# Components + +/baseapp/ @facundomedica @aaronc @testinginprod @kocubinski @cosmos/sdk-core-dev +/client/ @julienrbrt @JulianToledano @cosmos/sdk-core-dev +/client/v2/ @julienrbrt @JulianToledano @cosmos/sdk-core-dev +/collections/ @testinginprod @facundomedica @cosmos/sdk-core-dev +/core/ @cosmos/sdk-core-dev +/crypto/ @JulianToledano @raynaudoe @cosmos/sdk-core-dev +/depinject/ @aaronc @kocubinski @julienrbrt @cosmos/sdk-core-dev +/indexer/ @aaronc @cool-develope @cosmos/sdk-core-dev +/log/ @julienrbrt @sontrinh16 @cosmos/sdk-core-dev +/math/ @testinginprod @alpe @cosmos/sdk-core-dev +/orm/ @aaronc @testinginprod @lucaslopezf @cosmos/sdk-core-dev +/runtime/ @julienrbrt @hieuvubk @cosmos/sdk-core-dev +/runtime/v2/ @julienrbrt @hieuvubk @cosmos/sdk-core-dev +/schema/ @aaronc @testinginprod @cosmos/sdk-core-dev +/server/ @cosmos/sdk-core-dev +/server/v2/ @julienrbrt @hieuvubk @cosmos/sdk-core-dev +/server/v2/stf/ @testinginprod @kocubinski @cosmos/sdk-core-dev +/server/v2/appmanager/ @testinginprod @facundomedica @cosmos/sdk-core-dev +/server/v2/cometbft/ @facundomedica @sontrinh16 @cosmos/sdk-core-dev +/simapp/ @facundomedica @julienrbrt @cosmos/sdk-core-dev +/simapp/v2/ @kocubinski @julienrbrt @cosmos/sdk-core-dev +/store/ @cool-develope @kocubinski @cosmos/sdk-core-dev +/store/v2/ @cool-develope @kocubinski @cosmos/sdk-core-dev +/types/mempool/ @kocubinski @cosmos/sdk-core-dev +/tools/hubl @julienrbrt @JulianToledano @cosmos/sdk-core-dev +/tools/cosmovisor @julienrbrt @facundomedica @cosmos/sdk-core-dev +/tools/confix @julienrbrt @akhilkumarpilli @cosmos/sdk-core-dev + +# x modules + +/x/accounts/ @testinginprod @sontrinh16 @cosmos/sdk-core-dev +/x/auth/ @facundomedica @testinginprod @aaronc @cosmos/sdk-core-dev +/x/authz/ @akhilkumarpilli @raynaudoe @cosmos/sdk-core-dev +/x/bank/ @julienrbrt @sontrinh16 @cosmos/sdk-core-dev +/x/circuit/ @kocubinski @akhilkumarpilli @raynaudoe @cosmos/sdk-core-dev +/x/consensus/ @testinginprod @raynaudoe @cosmos/sdk-core-dev +/x/distribution/ @alpe @JulianToledano @cosmos/sdk-core-dev +/x/epochs/ @alpe @facundomedica @cosmos/sdk-core-dev +/x/evidence/ @alpe @akhilkumarpilli @cosmos/sdk-core-dev +/x/feegrant/ @cool-develope @alpe @cosmos/sdk-core-dev +/x/genutil/ @kocubinski @hieuvubk @julienrbrt @cosmos/sdk-core-dev +/x/gov/ @julienrbrt @sontrinh16 @cosmos/sdk-core-dev +/x/group/ @kocubinski @akhilkumarpilli @cosmos/sdk-core-dev +/x/mint/ @lucaslopezf @facundomedica @cosmos/sdk-core-dev +/x/nft/ @alpe @lucaslopezf @cosmos/sdk-core-dev +/x/params/ @cosmos/sdk-core-dev # deprecated so whole team +/x/protocolpool/ @facundomedica @hieuvubk @alpe @cosmos/sdk-core-dev +/x/simulation/ @cosmos/sdk-core-dev # deprecated so whole team +/x/slashing/ @testinginprod @raynaudoe @lucaslopezf @cosmos/sdk-core-dev +/x/staking/ @facundomedica @testinginprod @JulianToledano @ziscky @cosmos/sdk-core-dev +/x/tx/ @kocubinski @testinginprod @aaronc @cosmos/sdk-core-dev +/x/upgrade/ @facundomedica @cool-develope @akhilkumarpilli @lucaslopezf @cosmos/sdk-core-dev + +# go mods + +**/go.mod @cosmos/sdk-core-dev +**/go.sum @cosmos/sdk-core-dev + +# docs configuration + +/docs/ @cosmos/sdk-core-dev /docs/docusaurus.config.js @julienrbrt @tac0turtle /docs/sidebars.js @julienrbrt @tac0turtle /docs/pre.sh @julienrbrt @tac0turtle diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4418a28b373a..a5ce144c9f2d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ jobs: - uses: DeterminateSystems/magic-nix-cache-action@main - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true ################### #### Build App #### diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ed85efa0d1b8..da75289545b6 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -29,7 +29,7 @@ jobs: uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL @@ -37,7 +37,7 @@ jobs: with: languages: "go" config-file: ./.github/codeql/config.yml - + # If you wish to specify custom queries, you can do so here or in a config file. # By default, queries listed here will override any specified in a config file. # Prefix the list here with "+" to use these queries and those in the config file. diff --git a/.github/workflows/dependabot-update-all.yml b/.github/workflows/dependabot-update-all.yml index 1b50b9ab5de6..01e1ecc4eb4a 100644 --- a/.github/workflows/dependabot-update-all.yml +++ b/.github/workflows/dependabot-update-all.yml @@ -4,6 +4,9 @@ on: pull_request permissions: pull-requests: write +env: + PR_TITLE: ${{ github.event.pull_request.title }} + jobs: update-all: runs-on: ubuntu-latest @@ -17,7 +20,7 @@ jobs: token: ${{ secrets.PRBOT_PAT }} - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - name: Extract updated dependency id: deps @@ -25,8 +28,8 @@ jobs: # Extract the dependency name from the PR title # Example: "build(deps): Bump github.com/cosmos/cosmos-sdk from 0.46.0 to 0.47.0" # Extracts "github.com/cosmos/cosmos-sdk" and "0.47.0" - echo "name=$(echo "${{ github.event.pull_request.title }}" | cut -d ' ' -f 3)" >> $GITHUB_OUTPUT - echo "version=$(echo "${{ github.event.pull_request.title }}" | cut -d ' ' -f 7)" >> $GITHUB_OUTPUT + echo "name=$(echo "$PR_TITLE" | cut -d ' ' -f 3)" >> $GITHUB_OUTPUT + echo "version=$(echo "$PR_TITLE" | cut -d ' ' -f 7)" >> $GITHUB_OUTPUT - name: Update all Go modules run: | ./scripts/go-update-dep-all.sh ${{ format('{0}@v{1}', steps.deps.outputs.name, steps.deps.outputs.version) }} diff --git a/.github/workflows/dependencies-review.yml b/.github/workflows/dependencies-review.yml index 5a08d1c6e0ec..553b6efbf3e9 100644 --- a/.github/workflows/dependencies-review.yml +++ b/.github/workflows/dependencies-review.yml @@ -14,7 +14,7 @@ jobs: uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - name: "Dependency Review" uses: actions/dependency-review-action@v4 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1b61aa2b1748..846bde4c75a9 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,12 +18,13 @@ jobs: - uses: DeterminateSystems/magic-nix-cache-action@main - uses: actions/setup-go@v5 with: - go-version: "1.22.2" + go-version: "1.23" check-latest: true - uses: technote-space/get-diff-action@v6.1.2 id: git_diff with: PATTERNS: | + **/*.mk Makefile **/Makefile .golangci.yml diff --git a/.github/workflows/pr-go-mod-tidy-mocks.yml b/.github/workflows/pr-go-mod-tidy-mocks.yml index 30f4a697385f..76b5ad1f86f7 100644 --- a/.github/workflows/pr-go-mod-tidy-mocks.yml +++ b/.github/workflows/pr-go-mod-tidy-mocks.yml @@ -20,7 +20,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - name: Run go mod tidy run: ./scripts/go-mod-tidy-all.sh @@ -40,7 +40,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - name: Generate mocks run: make mocks diff --git a/.github/workflows/proto.yml b/.github/workflows/proto.yml index 05c577e55f8e..d5f05958f9c0 100644 --- a/.github/workflows/proto.yml +++ b/.github/workflows/proto.yml @@ -15,7 +15,7 @@ jobs: timeout-minutes: 5 steps: - uses: actions/checkout@v4 - - uses: bufbuild/buf-setup-action@v1.36.0 + - uses: bufbuild/buf-setup-action@v1.38.0 - uses: bufbuild/buf-lint-action@v1 with: input: "proto" @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: bufbuild/buf-setup-action@v1.36.0 + - uses: bufbuild/buf-setup-action@v1.38.0 - uses: bufbuild/buf-breaking-action@v1 with: input: "proto" diff --git a/.github/workflows/release-confix.yml b/.github/workflows/release-confix.yml index 2ea64f987853..da465a088103 100644 --- a/.github/workflows/release-confix.yml +++ b/.github/workflows/release-confix.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true # get 'v*.*.*' part from 'confix/v*.*.*' and save to $GITHUB_ENV - name: Set env diff --git a/.github/workflows/release-cosmovisor.yml b/.github/workflows/release-cosmovisor.yml index 0256a4433e18..acef3820e26b 100644 --- a/.github/workflows/release-cosmovisor.yml +++ b/.github/workflows/release-cosmovisor.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true # get 'v*.*.*' part from 'cosmovisor/v*.*.*' and save to $GITHUB_ENV - name: Set env diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ea3521e9e411..962a75136f06 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: - name: Install Go uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - name: Unshallow run: git fetch --prune --unshallow diff --git a/.github/workflows/sims-047.yml b/.github/workflows/sims-047.yml index 2115681b3d3d..4a6a0427d751 100644 --- a/.github/workflows/sims-047.yml +++ b/.github/workflows/sims-047.yml @@ -21,7 +21,7 @@ jobs: ref: "release/v0.47.x" - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - run: make build @@ -33,7 +33,7 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - name: Install runsim run: go install github.com/cosmos/tools/cmd/runsim@v1.0.0 @@ -52,7 +52,7 @@ jobs: ref: "release/v0.47.x" - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - uses: actions/cache@v4 with: @@ -71,7 +71,7 @@ jobs: ref: "release/v0.47.x" - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - uses: actions/cache@v4 with: @@ -90,7 +90,7 @@ jobs: ref: "release/v0.47.x" - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - uses: actions/cache@v4 with: diff --git a/.github/workflows/sims-050.yml b/.github/workflows/sims-050.yml index e22e8e4aa895..afc04b2a0ea5 100644 --- a/.github/workflows/sims-050.yml +++ b/.github/workflows/sims-050.yml @@ -21,7 +21,7 @@ jobs: ref: "release/v0.50.x" - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - run: make build @@ -33,7 +33,7 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - name: Install runsim run: go install github.com/cosmos/tools/cmd/runsim@v1.0.0 @@ -52,7 +52,7 @@ jobs: ref: "release/v0.50.x" - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - uses: actions/cache@v4 with: @@ -71,7 +71,7 @@ jobs: ref: "release/v0.50.x" - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - uses: actions/cache@v4 with: @@ -90,7 +90,7 @@ jobs: ref: "release/v0.50.x" - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - uses: actions/cache@v4 with: diff --git a/.github/workflows/sims-052.yml b/.github/workflows/sims-052.yml index b64d6332b76f..03ee9ef9234e 100644 --- a/.github/workflows/sims-052.yml +++ b/.github/workflows/sims-052.yml @@ -23,7 +23,7 @@ jobs: ref: "release/v0.52.x" - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - run: make build @@ -37,7 +37,7 @@ jobs: ref: "release/v0.52.x" - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - name: test-sim-import-export run: | @@ -53,7 +53,7 @@ jobs: ref: "release/v0.52.x" - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - name: test-sim-after-import run: | @@ -69,7 +69,7 @@ jobs: ref: "release/v0.52.x" - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - name: test-sim-nondeterminism-streaming run: | @@ -85,7 +85,7 @@ jobs: ref: "release/v0.52.x" - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - name: test-sim-multi-seed-short run: | diff --git a/.github/workflows/sims-nightly.yml b/.github/workflows/sims-nightly.yml index a4a1526223fb..0473bcad5268 100644 --- a/.github/workflows/sims-nightly.yml +++ b/.github/workflows/sims-nightly.yml @@ -21,9 +21,11 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - name: test-sim-multi-seed-long + env: + GOMEMLIMIT: 14GiB # reserve 2 GiB as buffer for GC to avoid OOM run: | make test-sim-multi-seed-long diff --git a/.github/workflows/sims.yml b/.github/workflows/sims.yml index 4b695d79ab4b..bb7cf1faf417 100644 --- a/.github/workflows/sims.yml +++ b/.github/workflows/sims.yml @@ -21,7 +21,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - run: make build @@ -33,7 +33,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - name: test-sim-import-export run: | @@ -47,7 +47,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - name: test-sim-after-import run: | @@ -61,7 +61,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - name: test-sim-nondeterminism-streaming run: | @@ -75,7 +75,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - name: test-sim-multi-seed-short run: | diff --git a/.github/workflows/software-compat-v052.yml b/.github/workflows/software-compat-v052.yml index ba6e7cd4b805..c3b6d02c64d7 100644 --- a/.github/workflows/software-compat-v052.yml +++ b/.github/workflows/software-compat-v052.yml @@ -18,7 +18,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - name: Test v052 with latest main run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 92c9914c14dc..0c3945eb1213 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true - name: Create a file with all core Cosmos SDK pkgs run: go list ./... > pkgs.txt @@ -54,7 +54,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: go.sum @@ -88,7 +88,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: go.sum @@ -119,7 +119,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: go.sum @@ -153,7 +153,7 @@ jobs: fetch-tags: true - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: | @@ -247,7 +247,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: go.sum @@ -280,7 +280,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: client/v2/go.sum @@ -311,7 +311,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.20" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: core/go.sum @@ -341,7 +341,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.20" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: core/testing/go.sum @@ -485,7 +485,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" cache: true cache-dependency-path: schema/testing/go.sum - uses: technote-space/get-diff-action@v6.1.2 @@ -515,7 +515,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" cache: true cache-dependency-path: indexer/postgres/tests/go.sum - uses: technote-space/get-diff-action@v6.1.2 @@ -551,7 +551,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: simapp/go.sum @@ -579,7 +579,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: go.sum @@ -605,7 +605,7 @@ jobs: simdv2 start & SIMD_PID=$! cnt=0 - while ! simdv2 query block --type=height 5; do + while ! simdv2 query comet block --type=height 5; do cnt=$((cnt + 1)) if [ $cnt -gt 30 ]; then kill -9 "$SIMD_PID" @@ -621,7 +621,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: collections/go.sum @@ -652,7 +652,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.20" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: orm/go.sum @@ -683,7 +683,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: tools/cosmovisor/go.sum @@ -714,7 +714,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: tools/confix/go.sum @@ -745,7 +745,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: tools/hubl/go.sum @@ -813,7 +813,7 @@ jobs: - uses: DeterminateSystems/magic-nix-cache-action@main - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: store/v2/go.sum @@ -828,7 +828,7 @@ jobs: if: env.GIT_DIFF run: | cd store/v2 - nix develop .. -c go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb' ./... + nix develop ../.. -c go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb' ./... - name: sonarcloud if: ${{ env.GIT_DIFF && !github.event.pull_request.draft && env.SONAR_TOKEN != null }} uses: SonarSource/sonarcloud-github-action@master @@ -882,7 +882,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: x/accounts/go.sum @@ -913,7 +913,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: x/accounts/defaults/lockup/go.sum @@ -936,7 +936,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: x/accounts/multisig/lockup/go.sum @@ -959,7 +959,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: x/tx/go.sum @@ -990,7 +990,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: x/nft/go.sum @@ -1021,7 +1021,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: x/circuit/go.sum @@ -1052,7 +1052,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: x/distribution/go.sum @@ -1083,7 +1083,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: x/protocolpool/go.sum @@ -1114,7 +1114,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: x/feegrant/go.sum @@ -1145,7 +1145,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: x/evidence/go.sum @@ -1175,7 +1175,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: x/params/go.sum @@ -1205,7 +1205,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: x/upgrade/go.sum @@ -1235,7 +1235,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: x/group/go.sum @@ -1265,7 +1265,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: x/gov/go.sum @@ -1296,7 +1296,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: x/slashing/go.sum @@ -1327,7 +1327,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: x/staking/go.sum @@ -1352,44 +1352,13 @@ jobs: with: projectBaseDir: x/staking/ - test-x-auth: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: "1.22" - check-latest: true - cache: true - cache-dependency-path: x/auth/go.sum - - uses: technote-space/get-diff-action@v6.1.2 - id: git_diff - with: - PATTERNS: | - x/auth/**/*.go - x/auth/go.mod - x/auth/go.sum - - name: tests - if: env.GIT_DIFF - run: | - cd x/auth - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock' ./... - - name: sonarcloud - if: ${{ env.GIT_DIFF && !github.event.pull_request.draft && env.SONAR_TOKEN != null }} - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - with: - projectBaseDir: x/auth/ - test-x-authz: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: x/authz/go.sum @@ -1420,7 +1389,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: x/bank/go.sum @@ -1451,7 +1420,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: x/mint/go.sum @@ -1482,7 +1451,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: x/epochs/go.sum @@ -1513,7 +1482,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: x/consensus/go.sum diff --git a/.github/workflows/v2-test.yml b/.github/workflows/v2-test.yml index 9bde9c3f39d1..6896f803a2c1 100644 --- a/.github/workflows/v2-test.yml +++ b/.github/workflows/v2-test.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: go.sum @@ -46,7 +46,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: go.sum @@ -70,7 +70,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: go.sum @@ -94,7 +94,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: go.sum diff --git a/.golangci.yml b/.golangci.yml index fc4dd038ba30..158724cf53cf 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -76,6 +76,9 @@ issues: - text: "SA1019: params.SendEnabled is deprecated" # TODO remove once ready to remove from the sdk linters: - staticcheck + - text: "SA1029: Inappropriate key in context.WithValue" # TODO remove this when dependency is updated + linters: + - staticcheck - text: "leading space" linters: - nolintlint diff --git a/CHANGELOG.md b/CHANGELOG.md index e220eb440016..add0a5b3b1b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,62 +43,86 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i ### Features * (baseapp) [#20291](https://github.com/cosmos/cosmos-sdk/pull/20291) Simulate nested messages. -* (tests) [#20013](https://github.com/cosmos/cosmos-sdk/pull/20013) Introduce system tests to run multi node local testnet in CI -* (runtime) [#19953](https://github.com/cosmos/cosmos-sdk/pull/19953) Implement `core/transaction.Service` in runtime. -* (client) [#19905](https://github.com/cosmos/cosmos-sdk/pull/19905) Add grpc client config to `client.toml`. -* (runtime) [#19571](https://github.com/cosmos/cosmos-sdk/pull/19571) Implement `core/router.Service` in runtime. This service is present in all modules (when using depinject). -* (types) [#19164](https://github.com/cosmos/cosmos-sdk/pull/19164) Add a ValueCodec for the math.Uint type that can be used in collections maps. -* (types) [#19281](https://github.com/cosmos/cosmos-sdk/pull/19281) Added a new method, `IsGT`, for `types.Coin`. This method is used to check if a `types.Coin` is greater than another `types.Coin`. -* (client) [#18557](https://github.com/cosmos/cosmos-sdk/pull/18557) Add `--qrcode` flag to `keys show` command to support displaying keys address QR code. -* (client) [#18101](https://github.com/cosmos/cosmos-sdk/pull/18101) Add a `keyring-default-keyname` in `client.toml` for specifying a default key name, and skip the need to use the `--from` flag when signing transactions. -* (tests) [#17868](https://github.com/cosmos/cosmos-sdk/pull/17868) Added helper method `SubmitTestTx` in testutil to broadcast test txns to test e2e tests. + +### Improvements + +* (client) [#21436](https://github.com/cosmos/cosmos-sdk/pull/21436) Use `address.Codec` from client.Context in `tx.Sign`. + +### Bug Fixes + +* (baseapp) [#21256](https://github.com/cosmos/cosmos-sdk/pull/21256) Halt height will not commit the block indicated, meaning that if halt-height is set to 10, only blocks until 9 (included) will be committed. This is to go back to the original behavior before a change was introduced in v0.50.0. + +### API Breaking Changes + +### Deprecated + +* (types) [#21435](https://github.com/cosmos/cosmos-sdk/pull/21435) The `String()` method on `AccAddress`, `ValAddress` and `ConsAddress` have been deprecated. This is done because those are still using the deprecated global `sdk.Config`. Use an `address.Codec` instead. + +## [v0.52.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.52.0) - 2024-XX-XX + +Every module contains its own CHANGELOG.md. Please refer to the module you are interested in. + +### Features + * (client) [#17513](https://github.com/cosmos/cosmos-sdk/pull/17513) Allow overwriting `client.toml`. Use `client.CreateClientConfig` in place of `client.ReadFromClientConfig` and provide a custom template and a custom config. +* (tests) [#17868](https://github.com/cosmos/cosmos-sdk/pull/17868) Added helper method `SubmitTestTx` in testutil to broadcast test txns to test e2e tests. +* (client) [#18101](https://github.com/cosmos/cosmos-sdk/pull/18101) Add a `keyring-default-keyname` in `client.toml` for specifying a default key name, and skip the need to use the `--from` flag when signing transactions. * (runtime) [#18475](https://github.com/cosmos/cosmos-sdk/pull/18475) Adds an implementation for core.branch.Service. * (baseapp) [#18499](https://github.com/cosmos/cosmos-sdk/pull/18499) Add `MsgRouter` response type from message name function. +* (client) [#18557](https://github.com/cosmos/cosmos-sdk/pull/18557) Add `--qrcode` flag to `keys show` command to support displaying keys address QR code. * (types) [#18768](https://github.com/cosmos/cosmos-sdk/pull/18768) Add MustValAddressFromBech32 function. * (gRPC) [#19049](https://github.com/cosmos/cosmos-sdk/pull/19049) Add debug log prints for each gRPC request. +* (types) [#19164](https://github.com/cosmos/cosmos-sdk/pull/19164) Add a ValueCodec for the math.Uint type that can be used in collections maps. +* (types) [#19281](https://github.com/cosmos/cosmos-sdk/pull/19281) Added a new method, `IsGT`, for `types.Coin`. This method is used to check if a `types.Coin` is greater than another `types.Coin`. +* (runtime) [#19571](https://github.com/cosmos/cosmos-sdk/pull/19571) Implement `core/router.Service` in runtime. This service is present in all modules (when using depinject). * (types) [#19759](https://github.com/cosmos/cosmos-sdk/pull/19759) Align SignerExtractionAdapter in PriorityNonceMempool Remove. * (client) [#19870](https://github.com/cosmos/cosmos-sdk/pull/19870) Add new query command `wait-tx`. Alias `event-query-tx-for` to `wait-tx` for backward compatibility. -* (crypto/keyring) [#20212](https://github.com/cosmos/cosmos-sdk/pull/20212) Expose the db keyring used in the keystore. +* (client) [#19905](https://github.com/cosmos/cosmos-sdk/pull/19905) Add grpc client config to `client.toml`. * (genutil) [#19971](https://github.com/cosmos/cosmos-sdk/pull/19971) Allow manually setting the consensus key type in genesis -* (cli) [#20779](https://github.com/cosmos/cosmos-sdk/pull/20779) Added `module-hash-by-height` command to query and retrieve module hashes at a specified blockchain height, enhancing debugging capabilities. +* (runtime) [#19953](https://github.com/cosmos/cosmos-sdk/pull/19953) Implement `core/transaction.Service` in runtime. +* (runtime) [#18475](https://github.com/cosmos/cosmos-sdk/pull/18475) Adds an implementation for `core.branch.Service`. +* (runtime) [#19004](https://github.com/cosmos/cosmos-sdk/pull/19004) Adds an implementation for `core/header.Service` in runtime. +* (runtime) [#20238](https://github.com/cosmos/cosmos-sdk/pull/20238) Adds an implementation for `core/comet.Service` in runtime. +* (tests) [#20013](https://github.com/cosmos/cosmos-sdk/pull/20013) Introduce system tests to run multi node local testnet in CI +* (crypto/keyring) [#20212](https://github.com/cosmos/cosmos-sdk/pull/20212) Expose the db keyring used in the keystore. * (client/tx) [#20870](https://github.com/cosmos/cosmos-sdk/pull/20870) Add `timeout-timestamp` field for tx body defines time based timeout.Add `WithTimeoutTimestamp` to tx factory. Increased gas cost for processing newly added timeout timestamp field in tx body. +* (client) [#21074](https://github.com/cosmos/cosmos-sdk/pull/21074) Add auto cli for node service ### Improvements -* (codec) [#20122](https://github.com/cosmos/cosmos-sdk/pull/20122) Added a cache to address codec. -* (types) [#19869](https://github.com/cosmos/cosmos-sdk/pull/19869) Removed `Any` type from `codec/types` and replaced it with an alias for `cosmos/gogoproto/types/any`. -* (server) [#19854](https://github.com/cosmos/cosmos-sdk/pull/19854) Add customizability to start command. - * Add `StartCmdOptions` in `server.AddCommands` instead of `servertypes.ModuleInitFlags`. To set custom flags set them in the `StartCmdOptions` struct on the `AddFlags` field. - * Add `StartCommandHandler` to `StartCmdOptions` to allow custom start command handlers. Users now have total control over how the app starts. -* (types) [#19672](https://github.com/cosmos/cosmos-sdk/pull/19672) `PreBlock` now returns only an error for consistency with server/v2. The SDK has upgraded x/upgrade accordingly. `ResponsePreBlock` hence has been removed. -* (server) [#19455](https://github.com/cosmos/cosmos-sdk/pull/19455) Allow calling back into the application struct in PostSetup. -* (types) [#19512](https://github.com/cosmos/cosmos-sdk/pull/19512) The notion of basic manager does not exist anymore (and all related helpers). - * The module manager now can do everything that the basic manager was doing. - * `AppModuleBasic` has been deprecated for extension interfaces. - * Modules can now implement `appmodule.HasRegisterInterfaces`, `module.HasGRPCGateway` and `module.HasAminoCodec` when relevant. - * SDK modules now directly implement those extension interfaces on `AppModule` instead of `AppModuleBasic`. -* (client/keys) [#18950](https://github.com/cosmos/cosmos-sdk/pull/18950) Improve ` keys add`, ` keys import` and ` keys rename` by checking name validation. -* (client/keys) [#18745](https://github.com/cosmos/cosmos-sdk/pull/18745) Improve ` keys export` and ` keys mnemonic` by adding --yes option to skip interactive confirmation. -* (client/keys) [#18743](https://github.com/cosmos/cosmos-sdk/pull/18743) Improve ` keys add -i` by hiding inputting of bip39 passphrase. -* (client/keys) [#18703](https://github.com/cosmos/cosmos-sdk/pull/18703) Improve ` keys add` and ` keys show` by checking whether there are duplicate keys in the multisig case. - * Usage of `Must...` kind of functions are avoided in keeper methods. -* (client/keys) [#18687](https://github.com/cosmos/cosmos-sdk/pull/18687) Improve ` keys mnemonic` by displaying mnemonic discreetly on an alternate screen and adding `--indiscreet` option to disable it. -* (client/keys) [#18684](https://github.com/cosmos/cosmos-sdk/pull/18684) Improve ` keys export` by displaying unarmored hex private key discreetly on an alternate screen and adding `--indiscreet` option to disable it. -* (client/keys) [#18663](https://github.com/cosmos/cosmos-sdk/pull/18663) Improve ` keys add` by displaying mnemonic discreetly on an alternate screen and adding `--indiscreet` option to disable it. -* (types) [#18440](https://github.com/cosmos/cosmos-sdk/pull/18440) Add `AmountOfNoValidation` to `sdk.DecCoins`. +* (all) [#16537](https://github.com/cosmos/cosmos-sdk/pull/16537) Properly propagated `fmt.Errorf` errors and using `errors.New` where appropriate. * (client) [#17503](https://github.com/cosmos/cosmos-sdk/pull/17503) Add `client.Context{}.WithAddressCodec`, `WithValidatorAddressCodec`, `WithConsensusAddressCodec` to provide address codecs to the client context. See the [UPGRADING.md](./UPGRADING.md) for more details. * (crypto/keyring) [#17503](https://github.com/cosmos/cosmos-sdk/pull/17503) Simplify keyring interfaces to use `[]byte` instead of `sdk.Address` for addresses. -* (all) [#16537](https://github.com/cosmos/cosmos-sdk/pull/16537) Properly propagated `fmt.Errorf` errors and using `errors.New` where appropriate. * (rpc) [#17470](https://github.com/cosmos/cosmos-sdk/pull/17470) Avoid open 0.0.0.0 to public by default and add `listen-ip-address` argument for `testnet init-files` cmd. * (types) [#17670](https://github.com/cosmos/cosmos-sdk/pull/17670) Use `ctx.CometInfo` in place of `ctx.VoteInfos` * [#17733](https://github.com/cosmos/cosmos-sdk/pull/17733) Ensure `buf export` exports all proto dependencies * (crypto/keys) [#18026](https://github.com/cosmos/cosmos-sdk/pull/18026) Made public key generation constant time on `secp256k1` * (crypto | x/auth) [#14372](https://github.com/cosmos/cosmos-sdk/pull/18194) Key checks on signatures antehandle. +* (types) [#18440](https://github.com/cosmos/cosmos-sdk/pull/18440) Add `AmountOfNoValidation` to `sdk.DecCoins`. +* (client/keys) [#18663](https://github.com/cosmos/cosmos-sdk/pull/18663) Improve ` keys add` by displaying mnemonic discreetly on an alternate screen and adding `--indiscreet` option to disable it. +* (client/keys) [#18684](https://github.com/cosmos/cosmos-sdk/pull/18684) Improve ` keys export` by displaying unarmored hex private key discreetly on an alternate screen and adding `--indiscreet` option to disable it. +* (client/keys) [#18687](https://github.com/cosmos/cosmos-sdk/pull/18687) Improve ` keys mnemonic` by displaying mnemonic discreetly on an alternate screen and adding `--indiscreet` option to disable it. +* (client/keys) [#18703](https://github.com/cosmos/cosmos-sdk/pull/18703) Improve ` keys add` and ` keys show` by checking whether there are duplicate keys in the multisig case. + * Usage of `Must...` kind of functions are avoided in keeper methods. +* (client/keys) [#18743](https://github.com/cosmos/cosmos-sdk/pull/18743) Improve ` keys add -i` by hiding inputting of bip39 passphrase. +* (client/keys) [#18745](https://github.com/cosmos/cosmos-sdk/pull/18745) Improve ` keys export` and ` keys mnemonic` by adding --yes option to skip interactive confirmation. +* (client/keys) [#18950](https://github.com/cosmos/cosmos-sdk/pull/18950) Improve ` keys add`, ` keys import` and ` keys rename` by checking name validation. * (types) [#18963](https://github.com/cosmos/cosmos-sdk/pull/18963) Swap out amino json encoding of `ABCIMessageLogs` for std lib json encoding +* (types) [#19512](https://github.com/cosmos/cosmos-sdk/pull/19512) The notion of basic manager does not exist anymore (and all related helpers). + * The module manager now can do everything that the basic manager was doing. + * `AppModuleBasic` has been deprecated for extension interfaces. + * Modules can now implement `appmodule.HasRegisterInterfaces`, `module.HasGRPCGateway` and `module.HasAminoCodec` when relevant. + * SDK modules now directly implement those extension interfaces on `AppModule` instead of `AppModuleBasic`. +* (server) [#19455](https://github.com/cosmos/cosmos-sdk/pull/19455) Allow calling back into the application struct in PostSetup. +* (types) [#19672](https://github.com/cosmos/cosmos-sdk/pull/19672) `PreBlock` now returns only an error for consistency with server/v2. The SDK has upgraded x/upgrade accordingly. `ResponsePreBlock` hence has been removed. * (x/auth) [#19651](https://github.com/cosmos/cosmos-sdk/pull/19651) Allow empty public keys in `GetSignBytesAdapter`. * (x/genutil) [#19735](https://github.com/cosmos/cosmos-sdk/pull/19735) Update genesis api to match new `appmodule.HasGenesis` interface. +* (types) [#19869](https://github.com/cosmos/cosmos-sdk/pull/19869) Removed `Any` type from `codec/types` and replaced it with an alias for `cosmos/gogoproto/types/any`. +* (server) [#19854](https://github.com/cosmos/cosmos-sdk/pull/19854) Add customizability to start command. + * Add `StartCmdOptions` in `server.AddCommands` instead of `servertypes.ModuleInitFlags`. To set custom flags set them in the `StartCmdOptions` struct on the `AddFlags` field. + * Add `StartCommandHandler` to `StartCmdOptions` to allow custom start command handlers. Users now have total control over how the app starts. * (server) [#19966](https://github.com/cosmos/cosmos-sdk/pull/19966) Return BlockHeader by shallow copy in server Context. +* (codec) [#20122](https://github.com/cosmos/cosmos-sdk/pull/20122) Added a cache to address codec. * (proto) [#20098](https://github.com/cosmos/cosmos-sdk/pull/20098) Use cosmos_proto added_in annotation instead of // Since comments. * (baseapp) [#20208](https://github.com/cosmos/cosmos-sdk/pull/20208) Skip running validateBasic for rechecking txs. * (baseapp) [#20380](https://github.com/cosmos/cosmos-sdk/pull/20380) Enhanced OfferSnapshot documentation. @@ -107,95 +131,86 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i ### Bug Fixes -* (baseapp) [#21159](https://github.com/cosmos/cosmos-sdk/pull/21159) Return PreBlocker events in FinalizeBlockResponse. -* (baseapp) [#18727](https://github.com/cosmos/cosmos-sdk/pull/18727) Ensure that `BaseApp.Init` firstly returns any errors from a nil commit multistore instead of panicking on nil dereferencing and before sealing the app. -* (client) [#18622](https://github.com/cosmos/cosmos-sdk/pull/18622) Fixed a potential under/overflow from `uint64->int64` when computing gas fees as a LegacyDec. -* (client/keys) [#18562](https://github.com/cosmos/cosmos-sdk/pull/18562) `keys delete` won't terminate when a key is not found. * (baseapp) [#18383](https://github.com/cosmos/cosmos-sdk/pull/18383) Fixed a data race inside BaseApp.getContext, found by end-to-end (e2e) tests. * (client/server) [#18345](https://github.com/cosmos/cosmos-sdk/pull/18345) Consistently set viper prefix in client and server. It defaults for the binary name for both client and server. * (baseapp) [#18551](https://github.com/cosmos/cosmos-sdk/pull/18551) Fix SelectTxForProposal the calculation method of tx bytes size is inconsistent with CometBFT +* (client/keys) [#18562](https://github.com/cosmos/cosmos-sdk/pull/18562) `keys delete` won't terminate when a key is not found. +* (client) [#18622](https://github.com/cosmos/cosmos-sdk/pull/18622) Fixed a potential under/overflow from `uint64->int64` when computing gas fees as a LegacyDec. +* (baseapp) [#18727](https://github.com/cosmos/cosmos-sdk/pull/18727) Ensure that `BaseApp.Init` firstly returns any errors from a nil commit multistore instead of panicking on nil dereferencing and before sealing the app. * (server) [#18994](https://github.com/cosmos/cosmos-sdk/pull/18994) Update server context directly rather than a reference to a sub-object * [#19833](https://github.com/cosmos/cosmos-sdk/pull/19833) Fix some places in which we call Remove inside a Walk. * [#19851](https://github.com/cosmos/cosmos-sdk/pull/19851) Fix some places in which we call Remove inside a Walk (x/staking and x/gov). -* [#20939](https://github.com/cosmos/cosmos-sdk/pull/20939) Fix collection reverse iterator to include `pagination.key` in the result. -* (client/grpc) [#20969](https://github.com/cosmos/cosmos-sdk/pull/20969) Fix `node.NewQueryServer` method not setting `cfg`. -* (testutil/integration) [#21006](https://github.com/cosmos/cosmos-sdk/pull/21006) Fix `NewIntegrationApp` method not writing default genesis to state ### API Breaking Changes -* (sims) [#21039](https://github.com/cosmos/cosmos-sdk/pull/21039): Remove Baseapp from sims by a new interface `simtypes.AppEntrypoint` -* (client) [#20976](https://github.com/cosmos/cosmos-sdk/pull/20976) Simplified command initialization by removing unnecessary parameters such as `txConfig` and `addressCodec`. - * Remove parameter `txConfig` from `genutilcli.Commands`,`genutilcli.CommandsWithCustomMigrationMap`,`genutilcli.GenTxCmd`. - * Remove parameter `addressCodec` from `genutilcli.GenTxCmd`,`genutilcli.AddGenesisAccountCmd`,`stakingcli.BuildCreateValidatorMsg`. -* (x/genutil) [#20740](https://github.com/cosmos/cosmos-sdk/pull/20740) Update `genutilcli.Commands` and `genutilcli.CommandsWithCustomMigrationMap` to take the genesis module and abstract the module manager. -* (server) [#20422](https://github.com/cosmos/cosmos-sdk/pull/20422) Deprecated `ServerContext`. To get `cmtcfg.Config` from cmd, use `client.GetCometConfigFromCmd(cmd)` instead of `server.GetServerContextFromCmd(cmd).Config` -* (types)[#20369](https://github.com/cosmos/cosmos-sdk/pull/20369) The signature of `HasAminoCodec` has changed to accept a `core/legacy.Amino` interface instead of `codec.LegacyAmino`. -* (x/simulation)[#20056](https://github.com/cosmos/cosmos-sdk/pull/20056) `SimulateFromSeed` now takes an address codec as argument. -* (x/crisis) [#20043](https://github.com/cosmos/cosmos-sdk/pull/20043) Changed `NewMsgVerifyInvariant` to accept a string as argument instead of an `AccAddress`. -* (x/genutil) [#19926](https://github.com/cosmos/cosmos-sdk/pull/19926) Removal of the Address.String() method and related changes: - * Added an address codec as an argument to `CollectTxs`, `GenAppStateFromConfig`, and `AddGenesisAccount`. - * Removed the `ValidatorAddressCodec` argument from `CollectGenTxsCmd`, now utilizing the context for this purpose. - * Changed `ValidateAccountInGenesis` to accept a string instead of an `AccAddress`. -* (server) [#19854](https://github.com/cosmos/cosmos-sdk/pull/19854) Remove `servertypes.ModuleInitFlags` types and from `server.AddCommands` as `StartCmdOptions` already achieves the same goal. -* (types) [#19792](https://github.com/cosmos/cosmos-sdk/pull/19792) In `MsgSimulatorFn` `sdk.Context` argument is replaced for an `address.Codec`. It also returns an error. -* (types) [#19742](https://github.com/cosmos/cosmos-sdk/pull/19742) Removes the use of `Accounts.String` - * `SimulationState` now has address and validator codecs as fields. -* (types) [#19447](https://github.com/cosmos/cosmos-sdk/pull/19447) `module.testutil.MakeTestEncodingConfig` now takes `CodecOptions` as argument. -* (types) [#19512](https://github.com/cosmos/cosmos-sdk/pull/19512) Remove basic manager and all related functions (`module.BasicManager`, `module.NewBasicManager`, `module.NewBasicManagerFromManager`, `NewGenesisOnlyAppModule`). - * The module manager now can do everything that the basic manager was doing. - * When using runtime, just inject the module manager when needed using your app config. - * All `AppModuleBasic` structs have been removed. -* (server) [#18303](https://github.com/cosmos/cosmos-sdk/pull/18303) `x/genutil` now handles the application export. `server.AddCommands` does not take an `AppExporter` but instead `genutilcli.Commands` does. -* (x/gov/testutil) [#17986](https://github.com/cosmos/cosmos-sdk/pull/18036) `MsgDeposit` has been removed because of AutoCLI migration. -* (x/staking/testutil) [#17986](https://github.com/cosmos/cosmos-sdk/pull/17986) `MsgRedelegateExec`, `MsgUnbondExec` has been removed because of AutoCLI migration. -* (x/bank/testutil) [#17868](https://github.com/cosmos/cosmos-sdk/pull/17868) `MsgSendExec` has been removed because of AutoCLI migration. -* (app) [#17838](https://github.com/cosmos/cosmos-sdk/pull/17838) Params module was removed from simapp and all imports of the params module removed throughout the repo. - * The Cosmos SDK has migrated away from using params, if your app still uses it, then you can leave it plugged into your app -* (types/simulation) [#17737](https://github.com/cosmos/cosmos-sdk/pull/17737) Remove unused parameter from `RandomFees` -* (client/keys) [#17503](https://github.com/cosmos/cosmos-sdk/pull/17503) `clientkeys.NewKeyOutput`, `MkConsKeyOutput`, `MkValKeyOutput`, `MkAccKeyOutput`, `MkAccKeysOutput` now take their corresponding address codec instead of using the global SDK config. -* (types) `module.BeginBlockAppModule` has been replaced by Core API `appmodule.HasBeginBlocker`. -* (types) `module.EndBlockAppModule` has been replaced by Core API `appmodule.HasEndBlocker` or `module.HasABCIEndBlock` when needing validator updates. -* (client) [#17259](https://github.com/cosmos/cosmos-sdk/pull/17259) Remove deprecated `clientCtx.PrintObjectLegacy`. Use `clientCtx.PrintProto` or `clientCtx.PrintRaw` instead. + +* (baseapp) [#16244](https://github.com/cosmos/cosmos-sdk/pull/16244) `SetProtocolVersion` has been renamed to `SetAppVersion`. It now updates the consensus params in baseapp's `ParamStore`. * (types) [#16918](https://github.com/cosmos/cosmos-sdk/pull/16918) Remove `IntProto` and `DecProto`. Instead, `math.Int` and `math.LegacyDec` should be used respectively. Both types support `Marshal` and `Unmarshal` which should be used for binary marshaling. * (client) [#17215](https://github.com/cosmos/cosmos-sdk/pull/17215) `server.StartCmd`,`server.ExportCmd`,`server.NewRollbackCmd`,`pruning.Cmd`,`genutilcli.InitCmd`,`genutilcli.GenTxCmd`,`genutilcli.CollectGenTxsCmd`,`genutilcli.AddGenesisAccountCmd`, do not take a home directory anymore. It is inferred from the root command. -* (baseapp) [#16244](https://github.com/cosmos/cosmos-sdk/pull/16244) `SetProtocolVersion` has been renamed to `SetAppVersion`. It now updates the consensus params in baseapp's `ParamStore`. +* (client) [#17259](https://github.com/cosmos/cosmos-sdk/pull/17259) Remove deprecated `clientCtx.PrintObjectLegacy`. Use `clientCtx.PrintProto` or `clientCtx.PrintRaw` instead. * (types) [#17348](https://github.com/cosmos/cosmos-sdk/pull/17348) Remove the `WrapServiceResult` function. - * The `*sdk.Result` returned by the msg server router will not contain the `.Data` field. + * The `*sdk.Result` returned by the msg server router will not contain the `.Data` field. * (types) [#17426](https://github.com/cosmos/cosmos-sdk/pull/17426) `NewContext` does not take a `cmtproto.Header{}` any longer. * `WithChainID` / `WithBlockHeight` / `WithBlockHeader` must be used to set values on the context +* (client/keys) [#17503](https://github.com/cosmos/cosmos-sdk/pull/17503) `clientkeys.NewKeyOutput`, `MkConsKeyOutput`, `MkValKeyOutput`, `MkAccKeyOutput`, `MkAccKeysOutput` now take their corresponding address codec instead of using the global SDK config. +* (types/simulation) [#17737](https://github.com/cosmos/cosmos-sdk/pull/17737) Remove unused parameter from `RandomFees` * (types) [#17738](https://github.com/cosmos/cosmos-sdk/pull/17738) `WithBlockTime()` was removed & `BlockTime()` were deprecated in favor of `WithHeaderInfo()` & `HeaderInfo()`. `BlockTime` now gets data from `HeaderInfo()` instead of `BlockHeader()`. * (client) [#17746](https://github.com/cosmos/cosmos-sdk/pull/17746) `txEncodeAmino` & `txDecodeAmino` txs via grpc and rest were removed - * `RegisterLegacyAmino` was removed from `AppModuleBasic` +* (app) [#17838](https://github.com/cosmos/cosmos-sdk/pull/17838) Params module was removed from simapp and all imports of the params module removed throughout the repo. + * The Cosmos SDK has migrated away from using params, if your app still uses it, then you can leave it plugged into your app +* (x/bank/testutil) [#17868](https://github.com/cosmos/cosmos-sdk/pull/17868) `MsgSendExec` has been removed because of AutoCLI migration. * (types) [#17885](https://github.com/cosmos/cosmos-sdk/pull/17885) `InitGenesis` & `ExportGenesis` now take `context.Context` instead of `sdk.Context` +* (x/gov/testutil) [#17986](https://github.com/cosmos/cosmos-sdk/pull/18036) `MsgDeposit` has been removed because of AutoCLI migration. +* (x/staking/testutil) [#17986](https://github.com/cosmos/cosmos-sdk/pull/17986) `MsgRedelegateExec`, `MsgUnbondExec` has been removed because of AutoCLI migration. * (x/group) [#17937](https://github.com/cosmos/cosmos-sdk/pull/17937) Groups module was moved to its own go.mod `cosmossdk.io/x/group` * (x/gov) [#18197](https://github.com/cosmos/cosmos-sdk/pull/18197) Gov module was moved to its own go.mod `cosmossdk.io/x/gov` * (x/distribution) [#18199](https://github.com/cosmos/cosmos-sdk/pull/18199) Distribution module was moved to its own go.mod `cosmossdk.io/x/distribution` * (x/slashing) [#18201](https://github.com/cosmos/cosmos-sdk/pull/18201) Slashing module was moved to its own go.mod `cosmossdk.io/x/slashing` * (x/staking) [#18257](https://github.com/cosmos/cosmos-sdk/pull/18257) Staking module was moved to its own go.mod `cosmossdk.io/x/staking` +* (types) [#18268](https://github.com/cosmos/cosmos-sdk/pull/18268) Remove global setting of basedenom. Use the staking module parameter instead * (x/authz) [#18265](https://github.com/cosmos/cosmos-sdk/pull/18265) Authz module was moved to its own go.mod `cosmossdk.io/x/authz` * (x/mint) [#18283](https://github.com/cosmos/cosmos-sdk/pull/18283) Mint module was moved to its own go.mod `cosmossdk.io/x/mint` -* (x/slashing) [#18115](https://github.com/cosmos/cosmos-sdk/pull/18115) `NewValidatorSigningInfo` takes strings instead of `sdk.AccAddress` -* (types) [#18268](https://github.com/cosmos/cosmos-sdk/pull/18268) Remove global setting of basedenom. Use the staking module parameter instead -* (x/auth) [#18351](https://github.com/cosmos/cosmos-sdk/pull/18351) Auth module was moved to its own go.mod `cosmossdk.io/x/auth` +* (server) [#18303](https://github.com/cosmos/cosmos-sdk/pull/18303) `x/genutil` now handles the application export. `server.AddCommands` does not take an `AppExporter` but instead `genutilcli.Commands` does. * (types) [#18372](https://github.com/cosmos/cosmos-sdk/pull/18372) Removed global configuration for coin type and purpose. Setters and getters should be removed and access directly to defined types. -* (types) [#18695](https://github.com/cosmos/cosmos-sdk/pull/18695) Removed global configuration for txEncoder. * (types) [#18607](https://github.com/cosmos/cosmos-sdk/pull/18607) Removed address verifier from global config, moved verifier function to bech32 codec. +* (types) [#18695](https://github.com/cosmos/cosmos-sdk/pull/18695) Removed global configuration for txEncoder. * (server) [#18909](https://github.com/cosmos/cosmos-sdk/pull/18909) Remove configuration endpoint on grpc reflection endpoint in favour of auth module bech32prefix endpoint already exposed. * (crypto) [#19541](https://github.com/cosmos/cosmos-sdk/pull/19541) The deprecated `FromTmProtoPublicKey`, `ToTmProtoPublicKey`, `FromTmPubKeyInterface` and `ToTmPubKeyInterface` functions have been removed. Use their replacements (`Cmt` instead of `Tm`) instead. +* (types) [#19512](https://github.com/cosmos/cosmos-sdk/pull/19512) Remove basic manager and all related functions (`module.BasicManager`, `module.NewBasicManager`, `module.NewBasicManagerFromManager`, `NewGenesisOnlyAppModule`). + * The module manager now can do everything that the basic manager was doing. + * When using runtime, just inject the module manager when needed using your app config. + * All `AppModuleBasic` structs have been removed. +* (types) [#19627](https://github.com/cosmos/cosmos-sdk/pull/19627) and [#19735](https://github.com/cosmos/cosmos-sdk/pull/19735) All genesis interfaces now don't take `codec.JsonCodec`: + * Every module has the codec already, passing it created an unneeded dependency. + * Additionally, to reflect this change, the module manager does not take a codec either. * (types) [#19652](https://github.com/cosmos/cosmos-sdk/pull/19652) and [#19758](https://github.com/cosmos/cosmos-sdk/pull/19758) * Moved`types/module.HasRegisterInterfaces` to `cosmossdk.io/core`. * Moved `RegisterInterfaces` and `RegisterImplementations` from `InterfaceRegistry` to `cosmossdk.io/core/registry.InterfaceRegistrar` interface. -* (types) [#19627](https://github.com/cosmos/cosmos-sdk/pull/19627) and [#19735](https://github.com/cosmos/cosmos-sdk/pull/19735) All genesis interfaces now don't take `codec.JsonCodec`. - * Every module has the codec already, passing it created an unneeded dependency. - * Additionally, to reflect this change, the module manager does not take a codec either. +* (types) [#19742](https://github.com/cosmos/cosmos-sdk/pull/19742) Removes the use of `Accounts.String` + * `SimulationState` now has address and validator codecs as fields. * (runtime) [#19747](https://github.com/cosmos/cosmos-sdk/pull/19747) `runtime.ValidatorAddressCodec` and `runtime.ConsensusAddressCodec` have been moved to `core`. +* (all) [#19726](https://github.com/cosmos/cosmos-sdk/pull/19726) Integrate comet v1 +* [#19833](https://github.com/cosmos/cosmos-sdk/pull/19833) Fix some places in which we call Remove inside a Walk. * [#19839](https://github.com/cosmos/cosmos-sdk/pull/19839) `Tx.GetMsgsV2` has been replaced with `Tx.GetReflectMessages`, and `Codec.GetMsgV1Signers` and `Codec.GetMsgV2Signers` have been replaced with `GetMsgSigners` and `GetReflectMsgSigners` respectively. These API changes clear up confusion as to the use and purpose of these methods. +* [#19851](https://github.com/cosmos/cosmos-sdk/pull/19851) Fix some places in which we call Remove inside a Walk (x/staking and x/gov). +* (server) [#19854](https://github.com/cosmos/cosmos-sdk/pull/19854) Remove `servertypes.ModuleInitFlags` types and from `server.AddCommands` as `StartCmdOptions` already achieves the same goal. +* (x/genutil) [#19926](https://github.com/cosmos/cosmos-sdk/pull/19926) Removal of the `Address.String()` method and related changes: + * Added an address codec as an argument to `CollectTxs`, `GenAppStateFromConfig`, and `AddGenesisAccount`. + * Removed the `ValidatorAddressCodec` argument from `CollectGenTxsCmd`, now utilizing the context for this purpose. + * Changed `ValidateAccountInGenesis` to accept a string instead of an `AccAddress`. * (baseapp) [#19993](https://github.com/cosmos/cosmos-sdk/pull/19993) Indicate pruning with error code "not found" rather than "invalid request". * (x/consensus) [#20010](https://github.com/cosmos/cosmos-sdk/pull/20010) Move consensus module to be its own go.mod +* (x/crisis) [#20043](https://github.com/cosmos/cosmos-sdk/pull/20043) Changed `NewMsgVerifyInvariant` to accept a string as argument instead of an `AccAddress`. +* (x/simulation)[#20056](https://github.com/cosmos/cosmos-sdk/pull/20056) `SimulateFromSeed` now takes an address codec as argument. * (server) [#20140](https://github.com/cosmos/cosmos-sdk/pull/20140) Remove embedded grpc-web proxy in favor of standalone grpc-web proxy. [Envoy Proxy](https://www.envoyproxy.io/docs/envoy/latest/start/start) * (client) [#20255](https://github.com/cosmos/cosmos-sdk/pull/20255) Use comet proofOp proto type instead of sdk version to avoid needing to translate to later be proven in the merkle proof runtime. -* (all) [#19726](https://github.com/cosmos/cosmos-sdk/pull/19726) Integrate comet v1 -* (client) [#20616](https://github.com/cosmos/cosmos-sdk/pull/20616) gentx subcommand output goes to `cmd.ErrOrStderr()` instead of being hardcoded to `os.Stderr` -* (types/errors) [#20756](https://github.com/cosmos/cosmos-sdk/pull/20756) Remove `ResponseCheckTxWithEvents`, `ResponseExecTxResultWithEvents` & `QueryResult` from types/errors pkg. They have been moved to `baseapp/errors.go` and made private +* (types)[#20369](https://github.com/cosmos/cosmos-sdk/pull/20369) The signature of `HasAminoCodec` has changed to accept a `core/legacy.Amino` interface instead of `codec.LegacyAmino`. +* (server) [#20422](https://github.com/cosmos/cosmos-sdk/pull/20422) Deprecated `ServerContext`. To get `cmtcfg.Config` from cmd, use `client.GetCometConfigFromCmd(cmd)` instead of `server.GetServerContextFromCmd(cmd).Config` +* (x/genutil) [#20740](https://github.com/cosmos/cosmos-sdk/pull/20740) Update `genutilcli.Commands` and `genutilcli.CommandsWithCustomMigrationMap` to take the genesis module and abstract the module manager. +* (types/errors) [#20756](https://github.com/cosmos/cosmos-sdk/pull/20756) Remove `ResponseCheckTxWithEvents`, `ResponseExecTxResultWithEvents` & `QueryResult` from types/errors pkg. They have been moved to `baseapp/errors.go` and made private. +* (client) [#20976](https://github.com/cosmos/cosmos-sdk/pull/20976) Simplified command initialization by removing unnecessary parameters such as `txConfig` and `addressCodec`. + * Remove parameter `txConfig` from `genutilcli.Commands`,`genutilcli.CommandsWithCustomMigrationMap`,`genutilcli.GenTxCmd`. + * Remove parameter `addressCodec` from `genutilcli.GenTxCmd`,`genutilcli.AddGenesisAccountCmd`,`stakingcli.BuildCreateValidatorMsg`. +* (sims) [#21039](https://github.com/cosmos/cosmos-sdk/pull/21039): Remove Baseapp from sims by a new interface `simtypes.AppEntrypoint`. ### Client Breaking Changes @@ -203,15 +218,24 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i ### CLI Breaking Changes -* (perf)[#20490](https://github.com/cosmos/cosmos-sdk/pull/20490) Sims: Replace runsim command with Go stdlib testing. CLI: `Commit` default true, `Lean`, `SimulateEveryOperation`, `PrintAllInvariants`, `DBBackend` params removed * (server) [#18303](https://github.com/cosmos/cosmos-sdk/pull/18303) `appd export` has moved with other genesis commands, use `appd genesis export` instead. +* (perf)[#20490](https://github.com/cosmos/cosmos-sdk/pull/20490) Sims: Replace runsim command with Go stdlib testing. CLI: `Commit` default true, `Lean`, `SimulateEveryOperation`, `PrintAllInvariants`, `DBBackend` params removed * (client/tx) [#20870](https://github.com/cosmos/cosmos-sdk/pull/20870) Removed `timeout-height` flag replace with `timeout-timestamp` flag for a time based timeout. ### Deprecated * (simapp) [#19146](https://github.com/cosmos/cosmos-sdk/pull/19146) Replace `--v` CLI option with `--validator-count`/`-n`. * (module) [#19370](https://github.com/cosmos/cosmos-sdk/pull/19370) Deprecate `module.Configurator`, use `appmodule.HasMigrations` and `appmodule.HasServices` instead from Core API. -* (x/auth) [#20531](https://github.com/cosmos/cosmos-sdk/pull/20531) Deprecate auth keeper `NextAccountNumber`, use `keeper.AccountsModKeeper.NextAccountNumber` instead. + +## [v0.50.9](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.9) - 2024-08-07 + +## Bug Fixes + +* (baseapp) [#21159](https://github.com/cosmos/cosmos-sdk/pull/21159) Return PreBlocker events in FinalizeBlockResponse. +* [#20939](https://github.com/cosmos/cosmos-sdk/pull/20939) Fix collection reverse iterator to include `pagination.key` in the result. +* (client/grpc) [#20969](https://github.com/cosmos/cosmos-sdk/pull/20969) Fix `node.NewQueryServer` method not setting `cfg`. +* (testutil/integration) [#21006](https://github.com/cosmos/cosmos-sdk/pull/21006) Fix `NewIntegrationApp` method not writing default genesis to state. +* (runtime) [#21080](https://github.com/cosmos/cosmos-sdk/pull/21080) Fix `app.yaml` / `app.json` incompatibility with `depinject v1.0.0`. ## [v0.50.8](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.8) - 2024-07-15 diff --git a/Dockerfile b/Dockerfile index 0302251120fa..9c563258c48d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ # # This image is pushed to the GHCR as https://ghcr.io/cosmos/simapp -FROM golang:1.22-alpine AS build-env +FROM golang:1.23-alpine AS build-env # Install minimum necessary dependencies ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev diff --git a/Makefile b/Makefile index 2e760653bfc9..067b5d4f6103 100644 --- a/Makefile +++ b/Makefile @@ -10,10 +10,7 @@ include scripts/build/build.mk .DEFAULT_GOAL := help -############################################################################### -### Tools & Dependencies ### -############################################################################### - +#? go.sum: Run go mod tidy and ensure dependencies have not been modified go.sum: go.mod echo "Ensure dependencies have not been modified ..." >&2 go mod verify diff --git a/README.md b/README.md index 294480cf36eb..b44232d3c006 100644 --- a/README.md +++ b/README.md @@ -66,42 +66,42 @@ The version matrix below shows which versions of the Cosmos SDK, modules and lib #### Core Dependencies -Core Dependencies are the core libraries that an application may depend on. +Core dependencies are the core libraries that an application may depend on. +Core dependencies not mentioned here as compatible across all maintained SDK versions. -> Note: the ❌ signals that the version of the Cosmos SDK does not need to import the dependency. - -| Cosmos SDK | cosmossdk.io/core | cosmossdk.io/api | cosmossdk.io/math | cosmossdk.io/errors | cosmossdk.io/depinject | cosmossdk.io/log | cosmossdk.io/store | -| ---------- | ----------------- | ---------------- | ----------------- | ------------------- | ---------------------- | ---------------- | ------------------ | -| 0.50.z | 0.11.z | 0.7.z | 1.y.z | 1.y.z | 1.y.z | 1.y.z | 1.y.z | -| 0.47.z | 0.5.z | 0.3.z | 1.y.z | 1.y.z | 1.y.z | 1.y.z | ❌ | -| 0.46.z | ❌ | ❌ | 1.y.z | 1.y.z | ❌ | ❌ | ❌ | +| Cosmos SDK | cosmossdk.io/core | cosmossdk.io/api | cosmossdk.io/x/tx | +| ---------- | ----------------- | ---------------- | ----------------- | +| 0.52.z | 1.y.z | 0.8.z | 0.14.z | +| 0.50.z | 0.11.z | 0.7.z | 0.13.z | +| 0.47.z | 0.5.z | 0.3.z | N/A | #### Module Dependencies Module Dependencies are the modules that an application may depend on and which version of the Cosmos SDK they are compatible with. -> Note: The version table only goes back to 0.50.x, this is due to the reason that modules were not spun out into their own go.mods until 0.50.z. ❌ signals that the module was not spun out into its own go.mod file. - -| Cosmos SDK | 0.50.z | 0.y.z | -| --------------------------- | --------- | ----- | -| cosmossdk.io/x/auth | ❌ | | -| cosmossdk.io/x/accounts | ❌ | | -| cosmossdk.io/x/bank | ❌ | | -| cosmossdk.io/x/circuit | 0.1.z | | -| cosmossdk.io/x/consensus | ❌ | | -| cosmossdk.io/x/distribution | ❌ | | -| cosmossdk.io/x/evidence | 0.1.z | | -| cosmossdk.io/x/feegrant | 0.1.z | | -| cosmossdk.io/x/gov | ❌ | | -| cosmossdk.io/x/group | ❌ | | -| cosmossdk.io/x/mint | ❌ | | -| cosmossdk.io/x/nft | 0.1.z | | -| cosmossdk.io/x/protcolpool | ❌ | | -| cosmossdk.io/x/slashing | ❌ | | -| cosmossdk.io/x/staking | ❌ | | -| cosmossdk.io/x/tx | =< 0.13.z | | -| cosmossdk.io/x/upgrade | 0.1.z | | +> Note: The version table only goes back to 0.50.x, as modules started to become modular with 0.50.z. +> X signals that the module was not spun out into its own go.mod file. +> N/A signals that the module was not available in the Cosmos SDK at that time. + +| Cosmos SDK | 0.50.z | 0.52.z | +| --------------------------- | ------ | ------ | +| cosmossdk.io/x/accounts | N/A | 0.2.z | +| cosmossdk.io/x/bank | X | 0.2.z | +| cosmossdk.io/x/circuit | 0.1.z | 0.2.z | +| cosmossdk.io/x/consensus | X | 0.2.z | +| cosmossdk.io/x/distribution | X | 0.2.z | +| cosmossdk.io/x/epochs | N/A | 0.2.z | +| cosmossdk.io/x/evidence | 0.1.z | 0.2.z | +| cosmossdk.io/x/feegrant | 0.1.z | 0.2.z | +| cosmossdk.io/x/gov | X | 0.2.z | +| cosmossdk.io/x/group | X | 0.2.z | +| cosmossdk.io/x/mint | X | 0.2.z | +| cosmossdk.io/x/nft | 0.1.z | 0.2.z | +| cosmossdk.io/x/protocolpool | N/A | 0.2.z | +| cosmossdk.io/x/slashing | X | 0.2.z | +| cosmossdk.io/x/staking | X | 0.2.z | +| cosmossdk.io/x/upgrade | 0.1.z | 0.2.z | ## Disambiguation -This Cosmos SDK project is not related to the [React-Cosmos](https://github.com/react-cosmos/react-cosmos) project (yet). Many thanks to Evan Coury and Ovidiu (@skidding) for this Github organization name. As per our agreement, this disambiguation notice will stay here. +This Cosmos SDK project is not related to the [React-Cosmos](https://github.com/react-cosmos/react-cosmos) project (yet). Many thanks to Evan Coury and Ovidiu [(@skidding)](https://github.com/skidding) for this Github organization name. As per our agreement, this disambiguation notice will stay here. diff --git a/UPGRADING.md b/UPGRADING.md index e18fa5b830b6..449583638f4b 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -32,12 +32,23 @@ messages, while maintaining the default behavior for other message types. Here is an example on how `SetIncludeNestedMsgsGas` option could be set to calculate the gas of a gov proposal nested messages: + ```go baseAppOptions = append(baseAppOptions, baseapp.SetIncludeNestedMsgsGas([]sdk.Message{&gov.MsgSubmitProposal{}})) // ... app.App = appBuilder.Build(db, traceStore, baseAppOptions...) ``` +To be able to simulate nested messages within a transaction, message types containing nested messages must implement the +`HasNestedMsgs` interface. This interface requires a single method: `GetMsgs() ([]sdk.Msg, error)`, which should return +the nested messages. By implementing this interface, the BaseApp can simulate these nested messages during +transaction simulation. + +## [v0.52.x](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.52.0-alpha.0) + +Documentation to migrate an application from v0.50.x to server/v2 is available elsewhere. +It is additional to the changes described here. + ### SimApp In this section we describe the changes made in Cosmos SDK' SimApp. @@ -61,9 +72,9 @@ clientCtx = clientCtx. + WithValidatorPrefix("cosmosvaloper") ``` -**When using `depinject` / `app v2`, the client codecs can be provided directly from application config.** +**When using `depinject` / `app_di`, the client codecs can be provided directly from application config.** -Refer to SimApp `root_v2.go` and `root.go` for an example with an app v2 and a legacy app. +Refer to SimApp `root_di.go` and `root.go` for an example with an app di and a legacy app. Additionally, a simplification of the start command leads to the following change: @@ -97,7 +108,104 @@ Additionally, thanks to the genesis simplification, as explained in [the genesis ##### GRPC-WEB -Grpc-web embedded client has been removed from the server. If you would like to use grpc-web, you can use the [envoy proxy](https://www.envoyproxy.io/docs/envoy/latest/start/start). +Grpc-web embedded client has been removed from the server. If you would like to use grpc-web, you can use the [envoy proxy](https://www.envoyproxy.io/docs/envoy/latest/start/start). Here's how to set it up: + +
+Step by step guide + +1. Install Envoy following the [official installation guide](https://www.envoyproxy.io/docs/envoy/latest/start/install). + +2. Create an Envoy configuration file named `envoy.yaml` with the following content: + + ```yaml + static_resources: + listeners: + - name: listener_0 + address: + socket_address: { address: 0.0.0.0, port_value: 8080 } + filter_chains: + - filters: + - name: envoy.filters.network.http_connection_manager + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager + codec_type: auto + stat_prefix: ingress_http + route_config: + name: local_route + virtual_hosts: + - name: local_service + domains: ["*"] + routes: + - match: { prefix: "/" } + route: + cluster: grpc_service + timeout: 0s + max_stream_duration: + grpc_timeout_header_max: 0s + cors: + allow_origin_string_match: + - prefix: "*" + allow_methods: GET, PUT, DELETE, POST, OPTIONS + allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout + max_age: "1728000" + expose_headers: custom-header-1,grpc-status,grpc-message + http_filters: + - name: envoy.filters.http.grpc_web + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.grpc_web.v3.GrpcWeb + - name: envoy.filters.http.cors + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.cors.v3.Cors + - name: envoy.filters.http.router + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router + clusters: + - name: grpc_service + connect_timeout: 0.25s + type: logical_dns + http2_protocol_options: {} + lb_policy: round_robin + load_assignment: + cluster_name: cluster_0 + endpoints: + - lb_endpoints: + - endpoint: + address: + socket_address: + address: 0.0.0.0 + port_value: 9090 + ``` + + This configuration tells Envoy to listen on port 8080 and forward requests to your gRPC service on port 9090. Note that this configuration is a starting point and can be modified according to your specific needs and preferences. You may need to adjust ports, addresses, or add additional settings based on your particular setup and requirements. + +3. Start your Cosmos SDK application, ensuring it's configured to serve gRPC on port 9090. + +4. Start Envoy with the configuration file: + + ```bash + envoy -c envoy.yaml + ``` + +5. If Envoy starts successfully, you should see output similar to this: + + ```bash + [2024-08-29 10:47:08.753][6281320][info][config] [source/common/listener_manager/listener_manager_impl.cc:930] all dependencies initialized. starting workers + [2024-08-29 10:47:08.754][6281320][info][main] [source/server/server.cc:978] starting main dispatch loop + ``` + + This indicates that Envoy has started and is ready to proxy requests. + +6. Update your client applications to connect to Envoy (http://localhost:8080 by default). + +
+ +By following these steps, Envoy will handle the translation between gRPC-Web and gRPC, allowing your existing gRPC-Web clients to continue functioning without modifications to your Cosmos SDK application. + +To test the setup, you can use a tool like [grpcurl](https://github.com/fullstorydev/grpcurl). For example: + +```bash +grpcurl -plaintext localhost:8080 cosmos.base.tendermint.v1beta1.Service/GetLatestBlock +``` ##### AnteHandlers @@ -108,8 +216,22 @@ need to remove them both from your app.go code, they will yield to unresolvable The Cosmos SDK now supports unordered transactions. This means that transactions can be executed in any order and doesn't require the client to deal with or manage -nonces. This also means the order of execution is not guaranteed. To enable unordered -transactions in your application: +nonces. This also means the order of execution is not guaranteed. + +Unordered transactions are automatically enabled when using `depinject` / app di, simply supply the `servertypes.AppOptions` in `app.go`: + +```diff + depinject.Supply( ++ // supply the application options ++ appOpts, + // supply the logger + logger, + ) +``` + +
+Step-by-step Wiring +If you are still using the legacy wiring, you must enable unordered transactions manually: * Update the `App` constructor to create, load, and save the unordered transaction manager. @@ -173,6 +295,8 @@ transactions in your application: } ``` +
+ To submit an unordered transaction, the client must set the `unordered` flag to `true` and ensure a reasonable `timeout_height` is set. The `timeout_height` is used as a TTL for the transaction and is used to provide replay protection. See @@ -182,8 +306,7 @@ for more details. ### Depinject `app_config.go` / `app.yml` With the introduction of [environment in modules](#core-api), depinject automatically creates the environment for all modules. -Learn more about environment [here](https://example.com) . Given the fields of environment, this means runtime creates a kv store service for all modules by default. -It can happen that some modules do not have a store necessary (such as `x/auth/tx` for instance). In this case, the store creation should be skipped in `app_config.go`: +Learn more about environment [here](https://example.com) . Given the fields of environment, this means runtime creates a kv store service for all modules by default. It can happen that some modules do not have a store necessary (such as `x/auth/tx` for instance). In this case, the store creation should be skipped in `app_config.go`: ```diff InitGenesis: []string{ @@ -203,7 +326,20 @@ There is no longer a need for the Cosmos SDK to host these protos for itself and That package containing proto v2 generated code, but the SDK now uses [buf generated go SDK instead](https://buf.build/docs/bsr/generated-sdks/go). If you were depending on `cosmossdk.io/api/tendermint`, please use the buf generated go SDK instead, or ask CometBFT host the generated proto v2 code. -The `codectypes.Any` has moved to `github.com/cosmos/gogoproto/types/any`. Module developers need to update the `buf.gen.gogo.yaml` configuration files by adjusting the corresponding `opt` option to `Mgoogle/protobuf/any.proto=github.com/cosmos/gogoproto/types/any` for directly mapping the`Any` type to its new location. This change is optional, but recommended, as `codectypes.Any` is aliased to `gogoproto.Any` in the SDK. +The `codectypes.Any` has moved to `github.com/cosmos/gogoproto/types/any`. Module developers need to update the `buf.gen.gogo.yaml` configuration files by adjusting the corresponding `opt` option to `Mgoogle/protobuf/any.proto=github.com/cosmos/gogoproto/types/any` for directly mapping the`Any` type to its new location: + +```diff +version: v1 +plugins: + - name: gocosmos + out: .. +- opt: plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types,Mcosmos/orm/v1/orm.proto=cosmossdk.io/orm ++ opt: plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/gogoproto/types/any,Mcosmos/orm/v1/orm.proto=cosmossdk.io/orm + - name: grpc-gateway + out: .. + opt: logtostderr=true,allow_colon_final_segments=true + +``` Also, any usages of the interfaces `AnyUnpacker` and `UnpackInterfacesMessage` must be replaced with the interfaces of the same name in the `github.com/cosmos/gogoproto/types/any` package. @@ -292,7 +428,7 @@ For modules that have migrated, verify you are checking against `collections.Err Accounts's AccountNumber will be used as a global account number tracking replacing Auth legacy AccountNumber. Must set accounts's AccountNumber with auth's AccountNumber value in upgrade handler. This is done through auth keeper MigrateAccountNumber function. ```go -import authkeeper "cosmossdk.io/x/auth/keeper" +import authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" ... err := authkeeper.MigrateAccountNumberUnsafe(ctx, &app.AuthKeeper) if err != nil { @@ -449,7 +585,7 @@ for more info. A `SetPreBlocker` method has been added to BaseApp. This is essential for BaseApp to run `PreBlock` which runs before begin blocker other modules, and allows to modify consensus parameters, and the changes are visible to the following state machine logics. Read more about other use cases [here](https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-068-preblock.md). -`depinject` / app v2 users need to add `x/upgrade` in their `app_config.go` / `app.yml`: +`depinject` / app di users need to add `x/upgrade` in their `app_config.go` / `app.yml`: ```diff + PreBlockers: []string{ @@ -557,7 +693,7 @@ The following modules `NewKeeper` function now take a `KVStoreService` instead o * `x/slashing` * `x/upgrade` -**Users using `depinject` / app v2 do not need any changes, this is abstracted for them.** +**Users using `depinject` / app di do not need any changes, this is abstracted for them.** Users manually wiring their chain need to use the `runtime.NewKVStoreService` method to create a `KVStoreService` from a `StoreKey`: @@ -574,7 +710,7 @@ app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper( Replace all your CometBFT logger imports by `cosmossdk.io/log`. -Additionally, `depinject` / app v2 users must now supply a logger through the main `depinject.Supply` function instead of passing it to `appBuilder.Build`. +Additionally, `depinject` / app di users must now supply a logger through the main `depinject.Supply` function instead of passing it to `appBuilder.Build`. ```diff appConfig = depinject.Configs( @@ -598,7 +734,7 @@ User manually wiring their chain need to add the logger argument when creating t Previously, the `ModuleBasics` was a global variable that was used to register all modules' `AppModuleBasic` implementation. The global variable has been removed and the basic module manager can be now created from the module manager. -This is automatically done for `depinject` / app v2 users, however for supplying different app module implementation, pass them via `depinject.Supply` in the main `AppConfig` (`app_config.go`): +This is automatically done for `depinject` / app di users, however for supplying different app module implementation, pass them via `depinject.Supply` in the main `AppConfig` (`app_config.go`): ```go depinject.Supply( @@ -709,7 +845,7 @@ When using (legacy) application wiring, the following must be added to `app.go` app.txConfig = txConfig ``` -When using `depinject` / `app v2`, **it's enabled by default** if there's a bank keeper present. +When using `depinject` / `app di`, **it's enabled by default** if there's a bank keeper present. And in the application client (usually `root.go`): @@ -728,7 +864,7 @@ And in the application client (usually `root.go`): } ``` -When using `depinject` / `app v2`, the tx config should be recreated from the `txConfigOpts` to use `NewGRPCCoinMetadataQueryFn` instead of depending on the bank keeper (that is used in the server). +When using `depinject` / `app di`, the tx config should be recreated from the `txConfigOpts` to use `NewGRPCCoinMetadataQueryFn` instead of depending on the bank keeper (that is used in the server). To learn more see the [docs](https://docs.cosmos.network/main/learn/advanced/transactions#sign_mode_textual) and the [ADR-050](https://docs.cosmos.network/main/build/architecture/adr-050-sign-mode-textual). diff --git a/api/cosmos/accounts/defaults/base/v1/base.pulsar.go b/api/cosmos/accounts/defaults/base/v1/base.pulsar.go index cc079ae338b6..f1136248cde1 100644 --- a/api/cosmos/accounts/defaults/base/v1/base.pulsar.go +++ b/api/cosmos/accounts/defaults/base/v1/base.pulsar.go @@ -7,6 +7,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" io "io" reflect "reflect" sync "sync" @@ -88,8 +89,8 @@ func (x *fastReflection_MsgInit) Interface() protoreflect.ProtoMessage { // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_MsgInit) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.PubKey) != 0 { - value := protoreflect.ValueOfBytes(x.PubKey) + if x.PubKey != nil { + value := protoreflect.ValueOfMessage(x.PubKey.ProtoReflect()) if !f(fd_MsgInit_pub_key, value) { return } @@ -110,7 +111,7 @@ func (x *fastReflection_MsgInit) Range(f func(protoreflect.FieldDescriptor, prot func (x *fastReflection_MsgInit) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { case "cosmos.accounts.defaults.base.v1.MsgInit.pub_key": - return len(x.PubKey) != 0 + return x.PubKey != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.MsgInit")) @@ -147,7 +148,7 @@ func (x *fastReflection_MsgInit) Get(descriptor protoreflect.FieldDescriptor) pr switch descriptor.FullName() { case "cosmos.accounts.defaults.base.v1.MsgInit.pub_key": value := x.PubKey - return protoreflect.ValueOfBytes(value) + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.MsgInit")) @@ -169,7 +170,7 @@ func (x *fastReflection_MsgInit) Get(descriptor protoreflect.FieldDescriptor) pr func (x *fastReflection_MsgInit) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { case "cosmos.accounts.defaults.base.v1.MsgInit.pub_key": - x.PubKey = value.Bytes() + x.PubKey = value.Message().Interface().(*anypb.Any) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.MsgInit")) @@ -191,7 +192,10 @@ func (x *fastReflection_MsgInit) Set(fd protoreflect.FieldDescriptor, value prot func (x *fastReflection_MsgInit) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "cosmos.accounts.defaults.base.v1.MsgInit.pub_key": - panic(fmt.Errorf("field pub_key of message cosmos.accounts.defaults.base.v1.MsgInit is not mutable")) + if x.PubKey == nil { + x.PubKey = new(anypb.Any) + } + return protoreflect.ValueOfMessage(x.PubKey.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.MsgInit")) @@ -206,7 +210,8 @@ func (x *fastReflection_MsgInit) Mutable(fd protoreflect.FieldDescriptor) protor func (x *fastReflection_MsgInit) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "cosmos.accounts.defaults.base.v1.MsgInit.pub_key": - return protoreflect.ValueOfBytes(nil) + m := new(anypb.Any) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.MsgInit")) @@ -276,8 +281,8 @@ func (x *fastReflection_MsgInit) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - l = len(x.PubKey) - if l > 0 { + if x.PubKey != nil { + l = options.Size(x.PubKey) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -309,10 +314,17 @@ func (x *fastReflection_MsgInit) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.PubKey) > 0 { - i -= len(x.PubKey) - copy(dAtA[i:], x.PubKey) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.PubKey))) + if x.PubKey != nil { + encoded, err := options.Marshal(x.PubKey) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- dAtA[i] = 0xa } @@ -369,7 +381,7 @@ func (x *fastReflection_MsgInit) ProtoMethods() *protoiface.Methods { if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -379,24 +391,26 @@ func (x *fastReflection_MsgInit) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.PubKey = append(x.PubKey[:0], dAtA[iNdEx:postIndex]...) if x.PubKey == nil { - x.PubKey = []byte{} + x.PubKey = &anypb.Any{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.PubKey); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex default: @@ -866,8 +880,8 @@ func (x *fastReflection_MsgSwapPubKey) Interface() protoreflect.ProtoMessage { // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_MsgSwapPubKey) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.NewPubKey) != 0 { - value := protoreflect.ValueOfBytes(x.NewPubKey) + if x.NewPubKey != nil { + value := protoreflect.ValueOfMessage(x.NewPubKey.ProtoReflect()) if !f(fd_MsgSwapPubKey_new_pub_key, value) { return } @@ -888,7 +902,7 @@ func (x *fastReflection_MsgSwapPubKey) Range(f func(protoreflect.FieldDescriptor func (x *fastReflection_MsgSwapPubKey) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { case "cosmos.accounts.defaults.base.v1.MsgSwapPubKey.new_pub_key": - return len(x.NewPubKey) != 0 + return x.NewPubKey != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.MsgSwapPubKey")) @@ -925,7 +939,7 @@ func (x *fastReflection_MsgSwapPubKey) Get(descriptor protoreflect.FieldDescript switch descriptor.FullName() { case "cosmos.accounts.defaults.base.v1.MsgSwapPubKey.new_pub_key": value := x.NewPubKey - return protoreflect.ValueOfBytes(value) + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.MsgSwapPubKey")) @@ -947,7 +961,7 @@ func (x *fastReflection_MsgSwapPubKey) Get(descriptor protoreflect.FieldDescript func (x *fastReflection_MsgSwapPubKey) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { case "cosmos.accounts.defaults.base.v1.MsgSwapPubKey.new_pub_key": - x.NewPubKey = value.Bytes() + x.NewPubKey = value.Message().Interface().(*anypb.Any) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.MsgSwapPubKey")) @@ -969,7 +983,10 @@ func (x *fastReflection_MsgSwapPubKey) Set(fd protoreflect.FieldDescriptor, valu func (x *fastReflection_MsgSwapPubKey) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "cosmos.accounts.defaults.base.v1.MsgSwapPubKey.new_pub_key": - panic(fmt.Errorf("field new_pub_key of message cosmos.accounts.defaults.base.v1.MsgSwapPubKey is not mutable")) + if x.NewPubKey == nil { + x.NewPubKey = new(anypb.Any) + } + return protoreflect.ValueOfMessage(x.NewPubKey.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.MsgSwapPubKey")) @@ -984,7 +1001,8 @@ func (x *fastReflection_MsgSwapPubKey) Mutable(fd protoreflect.FieldDescriptor) func (x *fastReflection_MsgSwapPubKey) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "cosmos.accounts.defaults.base.v1.MsgSwapPubKey.new_pub_key": - return protoreflect.ValueOfBytes(nil) + m := new(anypb.Any) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.MsgSwapPubKey")) @@ -1054,8 +1072,8 @@ func (x *fastReflection_MsgSwapPubKey) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - l = len(x.NewPubKey) - if l > 0 { + if x.NewPubKey != nil { + l = options.Size(x.NewPubKey) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -1087,10 +1105,17 @@ func (x *fastReflection_MsgSwapPubKey) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.NewPubKey) > 0 { - i -= len(x.NewPubKey) - copy(dAtA[i:], x.NewPubKey) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.NewPubKey))) + if x.NewPubKey != nil { + encoded, err := options.Marshal(x.NewPubKey) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- dAtA[i] = 0xa } @@ -1147,7 +1172,7 @@ func (x *fastReflection_MsgSwapPubKey) ProtoMethods() *protoiface.Methods { if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NewPubKey", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1157,24 +1182,26 @@ func (x *fastReflection_MsgSwapPubKey) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.NewPubKey = append(x.NewPubKey[:0], dAtA[iNdEx:postIndex]...) if x.NewPubKey == nil { - x.NewPubKey = []byte{} + x.NewPubKey = &anypb.Any{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.NewPubKey); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex default: @@ -2328,179 +2355,970 @@ func (x *fastReflection_QuerySequenceResponse) ProtoMethods() *protoiface.Method } } -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: cosmos/accounts/defaults/base/v1/base.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +var ( + md_QueryPubKey protoreflect.MessageDescriptor ) -// MsgInit is used to initialize a base account. -type MsgInit struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // pub_key defines the secp256k1 pubkey for the account. - PubKey []byte `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` -} - -func (x *MsgInit) Reset() { - *x = MsgInit{} - if protoimpl.UnsafeEnabled { - mi := &file_cosmos_accounts_defaults_base_v1_base_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgInit) String() string { - return protoimpl.X.MessageStringOf(x) +func init() { + file_cosmos_accounts_defaults_base_v1_base_proto_init() + md_QueryPubKey = File_cosmos_accounts_defaults_base_v1_base_proto.Messages().ByName("QueryPubKey") } -func (*MsgInit) ProtoMessage() {} - -// Deprecated: Use MsgInit.ProtoReflect.Descriptor instead. -func (*MsgInit) Descriptor() ([]byte, []int) { - return file_cosmos_accounts_defaults_base_v1_base_proto_rawDescGZIP(), []int{0} -} +var _ protoreflect.Message = (*fastReflection_QueryPubKey)(nil) -func (x *MsgInit) GetPubKey() []byte { - if x != nil { - return x.PubKey - } - return nil -} +type fastReflection_QueryPubKey QueryPubKey -// MsgInitResponse is the response returned after base account initialization. -// This is empty. -type MsgInitResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields +func (x *QueryPubKey) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryPubKey)(x) } -func (x *MsgInitResponse) Reset() { - *x = MsgInitResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_cosmos_accounts_defaults_base_v1_base_proto_msgTypes[1] +func (x *QueryPubKey) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_accounts_defaults_base_v1_base_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } + return mi.MessageOf(x) } -func (x *MsgInitResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} +var _fastReflection_QueryPubKey_messageType fastReflection_QueryPubKey_messageType +var _ protoreflect.MessageType = fastReflection_QueryPubKey_messageType{} -func (*MsgInitResponse) ProtoMessage() {} +type fastReflection_QueryPubKey_messageType struct{} -// Deprecated: Use MsgInitResponse.ProtoReflect.Descriptor instead. -func (*MsgInitResponse) Descriptor() ([]byte, []int) { - return file_cosmos_accounts_defaults_base_v1_base_proto_rawDescGZIP(), []int{1} +func (x fastReflection_QueryPubKey_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryPubKey)(nil) +} +func (x fastReflection_QueryPubKey_messageType) New() protoreflect.Message { + return new(fastReflection_QueryPubKey) +} +func (x fastReflection_QueryPubKey_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryPubKey } -// MsgSwapPubKey is used to change the pubkey for the account. -type MsgSwapPubKey struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // new_pub_key defines the secp256k1 pubkey to swap the account to. - NewPubKey []byte `protobuf:"bytes,1,opt,name=new_pub_key,json=newPubKey,proto3" json:"new_pub_key,omitempty"` +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryPubKey) Descriptor() protoreflect.MessageDescriptor { + return md_QueryPubKey } -func (x *MsgSwapPubKey) Reset() { - *x = MsgSwapPubKey{} - if protoimpl.UnsafeEnabled { - mi := &file_cosmos_accounts_defaults_base_v1_base_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryPubKey) Type() protoreflect.MessageType { + return _fastReflection_QueryPubKey_messageType } -func (x *MsgSwapPubKey) String() string { - return protoimpl.X.MessageStringOf(x) +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryPubKey) New() protoreflect.Message { + return new(fastReflection_QueryPubKey) } -func (*MsgSwapPubKey) ProtoMessage() {} +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryPubKey) Interface() protoreflect.ProtoMessage { + return (*QueryPubKey)(x) +} -// Deprecated: Use MsgSwapPubKey.ProtoReflect.Descriptor instead. -func (*MsgSwapPubKey) Descriptor() ([]byte, []int) { - return file_cosmos_accounts_defaults_base_v1_base_proto_rawDescGZIP(), []int{2} +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryPubKey) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { } -func (x *MsgSwapPubKey) GetNewPubKey() []byte { - if x != nil { - return x.NewPubKey +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryPubKey) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.QueryPubKey")) + } + panic(fmt.Errorf("message cosmos.accounts.defaults.base.v1.QueryPubKey does not contain field %s", fd.FullName())) } - return nil } -// MsgSwapPubKeyResponse is the response for the MsgSwapPubKey message. -// This is empty. -type MsgSwapPubKeyResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryPubKey) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.QueryPubKey")) + } + panic(fmt.Errorf("message cosmos.accounts.defaults.base.v1.QueryPubKey does not contain field %s", fd.FullName())) + } } -func (x *MsgSwapPubKeyResponse) Reset() { - *x = MsgSwapPubKeyResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_cosmos_accounts_defaults_base_v1_base_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryPubKey) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.QueryPubKey")) + } + panic(fmt.Errorf("message cosmos.accounts.defaults.base.v1.QueryPubKey does not contain field %s", descriptor.FullName())) } } -func (x *MsgSwapPubKeyResponse) String() string { - return protoimpl.X.MessageStringOf(x) +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryPubKey) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.QueryPubKey")) + } + panic(fmt.Errorf("message cosmos.accounts.defaults.base.v1.QueryPubKey does not contain field %s", fd.FullName())) + } } -func (*MsgSwapPubKeyResponse) ProtoMessage() {} - -// Deprecated: Use MsgSwapPubKeyResponse.ProtoReflect.Descriptor instead. -func (*MsgSwapPubKeyResponse) Descriptor() ([]byte, []int) { - return file_cosmos_accounts_defaults_base_v1_base_proto_rawDescGZIP(), []int{3} +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryPubKey) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.QueryPubKey")) + } + panic(fmt.Errorf("message cosmos.accounts.defaults.base.v1.QueryPubKey does not contain field %s", fd.FullName())) + } } -// QuerySequence is the request for the account sequence. -type QuerySequence struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryPubKey) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.QueryPubKey")) + } + panic(fmt.Errorf("message cosmos.accounts.defaults.base.v1.QueryPubKey does not contain field %s", fd.FullName())) + } } -func (x *QuerySequence) Reset() { - *x = QuerySequence{} - if protoimpl.UnsafeEnabled { - mi := &file_cosmos_accounts_defaults_base_v1_base_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryPubKey) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.accounts.defaults.base.v1.QueryPubKey", d.FullName())) } + panic("unreachable") } -func (x *QuerySequence) String() string { - return protoimpl.X.MessageStringOf(x) +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryPubKey) GetUnknown() protoreflect.RawFields { + return x.unknownFields } -func (*QuerySequence) ProtoMessage() {} +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryPubKey) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} -// Deprecated: Use QuerySequence.ProtoReflect.Descriptor instead. -func (*QuerySequence) Descriptor() ([]byte, []int) { - return file_cosmos_accounts_defaults_base_v1_base_proto_rawDescGZIP(), []int{4} +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryPubKey) IsValid() bool { + return x != nil } -// QuerySequenceResponse returns the sequence of the account. -type QuerySequenceResponse struct { - state protoimpl.MessageState +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryPubKey) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryPubKey) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryPubKey) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryPubKey) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryPubKey: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryPubKey: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryPubKeyResponse protoreflect.MessageDescriptor + fd_QueryPubKeyResponse_pub_key protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_accounts_defaults_base_v1_base_proto_init() + md_QueryPubKeyResponse = File_cosmos_accounts_defaults_base_v1_base_proto.Messages().ByName("QueryPubKeyResponse") + fd_QueryPubKeyResponse_pub_key = md_QueryPubKeyResponse.Fields().ByName("pub_key") +} + +var _ protoreflect.Message = (*fastReflection_QueryPubKeyResponse)(nil) + +type fastReflection_QueryPubKeyResponse QueryPubKeyResponse + +func (x *QueryPubKeyResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryPubKeyResponse)(x) +} + +func (x *QueryPubKeyResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_accounts_defaults_base_v1_base_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryPubKeyResponse_messageType fastReflection_QueryPubKeyResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryPubKeyResponse_messageType{} + +type fastReflection_QueryPubKeyResponse_messageType struct{} + +func (x fastReflection_QueryPubKeyResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryPubKeyResponse)(nil) +} +func (x fastReflection_QueryPubKeyResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryPubKeyResponse) +} +func (x fastReflection_QueryPubKeyResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryPubKeyResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryPubKeyResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryPubKeyResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryPubKeyResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryPubKeyResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryPubKeyResponse) New() protoreflect.Message { + return new(fastReflection_QueryPubKeyResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryPubKeyResponse) Interface() protoreflect.ProtoMessage { + return (*QueryPubKeyResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryPubKeyResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.PubKey != nil { + value := protoreflect.ValueOfMessage(x.PubKey.ProtoReflect()) + if !f(fd_QueryPubKeyResponse_pub_key, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryPubKeyResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.accounts.defaults.base.v1.QueryPubKeyResponse.pub_key": + return x.PubKey != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.QueryPubKeyResponse")) + } + panic(fmt.Errorf("message cosmos.accounts.defaults.base.v1.QueryPubKeyResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryPubKeyResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.accounts.defaults.base.v1.QueryPubKeyResponse.pub_key": + x.PubKey = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.QueryPubKeyResponse")) + } + panic(fmt.Errorf("message cosmos.accounts.defaults.base.v1.QueryPubKeyResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryPubKeyResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.accounts.defaults.base.v1.QueryPubKeyResponse.pub_key": + value := x.PubKey + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.QueryPubKeyResponse")) + } + panic(fmt.Errorf("message cosmos.accounts.defaults.base.v1.QueryPubKeyResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryPubKeyResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.accounts.defaults.base.v1.QueryPubKeyResponse.pub_key": + x.PubKey = value.Message().Interface().(*anypb.Any) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.QueryPubKeyResponse")) + } + panic(fmt.Errorf("message cosmos.accounts.defaults.base.v1.QueryPubKeyResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryPubKeyResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.accounts.defaults.base.v1.QueryPubKeyResponse.pub_key": + if x.PubKey == nil { + x.PubKey = new(anypb.Any) + } + return protoreflect.ValueOfMessage(x.PubKey.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.QueryPubKeyResponse")) + } + panic(fmt.Errorf("message cosmos.accounts.defaults.base.v1.QueryPubKeyResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryPubKeyResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.accounts.defaults.base.v1.QueryPubKeyResponse.pub_key": + m := new(anypb.Any) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.QueryPubKeyResponse")) + } + panic(fmt.Errorf("message cosmos.accounts.defaults.base.v1.QueryPubKeyResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryPubKeyResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.accounts.defaults.base.v1.QueryPubKeyResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryPubKeyResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryPubKeyResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryPubKeyResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryPubKeyResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryPubKeyResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.PubKey != nil { + l = options.Size(x.PubKey) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryPubKeyResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.PubKey != nil { + encoded, err := options.Marshal(x.PubKey) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryPubKeyResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryPubKeyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryPubKeyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.PubKey == nil { + x.PubKey = &anypb.Any{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.PubKey); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: cosmos/accounts/defaults/base/v1/base.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// MsgInit is used to initialize a base account. +type MsgInit struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // pub_key defines a pubkey for the account arbitrary encapsulated. + PubKey *anypb.Any `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` +} + +func (x *MsgInit) Reset() { + *x = MsgInit{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_accounts_defaults_base_v1_base_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgInit) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgInit) ProtoMessage() {} + +// Deprecated: Use MsgInit.ProtoReflect.Descriptor instead. +func (*MsgInit) Descriptor() ([]byte, []int) { + return file_cosmos_accounts_defaults_base_v1_base_proto_rawDescGZIP(), []int{0} +} + +func (x *MsgInit) GetPubKey() *anypb.Any { + if x != nil { + return x.PubKey + } + return nil +} + +// MsgInitResponse is the response returned after base account initialization. +// This is empty. +type MsgInitResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgInitResponse) Reset() { + *x = MsgInitResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_accounts_defaults_base_v1_base_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgInitResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgInitResponse) ProtoMessage() {} + +// Deprecated: Use MsgInitResponse.ProtoReflect.Descriptor instead. +func (*MsgInitResponse) Descriptor() ([]byte, []int) { + return file_cosmos_accounts_defaults_base_v1_base_proto_rawDescGZIP(), []int{1} +} + +// MsgSwapPubKey is used to change the pubkey for the account. +type MsgSwapPubKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // new_pub_key defines the secp256k1 pubkey to swap the account to. + NewPubKey *anypb.Any `protobuf:"bytes,1,opt,name=new_pub_key,json=newPubKey,proto3" json:"new_pub_key,omitempty"` +} + +func (x *MsgSwapPubKey) Reset() { + *x = MsgSwapPubKey{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_accounts_defaults_base_v1_base_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgSwapPubKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgSwapPubKey) ProtoMessage() {} + +// Deprecated: Use MsgSwapPubKey.ProtoReflect.Descriptor instead. +func (*MsgSwapPubKey) Descriptor() ([]byte, []int) { + return file_cosmos_accounts_defaults_base_v1_base_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgSwapPubKey) GetNewPubKey() *anypb.Any { + if x != nil { + return x.NewPubKey + } + return nil +} + +// MsgSwapPubKeyResponse is the response for the MsgSwapPubKey message. +// This is empty. +type MsgSwapPubKeyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgSwapPubKeyResponse) Reset() { + *x = MsgSwapPubKeyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_accounts_defaults_base_v1_base_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgSwapPubKeyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgSwapPubKeyResponse) ProtoMessage() {} + +// Deprecated: Use MsgSwapPubKeyResponse.ProtoReflect.Descriptor instead. +func (*MsgSwapPubKeyResponse) Descriptor() ([]byte, []int) { + return file_cosmos_accounts_defaults_base_v1_base_proto_rawDescGZIP(), []int{3} +} + +// QuerySequence is the request for the account sequence. +type QuerySequence struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *QuerySequence) Reset() { + *x = QuerySequence{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_accounts_defaults_base_v1_base_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QuerySequence) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QuerySequence) ProtoMessage() {} + +// Deprecated: Use QuerySequence.ProtoReflect.Descriptor instead. +func (*QuerySequence) Descriptor() ([]byte, []int) { + return file_cosmos_accounts_defaults_base_v1_base_proto_rawDescGZIP(), []int{4} +} + +// QuerySequenceResponse returns the sequence of the account. +type QuerySequenceResponse struct { + state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -2535,6 +3353,69 @@ func (x *QuerySequenceResponse) GetSequence() uint64 { return 0 } +// QueryPubKey is the request used to query the pubkey of an account. +type QueryPubKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *QueryPubKey) Reset() { + *x = QueryPubKey{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_accounts_defaults_base_v1_base_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryPubKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryPubKey) ProtoMessage() {} + +// Deprecated: Use QueryPubKey.ProtoReflect.Descriptor instead. +func (*QueryPubKey) Descriptor() ([]byte, []int) { + return file_cosmos_accounts_defaults_base_v1_base_proto_rawDescGZIP(), []int{6} +} + +// QueryPubKeyResponse is the response returned when a QueryPubKey message is sent. +type QueryPubKeyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PubKey *anypb.Any `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` +} + +func (x *QueryPubKeyResponse) Reset() { + *x = QueryPubKeyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_accounts_defaults_base_v1_base_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryPubKeyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryPubKeyResponse) ProtoMessage() {} + +// Deprecated: Use QueryPubKeyResponse.ProtoReflect.Descriptor instead. +func (*QueryPubKeyResponse) Descriptor() ([]byte, []int) { + return file_cosmos_accounts_defaults_base_v1_base_proto_rawDescGZIP(), []int{7} +} + +func (x *QueryPubKeyResponse) GetPubKey() *anypb.Any { + if x != nil { + return x.PubKey + } + return nil +} + var File_cosmos_accounts_defaults_base_v1_base_proto protoreflect.FileDescriptor var file_cosmos_accounts_defaults_base_v1_base_proto_rawDesc = []byte{ @@ -2542,38 +3423,47 @@ var file_cosmos_accounts_defaults_base_v1_base_proto_rawDesc = []byte{ 0x73, 0x2f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x64, - 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x22, - 0x22, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x75, - 0x62, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x70, 0x75, 0x62, - 0x4b, 0x65, 0x79, 0x22, 0x11, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2f, 0x0a, 0x0d, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, - 0x70, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0b, 0x6e, 0x65, 0x77, 0x5f, 0x70, - 0x75, 0x62, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x6e, 0x65, - 0x77, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x22, 0x17, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x53, 0x77, - 0x61, 0x70, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x0f, 0x0a, 0x0d, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, - 0x65, 0x22, 0x33, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, - 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, - 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, - 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x90, 0x02, 0x0a, 0x24, 0x63, 0x6f, 0x6d, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x64, - 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x42, - 0x09, 0x42, 0x61, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x38, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x64, - 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x3b, - 0x62, 0x61, 0x73, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x04, 0x43, 0x41, 0x44, 0x42, 0xaa, 0x02, 0x20, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, - 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x2e, 0x56, 0x31, - 0xca, 0x02, 0x20, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x73, 0x5c, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x5c, 0x42, 0x61, 0x73, 0x65, - 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x2c, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x5c, 0x42, - 0x61, 0x73, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x24, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3a, 0x3a, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x3a, - 0x3a, 0x42, 0x61, 0x73, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x1a, + 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x38, 0x0a, 0x07, 0x4d, 0x73, + 0x67, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x2d, 0x0a, 0x07, 0x70, 0x75, 0x62, 0x5f, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x06, 0x70, 0x75, + 0x62, 0x4b, 0x65, 0x79, 0x22, 0x11, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x69, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x45, 0x0a, 0x0d, 0x4d, 0x73, 0x67, 0x53, 0x77, + 0x61, 0x70, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x12, 0x34, 0x0a, 0x0b, 0x6e, 0x65, 0x77, 0x5f, + 0x70, 0x75, 0x62, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x41, 0x6e, 0x79, 0x52, 0x09, 0x6e, 0x65, 0x77, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x22, 0x17, + 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x0f, 0x0a, 0x0d, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x33, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x0d, 0x0a, + 0x0b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x22, 0x44, 0x0a, 0x13, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x07, 0x70, 0x75, 0x62, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x06, 0x70, 0x75, 0x62, 0x4b, + 0x65, 0x79, 0x42, 0x90, 0x02, 0x0a, 0x24, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x64, 0x65, 0x66, 0x61, 0x75, + 0x6c, 0x74, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x09, 0x42, 0x61, 0x73, + 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x38, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x64, 0x65, 0x66, 0x61, 0x75, + 0x6c, 0x74, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x61, 0x73, 0x65, + 0x76, 0x31, 0xa2, 0x02, 0x04, 0x43, 0x41, 0x44, 0x42, 0xaa, 0x02, 0x20, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x44, 0x65, 0x66, 0x61, + 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x20, 0x43, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x44, + 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x5c, 0x42, 0x61, 0x73, 0x65, 0x5c, 0x56, 0x31, 0xe2, + 0x02, 0x2c, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x73, 0x5c, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x5c, 0x42, 0x61, 0x73, 0x65, 0x5c, + 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x24, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x73, 0x3a, 0x3a, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x3a, 0x3a, 0x42, 0x61, 0x73, + 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2588,7 +3478,7 @@ func file_cosmos_accounts_defaults_base_v1_base_proto_rawDescGZIP() []byte { return file_cosmos_accounts_defaults_base_v1_base_proto_rawDescData } -var file_cosmos_accounts_defaults_base_v1_base_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_cosmos_accounts_defaults_base_v1_base_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_cosmos_accounts_defaults_base_v1_base_proto_goTypes = []interface{}{ (*MsgInit)(nil), // 0: cosmos.accounts.defaults.base.v1.MsgInit (*MsgInitResponse)(nil), // 1: cosmos.accounts.defaults.base.v1.MsgInitResponse @@ -2596,13 +3486,19 @@ var file_cosmos_accounts_defaults_base_v1_base_proto_goTypes = []interface{}{ (*MsgSwapPubKeyResponse)(nil), // 3: cosmos.accounts.defaults.base.v1.MsgSwapPubKeyResponse (*QuerySequence)(nil), // 4: cosmos.accounts.defaults.base.v1.QuerySequence (*QuerySequenceResponse)(nil), // 5: cosmos.accounts.defaults.base.v1.QuerySequenceResponse + (*QueryPubKey)(nil), // 6: cosmos.accounts.defaults.base.v1.QueryPubKey + (*QueryPubKeyResponse)(nil), // 7: cosmos.accounts.defaults.base.v1.QueryPubKeyResponse + (*anypb.Any)(nil), // 8: google.protobuf.Any } var file_cosmos_accounts_defaults_base_v1_base_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 8, // 0: cosmos.accounts.defaults.base.v1.MsgInit.pub_key:type_name -> google.protobuf.Any + 8, // 1: cosmos.accounts.defaults.base.v1.MsgSwapPubKey.new_pub_key:type_name -> google.protobuf.Any + 8, // 2: cosmos.accounts.defaults.base.v1.QueryPubKeyResponse.pub_key:type_name -> google.protobuf.Any + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_cosmos_accounts_defaults_base_v1_base_proto_init() } @@ -2683,6 +3579,30 @@ func file_cosmos_accounts_defaults_base_v1_base_proto_init() { return nil } } + file_cosmos_accounts_defaults_base_v1_base_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryPubKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_accounts_defaults_base_v1_base_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryPubKeyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -2690,7 +3610,7 @@ func file_cosmos_accounts_defaults_base_v1_base_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_accounts_defaults_base_v1_base_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 8, NumExtensions: 0, NumServices: 0, }, diff --git a/api/cosmos/auth/module/v1/module.pulsar.go b/api/cosmos/auth/module/v1/module.pulsar.go index 8b371ab269b4..2ba0bff52d41 100644 --- a/api/cosmos/auth/module/v1/module.pulsar.go +++ b/api/cosmos/auth/module/v1/module.pulsar.go @@ -1302,7 +1302,7 @@ var file_cosmos_auth_module_v1_module_proto_rawDesc = []byte{ 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, - 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd6, 0x01, + 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe6, 0x01, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x62, 0x65, 0x63, 0x68, 0x33, 0x32, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x62, 0x65, 0x63, 0x68, 0x33, 0x32, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x6c, 0x0a, @@ -1314,8 +1314,9 @@ var file_cosmos_auth_module_v1_module_proto_rawDesc = []byte{ 0x6e, 0x52, 0x18, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x1b, 0xba, 0xc0, 0x96, 0xda, 0x01, - 0x15, 0x0a, 0x13, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x2b, 0xba, 0xc0, 0x96, 0xda, 0x01, + 0x25, 0x0a, 0x23, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x78, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x22, 0x55, 0x0a, 0x17, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, diff --git a/api/cosmos/base/abci/v1beta1/abci.pulsar.go b/api/cosmos/base/abci/v1beta1/abci.pulsar.go index 234e7c3bdfd5..824ceb18f855 100644 --- a/api/cosmos/base/abci/v1beta1/abci.pulsar.go +++ b/api/cosmos/base/abci/v1beta1/abci.pulsar.go @@ -7317,8 +7317,6 @@ type TxResponse struct { // these events include those emitted by processing all the messages and those // emitted from the ante. Whereas Logs contains the events, with // additional metadata, emitted only by processing the messages. - // - // Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 Events []*v1.Event `protobuf:"bytes,13,rep,name=events,proto3" json:"events,omitempty"` } diff --git a/api/cosmos/consensus/v1/query.pulsar.go b/api/cosmos/consensus/v1/query.pulsar.go index 734ec7f7023e..ef4d64ea7464 100644 --- a/api/cosmos/consensus/v1/query.pulsar.go +++ b/api/cosmos/consensus/v1/query.pulsar.go @@ -896,37 +896,35 @@ var file_cosmos_consensus_v1_query_proto_rawDesc = []byte{ 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x62, 0x66, 0x74, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x6e, - 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, - 0x73, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, - 0x51, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x62, 0x66, - 0x74, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x65, - 0x6e, 0x73, 0x75, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x32, 0x8a, 0x01, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x80, 0x01, 0x0a, - 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x28, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, - 0x73, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x1d, 0x12, 0x1b, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x73, - 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, - 0xc5, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, - 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2f, 0x76, 0x31, 0x3b, - 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x43, - 0x58, 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x65, - 0x6e, 0x73, 0x75, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, - 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x15, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, - 0x73, 0x75, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x51, 0x0a, 0x13, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x3a, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x62, 0x66, 0x74, 0x2e, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0x8a, 0x01, + 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x80, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x12, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x73, + 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x12, 0x1b, 0x2f, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, + 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xc5, 0x01, 0x0a, 0x17, 0x63, + 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, + 0x73, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, + 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, + 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6e, 0x73, 0x65, + 0x6e, 0x73, 0x75, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x43, 0x58, 0xaa, 0x02, 0x13, 0x43, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2e, + 0x56, 0x31, 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x43, 0x6f, 0x6e, 0x73, + 0x65, 0x6e, 0x73, 0x75, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x43, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x3a, 0x3a, + 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -963,7 +961,6 @@ func file_cosmos_consensus_v1_query_proto_init() { if File_cosmos_consensus_v1_query_proto != nil { return } - file_cosmos_consensus_v1_consensus_proto_init() if !protoimpl.UnsafeEnabled { file_cosmos_consensus_v1_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryParamsRequest); i { diff --git a/api/cosmos/consensus/v1/tx.pulsar.go b/api/cosmos/consensus/v1/tx.pulsar.go index 6a6a85835bc5..addd9db38326 100644 --- a/api/cosmos/consensus/v1/tx.pulsar.go +++ b/api/cosmos/consensus/v1/tx.pulsar.go @@ -2,7 +2,6 @@ package consensusv1 import ( - _ "buf.build/gen/go/cometbft/cometbft/protocolbuffers/go/cometbft/abci/v1" v1 "buf.build/gen/go/cometbft/cometbft/protocolbuffers/go/cometbft/types/v1" _ "cosmossdk.io/api/amino" _ "cosmossdk.io/api/cosmos/msg/v1" @@ -1414,67 +1413,65 @@ var file_cosmos_consensus_v1_tx_proto_rawDesc = []byte{ 0x6f, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x62, 0x66, 0x74, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x63, 0x6f, 0x6d, 0x65, - 0x74, 0x62, 0x66, 0x74, 0x2f, 0x61, 0x62, 0x63, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xad, 0x04, 0x0a, 0x0f, 0x4d, 0x73, 0x67, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x74, 0x79, 0x12, 0x34, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x62, 0x66, 0x74, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x3d, 0x0a, 0x08, 0x65, 0x76, - 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, - 0x6f, 0x6d, 0x65, 0x74, 0x62, 0x66, 0x74, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, - 0x08, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x40, 0x0a, 0x09, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, - 0x6f, 0x6d, 0x65, 0x74, 0x62, 0x66, 0x74, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x52, 0x09, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x48, 0x0a, 0x04, 0x61, - 0x62, 0x63, 0x69, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x6f, 0x6d, 0x65, - 0x74, 0x62, 0x66, 0x74, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x42, - 0x43, 0x49, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x15, 0xda, 0xb4, 0x2d, 0x0f, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x20, 0x30, 0x2e, 0x35, 0x30, 0x18, 0x01, 0x52, - 0x04, 0x61, 0x62, 0x63, 0x69, 0x12, 0x55, 0x0a, 0x09, 0x73, 0x79, 0x6e, 0x63, 0x68, 0x72, 0x6f, - 0x6e, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x6f, 0x6d, 0x65, 0x74, - 0x62, 0x66, 0x74, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x79, 0x6e, - 0x63, 0x68, 0x72, 0x6f, 0x6e, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x13, 0xda, 0xb4, - 0x2d, 0x0f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x20, 0x30, 0x2e, 0x35, - 0x32, 0x52, 0x09, 0x73, 0x79, 0x6e, 0x63, 0x68, 0x72, 0x6f, 0x6e, 0x79, 0x12, 0x4f, 0x0a, 0x07, - 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, - 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x62, 0x66, 0x74, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, - 0x13, 0xda, 0xb4, 0x2d, 0x0f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x20, - 0x30, 0x2e, 0x35, 0x32, 0x52, 0x07, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x3a, 0x39, 0x82, - 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, - 0x2a, 0x26, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x78, 0x2f, 0x63, - 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x32, 0x85, 0x01, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x77, 0x0a, 0x0c, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x1a, 0x2c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x65, - 0x6e, 0x73, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x13, 0xca, 0xb4, 0x2d, 0x0f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x20, - 0x30, 0x2e, 0x34, 0x37, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xc2, 0x01, 0x0a, 0x17, - 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x65, - 0x6e, 0x73, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x30, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x73, - 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, - 0x75, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x43, 0x58, 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2e, 0x56, 0x31, - 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, - 0x73, 0x75, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, - 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x43, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x3a, 0x3a, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x3a, 0x3a, 0x56, 0x31, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xad, 0x04, 0x0a, 0x0f, 0x4d, + 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, + 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x34, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x62, 0x66, 0x74, + 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x3d, 0x0a, 0x08, + 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, + 0x2e, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x62, 0x66, 0x74, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x52, 0x08, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x40, 0x0a, 0x09, 0x76, + 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, + 0x2e, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x62, 0x66, 0x74, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x52, 0x09, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x48, 0x0a, + 0x04, 0x61, 0x62, 0x63, 0x69, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x6f, + 0x6d, 0x65, 0x74, 0x62, 0x66, 0x74, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, + 0x41, 0x42, 0x43, 0x49, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x15, 0xda, 0xb4, 0x2d, 0x0f, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x20, 0x30, 0x2e, 0x35, 0x30, 0x18, + 0x01, 0x52, 0x04, 0x61, 0x62, 0x63, 0x69, 0x12, 0x55, 0x0a, 0x09, 0x73, 0x79, 0x6e, 0x63, 0x68, + 0x72, 0x6f, 0x6e, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x6f, 0x6d, + 0x65, 0x74, 0x62, 0x66, 0x74, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, + 0x79, 0x6e, 0x63, 0x68, 0x72, 0x6f, 0x6e, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x13, + 0xda, 0xb4, 0x2d, 0x0f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x20, 0x30, + 0x2e, 0x35, 0x32, 0x52, 0x09, 0x73, 0x79, 0x6e, 0x63, 0x68, 0x72, 0x6f, 0x6e, 0x79, 0x12, 0x4f, + 0x0a, 0x07, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x20, 0x2e, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x62, 0x66, 0x74, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x42, 0x13, 0xda, 0xb4, 0x2d, 0x0f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, + 0x6b, 0x20, 0x30, 0x2e, 0x35, 0x32, 0x52, 0x07, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x3a, + 0x39, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, + 0xe7, 0xb0, 0x2a, 0x26, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x78, + 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x85, 0x01, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x77, 0x0a, + 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x24, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, + 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x1a, 0x2c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6e, + 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x13, 0xca, 0xb4, 0x2d, 0x0f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, + 0x6b, 0x20, 0x30, 0x2e, 0x34, 0x37, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xc2, 0x01, + 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6e, + 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, + 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, + 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6e, 0x73, 0x65, + 0x6e, 0x73, 0x75, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x43, 0x58, 0xaa, 0x02, 0x13, 0x43, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2e, + 0x56, 0x31, 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x43, 0x6f, 0x6e, 0x73, + 0x65, 0x6e, 0x73, 0x75, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x43, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x3a, 0x3a, + 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/cosmos/tx/config/v1/config.pulsar.go b/api/cosmos/tx/config/v1/config.pulsar.go index 5d8dc685ef12..c0b353c4367f 100644 --- a/api/cosmos/tx/config/v1/config.pulsar.go +++ b/api/cosmos/tx/config/v1/config.pulsar.go @@ -546,15 +546,16 @@ var file_cosmos_tx_config_v1_config_proto_rawDesc = []byte{ 0x74, 0x6f, 0x12, 0x13, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, - 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x80, 0x01, 0x0a, 0x06, 0x43, 0x6f, + 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x90, 0x01, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2a, 0x0a, 0x11, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x61, 0x6e, 0x74, 0x65, 0x5f, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x73, 0x6b, 0x69, 0x70, 0x41, 0x6e, 0x74, 0x65, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x11, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x70, 0x6f, 0x73, 0x74, 0x5f, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x73, 0x6b, 0x69, - 0x70, 0x50, 0x6f, 0x73, 0x74, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x3a, 0x1e, 0xba, 0xc0, - 0x96, 0xda, 0x01, 0x18, 0x0a, 0x16, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, - 0x69, 0x6f, 0x2f, 0x78, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x74, 0x78, 0x42, 0xc4, 0x01, 0x0a, + 0x70, 0x50, 0x6f, 0x73, 0x74, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x3a, 0x2e, 0xba, 0xc0, + 0x96, 0xda, 0x01, 0x28, 0x0a, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, + 0x64, 0x6b, 0x2f, 0x78, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x74, 0x78, 0x42, 0xc4, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, diff --git a/api/go.mod b/api/go.mod index c1ba83131d77..c8413fe04623 100644 --- a/api/go.mod +++ b/api/go.mod @@ -6,8 +6,8 @@ require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/gogoproto v1.7.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 - google.golang.org/grpc v1.65.0 + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 + google.golang.org/grpc v1.66.0 google.golang.org/protobuf v1.34.2 ) @@ -17,5 +17,5 @@ require ( golang.org/x/net v0.28.0 // indirect golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect ) diff --git a/api/go.sum b/api/go.sum index 16d0c49ba096..7ec3dea606f7 100644 --- a/api/go.sum +++ b/api/go.sum @@ -6,8 +6,8 @@ github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+R github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= @@ -16,11 +16,11 @@ golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= diff --git a/baseapp/abci.go b/baseapp/abci.go index d2d87a5cf562..05b9e61794a7 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -38,6 +38,8 @@ const ( QueryPathBroadcastTx = "/cosmos.tx.v1beta1.Service/BroadcastTx" ) +// InitChain implements the ABCI interface. It initializes the application's state +// and sets up the initial validator set. func (app *BaseApp) InitChain(req *abci.InitChainRequest) (*abci.InitChainResponse, error) { if req.ChainId != app.chainID { return nil, fmt.Errorf("invalid chain-id on InitChain; expected: %s, got: %s", app.chainID, req.ChainId) @@ -135,6 +137,7 @@ func (app *BaseApp) InitChain(req *abci.InitChainRequest) (*abci.InitChainRespon }, nil } +// Info implements the ABCI interface. It returns information about the application. func (app *BaseApp) Info(_ *abci.InfoRequest) (*abci.InfoResponse, error) { lastCommitID := app.cms.LastCommitID() appVersion := InitialAppVersion @@ -914,10 +917,10 @@ func (app *BaseApp) FinalizeBlock(req *abci.FinalizeBlockRequest) (res *abci.Fin func (app *BaseApp) checkHalt(height int64, time time.Time) error { var halt bool switch { - case app.haltHeight > 0 && uint64(height) > app.haltHeight: + case app.haltHeight > 0 && uint64(height) >= app.haltHeight: halt = true - case app.haltTime > 0 && time.Unix() > int64(app.haltTime): + case app.haltTime > 0 && time.Unix() >= int64(app.haltTime): halt = true } diff --git a/baseapp/abci_test.go b/baseapp/abci_test.go index b7fb67fad216..7a5fde3ba17d 100644 --- a/baseapp/abci_test.go +++ b/baseapp/abci_test.go @@ -34,7 +34,6 @@ import ( "cosmossdk.io/store/snapshots" snapshottypes "cosmossdk.io/store/snapshots/types" storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/auth/signing" "github.com/cosmos/cosmos-sdk/baseapp" baseapptestutil "github.com/cosmos/cosmos-sdk/baseapp/testutil" @@ -46,6 +45,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/mempool" + "github.com/cosmos/cosmos-sdk/x/auth/signing" ) const ( @@ -2257,9 +2257,11 @@ func TestABCI_HaltChain(t *testing.T) { expHalt bool }{ {"default", 0, 0, 10, 0, false}, - {"halt-height-edge", 10, 0, 10, 0, false}, - {"halt-height", 10, 0, 11, 0, true}, - {"halt-time-edge", 0, 10, 1, 10, false}, + {"halt-height-edge", 11, 0, 10, 0, false}, + {"halt-height-equal", 10, 0, 10, 0, true}, + {"halt-height", 10, 0, 10, 0, true}, + {"halt-time-edge", 0, 11, 1, 10, false}, + {"halt-time-equal", 0, 10, 1, 10, true}, {"halt-time", 0, 10, 1, 11, true}, } diff --git a/baseapp/abci_utils.go b/baseapp/abci_utils.go index 6da80906fab5..da6adef5539d 100644 --- a/baseapp/abci_utils.go +++ b/baseapp/abci_utils.go @@ -23,7 +23,7 @@ import ( ) type ( - // ValidatorStore defines the interface contract require for verifying vote + // ValidatorStore defines the interface contract required for verifying vote // extension signatures. Typically, this will be implemented by the x/staking // module, which has knowledge of the CometBFT public key. ValidatorStore interface { @@ -84,7 +84,7 @@ func ValidateVoteExtensions( totalVP += vote.Validator.Power // Only check + include power if the vote is a commit vote. There must be super-majority, otherwise the - // previous block (the block vote is for) could not have been committed. + // previous block (the block the vote is for) could not have been committed. if vote.BlockIdFlag != cmtproto.BlockIDFlagCommit { continue } diff --git a/baseapp/abci_utils_test.go b/baseapp/abci_utils_test.go index 7e1c566faf94..65e4e0ec1a78 100644 --- a/baseapp/abci_utils_test.go +++ b/baseapp/abci_utils_test.go @@ -21,7 +21,6 @@ import ( "cosmossdk.io/core/comet" "cosmossdk.io/core/header" "cosmossdk.io/log" - authtx "cosmossdk.io/x/auth/tx" "github.com/cosmos/cosmos-sdk/baseapp" baseapptestutil "github.com/cosmos/cosmos-sdk/baseapp/testutil" @@ -34,6 +33,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/mempool" signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" ) const ( @@ -419,7 +419,7 @@ func (s *ABCIUtilsTestSuite) TestValidateVoteExtensionsIncorrectVotingPower() { s.Require().Error(baseapp.ValidateVoteExtensions(s.ctx, s.valStore, llc)) } -func (s *ABCIUtilsTestSuite) TestValidateVoteExtensionsIncorrecOrder() { +func (s *ABCIUtilsTestSuite) TestValidateVoteExtensionsIncorrectOrder() { ext := []byte("vote-extension") cve := cmtproto.CanonicalVoteExtension{ Extension: ext, diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index a6a60a6d376f..b380fc2c5169 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -4,20 +4,20 @@ import ( "context" "errors" "fmt" + "maps" "math" - "sort" + "slices" "strconv" "sync" abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" "github.com/cometbft/cometbft/crypto/tmhash" - dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/gogoproto/proto" - "golang.org/x/exp/maps" "google.golang.org/protobuf/reflect/protoreflect" "cosmossdk.io/core/header" + corestore "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" "cosmossdk.io/store" @@ -65,7 +65,7 @@ type BaseApp struct { mu sync.Mutex // mu protects the fields below. logger log.Logger name string // application name from abci.BlockInfo - db dbm.DB // common DB backend + db corestore.KVStoreWithBatch // common DB backend cms storetypes.CommitMultiStore // Main (uncached) state qms storetypes.MultiStore // Optional alternative multistore for querying only. storeLoader StoreLoader // function to handle store loading, may be overridden with SetStoreLoader() @@ -194,7 +194,7 @@ type BaseApp struct { // variadic number of option functions, which act on the BaseApp to set // configuration choices. func NewBaseApp( - name string, logger log.Logger, db dbm.DB, txDecoder sdk.TxDecoder, options ...func(*BaseApp), + name string, logger log.Logger, db corestore.KVStoreWithBatch, txDecoder sdk.TxDecoder, options ...func(*BaseApp), ) *BaseApp { app := &BaseApp{ logger: logger.With(log.ModuleKey, "baseapp"), @@ -340,8 +340,7 @@ func (app *BaseApp) MountTransientStores(keys map[string]*storetypes.TransientSt // MountMemoryStores mounts all in-memory KVStores with the BaseApp's internal // commit multi-store. func (app *BaseApp) MountMemoryStores(keys map[string]*storetypes.MemoryStoreKey) { - skeys := maps.Keys(keys) - sort.Strings(skeys) + skeys := slices.Sorted(maps.Keys(keys)) for _, key := range skeys { memKey := keys[key] app.MountStore(memKey, storetypes.StoreTypeMemory) @@ -712,7 +711,7 @@ func (app *BaseApp) cacheTxContext(ctx sdk.Context, txBytes []byte) (sdk.Context func (app *BaseApp) preBlock(req *abci.FinalizeBlockRequest) ([]abci.Event, error) { var events []abci.Event if app.preBlocker != nil { - ctx := app.finalizeBlockState.Context() + ctx := app.finalizeBlockState.Context().WithEventManager(sdk.NewEventManager()) if err := app.preBlocker(ctx, req); err != nil { return nil, err } diff --git a/baseapp/baseapp_test.go b/baseapp/baseapp_test.go index aa5060ae7242..ecaf6894b400 100644 --- a/baseapp/baseapp_test.go +++ b/baseapp/baseapp_test.go @@ -14,6 +14,7 @@ import ( dbm "github.com/cosmos/cosmos-db" "github.com/stretchr/testify/require" + corestore "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" "cosmossdk.io/store/metrics" @@ -22,7 +23,6 @@ import ( "cosmossdk.io/store/snapshots" snapshottypes "cosmossdk.io/store/snapshots/types" storetypes "cosmossdk.io/store/types" - authtx "cosmossdk.io/x/auth/tx" "github.com/cosmos/cosmos-sdk/baseapp" baseapptestutil "github.com/cosmos/cosmos-sdk/baseapp/testutil" @@ -32,6 +32,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" ) var ( @@ -296,7 +297,7 @@ func TestSetLoader(t *testing.T) { app.SetStoreLoader(baseapp.DefaultStoreLoader) } - initStore := func(t *testing.T, db dbm.DB, storeKey string, k, v []byte) { + initStore := func(t *testing.T, db corestore.KVStoreWithBatch, storeKey string, k, v []byte) { t.Helper() rs := rootmulti.NewStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) rs.SetPruning(pruningtypes.NewPruningOptions(pruningtypes.PruningNothing)) @@ -317,7 +318,7 @@ func TestSetLoader(t *testing.T) { require.Equal(t, int64(1), commitID.Version) } - checkStore := func(t *testing.T, db dbm.DB, ver int64, storeKey string, k, v []byte) { + checkStore := func(t *testing.T, db corestore.KVStoreWithBatch, ver int64, storeKey string, k, v []byte) { t.Helper() rs := rootmulti.NewStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) rs.SetPruning(pruningtypes.NewPruningOptions(pruningtypes.PruningDefault)) diff --git a/baseapp/genesis.go b/baseapp/genesis.go index ef3499462472..c4705c3f88db 100644 --- a/baseapp/genesis.go +++ b/baseapp/genesis.go @@ -6,9 +6,9 @@ import ( "github.com/cometbft/cometbft/abci/types" ) -// ExecuteGenesis implements a genesis TxHandler used to execute a genTxs (from genutil). -func (ba *BaseApp) ExecuteGenesisTx(tx []byte) error { - res := ba.deliverTx(tx) +// ExecuteGenesisTx implements a genesis TxHandler used to execute a genTxs (from genutil). +func (app *BaseApp) ExecuteGenesisTx(tx []byte) error { + res := app.deliverTx(tx) if res.Code != types.CodeTypeOK { return errors.New(res.Log) diff --git a/baseapp/internal/protocompat/protocompat.go b/baseapp/internal/protocompat/protocompat.go index 4bd24f6c2ff2..bd277e4a44f7 100644 --- a/baseapp/internal/protocompat/protocompat.go +++ b/baseapp/internal/protocompat/protocompat.go @@ -43,9 +43,8 @@ func MakeHybridHandler(cdc codec.BinaryCodec, sd *grpc.ServiceDesc, method grpc. } if isProtov2Handler { return makeProtoV2HybridHandler(methodDesc, cdc, method, handler) - } else { - return makeGogoHybridHandler(methodDesc, cdc, method, handler) } + return makeGogoHybridHandler(methodDesc, cdc, method, handler) } // makeProtoV2HybridHandler returns a handler that can handle both gogo and protov2 messages. diff --git a/baseapp/msg_service_router.go b/baseapp/msg_service_router.go index 867809152f57..11e3b4bf1b75 100644 --- a/baseapp/msg_service_router.go +++ b/baseapp/msg_service_router.go @@ -47,7 +47,6 @@ func NewMsgServiceRouter() *MsgServiceRouter { routes: map[string]MsgServiceHandler{}, hybridHandlers: map[string]func(ctx context.Context, req, resp protoiface.MessageV1) error{}, responseByMsgName: map[string]string{}, - circuitBreaker: nil, } } diff --git a/baseapp/msg_service_router_test.go b/baseapp/msg_service_router_test.go index 85b233c71d97..84862c76f89c 100644 --- a/baseapp/msg_service_router_test.go +++ b/baseapp/msg_service_router_test.go @@ -10,8 +10,6 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/log" - authsigning "cosmossdk.io/x/auth/signing" - authtx "cosmossdk.io/x/auth/tx" "github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/codec" @@ -19,6 +17,8 @@ import ( "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/testutil/testdata" "github.com/cosmos/cosmos-sdk/types/tx/signing" + authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" ) func TestRegisterMsgService(t *testing.T) { diff --git a/baseapp/options.go b/baseapp/options.go index bcff418fb8b0..9b657f4136cf 100644 --- a/baseapp/options.go +++ b/baseapp/options.go @@ -7,8 +7,7 @@ import ( "io" "math" - dbm "github.com/cosmos/cosmos-db" - + corestore "cosmossdk.io/core/store" "cosmossdk.io/store/metrics" pruningtypes "cosmossdk.io/store/pruning/types" "cosmossdk.io/store/snapshots" @@ -178,7 +177,7 @@ func (app *BaseApp) SetAppVersion(ctx context.Context, v uint64) error { return nil } -func (app *BaseApp) SetDB(db dbm.DB) { +func (app *BaseApp) SetDB(db corestore.KVStoreWithBatch) { if app.sealed { panic("SetDB() on sealed BaseApp") } diff --git a/baseapp/streaming.go b/baseapp/streaming.go index 9c5c3d5d1742..6eeb8e37b449 100644 --- a/baseapp/streaming.go +++ b/baseapp/streaming.go @@ -9,6 +9,7 @@ import ( abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" "github.com/spf13/cast" + "cosmossdk.io/log" "cosmossdk.io/schema" "cosmossdk.io/schema/appdata" "cosmossdk.io/schema/decoding" @@ -36,7 +37,7 @@ func (app *BaseApp) EnableIndexer(indexerOpts interface{}, keys map[string]*stor Config: indexerOpts, Resolver: decoding.ModuleSetDecoderResolver(appModules), SyncSource: nil, - Logger: app.logger.With("module", "indexer"), + Logger: app.logger.With(log.ModuleKey, "indexer"), }) if err != nil { return err @@ -163,14 +164,16 @@ func (p listenerWrapper) ListenFinalizeBlock(_ context.Context, req abci.Finaliz func (p listenerWrapper) ListenCommit(ctx context.Context, res abci.CommitResponse, changeSet []*storetypes.StoreKVPair) error { if cb := p.listener.OnKVPair; cb != nil { - updates := make([]appdata.ModuleKVPairUpdate, len(changeSet)) + updates := make([]appdata.ActorKVPairUpdate, len(changeSet)) for i, pair := range changeSet { - updates[i] = appdata.ModuleKVPairUpdate{ - ModuleName: pair.StoreKey, - Update: schema.KVPairUpdate{ - Key: pair.Key, - Value: pair.Value, - Delete: pair.Delete, + updates[i] = appdata.ActorKVPairUpdate{ + Actor: []byte(pair.StoreKey), + StateChanges: []schema.KVPairUpdate{ + { + Key: pair.Key, + Value: pair.Value, + Remove: pair.Delete, + }, }, } } @@ -181,10 +184,16 @@ func (p listenerWrapper) ListenCommit(ctx context.Context, res abci.CommitRespon } if p.listener.Commit != nil { - err := p.listener.Commit(appdata.CommitData{}) + commitCb, err := p.listener.Commit(appdata.CommitData{}) if err != nil { return err } + if commitCb != nil { + err := commitCb() + if err != nil { + return err + } + } } return nil diff --git a/baseapp/test_helpers.go b/baseapp/test_helpers.go index 3125e268b0bd..fcd0e55c8447 100644 --- a/baseapp/test_helpers.go +++ b/baseapp/test_helpers.go @@ -41,7 +41,7 @@ func (app *BaseApp) SimDeliver(txEncoder sdk.TxEncoder, tx sdk.Tx) (sdk.GasInfo, } // SimWriteState is an entrypoint for simulations only. They are not executed during the normal ABCI finalize -// block step but later. Therefore an extra call to the root multi-store (app.cms) is required to write the changes. +// block step but later. Therefore, an extra call to the root multi-store (app.cms) is required to write the changes. func (app *BaseApp) SimWriteState() { app.finalizeBlockState.ms.Write() } diff --git a/baseapp/utils_test.go b/baseapp/utils_test.go index 27668ce590c5..970aa0cedce5 100644 --- a/baseapp/utils_test.go +++ b/baseapp/utils_test.go @@ -24,9 +24,6 @@ import ( "cosmossdk.io/depinject/appconfig" errorsmod "cosmossdk.io/errors" storetypes "cosmossdk.io/store/types" - _ "cosmossdk.io/x/auth" - "cosmossdk.io/x/auth/signing" - _ "cosmossdk.io/x/auth/tx/config" "github.com/cosmos/cosmos-sdk/baseapp" baseapptestutil "github.com/cosmos/cosmos-sdk/baseapp/testutil" @@ -39,6 +36,9 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/mempool" signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" + _ "github.com/cosmos/cosmos-sdk/x/auth" + "github.com/cosmos/cosmos-sdk/x/auth/signing" + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" ) var ParamStoreKey = []byte("paramstore") diff --git a/client/debug/main.go b/client/debug/main.go index f9f8a176f5ef..0cce37d16cd1 100644 --- a/client/debug/main.go +++ b/client/debug/main.go @@ -82,7 +82,7 @@ func getCodecInterfaces() *cobra.Command { // getCodecInterfaceImpls creates and returns a new cmd used for listing all registered implementations of a given interface on the application codec. func getCodecInterfaceImpls() *cobra.Command { return &cobra.Command{ - Use: "list-implementations [interface]", + Use: "list-implementations ", Short: "List the registered type URLs for the provided interface", Long: "List the registered type URLs that can be used for the provided interface name using the application codec", Example: fmt.Sprintf("%s debug codec list-implementations cosmos.crypto.PubKey", version.AppName), @@ -109,7 +109,7 @@ func getPubKeyFromString(ctx client.Context, pkstr string) (cryptotypes.PubKey, func PubkeyCmd() *cobra.Command { return &cobra.Command{ - Use: "pubkey [pubkey]", + Use: "pubkey ", Short: "Decode a pubkey from proto JSON", Long: "Decode a pubkey from proto JSON and display it's address.", Example: fmt.Sprintf(`%s debug pubkey '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"AurroA7jvfPd1AadmmOvWM2rJSwipXfRf8yD6pLbA2DJ"}'`, version.AppName), @@ -181,7 +181,7 @@ func getPubKeyFromRawString(pkstr, keytype string) (cryptotypes.PubKey, error) { func PubkeyRawCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "pubkey-raw [pubkey] -t [{ed25519, secp256k1}]", + Use: "pubkey-raw [-t {ed25519, secp256k1}]", Short: "Decode a ED25519 or secp256k1 pubkey from hex, base64, or bech32", Long: "Decode a pubkey from hex, base64, or bech32.", Example: fmt.Sprintf(` @@ -247,7 +247,7 @@ func PubkeyRawCmd() *cobra.Command { func AddrCmd() *cobra.Command { return &cobra.Command{ - Use: "addr [address]", + Use: "addr
", Short: "Convert an address between hex and bech32", Example: fmt.Sprintf("%s debug addr cosmos1e0jnq2sun3dzjh8p2xq95kk0expwmd7shwjpfg", version.AppName), Args: cobra.ExactArgs(1), @@ -303,7 +303,7 @@ func AddrCmd() *cobra.Command { func RawBytesCmd() *cobra.Command { return &cobra.Command{ - Use: "raw-bytes [raw-bytes]", + Use: "raw-bytes ", Short: "Convert raw bytes output (eg. [10 21 13 255]) to hex", Long: "Convert raw-bytes to hex.", Example: fmt.Sprintf("%s debug raw-bytes [72 101 108 108 111 44 32 112 108 97 121 103 114 111 117 110 100]", version.AppName), diff --git a/client/grpc/cmtservice/autocli.go b/client/grpc/cmtservice/autocli.go index ea314c6f8c08..6d8be1f22994 100644 --- a/client/grpc/cmtservice/autocli.go +++ b/client/grpc/cmtservice/autocli.go @@ -25,7 +25,7 @@ var CometBFTAutoCLIDescriptor = &autocliv1.ServiceCommandDescriptor{ }, { RpcMethod: "GetBlockByHeight", - Use: "block-by-height [height]", + Use: "block-by-height ", Short: "Query for a committed block by height", Long: "Query for a specific committed block using the CometBFT RPC `block_by_height` method", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "height"}}, @@ -38,7 +38,7 @@ var CometBFTAutoCLIDescriptor = &autocliv1.ServiceCommandDescriptor{ }, { RpcMethod: "GetValidatorSetByHeight", - Use: "validator-set-by-height [height]", + Use: "validator-set-by-height ", Short: "Query for a validator set by height", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "height"}}, }, diff --git a/client/grpc/cmtservice/service.go b/client/grpc/cmtservice/service.go index 05eeeb6ecc43..d209475e8648 100644 --- a/client/grpc/cmtservice/service.go +++ b/client/grpc/cmtservice/service.go @@ -15,7 +15,6 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" qtypes "github.com/cosmos/cosmos-sdk/types/query" "github.com/cosmos/cosmos-sdk/version" ) @@ -73,10 +72,15 @@ func (s queryServer) GetLatestBlock(ctx context.Context, _ *GetLatestBlockReques return nil, err } + sdkBlock, err := convertBlock(protoBlock, s.clientCtx.ConsensusAddressCodec) + if err != nil { + return nil, err + } + return &GetLatestBlockResponse{ BlockId: &protoBlockID, Block: protoBlock, - SdkBlock: convertBlock(protoBlock), + SdkBlock: sdkBlock, }, nil } @@ -96,10 +100,15 @@ func (s queryServer) GetBlockByHeight(ctx context.Context, req *GetBlockByHeight return nil, err } + sdkBlock, err := convertBlock(protoBlock, s.clientCtx.ConsensusAddressCodec) + if err != nil { + return nil, err + } + return &GetBlockByHeightResponse{ BlockId: &protoBlockID, Block: protoBlock, - SdkBlock: convertBlock(protoBlock), + SdkBlock: sdkBlock, }, nil } @@ -177,8 +186,13 @@ func ValidatorsOutput(ctx context.Context, clientCtx client.Context, height *int return nil, err } + addr, err := clientCtx.ConsensusAddressCodec.BytesToString(v.Address) + if err != nil { + return nil, err + } + resp.Validators[i] = &Validator{ - Address: sdk.ConsAddress(v.Address).String(), + Address: addr, ProposerPriority: v.ProposerPriority, PubKey: anyPub, VotingPower: v.VotingPower, diff --git a/client/grpc/cmtservice/util.go b/client/grpc/cmtservice/util.go index 6b18e3fdb6e5..22c939fa8aa2 100644 --- a/client/grpc/cmtservice/util.go +++ b/client/grpc/cmtservice/util.go @@ -3,11 +3,16 @@ package cmtservice import ( cmtprototypes "github.com/cometbft/cometbft/api/cometbft/types/v1" - sdk "github.com/cosmos/cosmos-sdk/types" + "cosmossdk.io/core/address" ) // convertHeader converts CometBFT header to sdk header -func convertHeader(h cmtprototypes.Header) Header { +func convertHeader(h cmtprototypes.Header, ac address.Codec) (Header, error) { + proposerAddr, err := ac.BytesToString(h.ProposerAddress) + if err != nil { + return Header{}, err + } + return Header{ Version: h.Version, ChainID: h.ChainID, @@ -22,18 +27,21 @@ func convertHeader(h cmtprototypes.Header) Header { EvidenceHash: h.EvidenceHash, LastResultsHash: h.LastResultsHash, LastCommitHash: h.LastCommitHash, - ProposerAddress: sdk.ConsAddress(h.ProposerAddress).String(), - } + ProposerAddress: proposerAddr, + }, nil } // convertBlock converts CometBFT block to sdk block -func convertBlock(cmtblock *cmtprototypes.Block) *Block { +func convertBlock(cmtblock *cmtprototypes.Block, ac address.Codec) (*Block, error) { b := new(Block) - - b.Header = convertHeader(cmtblock.Header) + var err error + b.Header, err = convertHeader(cmtblock.Header, ac) + if err != nil { + return nil, err + } b.LastCommit = cmtblock.LastCommit b.Data = cmtblock.Data b.Evidence = cmtblock.Evidence - return b + return b, nil } diff --git a/client/grpc/node/autocli.go b/client/grpc/node/autocli.go new file mode 100644 index 000000000000..87819e0f0371 --- /dev/null +++ b/client/grpc/node/autocli.go @@ -0,0 +1,43 @@ +package node + +import ( + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + nodev1beta1 "cosmossdk.io/api/cosmos/base/node/v1beta1" +) + +var ServiceAutoCLIDescriptor = &autocliv1.ServiceCommandDescriptor{ + Service: nodev1beta1.Service_ServiceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "Config", + Use: "config", + Short: "Query the current node config", + }, + { + RpcMethod: "Status", + Use: "status", + Short: "Query the current node status", + }, + }, +} + +// NewNodeCommands is a fake `appmodule.Module` to be considered as a module +// and be added in AutoCLI. +func NewNodeCommands() *nodeModule { + return &nodeModule{} +} + +type nodeModule struct{} + +func (m nodeModule) IsOnePerModuleType() {} +func (m nodeModule) IsAppModule() {} + +func (m nodeModule) Name() string { + return "node" +} + +func (m nodeModule) AutoCLIOptions() *autocliv1.ModuleOptions { + return &autocliv1.ModuleOptions{ + Query: ServiceAutoCLIDescriptor, + } +} diff --git a/client/keys/show.go b/client/keys/show.go index 22c14ddaeb58..0c418b6ed6f9 100644 --- a/client/keys/show.go +++ b/client/keys/show.go @@ -37,7 +37,7 @@ const ( // ShowKeysCmd shows key information for a given key name. func ShowKeysCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "show [name_or_address [name_or_address...]]", + Use: "show [name_or_address...]", Short: "Retrieve key information by name or address", Long: `Display keys details. If multiple names or addresses are provided, then an ephemeral multisig key will be created under the name "multi" diff --git a/client/keys/show_test.go b/client/keys/show_test.go index ac6c162b5076..2f75430638a6 100644 --- a/client/keys/show_test.go +++ b/client/keys/show_test.go @@ -116,8 +116,10 @@ func Test_runShowCmd(t *testing.T) { require.NoError(t, err) addr, err := k.GetAddress() require.NoError(t, err) + addrStr, err := clientCtx.AddressCodec.BytesToString(addr) + require.NoError(t, err) cmd.SetArgs([]string{ - addr.String(), + addrStr, fmt.Sprintf("--%s=%s", flags.FlagKeyringDir, kbHome), fmt.Sprintf("--%s=%s", FlagBechPrefix, sdk.PrefixAccount), fmt.Sprintf("--%s=%s", flags.FlagKeyringBackend, keyring.BackendTest), diff --git a/client/pruning/main.go b/client/pruning/main.go index 9cb73a8cb9de..bdcff50a9bc5 100644 --- a/client/pruning/main.go +++ b/client/pruning/main.go @@ -9,6 +9,7 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" + corestore "cosmossdk.io/core/store" "cosmossdk.io/log" pruningtypes "cosmossdk.io/store/pruning/types" "cosmossdk.io/store/rootmulti" @@ -107,7 +108,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, return cmd } -func openDB(rootDir string, backendType dbm.BackendType) (dbm.DB, error) { +func openDB(rootDir string, backendType dbm.BackendType) (corestore.KVStoreWithBatch, error) { dataDir := filepath.Join(rootDir, "data") return dbm.NewDB("application", backendType, dataDir) } diff --git a/client/snapshot/restore.go b/client/snapshot/restore.go index b0f86b9de678..3cb6e4154e25 100644 --- a/client/snapshot/restore.go +++ b/client/snapshot/restore.go @@ -7,6 +7,7 @@ import ( dbm "github.com/cosmos/cosmos-db" "github.com/spf13/cobra" + corestore "cosmossdk.io/core/store" "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/client" @@ -49,7 +50,7 @@ func RestoreSnapshotCmd[T servertypes.Application](appCreator servertypes.AppCre return cmd } -func openDB(rootDir string, backendType dbm.BackendType) (dbm.DB, error) { +func openDB(rootDir string, backendType dbm.BackendType) (corestore.KVStoreWithBatch, error) { dataDir := filepath.Join(rootDir, "data") return dbm.NewDB("application", backendType, dataDir) } diff --git a/client/test_helpers.go b/client/test_helpers.go index faa7b833729f..7409204f9f0e 100644 --- a/client/test_helpers.go +++ b/client/test_helpers.go @@ -45,8 +45,13 @@ type TestAccountRetriever struct { } // GetAccount implements AccountRetriever.GetAccount -func (t TestAccountRetriever) GetAccount(_ Context, addr sdk.AccAddress) (Account, error) { - acc, ok := t.Accounts[addr.String()] +func (t TestAccountRetriever) GetAccount(clientCtx Context, addr sdk.AccAddress) (Account, error) { + addrStr, err := clientCtx.AddressCodec.BytesToString(addr) + if err != nil { + return nil, err + } + + acc, ok := t.Accounts[addrStr] if !ok { return nil, fmt.Errorf("account: account %s not found", addr) } @@ -65,19 +70,16 @@ func (t TestAccountRetriever) GetAccountWithHeight(clientCtx Context, addr sdk.A } // EnsureExists implements AccountRetriever.EnsureExists -func (t TestAccountRetriever) EnsureExists(_ Context, addr sdk.AccAddress) error { - _, ok := t.Accounts[addr.String()] - if !ok { - return fmt.Errorf("ensureExists: account %s not found", addr) - } - return nil +func (t TestAccountRetriever) EnsureExists(clientCtx Context, addr sdk.AccAddress) error { + _, err := t.GetAccount(clientCtx, addr) + return err } // GetAccountNumberSequence implements AccountRetriever.GetAccountNumberSequence -func (t TestAccountRetriever) GetAccountNumberSequence(_ Context, addr sdk.AccAddress) (accNum, accSeq uint64, err error) { - acc, ok := t.Accounts[addr.String()] - if !ok { - return 0, 0, fmt.Errorf("accountNumberSequence: account %s not found", addr) +func (t TestAccountRetriever) GetAccountNumberSequence(clientCtx Context, addr sdk.AccAddress) (accNum, accSeq uint64, err error) { + acc, err := t.GetAccount(clientCtx, addr) + if err != nil { + return 0, 0, err } - return acc.Num, acc.Seq, nil + return acc.GetAccountNumber(), acc.GetSequence(), nil } diff --git a/client/tx/aux_builder_test.go b/client/tx/aux_builder_test.go index fc15190d50ca..f2083846ce38 100644 --- a/client/tx/aux_builder_test.go +++ b/client/tx/aux_builder_test.go @@ -26,8 +26,9 @@ const ( var ( _, pub1, addr1 = testdata.KeyTestPubAddr() + addr1Str, _ = testutil.CodecOptions{}.GetAddressCodec().BytesToString(addr1) rawSig = []byte("dummy") - msg1 = &countertypes.MsgIncreaseCounter{Signer: addr1.String(), Count: 1} + msg1 = &countertypes.MsgIncreaseCounter{Signer: addr1Str, Count: 1} chainID = "test-chain" ) @@ -131,7 +132,7 @@ func TestAuxTxBuilder(t *testing.T) { func() error { require.NoError(t, b.SetMsgs(msg1)) require.NoError(t, b.SetPubKey(pub1)) - b.SetAddress(addr1.String()) + b.SetAddress(addr1Str) require.NoError(t, b.SetSignMode(signing.SignMode_SIGN_MODE_DIRECT_AUX)) _, err := b.GetSignBytes() @@ -152,7 +153,7 @@ func TestAuxTxBuilder(t *testing.T) { b.SetChainID(chainID) require.NoError(t, b.SetMsgs(msg1)) require.NoError(t, b.SetPubKey(pub1)) - b.SetAddress(addr1.String()) + b.SetAddress(addr1Str) err := b.SetSignMode(signing.SignMode_SIGN_MODE_DIRECT_AUX) require.NoError(t, err) @@ -174,7 +175,7 @@ func TestAuxTxBuilder(t *testing.T) { func() error { require.NoError(t, b.SetMsgs(msg1)) require.NoError(t, b.SetPubKey(pub1)) - b.SetAddress(addr1.String()) + b.SetAddress(addr1Str) err := b.SetSignMode(signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON) require.NoError(t, err) @@ -193,7 +194,7 @@ func TestAuxTxBuilder(t *testing.T) { b.SetChainID(chainID) require.NoError(t, b.SetMsgs(msg1)) require.NoError(t, b.SetPubKey(pub1)) - b.SetAddress(addr1.String()) + b.SetAddress(addr1Str) err := b.SetSignMode(signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON) require.NoError(t, err) diff --git a/client/tx/tx.go b/client/tx/tx.go index 4365429d27ac..4aa34b0a931c 100644 --- a/client/tx/tx.go +++ b/client/tx/tx.go @@ -11,8 +11,6 @@ import ( gogogrpc "github.com/cosmos/gogoproto/grpc" "github.com/spf13/pflag" - authsigning "cosmossdk.io/x/auth/signing" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/input" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" @@ -20,6 +18,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/tx" "github.com/cosmos/cosmos-sdk/types/tx/signing" + authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" ) // GenerateOrBroadcastTxCLI will either generate and print an unsigned transaction @@ -126,7 +125,7 @@ func BroadcastTx(clientCtx client.Context, txf Factory, msgs ...sdk.Msg) error { } } - if err = Sign(clientCtx.CmdContext, txf, clientCtx.FromName, tx, true); err != nil { + if err = Sign(clientCtx, txf, clientCtx.FromName, tx, true); err != nil { return err } @@ -248,7 +247,7 @@ func checkMultipleSigners(tx authsigning.Tx) error { // Signing a transaction with mutltiple signers in the DIRECT mode is not supported and will // return an error. // An error is returned upon failure. -func Sign(ctx context.Context, txf Factory, name string, txBuilder client.TxBuilder, overwriteSig bool) error { +func Sign(ctx client.Context, txf Factory, name string, txBuilder client.TxBuilder, overwriteSig bool) error { if txf.keybase == nil { return errors.New("keybase must be set prior to signing a transaction") } @@ -273,12 +272,17 @@ func Sign(ctx context.Context, txf Factory, name string, txBuilder client.TxBuil return err } + addressStr, err := ctx.AddressCodec.BytesToString(pubKey.Address()) + if err != nil { + return err + } + signerData := authsigning.SignerData{ ChainID: txf.chainID, AccountNumber: txf.accountNumber, Sequence: txf.sequence, PubKey: pubKey, - Address: sdk.AccAddress(pubKey.Address()).String(), + Address: addressStr, } // For SIGN_MODE_DIRECT, calling SetSignatures calls setSignerInfos on @@ -322,7 +326,7 @@ func Sign(ctx context.Context, txf Factory, name string, txBuilder client.TxBuil return err } - bytesToSign, err := authsigning.GetSignBytesAdapter(ctx, txf.txConfig.SignModeHandler(), signMode, signerData, txBuilder.GetTx()) + bytesToSign, err := authsigning.GetSignBytesAdapter(ctx.CmdContext, txf.txConfig.SignModeHandler(), signMode, signerData, txBuilder.GetTx()) if err != nil { return err } @@ -377,7 +381,12 @@ func makeAuxSignerData(clientCtx client.Context, f Factory, msgs ...sdk.Msg) (tx return tx.AuxSignerData{}, err } - b.SetAddress(fromAddress.String()) + fromAddrStr, err := clientCtx.AddressCodec.BytesToString(fromAddress) + if err != nil { + return tx.AuxSignerData{}, err + } + + b.SetAddress(fromAddrStr) if clientCtx.Offline { b.SetAccountNumber(f.accountNumber) b.SetSequence(f.sequence) diff --git a/client/tx/tx_test.go b/client/tx/tx_test.go index fd81ee79e26d..2669fe804983 100644 --- a/client/tx/tx_test.go +++ b/client/tx/tx_test.go @@ -10,12 +10,9 @@ import ( "github.com/stretchr/testify/require" "google.golang.org/grpc" - "cosmossdk.io/x/auth/ante" - "cosmossdk.io/x/auth/signing" - authtx "cosmossdk.io/x/auth/tx" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" + addresscodec "github.com/cosmos/cosmos-sdk/codec/address" "github.com/cosmos/cosmos-sdk/codec/testutil" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/crypto/hd" @@ -27,8 +24,13 @@ import ( moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" txtypes "github.com/cosmos/cosmos-sdk/types/tx" signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + "github.com/cosmos/cosmos-sdk/x/auth/signing" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" ) +var ac = testutil.CodecOptions{}.GetAddressCodec() + func newTestTxConfig() (client.TxConfig, codec.Codec) { encodingConfig := moduletestutil.MakeTestEncodingConfig(testutil.CodecOptions{}) cdc := codec.NewProtoCodec(encodingConfig.InterfaceRegistry) @@ -129,8 +131,11 @@ func TestBuildSimTx(t *testing.T) { _, _, err = kb.NewMnemonic("test_key1", keyring.English, path, keyring.DefaultBIP39Passphrase, hd.Secp256k1) require.NoError(t, err) + fromAddr, err := ac.BytesToString(sdk.AccAddress("from")) + require.NoError(t, err) + txf := mockTxFactory(txCfg).WithSignMode(defaultSignMode).WithKeybase(kb) - msg := &countertypes.MsgIncreaseCounter{Signer: sdk.AccAddress("from").String(), Count: 1} + msg := &countertypes.MsgIncreaseCounter{Signer: fromAddr, Count: 1} bz, err := txf.BuildSimTx(msg) require.NoError(t, err) require.NotNil(t, bz) @@ -145,8 +150,10 @@ func TestBuildUnsignedTx(t *testing.T) { _, _, err = kb.NewMnemonic("test_key1", keyring.English, path, keyring.DefaultBIP39Passphrase, hd.Secp256k1) require.NoError(t, err) + fromAddr, err := ac.BytesToString(sdk.AccAddress("from")) + require.NoError(t, err) txf := mockTxFactory(txConfig).WithKeybase(kb) - msg := &countertypes.MsgIncreaseCounter{Signer: sdk.AccAddress("from").String(), Count: 1} + msg := &countertypes.MsgIncreaseCounter{Signer: fromAddr, Count: 1} tx, err := txf.BuildUnsignedTx(msg) require.NoError(t, err) require.NotNil(t, tx) @@ -164,8 +171,11 @@ func TestBuildUnsignedTxWithWithExtensionOptions(t *testing.T) { Value: []byte("test"), }, } + + fromAddr, err := ac.BytesToString(sdk.AccAddress("from")) + require.NoError(t, err) txf := mockTxFactory(txCfg).WithExtensionOptions(extOpts...) - msg := &countertypes.MsgIncreaseCounter{Signer: sdk.AccAddress("from").String(), Count: 1} + msg := &countertypes.MsgIncreaseCounter{Signer: fromAddr, Count: 1} tx, err := txf.BuildUnsignedTx(msg) require.NoError(t, err) require.NotNil(t, tx) @@ -208,7 +218,9 @@ func TestMnemonicInMemo(t *testing.T) { WithChainID("test-chain"). WithKeybase(kb) - msg := &countertypes.MsgIncreaseCounter{Signer: sdk.AccAddress("from").String(), Count: 1} + fromAddr, err := ac.BytesToString(sdk.AccAddress("from")) + require.NoError(t, err) + msg := &countertypes.MsgIncreaseCounter{Signer: fromAddr, Count: 1} tx, err := txf.BuildUnsignedTx(msg) if tc.error { require.Error(t, err) @@ -259,8 +271,12 @@ func TestSign(t *testing.T) { requireT.NoError(err) addr2, err := k2.GetAddress() requireT.NoError(err) - msg1 := &countertypes.MsgIncreaseCounter{Signer: addr1.String(), Count: 1} - msg2 := &countertypes.MsgIncreaseCounter{Signer: addr2.String(), Count: 1} + addr1Str, err := ac.BytesToString(addr1) + require.NoError(t, err) + addr2Str, err := ac.BytesToString(addr2) + require.NoError(t, err) + msg1 := &countertypes.MsgIncreaseCounter{Signer: addr1Str, Count: 1} + msg2 := &countertypes.MsgIncreaseCounter{Signer: addr2Str, Count: 1} txb, err := txfNoKeybase.BuildUnsignedTx(msg1, msg2) requireT.NoError(err) txb2, err := txfNoKeybase.BuildUnsignedTx(msg1, msg2) @@ -268,6 +284,10 @@ func TestSign(t *testing.T) { txbSimple, err := txfNoKeybase.BuildUnsignedTx(msg2) requireT.NoError(err) + clientCtx := client.Context{}. + WithAddressCodec(addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix())). + WithCmdContext(context.TODO()) + testCases := []struct { name string txf Factory @@ -357,7 +377,7 @@ func TestSign(t *testing.T) { var prevSigs []signingtypes.SignatureV2 for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - err = Sign(context.TODO(), tc.txf, tc.from, tc.txb, tc.overwrite) + err = Sign(clientCtx, tc.txf, tc.from, tc.txb, tc.overwrite) if len(tc.expectedPKs) == 0 { requireT.Error(err) } else { @@ -409,12 +429,20 @@ func TestPreprocessHook(t *testing.T) { addr1, err := kr.GetAddress() requireT.NoError(err) - msg1 := &countertypes.MsgIncreaseCounter{Signer: addr1.String(), Count: 1} - msg2 := &countertypes.MsgIncreaseCounter{Signer: addr2.String(), Count: 1} + addr1Str, err := ac.BytesToString(addr1) + require.NoError(t, err) + addr2Str, err := ac.BytesToString(addr2) + require.NoError(t, err) + msg1 := &countertypes.MsgIncreaseCounter{Signer: addr1Str, Count: 1} + msg2 := &countertypes.MsgIncreaseCounter{Signer: addr2Str, Count: 1} txb, err := txfDirect.BuildUnsignedTx(msg1, msg2) requireT.NoError(err) - err = Sign(context.TODO(), txfDirect, from, txb, false) + clientCtx := client.Context{}. + WithAddressCodec(addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix())). + WithCmdContext(context.TODO()) + + err = Sign(clientCtx, txfDirect, from, txb, false) requireT.NoError(err) // Run preprocessing diff --git a/client/tx_config.go b/client/tx_config.go index c41d3de6389a..44e07cdd7686 100644 --- a/client/tx_config.go +++ b/client/tx_config.go @@ -3,13 +3,13 @@ package client import ( "time" - "cosmossdk.io/x/auth/signing" txsigning "cosmossdk.io/x/tx/signing" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/tx" signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/signing" ) type ( diff --git a/client/v2/README.md b/client/v2/README.md index 80e6e65e9f3e..9efc241748af 100644 --- a/client/v2/README.md +++ b/client/v2/README.md @@ -38,7 +38,7 @@ Here are the steps to use AutoCLI: 1. Ensure your app's modules implements the `appmodule.AppModule` interface. 2. (optional) Configure how to behave as `autocli` command generation, by implementing the `func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions` method on the module. -3. Use the `autocli.AppOptions` struct to specify the modules you defined. If you are using `depinject` / app v2, it can automatically create an instance of `autocli.AppOptions` based on your app's configuration. +3. Use the `autocli.AppOptions` struct to specify the modules you defined. If you are using `depinject`, it can automatically create an instance of `autocli.AppOptions` based on your app's configuration. 4. Use the `EnhanceRootCommand()` method provided by `autocli` to add the CLI commands for the specified modules to your root command. :::tip @@ -131,6 +131,30 @@ AutoCLI can create a gov proposal of any tx by simply setting the `GovProposal` Users can however use the `--no-proposal` flag to disable the proposal creation (which is useful if the authority isn't the gov module on a chain). ::: +### Conventions for the `Use` field in Cobra + +According to the [Cobra documentation](https://pkg.go.dev/github.com/spf13/cobra#Command) the following conventions should be followed for the `Use` field in Cobra commands: + +1. **Required arguments**: + * Should not be enclosed in brackets. They can be enclosed in angle brackets `< >` for clarity. + * Example: `command ` + +2. **Optional arguments**: + * Should be enclosed in square brackets `[ ]`. + * Example: `command [optional_argument]` + +3. **Alternative (mutually exclusive) arguments**: + * Should be enclosed in curly braces `{ }`. + * Example: `command {-a | -b}` for required alternatives. + * Example: `command [-a | -b]` for optional alternatives. + +4. **Multiple arguments**: + * Indicated with `...` after the argument. + * Example: `command argument...` + +5. **Combination of options**: + * Example: `command [-F file | -D dir]... [-f format] profile` + ### Specifying Subcommands By default, `autocli` generates a command for each method in your gRPC service. However, you can specify subcommands to group related commands together. To specify subcommands, use the `autocliv1.ServiceCommandDescriptor` struct. diff --git a/client/v2/autocli/keyring/keyring.go b/client/v2/autocli/keyring/keyring.go index a838b12d8455..70c2d27d08ed 100644 --- a/client/v2/autocli/keyring/keyring.go +++ b/client/v2/autocli/keyring/keyring.go @@ -10,7 +10,9 @@ import ( // KeyringContextKey is the key used to store the keyring in the context. // The keyring must be wrapped using the KeyringImpl. -var KeyringContextKey struct{} +var KeyringContextKey keyringContextKey + +type keyringContextKey struct{} var _ Keyring = &KeyringImpl{} diff --git a/client/v2/autocli/msg.go b/client/v2/autocli/msg.go index 68a19ab69062..b19aabc95ba0 100644 --- a/client/v2/autocli/msg.go +++ b/client/v2/autocli/msg.go @@ -18,9 +18,9 @@ import ( // the following will be extracted to a separate module // https://github.com/cosmos/cosmos-sdk/issues/14403 - authtypes "cosmossdk.io/x/auth/types" govcli "cosmossdk.io/x/gov/client/cli" govtypes "cosmossdk.io/x/gov/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/client" clienttx "github.com/cosmos/cosmos-sdk/client/tx" diff --git a/client/v2/autocli/msg_test.go b/client/v2/autocli/msg_test.go index 2c08022fde80..11e6fd2d2fce 100644 --- a/client/v2/autocli/msg_test.go +++ b/client/v2/autocli/msg_test.go @@ -41,7 +41,7 @@ var bankAutoCLI = &autocliv1.ServiceCommandDescriptor{ RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { RpcMethod: "Send", - Use: "send [from_key_or_address] [to_address] [amount] [flags]", + Use: "send [flags]", Short: "Send coins from one account to another", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "from_address"}, {ProtoField: "to_address"}, {ProtoField: "amount"}}, }, @@ -64,7 +64,7 @@ func TestMsg(t *testing.T) { RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { RpcMethod: "Send", - Use: "send [from_key_or_address] [to_address] [amount] [flags]", + Use: "send [flags]", Short: "Send coins from one account to another", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "from_address"}, {ProtoField: "to_address"}, {ProtoField: "amount"}}, }, @@ -83,7 +83,7 @@ func TestMsg(t *testing.T) { RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { RpcMethod: "Send", - Use: "send [from_key_or_address] [to_address] [amount] [flags]", + Use: "send [flags]", Short: "Send coins from one account to another", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "to_address"}, {ProtoField: "amount"}}, // from_address should be automatically added @@ -104,7 +104,7 @@ func TestMsg(t *testing.T) { RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { RpcMethod: "Send", - Use: "send [from_key_or_address] [to_address] [amount] [flags]", + Use: "send [flags]", Short: "Send coins from one account to another", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "to_address"}, {ProtoField: "amount"}}, FlagOptions: map[string]*autocliv1.FlagOptions{ diff --git a/client/v2/autocli/testdata/help-echo-msg.golden b/client/v2/autocli/testdata/help-echo-msg.golden index 91c5e678c43e..1307509569c9 100644 --- a/client/v2/autocli/testdata/help-echo-msg.golden +++ b/client/v2/autocli/testdata/help-echo-msg.golden @@ -1,7 +1,7 @@ Send coins from one account to another Usage: - test send [from_key_or_address] [to_address] [amount] [flags] + test send [flags] Flags: -a, --account-number uint The account number of the signing account (offline mode only) diff --git a/client/v2/go.mod b/client/v2/go.mod index 62d547732595..f8233682d8ce 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -1,10 +1,10 @@ module cosmossdk.io/client/v2 -go 1.22.2 +go 1.23 require ( cosmossdk.io/api v0.7.5 - cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 + cosmossdk.io/core v1.0.0 cosmossdk.io/depinject v1.0.0 cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 cosmossdk.io/x/gov v0.0.0-20231113122742-912390d5fc4a @@ -13,7 +13,7 @@ require ( github.com/cosmos/cosmos-sdk v0.53.0 github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 - google.golang.org/grpc v1.65.0 + google.golang.org/grpc v1.66.0 google.golang.org/protobuf v1.34.2 gotest.tools/v3 v3.5.1 sigs.k8s.io/yaml v1.4.0 @@ -24,10 +24,9 @@ require ( buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/errors v1.0.1 // indirect - cosmossdk.io/log v1.4.0 // indirect + cosmossdk.io/log v1.4.1 // indirect cosmossdk.io/math v1.3.0 cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc // indirect - cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect filippo.io/edwards25519 v1.1.0 // indirect @@ -50,13 +49,13 @@ require ( github.com/cometbft/cometbft-db v0.12.0 // indirect github.com/cometbft/cometbft/api v1.0.0-rc.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-db v1.0.2 // indirect + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 // indirect github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/gogoproto v1.7.0 github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -105,7 +104,7 @@ require ( github.com/iancoleman/strcase v0.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect @@ -121,13 +120,13 @@ require ( github.com/mtibben/percent v0.2.1 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -163,28 +162,28 @@ require ( golang.org/x/text v0.17.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect pgregory.net/rapid v1.1.0 // indirect ) require ( - cosmossdk.io/schema v0.1.1 // indirect + cosmossdk.io/schema v0.2.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect ) replace github.com/cosmos/cosmos-sdk => ./../../ +replace github.com/cosmos/iavl => github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e + // TODO remove post spinning out all modules replace ( cosmossdk.io/api => ./../../api cosmossdk.io/core => ./../../core cosmossdk.io/core/testing => ../../core/testing cosmossdk.io/store => ./../../store - cosmossdk.io/x/accounts => ./../../x/accounts - cosmossdk.io/x/auth => ./../../x/auth cosmossdk.io/x/bank => ./../../x/bank cosmossdk.io/x/consensus => ./../../x/consensus cosmossdk.io/x/distribution => ./../../x/distribution diff --git a/client/v2/go.sum b/client/v2/go.sum index a6352d0aa06a..fbceb3ba67ad 100644 --- a/client/v2/go.sum +++ b/client/v2/go.sum @@ -10,12 +10,12 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= -cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= +cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk= +cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= @@ -106,8 +106,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/crypto v0.1.2 h1:Yn500sPY+9sKVdhiPUSDtt8JOpBGMB515dOmla4zfls= @@ -119,10 +119,10 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e h1:LEii0v/FxtXa/F7mRn+tijZ0zaXBPn2ZkKwb6Qm4rqE= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e/go.mod h1:3ywr0wDnWeD7MUH6qu50wZ5bxuKH3LBrGG4/lZX8lVY= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -315,8 +315,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -326,6 +326,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -393,8 +395,8 @@ github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4 github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba h1:3jPgmsFGBID1wFfU2AbYocNcN4wqU68UaHSdMjiw/7U= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= @@ -411,8 +413,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -421,8 +423,8 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -478,7 +480,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -510,6 +511,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= @@ -647,10 +650,10 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEY google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -661,8 +664,8 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/codec/bench_test.go b/codec/bench_test.go index 7a3956bab964..624f14d1cf75 100644 --- a/codec/bench_test.go +++ b/codec/bench_test.go @@ -8,6 +8,7 @@ import ( "google.golang.org/protobuf/types/dynamicpb" counterv1 "cosmossdk.io/api/cosmos/counter/v1" + "cosmossdk.io/core/address" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -16,21 +17,26 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) +var ac = codectestutil.CodecOptions{}.GetAddressCodec() + type msgCounterWrapper struct { *countertypes.MsgIncreaseCounter + ac address.Codec } func (msg msgCounterWrapper) GetSigners() []sdk.AccAddress { - fromAddress, _ := sdk.AccAddressFromBech32(msg.Signer) + fromAddress, _ := msg.ac.StringToBytes(msg.Signer) return []sdk.AccAddress{fromAddress} } func BenchmarkLegacyGetSigners(b *testing.B) { _, _, addr := testdata.KeyTestPubAddr() + addrStr, err := ac.BytesToString(addr) + require.NoError(b, err) msg := msgCounterWrapper{&countertypes.MsgIncreaseCounter{ - Signer: addr.String(), + Signer: addrStr, Count: 2, - }} + }, ac} b.ResetTimer() for i := 0; i < b.N; i++ { @@ -42,9 +48,11 @@ func BenchmarkProtoreflectGetSigners(b *testing.B) { cdc := codectestutil.CodecOptions{}.NewCodec() signingCtx := cdc.InterfaceRegistry().SigningContext() _, _, addr := testdata.KeyTestPubAddr() + addrStr, err := ac.BytesToString(addr) + require.NoError(b, err) // use a pulsar message msg := &counterv1.MsgIncreaseCounter{ - Signer: addr.String(), + Signer: addrStr, Count: 1, } @@ -60,9 +68,11 @@ func BenchmarkProtoreflectGetSigners(b *testing.B) { func BenchmarkProtoreflectGetSignersWithUnmarshal(b *testing.B) { cdc := codectestutil.CodecOptions{}.NewCodec() _, _, addr := testdata.KeyTestPubAddr() + addrStr, err := ac.BytesToString(addr) + require.NoError(b, err) // start with a protoreflect message msg := &countertypes.MsgIncreaseCounter{ - Signer: addr.String(), + Signer: addrStr, Count: 1, } // marshal to an any first because this is what we get from the wire @@ -82,8 +92,10 @@ func BenchmarkProtoreflectGetSignersDynamicpb(b *testing.B) { cdc := codectestutil.CodecOptions{}.NewCodec() signingCtx := cdc.InterfaceRegistry().SigningContext() _, _, addr := testdata.KeyTestPubAddr() + addrStr, err := ac.BytesToString(addr) + require.NoError(b, err) msg := &counterv1.MsgIncreaseCounter{ - Signer: addr.String(), + Signer: addrStr, Count: 1, } bz, err := protov2.Marshal(msg) diff --git a/codec/proto_codec_test.go b/codec/proto_codec_test.go index 7e18914a0486..8a8b94361de2 100644 --- a/codec/proto_codec_test.go +++ b/codec/proto_codec_test.go @@ -17,6 +17,7 @@ import ( "cosmossdk.io/x/tx/signing" "github.com/cosmos/cosmos-sdk/codec" + codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/testutil/testdata" countertypes "github.com/cosmos/cosmos-sdk/testutil/x/counter/types" @@ -176,17 +177,19 @@ func BenchmarkProtoCodecMarshalLengthPrefixed(b *testing.B) { } func TestGetSigners(t *testing.T) { + cdcOpts := codectestutil.CodecOptions{} interfaceRegistry, err := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{ SigningOptions: signing.Options{ - AddressCodec: testAddressCodec{}, - ValidatorAddressCodec: testAddressCodec{}, + AddressCodec: cdcOpts.GetAddressCodec(), + ValidatorAddressCodec: cdcOpts.GetValidatorCodec(), }, ProtoFiles: protoregistry.GlobalFiles, }) require.NoError(t, err) cdc := codec.NewProtoCodec(interfaceRegistry) testAddr := sdk.AccAddress("test") - testAddrStr := testAddr.String() + testAddrStr, err := cdcOpts.GetAddressCodec().BytesToString(testAddr) + require.NoError(t, err) msgSendV1 := &countertypes.MsgIncreaseCounter{Signer: testAddrStr, Count: 1} msgSendV2 := &counterv1.MsgIncreaseCounter{Signer: testAddrStr, Count: 1} @@ -207,13 +210,3 @@ func TestGetSigners(t *testing.T) { require.Equal(t, [][]byte{testAddr}, signers) require.True(t, protov2.Equal(msgSendV2, msgSendV2Copy.Interface())) } - -type testAddressCodec struct{} - -func (t testAddressCodec) StringToBytes(text string) ([]byte, error) { - return sdk.AccAddressFromBech32(text) -} - -func (t testAddressCodec) BytesToString(bz []byte) (string, error) { - return sdk.AccAddress(bz).String(), nil -} diff --git a/collections/CHANGELOG.md b/collections/CHANGELOG.md index fda6ca900b30..6be747f2f4b2 100644 --- a/collections/CHANGELOG.md +++ b/collections/CHANGELOG.md @@ -33,10 +33,12 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features -* [#19343](https://github.com/cosmos/cosmos-sdk/pull/19343) Simplify IndexedMap creation by allowing to infer indexes through reflection. -* [#18933](https://github.com/cosmos/cosmos-sdk/pull/18933) Add LookupMap implementation. It is basic wrapping of the standard Map methods but is not iterable. -* [#17656](https://github.com/cosmos/cosmos-sdk/pull/17656) Introduces `Vec`, a collection type that allows to represent a growable array on top of a KVStore. +* [#17656](https://github.com/cosmos/cosmos-sdk/pull/17656) Introduces `Vec`, a collection type that allows to represent a growable array on top of a KVStore. +* [#18933](https://github.com/cosmos/cosmos-sdk/pull/18933) Add LookupMap implementation. It is basic wrapping of the standard Map methods but is not iterable. +* [#19343](https://github.com/cosmos/cosmos-sdk/pull/19343) Simplify IndexedMap creation by allowing to infer indexes through reflection. * [#19861](https://github.com/cosmos/cosmos-sdk/pull/19861) Add `NewJSONValueCodec` value codec as an alternative for `codec.CollValue` from the SDK for non protobuf types. +* [#21090](https://github.com/cosmos/cosmos-sdk/pull/21090) Introduces `Quad`, a composite key with four keys. +* [#20704](https://github.com/cosmos/cosmos-sdk/pull/20704) Add `ModuleCodec` method to `Schema` and `HasSchemaCodec` interface in order to support `cosmossdk.io/schema` compatible indexing. ## [v0.4.0](https://github.com/cosmos/cosmos-sdk/releases/tag/collections%2Fv0.4.0) @@ -58,8 +60,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#16074](https://github.com/cosmos/cosmos-sdk/pull/16607) Introduces `Clear` method for `Map` and `KeySet` * [#16773](https://github.com/cosmos/cosmos-sdk/pull/16773) - * Adds `AltValueCodec` which provides a way to decode a value in two ways. - * Adds the possibility to specify an alternative way to decode the values of `KeySet`, `indexes.Multi`, `indexes.ReversePair`. + * Adds `AltValueCodec` which provides a way to decode a value in two ways. + * Adds the possibility to specify an alternative way to decode the values of `KeySet`, `indexes.Multi`, `indexes.ReversePair`. ## [v0.2.0](https://github.com/cosmos/cosmos-sdk/releases/tag/collections%2Fv0.2.0) diff --git a/collections/README.md b/collections/README.md index 298f684e6691..421bc255d1c0 100644 --- a/collections/README.md +++ b/collections/README.md @@ -208,7 +208,7 @@ import ( storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "cosmossdk.io/x/auth/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var AccountsPrefix = collections.NewPrefix(0) @@ -257,7 +257,7 @@ import ( "fmt" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "cosmossdk.io/x/auth/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var AccountsPrefix = collections.NewPrefix(0) @@ -508,7 +508,7 @@ import ( storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "cosmossdk.io/x/auth/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var AccountsPrefix = collections.NewPrefix(0) @@ -930,7 +930,7 @@ import ( storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "cosmossdk.io/x/auth/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var AccountsNumberIndexPrefix = collections.NewPrefix(1) @@ -989,7 +989,7 @@ import ( storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "cosmossdk.io/x/auth/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var AccountsNumberIndexPrefix = collections.NewPrefix(1) @@ -1097,7 +1097,7 @@ import ( storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "cosmossdk.io/x/auth/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var AccountsPrefix = collections.NewPrefix(0) diff --git a/collections/codec/indexing.go b/collections/codec/indexing.go new file mode 100644 index 000000000000..26ff651cc8e0 --- /dev/null +++ b/collections/codec/indexing.go @@ -0,0 +1,102 @@ +package codec + +import ( + "encoding/json" + "fmt" + + "cosmossdk.io/schema" +) + +// HasSchemaCodec is an interface that all codec's should implement in order +// to properly support indexing. It is not required by KeyCodec or ValueCodec +// in order to preserve backwards compatibility, but a future version of collections +// may make it required and all codec's should aim to implement it. If it is not +// implemented, fallback defaults will be used for indexing that may be sub-optimal. +// +// Implementations of HasSchemaCodec should test that they are conformant using +// schema.ValidateObjectKey or schema.ValidateObjectValue depending on whether +// the codec is a KeyCodec or ValueCodec respectively. +type HasSchemaCodec[T any] interface { + // SchemaCodec returns the schema codec for the collections codec. + SchemaCodec() (SchemaCodec[T], error) +} + +// SchemaCodec is a codec that supports converting collection codec values to and +// from schema codec values. +type SchemaCodec[T any] struct { + // Fields are the schema fields that the codec represents. If this is empty, + // it will be assumed that this codec represents no value (such as an item key + // or key set value). + Fields []schema.Field + + // ToSchemaType converts a codec value of type T to a value corresponding to + // a schema object key or value (depending on whether this is a key or value + // codec). The returned value should pass validation with schema.ValidateObjectKey + // or schema.ValidateObjectValue with the fields specified in Fields. + // If this function is nil, it will be assumed that T already represents a + // value that conforms to a schema value without any further conversion. + ToSchemaType func(T) (any, error) + + // FromSchemaType converts a schema object key or value to T. + // If this function is nil, it will be assumed that T already represents a + // value that conforms to a schema value without any further conversion. + FromSchemaType func(any) (T, error) +} + +// KeySchemaCodec gets the schema codec for the provided KeyCodec either +// by casting to HasSchemaCodec or returning a fallback codec. +func KeySchemaCodec[K any](cdc KeyCodec[K]) (SchemaCodec[K], error) { + if indexable, ok := cdc.(HasSchemaCodec[K]); ok { + return indexable.SchemaCodec() + } else { + return FallbackSchemaCodec[K](), nil + } +} + +// ValueSchemaCodec gets the schema codec for the provided ValueCodec either +// by casting to HasSchemaCodec or returning a fallback codec. +func ValueSchemaCodec[V any](cdc ValueCodec[V]) (SchemaCodec[V], error) { + if indexable, ok := cdc.(HasSchemaCodec[V]); ok { + return indexable.SchemaCodec() + } else { + return FallbackSchemaCodec[V](), nil + } +} + +// FallbackSchemaCodec returns a fallback schema codec for T when one isn't explicitly +// specified with HasSchemaCodec. It maps all simple types directly to schema kinds +// and converts everything else to JSON. +func FallbackSchemaCodec[T any]() SchemaCodec[T] { + var t T + kind := schema.KindForGoValue(t) + if err := kind.Validate(); err == nil { + return SchemaCodec[T]{ + Fields: []schema.Field{{ + // we don't set any name so that this can be set to a good default by the caller + Name: "", + Kind: kind, + }}, + // these can be nil because T maps directly to a schema value for this kind + ToSchemaType: nil, + FromSchemaType: nil, + } + } else { + // we default to encoding everything to JSON + return SchemaCodec[T]{ + Fields: []schema.Field{{Kind: schema.JSONKind}}, + ToSchemaType: func(t T) (any, error) { + bz, err := json.Marshal(t) + return json.RawMessage(bz), err + }, + FromSchemaType: func(a any) (T, error) { + var t T + bz, ok := a.(json.RawMessage) + if !ok { + return t, fmt.Errorf("expected json.RawMessage, got %T", a) + } + err := json.Unmarshal(bz, &t) + return t, err + }, + } + } +} diff --git a/collections/collections.go b/collections/collections.go index 9de3bbc38226..c6631b28c14b 100644 --- a/collections/collections.go +++ b/collections/collections.go @@ -7,6 +7,7 @@ import ( "math" "cosmossdk.io/collections/codec" + "cosmossdk.io/schema" ) var ( @@ -90,6 +91,24 @@ type Collection interface { ValueCodec() codec.UntypedValueCodec genesisHandler + + // collectionSchemaCodec returns the schema codec for this collection. + schemaCodec() (*collectionSchemaCodec, error) + + // isSecondaryIndex indicates that this collection represents a secondary index + // in the schema and should be excluded from the module's user facing schema. + isSecondaryIndex() bool +} + +// collectionSchemaCodec maps a collection to a schema object type and provides +// decoders and encoders to and from schema values and raw kv-store bytes. +type collectionSchemaCodec struct { + coll Collection + objectType schema.ObjectType + keyDecoder func([]byte) (any, error) + valueDecoder func([]byte) (any, error) + keyEncoder func(any) ([]byte, error) + valueEncoder func(any) ([]byte, error) } // Prefix defines a segregation bytes namespace for specific collections objects. @@ -157,3 +176,5 @@ func (c collectionImpl[K, V]) exportGenesis(ctx context.Context, w io.Writer) er } func (c collectionImpl[K, V]) defaultGenesis(w io.Writer) error { return c.m.defaultGenesis(w) } + +func (c collectionImpl[K, V]) isSecondaryIndex() bool { return c.m.isSecondaryIndex } diff --git a/collections/go.mod b/collections/go.mod index bcb2dff1e7b0..3eaa69315d3c 100644 --- a/collections/go.mod +++ b/collections/go.mod @@ -1,18 +1,19 @@ module cosmossdk.io/collections -go 1.21 +go 1.23 require ( - cosmossdk.io/core v0.12.0 + cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 + cosmossdk.io/schema v0.2.0 github.com/stretchr/testify v1.9.0 + github.com/tidwall/btree v1.7.0 pgregory.net/rapid v1.1.0 ) require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/tidwall/btree v1.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/collections/go.sum b/collections/go.sum index f59be83bdbe3..a616ad38d9a9 100644 --- a/collections/go.sum +++ b/collections/go.sum @@ -1,3 +1,5 @@ +cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk= +cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/collections/indexing.go b/collections/indexing.go new file mode 100644 index 000000000000..f7750ff27337 --- /dev/null +++ b/collections/indexing.go @@ -0,0 +1,181 @@ +package collections + +import ( + "bytes" + "fmt" + "strings" + + "github.com/tidwall/btree" + + "cosmossdk.io/collections/codec" + "cosmossdk.io/schema" +) + +// IndexingOptions are indexing options for the collections schema. +type IndexingOptions struct { + // RetainDeletionsFor is the list of collections to retain deletions for. + RetainDeletionsFor []string +} + +// ModuleCodec returns the ModuleCodec for this schema for the provided options. +func (s Schema) ModuleCodec(opts IndexingOptions) (schema.ModuleCodec, error) { + decoder := moduleDecoder{ + collectionLookup: &btree.Map[string, *collectionSchemaCodec]{}, + } + + retainDeletions := make(map[string]bool) + for _, collName := range opts.RetainDeletionsFor { + retainDeletions[collName] = true + } + + var types []schema.Type + for _, collName := range s.collectionsOrdered { + coll := s.collectionsByName[collName] + + // skip secondary indexes + if coll.isSecondaryIndex() { + continue + } + + cdc, err := coll.schemaCodec() + if err != nil { + return schema.ModuleCodec{}, err + } + + if retainDeletions[coll.GetName()] { + cdc.objectType.RetainDeletions = true + } + + types = append(types, cdc.objectType) + + decoder.collectionLookup.Set(string(coll.GetPrefix()), cdc) + } + + modSchema, err := schema.CompileModuleSchema(types...) + if err != nil { + return schema.ModuleCodec{}, err + } + + return schema.ModuleCodec{ + Schema: modSchema, + KVDecoder: decoder.decodeKV, + }, nil +} + +type moduleDecoder struct { + // collectionLookup lets us efficiently look the correct collection based on raw key bytes + collectionLookup *btree.Map[string, *collectionSchemaCodec] +} + +func (m moduleDecoder) decodeKV(update schema.KVPairUpdate) ([]schema.ObjectUpdate, error) { + key := update.Key + ks := string(key) + var cd *collectionSchemaCodec + // we look for the collection whose prefix is less than this key + m.collectionLookup.Descend(ks, func(prefix string, cur *collectionSchemaCodec) bool { + bytesPrefix := cur.coll.GetPrefix() + if bytes.HasPrefix(key, bytesPrefix) { + cd = cur + return true + } + return false + }) + if cd == nil { + return nil, nil + } + + return cd.decodeKVPair(update) +} + +func (c collectionSchemaCodec) decodeKVPair(update schema.KVPairUpdate) ([]schema.ObjectUpdate, error) { + // strip prefix + key := update.Key + key = key[len(c.coll.GetPrefix()):] + + k, err := c.keyDecoder(key) + if err != nil { + return []schema.ObjectUpdate{ + {TypeName: c.coll.GetName()}, + }, err + } + + if update.Remove { + return []schema.ObjectUpdate{ + {TypeName: c.coll.GetName(), Key: k, Delete: true}, + }, nil + } + + v, err := c.valueDecoder(update.Value) + if err != nil { + return []schema.ObjectUpdate{ + {TypeName: c.coll.GetName(), Key: k}, + }, err + } + + return []schema.ObjectUpdate{ + {TypeName: c.coll.GetName(), Key: k, Value: v}, + }, nil +} + +func (c collectionImpl[K, V]) schemaCodec() (*collectionSchemaCodec, error) { + res := &collectionSchemaCodec{ + coll: c, + } + res.objectType.Name = c.GetName() + + keyDecoder, err := codec.KeySchemaCodec(c.m.kc) + if err != nil { + return nil, err + } + res.objectType.KeyFields = keyDecoder.Fields + res.keyDecoder = func(i []byte) (any, error) { + _, x, err := c.m.kc.Decode(i) + if err != nil { + return nil, err + } + return keyDecoder.ToSchemaType(x) + } + ensureFieldNames(c.m.kc, "key", res.objectType.KeyFields) + + valueDecoder, err := codec.ValueSchemaCodec(c.m.vc) + if err != nil { + return nil, err + } + res.objectType.ValueFields = valueDecoder.Fields + res.valueDecoder = func(i []byte) (any, error) { + x, err := c.m.vc.Decode(i) + if err != nil { + return nil, err + } + return valueDecoder.ToSchemaType(x) + } + ensureFieldNames(c.m.vc, "value", res.objectType.ValueFields) + + return res, nil +} + +// ensureFieldNames makes sure that all fields have valid names - either the +// names were specified by user or they get filled +func ensureFieldNames(x any, defaultName string, cols []schema.Field) { + var names []string = nil + if hasName, ok := x.(interface{ Name() string }); ok { + name := hasName.Name() + if name != "" { + names = strings.Split(hasName.Name(), ",") + } + } + for i, col := range cols { + if names != nil && i < len(names) { + col.Name = names[i] + } else { + if col.Name == "" { + if i == 0 && len(cols) == 1 { + col.Name = defaultName + } else { + col.Name = fmt.Sprintf("%s%d", defaultName, i+1) + } + } + } + cols[i] = col + } +} diff --git a/collections/map.go b/collections/map.go index 0b9b247aa27a..360d96feafa3 100644 --- a/collections/map.go +++ b/collections/map.go @@ -20,6 +20,11 @@ type Map[K, V any] struct { sa func(context.Context) store.KVStore prefix []byte name string + + // isSecondaryIndex indicates that this map represents a secondary index + // on another collection and that it should be skipped when generating + // a user facing schema + isSecondaryIndex bool } // NewMap returns a Map given a StoreKey, a Prefix, human-readable name and the relative value and key encoders. diff --git a/contrib/devtools/Dockerfile b/contrib/devtools/Dockerfile index 892bafdb0f73..99d6894af49f 100644 --- a/contrib/devtools/Dockerfile +++ b/contrib/devtools/Dockerfile @@ -2,8 +2,8 @@ # docker build --pull --rm -f "contrib/devtools/Dockerfile" -t cosmossdk-proto:latest "contrib/devtools" # docker run --rm -v $(pwd):/workspace --workdir /workspace cosmossdk-proto sh ./scripts/protocgen.sh -FROM bufbuild/buf:1.24.0 as BUILDER -FROM golang:1.22-alpine +FROM bufbuild/buf:1.36.0 as BUILDER +FROM golang:1.23-alpine RUN apk add --no-cache \ nodejs \ diff --git a/contrib/images/simd-dlv/Dockerfile b/contrib/images/simd-dlv/Dockerfile index 35266f5f271a..684eb55fedab 100644 --- a/contrib/images/simd-dlv/Dockerfile +++ b/contrib/images/simd-dlv/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.22-alpine AS build +FROM golang:1.23-alpine AS build RUN apk add build-base git linux-headers libc-dev RUN go install github.com/go-delve/delve/cmd/dlv@latest diff --git a/contrib/images/simd-env/Dockerfile b/contrib/images/simd-env/Dockerfile index a61aca7c5f12..8ff6675b0379 100644 --- a/contrib/images/simd-env/Dockerfile +++ b/contrib/images/simd-env/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.22-alpine AS build +FROM golang:1.23-alpine AS build RUN apk add build-base git linux-headers diff --git a/core/README.md b/core/README.md index 0fa09f59755b..6ab95a67a6f1 100644 --- a/core/README.md +++ b/core/README.md @@ -1,11 +1,19 @@ # Cosmos SDK Core -The [cosmossdk.io/core](https://pkg.go.dev/cosmossdk.io/core) go module defines -"core" functionality for the Cosmos SDK. +The [cosmossdk.io/core](https://pkg.go.dev/cosmossdk.io/core) Go module defines essential APIs and interfaces for the Cosmos SDK ecosystem. It serves as a foundation for building modular blockchain applications. -Currently functionality for registering modules using the [appmodule](https://pkg.go.dev/cosmossdk.io/core/appmodule) -package and composing apps using the [appconfig](https://pkg.go.dev/cosmossdk.io/core/appconfig) -package is provided. +Key features and principles: -In the future core functionality for building Cosmos SDK app modules will be -provided in this go module. +1. Provides stable, long-term maintained APIs for module development and app composition. +2. Focuses on interface definitions without implementation details. +3. Implementations are housed in the runtime(/v2) or individual modules. +4. Modules depend solely on core APIs for maximum compatibility. +5. New API additions undergo thorough consideration to maintain stability. +6. Adheres to a no-breaking-changes policy for reliable dependency management. +7. Aimed to have zero dependencies, ensuring a lightweight and self-contained foundation. + +The core module offers the [appmodule](https://pkg.go.dev/cosmossdk.io/core/appmodule) and [appmodule/v2](https://pkg.go.dev/cosmossdk.io/core/appmodule/v2) packages that include APIs to describe how modules can be written. +Additionally, it contains all core services APIs that can be used in modules to interact with the SDK, majoritarily via the `appmodule.Environment` struct. +Last but not least, it provides codecs and packages for the Cosmos SDK's core types (think of, for instance, logger, store interface or an address codec). + +Developers and contributors approach core API design with careful deliberation, ensuring that additions provide significant value while maintaining the module's stability and simplicity. diff --git a/core/app/codec.go b/core/app/codec.go deleted file mode 100644 index 6b24b7ccb499..000000000000 --- a/core/app/codec.go +++ /dev/null @@ -1,24 +0,0 @@ -package app - -import ( - "cosmossdk.io/core/transaction" -) - -// MsgInterfaceProtoName defines the protobuf name of the cosmos Msg interface -const MsgInterfaceProtoName = "cosmos.base.v1beta1.Msg" - -type ProtoCodec interface { - Marshal(v transaction.Msg) ([]byte, error) - Unmarshal(data []byte, v transaction.Msg) error - Name() string -} - -type InterfaceRegistry interface { - AnyResolver - ListImplementations(ifaceTypeURL string) []string - ListAllInterfaces() []string -} - -type AnyResolver = interface { - Resolve(typeUrl string) (transaction.Msg, error) -} diff --git a/core/app/identity.go b/core/app/identity.go deleted file mode 100644 index 861135cd5a7b..000000000000 --- a/core/app/identity.go +++ /dev/null @@ -1,6 +0,0 @@ -package app - -var ( - RuntimeIdentity = []byte("runtime") - ConsensusIdentity = []byte("consensus") -) diff --git a/core/appmodule/README.md b/core/appmodule/README.md deleted file mode 100644 index f41dd41a9d64..000000000000 --- a/core/appmodule/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Appmodule - - - -This package defines what is needed for an module to be used in the Cosmos SDK. - -If you are looking at integrating Dependency injection into your module please see [depinject appconfig documentation](../../depinject/appconfig/README.md) \ No newline at end of file diff --git a/core/appmodule/doc.go b/core/appmodule/doc.go index bf64ed40d589..311f6e25a271 100644 --- a/core/appmodule/doc.go +++ b/core/appmodule/doc.go @@ -1,5 +1,4 @@ -// Package appmodule defines the functionality for registering Cosmos SDK app -// modules that are assembled using the cosmossdk.io/depinject -// dependency injection system and the declarative app configuration format -// handled by the appconfig package. +// Package appmodule defines what is needed for an module to be used in the Cosmos SDK (runtime). +// It is equivalent to the appmodulev2 package, but less flexible to stay compatible with baseapp instead of server/v2. +// If you are looking at integrating dependency injection into your module please see depinject appconfig documentation. package appmodule diff --git a/core/appmodule/environment.go b/core/appmodule/environment.go index 6b5c09bb4fc6..8e4079066661 100644 --- a/core/appmodule/environment.go +++ b/core/appmodule/environment.go @@ -1,9 +1,9 @@ package appmodule import ( - "cosmossdk.io/core/appmodule/v2" + appmodulev2 "cosmossdk.io/core/appmodule/v2" ) -// Environment is used to get all services to their respective module -// Contract: All fields of environment are always populated. -type Environment = appmodule.Environment +// Environment is used to get all services to their respective module. +// Contract: All fields of environment are always populated by runtime. +type Environment = appmodulev2.Environment diff --git a/core/appmodule/genesis.go b/core/appmodule/genesis.go index a7f1155a59ff..ca312a2b8c93 100644 --- a/core/appmodule/genesis.go +++ b/core/appmodule/genesis.go @@ -5,7 +5,7 @@ import ( "encoding/json" "io" - "cosmossdk.io/core/appmodule/v2" + appmodulev2 "cosmossdk.io/core/appmodule/v2" ) // HasGenesisBasics is the legacy interface for stateless genesis methods. @@ -15,18 +15,18 @@ type HasGenesisBasics interface { } // HasGenesis defines a custom genesis handling API implementation. -type HasGenesis = appmodule.HasGenesis +type HasGenesis = appmodulev2.HasGenesis // HasABCIGenesis defines a custom genesis handling API implementation for ABCI. // (stateful genesis methods which returns validator updates) // Most modules should not implement this interface. -type HasABCIGenesis = appmodule.HasABCIGenesis +type HasABCIGenesis = appmodulev2.HasABCIGenesis // HasGenesisAuto is the extension interface that modules should implement to handle // genesis data and state initialization. -// WARNING: This interface is experimental and may change at any time. +// WARNING: This interface is experimental and may change at any time and has been dropped in v2. type HasGenesisAuto interface { - appmodule.AppModule + appmodulev2.AppModule // DefaultGenesis writes the default genesis for this module to the target. DefaultGenesis(GenesisTarget) error diff --git a/core/appmodule/migrations.go b/core/appmodule/migrations.go index 8c4ec594f6de..5632e55424d1 100644 --- a/core/appmodule/migrations.go +++ b/core/appmodule/migrations.go @@ -1,20 +1,20 @@ package appmodule import ( - "cosmossdk.io/core/appmodule/v2" + appmodulev2 "cosmossdk.io/core/appmodule/v2" ) // HasConsensusVersion is the interface for declaring a module consensus version. -type HasConsensusVersion = appmodule.HasConsensusVersion +type HasConsensusVersion = appmodulev2.HasConsensusVersion // HasMigrations is implemented by a module which upgrades or has upgraded to a new consensus version. -type HasMigrations = appmodule.HasMigrations +type HasMigrations = appmodulev2.HasMigrations // MigrationRegistrar is the interface for registering in-place store migrations. -type MigrationRegistrar = appmodule.MigrationRegistrar +type MigrationRegistrar = appmodulev2.MigrationRegistrar // MigrationHandler is the migration function that each module registers. -type MigrationHandler = appmodule.MigrationHandler +type MigrationHandler = appmodulev2.MigrationHandler // VersionMap is a map of moduleName -> version -type VersionMap = appmodule.VersionMap +type VersionMap = appmodulev2.VersionMap diff --git a/core/appmodule/module.go b/core/appmodule/module.go index 7caca9987072..279b3c8d6fad 100644 --- a/core/appmodule/module.go +++ b/core/appmodule/module.go @@ -3,7 +3,7 @@ package appmodule import ( "context" - "cosmossdk.io/core/appmodule/v2" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/legacy" ) @@ -11,25 +11,25 @@ import ( // for extension interfaces. It provides no functionality itself, but is the // type that all valid app modules should provide so that they can be identified // by other modules (usually via depinject) as app modules. -type AppModule = appmodule.AppModule +type AppModule = appmodulev2.AppModule // HasPreBlocker is the extension interface that modules should implement to run // custom logic before BeginBlock. -type HasPreBlocker = appmodule.HasPreBlocker +type HasPreBlocker = appmodulev2.HasPreBlocker // HasBeginBlocker is the extension interface that modules should implement to run // custom logic before transaction processing in a block. -type HasBeginBlocker = appmodule.HasBeginBlocker +type HasBeginBlocker = appmodulev2.HasBeginBlocker // HasEndBlocker is the extension interface that modules should implement to run // custom logic after transaction processing in a block. -type HasEndBlocker = appmodule.HasEndBlocker +type HasEndBlocker = appmodulev2.HasEndBlocker // HasRegisterInterfaces is the interface for modules to register their msg types. -type HasRegisterInterfaces = appmodule.HasRegisterInterfaces +type HasRegisterInterfaces = appmodulev2.HasRegisterInterfaces // ValidatorUpdate defines a validator update. -type ValidatorUpdate = appmodule.ValidatorUpdate +type ValidatorUpdate = appmodulev2.ValidatorUpdate // HasServices is the extension interface that modules should implement to register // implementations of services defined in .proto files. @@ -55,13 +55,13 @@ type ValidatorUpdate = appmodule.ValidatorUpdate // HasPrepareCheckState is an extension interface that contains information about the AppModule // and PrepareCheckState. type HasPrepareCheckState interface { - appmodule.AppModule + appmodulev2.AppModule PrepareCheckState(context.Context) error } // HasPrecommit is an extension interface that contains information about the appmodule.AppModule and Precommit. type HasPrecommit interface { - appmodule.AppModule + appmodulev2.AppModule Precommit(context.Context) error } diff --git a/core/appmodule/v2/doc.go b/core/appmodule/v2/doc.go new file mode 100644 index 000000000000..4953f90ac4f7 --- /dev/null +++ b/core/appmodule/v2/doc.go @@ -0,0 +1,3 @@ +// Package appmodule defines what is needed for an module to be used in the Cosmos SDK (runtime/v2). +// If you are looking at integrating dependency injection into your module please see depinject appconfig documentation. +package appmodulev2 diff --git a/core/appmodule/v2/environment.go b/core/appmodule/v2/environment.go index 6d64d9b1ebae..450e10e162fe 100644 --- a/core/appmodule/v2/environment.go +++ b/core/appmodule/v2/environment.go @@ -1,4 +1,4 @@ -package appmodule +package appmodulev2 import ( "cosmossdk.io/core/branch" @@ -11,8 +11,8 @@ import ( "cosmossdk.io/core/transaction" ) -// Environment is used to get all services to their respective module -// Contract: All fields of environment are always populated. +// Environment is used to get all services to their respective module. +// Contract: All fields of environment are always populated by runtime. type Environment struct { Logger log.Logger diff --git a/core/appmodule/v2/genesis.go b/core/appmodule/v2/genesis.go index 629ac02ac6de..907d29f864a7 100644 --- a/core/appmodule/v2/genesis.go +++ b/core/appmodule/v2/genesis.go @@ -1,4 +1,4 @@ -package appmodule +package appmodulev2 import ( "context" diff --git a/core/appmodule/v2/handlers.go b/core/appmodule/v2/handlers.go index abb9e95a1d1d..c446a46cebd2 100644 --- a/core/appmodule/v2/handlers.go +++ b/core/appmodule/v2/handlers.go @@ -1,4 +1,4 @@ -package appmodule +package appmodulev2 import ( "context" @@ -19,12 +19,12 @@ type ( // msg handler type PreMsgRouter interface { - // Register will register a specific message handler hooking into the message with + // RegisterPreHandler will register a specific message handler hooking into the message with // the provided name. - Register(msgName string, handler PreMsgHandler) - // RegisterGlobal will register a global message handler hooking into any message + RegisterPreHandler(msgName string, handler PreMsgHandler) + // RegisterGlobalPreHandler will register a global message handler hooking into any message // being executed. - RegisterGlobal(handler PreMsgHandler) + RegisterGlobalPreHandler(handler PreMsgHandler) } type HasPreMsgHandlers interface { @@ -40,11 +40,15 @@ type HasMsgHandlers interface { } type PostMsgRouter interface { - // Register will register a specific message handler hooking after the execution of message with + // RegisterPostHandler will register a specific message handler hooking after the execution of message with // the provided name. - Register(msgName string, handler PostMsgHandler) - // RegisterGlobal will register a global message handler hooking after the execution of any message. - RegisterGlobal(handler PreMsgHandler) + RegisterPostHandler(msgName string, handler PostMsgHandler) + // RegisterGlobalPostHandler will register a global message handler hooking after the execution of any message. + RegisterGlobalPostHandler(handler PostMsgHandler) +} + +type HasPostMsgHandlers interface { + RegisterPostMsgHandlers(router PostMsgRouter) } // query handler diff --git a/core/appmodule/v2/migrations.go b/core/appmodule/v2/migrations.go index 3e62ad7dfee4..a363e1a4a383 100644 --- a/core/appmodule/v2/migrations.go +++ b/core/appmodule/v2/migrations.go @@ -1,4 +1,4 @@ -package appmodule +package appmodulev2 import "context" diff --git a/core/appmodule/v2/module.go b/core/appmodule/v2/module.go index f934be512774..e01818cdaf45 100644 --- a/core/appmodule/v2/module.go +++ b/core/appmodule/v2/module.go @@ -1,4 +1,4 @@ -package appmodule +package appmodulev2 import ( "context" diff --git a/core/appmodule/v2/tx_validator.go b/core/appmodule/v2/tx_validator.go index 0ef877af00a8..0886fe03ef81 100644 --- a/core/appmodule/v2/tx_validator.go +++ b/core/appmodule/v2/tx_validator.go @@ -1,4 +1,4 @@ -package appmodule +package appmodulev2 import ( "context" diff --git a/core/context/context.go b/core/context/context.go index 54ed6b46236f..2d97bacbd654 100644 --- a/core/context/context.go +++ b/core/context/context.go @@ -12,8 +12,8 @@ var ( ExecModeKey = execModeKey{} // CometInfoKey is the context key for allowing modules to get CometInfo. CometInfoKey = cometInfoKey{} - // InitInfoKey is the context key for setting consensus params from genesis in the consensus module. - InitInfoKey = initInfoKey{} + // CometParamsInitInfoKey is the context key for setting consensus params from genesis in the consensus module. + CometParamsInitInfoKey = initInfoKey{} // EnvironmentContextKey is the context key for the environment. // A caller should not assume the environment is available in each context. diff --git a/core/context/server_context.go b/core/context/server_context.go index 93975078ccba..82b725f86083 100644 --- a/core/context/server_context.go +++ b/core/context/server_context.go @@ -6,6 +6,8 @@ type ( ) var ( + // LoggerContextKey is the context key where the logger can be found. LoggerContextKey loggerContextKey - ViperContextKey viperContextKey + // ViperContextKey is the context key where the viper instance can be found. + ViperContextKey viperContextKey ) diff --git a/core/gas/service.go b/core/gas/service.go index 8903b4686bb5..ca095a9aa33a 100644 --- a/core/gas/service.go +++ b/core/gas/service.go @@ -38,9 +38,11 @@ type Meter interface { Consume(amount Gas, descriptor string) error Refund(amount Gas, descriptor string) error Remaining() Gas + Consumed() Gas Limit() Gas } +// GasConfig defines the gas costs for the application. type GasConfig struct { HasCost Gas DeleteCost Gas diff --git a/core/genesis/doc.go b/core/genesis/doc.go new file mode 100644 index 000000000000..1891fdc18364 --- /dev/null +++ b/core/genesis/doc.go @@ -0,0 +1,3 @@ +// package genesis is used to define appmodule.HasGenesisAuto experimental auto genesis. +// This genesis package isn't supported in server/v2. +package genesis diff --git a/core/go.mod b/core/go.mod index 6968f363d26a..8f691cc75063 100644 --- a/core/go.mod +++ b/core/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/core // Core is meant to have zero dependencies, so we can use it as a dependency // in other modules without having to worry about circular dependencies. -go 1.20 +go 1.23 // Version tagged too early and incompatible with v0.50 (latest at the time of tagging) retract v0.12.0 diff --git a/core/legacy/amino.go b/core/legacy/amino.go index 63ae965ee03e..eefcfd0c5576 100644 --- a/core/legacy/amino.go +++ b/core/legacy/amino.go @@ -1,5 +1,6 @@ package legacy +// Amino is an interface that allow to register concrete types and interfaces with the Amino codec. type Amino interface { // RegisterInterface registers an interface and its concrete type with the Amino codec. RegisterInterface(interfacePtr any, iopts *InterfaceOptions) @@ -8,6 +9,7 @@ type Amino interface { RegisterConcrete(cdcType interface{}, name string) } +// InterfaceOptions defines options for registering an interface with the Amino codec. type InterfaceOptions struct { Priority []string // Disamb priority. AlwaysDisambiguate bool // If true, include disamb for all types. diff --git a/core/registry/legacy.go b/core/registry/legacy.go index c0f45883ef92..c1141751e18a 100644 --- a/core/registry/legacy.go +++ b/core/registry/legacy.go @@ -4,6 +4,8 @@ import ( "cosmossdk.io/core/transaction" ) +// InterfaceRegistrar is an interface for registering interfaces and their implementation. +// It is a subset of the Cosmos SDK InterfaceRegistry for registration only. type InterfaceRegistrar interface { // RegisterInterface associates protoName as the public name for the // interface passed in as iface. This is to be used primarily to create diff --git a/core/router/service.go b/core/router/service.go index 50b1865e6800..95c65f851e0c 100644 --- a/core/router/service.go +++ b/core/router/service.go @@ -11,8 +11,6 @@ import ( type Service interface { // CanInvoke returns an error if the given request cannot be invoked. CanInvoke(ctx context.Context, typeURL string) error - // InvokeTyped execute a message or query. It should be used when the called knows the type of the response. - InvokeTyped(ctx context.Context, req, res transaction.Msg) error - // InvokeUntyped execute a Msg or query. It should be used when the called doesn't know the type of the response. - InvokeUntyped(ctx context.Context, req transaction.Msg) (res transaction.Msg, err error) + // Invoke execute a message or query. The response should be type casted by the caller to the expected response. + Invoke(ctx context.Context, req transaction.Msg) (res transaction.Msg, err error) } diff --git a/core/app/app.go b/core/server/app.go similarity index 52% rename from core/app/app.go rename to core/server/app.go index b377d42cef38..a785de5011a7 100644 --- a/core/app/app.go +++ b/core/server/app.go @@ -1,4 +1,4 @@ -package app +package server import ( "context" @@ -9,17 +9,7 @@ import ( "cosmossdk.io/core/transaction" ) -type QueryRequest struct { - Height int64 - Path string - Data []byte -} - -type QueryResponse struct { - Height int64 - Value []byte -} - +// BlockRequest defines the request structure for a block coming from consensus server to the state transition function. type BlockRequest[T transaction.Tx] struct { Height uint64 Time time.Time @@ -32,8 +22,8 @@ type BlockRequest[T transaction.Tx] struct { IsGenesis bool } +// BlockResponse defines the response structure for a block coming from the state transition function to consensus server. type BlockResponse struct { - Apphash []byte ValidatorUpdates []appmodulev2.ValidatorUpdate PreBlockEvents []event.Event BeginBlockEvents []event.Event @@ -41,30 +31,22 @@ type BlockResponse struct { EndBlockEvents []event.Event } -type RequestInitChain struct { - Time time.Time - ChainId string - Validators []appmodulev2.ValidatorUpdate - AppStateBytes []byte - InitialHeight int64 -} - -type ResponseInitChain struct { - Validators []appmodulev2.ValidatorUpdate - AppHash []byte -} - +// TxResult defines the result of a transaction execution. type TxResult struct { - Events []event.Event - Resp []transaction.Msg - Error error - Code uint32 - Data []byte - Log string - Info string + // Events produced by the transaction. + Events []event.Event + // Response messages produced by the transaction. + Resp []transaction.Msg + // Error produced by the transaction. + Error error + // Code produced by the transaction. + // A non-zero code is an error that is either define by the module via the cosmossdk.io/errors/v2 package + // or injected through the antehandler along the execution of the transaction. + Code uint32 + // GasWanted is the maximum units of work we allow this tx to perform. GasWanted uint64 - GasUsed uint64 - Codespace string + // GasUsed is the amount of gas actually consumed. + GasUsed uint64 } // VersionModifier defines the interface fulfilled by BaseApp diff --git a/core/server/codec.go b/core/server/codec.go new file mode 100644 index 000000000000..e4de33f5d111 --- /dev/null +++ b/core/server/codec.go @@ -0,0 +1,20 @@ +package server + +import ( + "cosmossdk.io/core/transaction" +) + +// InterfaceRegistry defines the interface for resolving interfaces +// The interface registry is used to resolve interfaces from type URLs, +// this is only used for the server and not for modules +type InterfaceRegistry interface { + AnyResolver + ListImplementations(ifaceTypeURL string) []string + ListAllInterfaces() []string +} + +// AnyResolver defines the interface for resolving interfaces +// This is used to avoid the gogoproto import in core +type AnyResolver = interface { + Resolve(typeUrl string) (transaction.Msg, error) +} diff --git a/core/server/doc.go b/core/server/doc.go new file mode 100644 index 000000000000..086d61bd93a9 --- /dev/null +++ b/core/server/doc.go @@ -0,0 +1,4 @@ +// Server Defines types and interfaces which are shared between Consensus, Appmanager and Stf +// This package is not meant to be used directly by modules instead if an advanced user would like +// to create a custom server or replace a component in the server they will need to use the app package. +package server diff --git a/core/store/changeset.go b/core/store/changeset.go index b1233e8abfaa..35837059c627 100644 --- a/core/store/changeset.go +++ b/core/store/changeset.go @@ -10,7 +10,7 @@ type Changeset struct { } // StateChanges represents a set of changes to the state of an actor in storage. -type StateChanges struct { +type StateChanges = struct { Actor []byte // actor represents the space in storage where state is stored, previously this was called a "storekey" StateChanges KVPairs // StateChanges is a list of key-value pairs representing the changes to the state. } diff --git a/core/testing/gas/service_mocks.go b/core/testing/gas/service_mocks.go new file mode 100644 index 000000000000..c328455997a1 --- /dev/null +++ b/core/testing/gas/service_mocks.go @@ -0,0 +1,157 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: core/gas/service.go + +// Package gas is a generated GoMock package. +package gas + +import ( + context "context" + reflect "reflect" + + gas "cosmossdk.io/core/gas" + gomock "github.com/golang/mock/gomock" +) + +// MockService is a mock of Service interface. +type MockService struct { + ctrl *gomock.Controller + recorder *MockServiceMockRecorder +} + +// MockServiceMockRecorder is the mock recorder for MockService. +type MockServiceMockRecorder struct { + mock *MockService +} + +// NewMockService creates a new mock instance. +func NewMockService(ctrl *gomock.Controller) *MockService { + mock := &MockService{ctrl: ctrl} + mock.recorder = &MockServiceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockService) EXPECT() *MockServiceMockRecorder { + return m.recorder +} + +// GasConfig mocks base method. +func (m *MockService) GasConfig(ctx context.Context) gas.GasConfig { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GasConfig", ctx) + ret0, _ := ret[0].(gas.GasConfig) + return ret0 +} + +// GasConfig indicates an expected call of GasConfig. +func (mr *MockServiceMockRecorder) GasConfig(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GasConfig", reflect.TypeOf((*MockService)(nil).GasConfig), ctx) +} + +// GasMeter mocks base method. +func (m *MockService) GasMeter(arg0 context.Context) gas.Meter { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GasMeter", arg0) + ret0, _ := ret[0].(gas.Meter) + return ret0 +} + +// GasMeter indicates an expected call of GasMeter. +func (mr *MockServiceMockRecorder) GasMeter(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GasMeter", reflect.TypeOf((*MockService)(nil).GasMeter), arg0) +} + +// MockMeter is a mock of Meter interface. +type MockMeter struct { + ctrl *gomock.Controller + recorder *MockMeterMockRecorder +} + +// MockMeterMockRecorder is the mock recorder for MockMeter. +type MockMeterMockRecorder struct { + mock *MockMeter +} + +// NewMockMeter creates a new mock instance. +func NewMockMeter(ctrl *gomock.Controller) *MockMeter { + mock := &MockMeter{ctrl: ctrl} + mock.recorder = &MockMeterMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockMeter) EXPECT() *MockMeterMockRecorder { + return m.recorder +} + +// Consume mocks base method. +func (m *MockMeter) Consume(amount gas.Gas, descriptor string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Consume", amount, descriptor) + ret0, _ := ret[0].(error) + return ret0 +} + +// Consume indicates an expected call of Consume. +func (mr *MockMeterMockRecorder) Consume(amount, descriptor interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Consume", reflect.TypeOf((*MockMeter)(nil).Consume), amount, descriptor) +} + +// Consumed mocks base method. +func (m *MockMeter) Consumed() gas.Gas { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Consumed") + ret0, _ := ret[0].(gas.Gas) + return ret0 +} + +// Consumed indicates an expected call of Consumed. +func (mr *MockMeterMockRecorder) Consumed() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Consumed", reflect.TypeOf((*MockMeter)(nil).Consumed)) +} + +// Limit mocks base method. +func (m *MockMeter) Limit() gas.Gas { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Limit") + ret0, _ := ret[0].(gas.Gas) + return ret0 +} + +// Limit indicates an expected call of Limit. +func (mr *MockMeterMockRecorder) Limit() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Limit", reflect.TypeOf((*MockMeter)(nil).Limit)) +} + +// Refund mocks base method. +func (m *MockMeter) Refund(amount gas.Gas, descriptor string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Refund", amount, descriptor) + ret0, _ := ret[0].(error) + return ret0 +} + +// Refund indicates an expected call of Refund. +func (mr *MockMeterMockRecorder) Refund(amount, descriptor interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Refund", reflect.TypeOf((*MockMeter)(nil).Refund), amount, descriptor) +} + +// Remaining mocks base method. +func (m *MockMeter) Remaining() gas.Gas { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Remaining") + ret0, _ := ret[0].(gas.Gas) + return ret0 +} + +// Remaining indicates an expected call of Remaining. +func (mr *MockMeterMockRecorder) Remaining() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Remaining", reflect.TypeOf((*MockMeter)(nil).Remaining)) +} diff --git a/core/testing/go.mod b/core/testing/go.mod index 649d1e97b887..311b0c16ac02 100644 --- a/core/testing/go.mod +++ b/core/testing/go.mod @@ -1,10 +1,11 @@ module cosmossdk.io/core/testing -go 1.20 +go 1.23 replace cosmossdk.io/core => ../ require ( - cosmossdk.io/core v0.12.0 + cosmossdk.io/core v1.0.0 + github.com/golang/mock v1.6.0 github.com/tidwall/btree v1.7.0 ) diff --git a/core/testing/go.sum b/core/testing/go.sum index 25d624e85744..86d7a5ef2ad5 100644 --- a/core/testing/go.sum +++ b/core/testing/go.sum @@ -1,2 +1,27 @@ +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/core/transaction/service.go b/core/transaction/service.go index 627fb3f85dc3..57ec9c7be6ba 100644 --- a/core/transaction/service.go +++ b/core/transaction/service.go @@ -20,5 +20,6 @@ const ( // Service creates a transaction service. type Service interface { + // ExecMode returns the current execution mode. ExecMode(ctx context.Context) ExecMode } diff --git a/core/transaction/transaction.go b/core/transaction/transaction.go index 312ca6137bc6..5211c54c66e2 100644 --- a/core/transaction/transaction.go +++ b/core/transaction/transaction.go @@ -19,6 +19,8 @@ type Codec[T Tx] interface { DecodeJSON([]byte) (T, error) } +// Tx defines the interface for a transaction. +// All custom transactions must implement this interface. type Tx interface { // Hash returns the unique identifier for the Tx. Hash() [32]byte diff --git a/crypto/armor_test.go b/crypto/armor_test.go index 45c16bfcc5e1..9d6c2b04b42a 100644 --- a/crypto/armor_test.go +++ b/crypto/armor_test.go @@ -43,7 +43,7 @@ func TestArmorUnarmorPrivKey(t *testing.T) { // empty string decrypted, algo, err = crypto.UnarmorDecryptPrivKey("", "passphrase") require.Error(t, err) - require.True(t, errors.Is(io.EOF, err)) + require.True(t, errors.Is(err, io.EOF)) require.Nil(t, decrypted) require.Empty(t, algo) @@ -165,7 +165,7 @@ func TestArmorInfoBytes(t *testing.T) { func TestUnarmorInfoBytesErrors(t *testing.T) { unarmoredBytes, err := crypto.UnarmorInfoBytes("") require.Error(t, err) - require.True(t, errors.Is(io.EOF, err)) + require.True(t, errors.Is(err, io.EOF)) require.Nil(t, unarmoredBytes) header := map[string]string{ diff --git a/crypto/keyring/autocli.go b/crypto/keyring/autocli.go index 51569f19170d..0dd91ff60a43 100644 --- a/crypto/keyring/autocli.go +++ b/crypto/keyring/autocli.go @@ -2,9 +2,9 @@ package keyring import ( signingv1beta1 "cosmossdk.io/api/cosmos/tx/signing/v1beta1" - authsigning "cosmossdk.io/x/auth/signing" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" ) // autoCLIKeyring represents the keyring interface used by the AutoCLI. diff --git a/crypto/keyring/keyring_test.go b/crypto/keyring/keyring_test.go index 142360dd7fef..519cd01142f8 100644 --- a/crypto/keyring/keyring_test.go +++ b/crypto/keyring/keyring_test.go @@ -17,6 +17,7 @@ import ( "golang.org/x/crypto/bcrypt" "github.com/cosmos/cosmos-sdk/codec" + codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/crypto" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" @@ -223,7 +224,7 @@ func TestNewKey(t *testing.T) { _, err = kb.KeyByAddress(addr) require.NoError(t, err) - addr, err = sdk.AccAddressFromBech32("cosmos1yq8lgssgxlx9smjhes6ryjasmqmd3ts2559g0t") + addr, err = codectestutil.CodecOptions{}.GetAddressCodec().StringToBytes("cosmos1yq8lgssgxlx9smjhes6ryjasmqmd3ts2559g0t") require.NoError(t, err) _, err = kb.KeyByAddress(addr) require.NotNil(t, err) diff --git a/crypto/keys/multisig/multisig_test.go b/crypto/keys/multisig/multisig_test.go index e8e75a61ab02..abd56e4cdaab 100644 --- a/crypto/keys/multisig/multisig_test.go +++ b/crypto/keys/multisig/multisig_test.go @@ -9,7 +9,6 @@ import ( "cosmossdk.io/core/address" "cosmossdk.io/depinject" "cosmossdk.io/log" - "cosmossdk.io/x/auth/migrations/legacytx" "github.com/cosmos/cosmos-sdk/codec" addresscodec "github.com/cosmos/cosmos-sdk/codec/address" @@ -23,6 +22,7 @@ import ( _ "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/testutil/configurator" "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) func TestNewMultiSig(t *testing.T) { diff --git a/crypto/ledger/ledger_mock.go b/crypto/ledger/ledger_mock.go index 94e5063bc54f..999b7b40fcc6 100644 --- a/crypto/ledger/ledger_mock.go +++ b/crypto/ledger/ledger_mock.go @@ -12,10 +12,10 @@ import ( secp "github.com/decred/dcrd/dcrec/secp256k1/v4" "github.com/decred/dcrd/dcrec/secp256k1/v4/ecdsa" + codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" "github.com/cosmos/cosmos-sdk/crypto/hd" csecp256k1 "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" "github.com/cosmos/cosmos-sdk/testutil/testdata" - sdk "github.com/cosmos/cosmos-sdk/types" ) // If ledger support (build tag) has been enabled, which implies a CGO dependency, @@ -78,7 +78,11 @@ func (mock LedgerSECP256K1Mock) GetAddressPubKeySECP256K1(derivationPath []uint3 // Generate the bech32 addr using existing cmtcrypto/etc. pub := &csecp256k1.PubKey{Key: compressedPublicKey} - addr := sdk.AccAddress(pub.Address()).String() + addr, err := codectestutil.CodecOptions{}.GetAddressCodec().BytesToString(pub.Address()) + if err != nil { + return nil, "", err + } + return pk, addr, err } diff --git a/crypto/ledger/ledger_test.go b/crypto/ledger/ledger_test.go index a0ff890b935c..f8599abec1e7 100644 --- a/crypto/ledger/ledger_test.go +++ b/crypto/ledger/ledger_test.go @@ -10,12 +10,15 @@ import ( "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/codec/legacy" + codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" ) +var ac = codectestutil.CodecOptions{}.GetAddressCodec() + func TestPublicKeyUnsafe(t *testing.T) { path := *hd.NewFundraiserParams(0, sdk.CoinType, 0) priv, err := NewPrivKeySecp256k1Unsafe(path) @@ -31,7 +34,8 @@ func checkDefaultPubKey(t *testing.T, priv types.LedgerPrivKey) { fmt.Sprintf("%x", cdc.Amino.MustMarshalBinaryBare(priv.PubKey())), "Is your device using test mnemonic: %s ?", testdata.TestMnemonic) require.Equal(t, expectedPkStr, priv.PubKey().String()) - addr := sdk.AccAddress(priv.PubKey().Address()).String() + addr, err := ac.BytesToString(priv.PubKey().Address()) + require.NoError(t, err) require.Equal(t, "cosmos1w34k53py5v5xyluazqpq65agyajavep2rflq6h", addr, "Is your device using test mnemonic: %s ?", testdata.TestMnemonic) } @@ -98,7 +102,8 @@ func TestPublicKeySafe(t *testing.T) { require.Nil(t, ShowAddress(path, priv.PubKey(), "cosmos")) checkDefaultPubKey(t, priv) - addr2 := sdk.AccAddress(priv.PubKey().Address()).String() + addr2, err := ac.BytesToString(priv.PubKey().Address()) + require.NoError(t, err) require.Equal(t, addr, addr2) } @@ -143,7 +148,9 @@ func TestPublicKeyHDPath(t *testing.T) { require.NotNil(t, addr) require.NotNil(t, priv) - addr2 := sdk.AccAddress(priv.PubKey().Address()).String() + addr2, err := ac.BytesToString(priv.PubKey().Address()) + require.NoError(t, err) + require.Equal(t, addr2, addr) require.Equal(t, expectedAddrs[i], addr, diff --git a/depinject/appconfig/README.md b/depinject/appconfig/README.md index b95f3e8ebc0a..2e8ace564972 100644 --- a/depinject/appconfig/README.md +++ b/depinject/appconfig/README.md @@ -26,7 +26,7 @@ import "cosmos/app/v1alpha1/module.proto"; message Module { option (cosmos.app.v1alpha1.module) = { - go_import: "cosmossdk.io/x/auth" + go_import: "github.com/cosmos/cosmos-sdk/x/auth" }; string bech32_prefix = 1; repeated ModuleAccountPermission module_account_permissions = 2; diff --git a/depinject/internal/appconfig/buf.gen.pulsar.yaml b/depinject/internal/appconfig/buf.gen.pulsar.yaml index 1866261857af..fbc7775f4871 100644 --- a/depinject/internal/appconfig/buf.gen.pulsar.yaml +++ b/depinject/internal/appconfig/buf.gen.pulsar.yaml @@ -1,5 +1,9 @@ version: v1 +managed: + enabled: true + go_package_prefix: + default: cosmossdk.io/depinject plugins: - name: go-pulsar out: . - opt: paths=source_relative + opt: paths=source_relative,Mcosmos/app/v1alpha1/module.proto=cosmossdk.io/depinject/appconfig/v1alpha1 diff --git a/depinject/internal/appconfig/buf.lock b/depinject/internal/appconfig/buf.lock new file mode 100644 index 000000000000..28c135cc08bb --- /dev/null +++ b/depinject/internal/appconfig/buf.lock @@ -0,0 +1,28 @@ +# Generated by buf. DO NOT EDIT. +version: v1 +deps: + - remote: buf.build + owner: cosmos + repository: cosmos-proto + commit: 04467658e59e44bbb22fe568206e1f70 + digest: shake256:73a640bd60e0c523b0f8237ff34eab67c45a38b64bbbde1d80224819d272dbf316ac183526bd245f994af6608b025f5130483d0133c5edd385531326b5990466 + - remote: buf.build + owner: cosmos + repository: cosmos-sdk + commit: cf13c7d232dd405180c2af616fa8a075 + digest: shake256:769a38e306a98339b549bc96991c97fae8bd3ceb1a7646c7bfe9a74e406ab068372970fbc5abda1891e2f3c36527cf2d3a25f631739d36900787226e564bb612 + - remote: buf.build + owner: cosmos + repository: gogo-proto + commit: 5e5b9fdd01804356895f8f79a6f1ddc1 + digest: shake256:0b85da49e2e5f9ebc4806eae058e2f56096ff3b1c59d1fb7c190413dd15f45dd456f0b69ced9059341c80795d2b6c943de15b120a9e0308b499e43e4b5fc2952 + - remote: buf.build + owner: googleapis + repository: googleapis + commit: 28151c0d0a1641bf938a7672c500e01d + digest: shake256:49215edf8ef57f7863004539deff8834cfb2195113f0b890dd1f67815d9353e28e668019165b9d872395871eeafcbab3ccfdb2b5f11734d3cca95be9e8d139de + - remote: buf.build + owner: protocolbuffers + repository: wellknowntypes + commit: 657250e6a39648cbb169d079a60bd9ba + digest: shake256:00de25001b8dd2e29d85fc4bcc3ede7aed886d76d67f5e0f7a9b320b90f871d3eb73507d50818d823a0512f3f8db77a11c043685528403e31ff3fef18323a9fb diff --git a/depinject/internal/appconfig/testpb/test.pulsar.go b/depinject/internal/appconfig/testpb/test.pulsar.go index 2163a1fd6346..720a0e5ef580 100644 --- a/depinject/internal/appconfig/testpb/test.pulsar.go +++ b/depinject/internal/appconfig/testpb/test.pulsar.go @@ -2344,10 +2344,14 @@ var file_testpb_test_proto_rawDesc = []byte{ 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x22, 0x1e, 0x0a, 0x14, 0x54, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x47, 0x6f, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x06, 0xba, 0xc0, 0x96, 0xda, - 0x01, 0x00, 0x42, 0x32, 0x5a, 0x30, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, - 0x69, 0x6f, 0x2f, 0x64, 0x65, 0x70, 0x69, 0x6e, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, - 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x01, 0x00, 0x42, 0x6e, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, + 0x42, 0x09, 0x54, 0x65, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x64, 0x65, 0x70, 0x69, + 0x6e, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0xa2, 0x02, 0x03, 0x54, + 0x58, 0x58, 0xaa, 0x02, 0x06, 0x54, 0x65, 0x73, 0x74, 0x70, 0x62, 0xca, 0x02, 0x06, 0x54, 0x65, + 0x73, 0x74, 0x70, 0x62, 0xe2, 0x02, 0x12, 0x54, 0x65, 0x73, 0x74, 0x70, 0x62, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x54, 0x65, 0x73, 0x74, + 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/depinject/internal/appconfiggogo/buf.gen.gogo.yaml b/depinject/internal/appconfiggogo/buf.gen.gogo.yaml index ca01a181525f..a65eb7fa539c 100644 --- a/depinject/internal/appconfiggogo/buf.gen.gogo.yaml +++ b/depinject/internal/appconfiggogo/buf.gen.gogo.yaml @@ -2,4 +2,4 @@ version: v1 plugins: - name: gocosmos out: . - opt: paths=source_relative + opt: paths=source_relative,Mcosmos/app/v1alpha1/module.proto=cosmossdk.io/depinject/appconfig/v1alpha1 diff --git a/depinject/internal/appconfiggogo/buf.lock b/depinject/internal/appconfiggogo/buf.lock new file mode 100644 index 000000000000..28c135cc08bb --- /dev/null +++ b/depinject/internal/appconfiggogo/buf.lock @@ -0,0 +1,28 @@ +# Generated by buf. DO NOT EDIT. +version: v1 +deps: + - remote: buf.build + owner: cosmos + repository: cosmos-proto + commit: 04467658e59e44bbb22fe568206e1f70 + digest: shake256:73a640bd60e0c523b0f8237ff34eab67c45a38b64bbbde1d80224819d272dbf316ac183526bd245f994af6608b025f5130483d0133c5edd385531326b5990466 + - remote: buf.build + owner: cosmos + repository: cosmos-sdk + commit: cf13c7d232dd405180c2af616fa8a075 + digest: shake256:769a38e306a98339b549bc96991c97fae8bd3ceb1a7646c7bfe9a74e406ab068372970fbc5abda1891e2f3c36527cf2d3a25f631739d36900787226e564bb612 + - remote: buf.build + owner: cosmos + repository: gogo-proto + commit: 5e5b9fdd01804356895f8f79a6f1ddc1 + digest: shake256:0b85da49e2e5f9ebc4806eae058e2f56096ff3b1c59d1fb7c190413dd15f45dd456f0b69ced9059341c80795d2b6c943de15b120a9e0308b499e43e4b5fc2952 + - remote: buf.build + owner: googleapis + repository: googleapis + commit: 28151c0d0a1641bf938a7672c500e01d + digest: shake256:49215edf8ef57f7863004539deff8834cfb2195113f0b890dd1f67815d9353e28e668019165b9d872395871eeafcbab3ccfdb2b5f11734d3cca95be9e8d139de + - remote: buf.build + owner: protocolbuffers + repository: wellknowntypes + commit: 657250e6a39648cbb169d079a60bd9ba + digest: shake256:00de25001b8dd2e29d85fc4bcc3ede7aed886d76d67f5e0f7a9b320b90f871d3eb73507d50818d823a0512f3f8db77a11c043685528403e31ff3fef18323a9fb diff --git a/docs/Introduction.md b/docs/Introduction.md index 9b42b734a0be..80c5a7a0a9c4 100644 --- a/docs/Introduction.md +++ b/docs/Introduction.md @@ -34,4 +34,4 @@ Check out the docs for the various parts of the Cosmos stack. * [**GitHub Discussions**](https://github.com/orgs/cosmos/discussions) - Ask questions and discuss SDK development on GitHub. * [**Discord**](https://discord.gg/interchain) - Chat with Cosmos developers on Discord. -* [**Found an issue?**](https://github.com/cosmos/cosmos-sdk/edit/main/docs/docs/README.md) - Help us improve this page by suggesting edits on GitHub. +* [**Found an issue?**](https://github.com/cosmos/cosmos-sdk/edit/main/docs/Introduction.md) - Help us improve this page by suggesting edits on GitHub. diff --git a/docs/architecture/adr-011-generalize-genesis-accounts.md b/docs/architecture/adr-011-generalize-genesis-accounts.md index be4f9b37ef57..92a704ba6ea9 100644 --- a/docs/architecture/adr-011-generalize-genesis-accounts.md +++ b/docs/architecture/adr-011-generalize-genesis-accounts.md @@ -63,7 +63,7 @@ The `auth` codec must have all custom account types registered to marshal them. An example custom account definition: ```go -import authtypes "cosmossdk.io/x/auth/types" +import authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" // Register the module account type with the auth module codec so it can decode module accounts stored in a genesis file func init() { diff --git a/docs/architecture/adr-038-state-listening.md b/docs/architecture/adr-038-state-listening.md index a8f8e0718ad1..db0620c55441 100644 --- a/docs/architecture/adr-038-state-listening.md +++ b/docs/architecture/adr-038-state-listening.md @@ -618,7 +618,7 @@ e.g. in `NewSimApp`: ```go func NewSimApp( logger log.Logger, - db dbm.DB, + db corestore.KVStoreWithBatch, traceStore io.Writer, loadLatest bool, appOpts servertypes.AppOptions, diff --git a/docs/architecture/adr-057-app-wiring.md b/docs/architecture/adr-057-app-wiring.md index 239e7d52b352..d187cf2f8d03 100644 --- a/docs/architecture/adr-057-app-wiring.md +++ b/docs/architecture/adr-057-app-wiring.md @@ -226,7 +226,7 @@ package main import ( // Each go package which registers a module must be imported just for side-effects // so that module implementations are registered. - _ "cosmossdk.io/x/auth/module" + _ "github.com/cosmos/cosmos-sdk/x/auth/module" _ "cosmossdk.io/x/bank/module" _ "cosmossdk.io/x/staking/module" "github.com/cosmos/cosmos-sdk/core/app" diff --git a/docs/build/building-apps/03-app-upgrade.md b/docs/build/building-apps/03-app-upgrade.md index a38644a40a44..a26cdcce0fb7 100644 --- a/docs/build/building-apps/03-app-upgrade.md +++ b/docs/build/building-apps/03-app-upgrade.md @@ -53,7 +53,7 @@ be a matter of minutes and not even require them to be awake at that time. ## Integrating With An App :::tip -The following is not required for users using `depinject` / app v2, this is abstracted for them. +The following is not required for users using `depinject`, this is abstracted for them. ::: In addition to basic module wiring, setup the upgrade Keeper for the app and then define a `PreBlocker` that calls the upgrade diff --git a/docs/build/building-modules/01-module-manager.md b/docs/build/building-modules/01-module-manager.md index 5370ae41672f..f69f9887265b 100644 --- a/docs/build/building-modules/01-module-manager.md +++ b/docs/build/building-modules/01-module-manager.md @@ -260,7 +260,7 @@ Here's an example of a concrete integration within an `simapp`: https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/simapp/app.go#L411-L434 ``` -This is the same example from `runtime` (the package that powers app v2): +This is the same example from `runtime` (the package that powers app di): ```go reference https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/runtime/module.go#L61 diff --git a/docs/build/tooling/00-protobuf.md b/docs/build/tooling/00-protobuf.md index 3780435b192d..01afbb342c15 100644 --- a/docs/build/tooling/00-protobuf.md +++ b/docs/build/tooling/00-protobuf.md @@ -98,7 +98,7 @@ https://github.com/cosmos/cosmos-sdk/blob/main/proto/buf.lock#L1-L16 #### `buf.yaml` -`buf.yaml` defines the [name of your package](https://github.com/cosmos/cosmos-sdk/blob/main/proto/buf.yaml#L3), which [breakage checker](https://docs.buf.build/tour/detect-breaking-changes) to use and how to [lint your protobuf files](https://docs.buf.build/tour/lint-your-api). +`buf.yaml` defines the [name of your package](https://github.com/cosmos/cosmos-sdk/blob/main/proto/buf.yaml#L3), which [breakage checker](https://docs.buf.build/tour/detect-breaking-changes) to use and how to [lint your protobuf files](https://buf.build/docs/tutorials/getting-started-with-buf-cli#lint-your-api). ```go reference https://github.com/cosmos/cosmos-sdk/blob/main/proto/buf.yaml#L1-L24 diff --git a/docs/learn/advanced/00-baseapp.md b/docs/learn/advanced/00-baseapp.md index 61e71f28d779..1a7cd28fdc96 100644 --- a/docs/learn/advanced/00-baseapp.md +++ b/docs/learn/advanced/00-baseapp.md @@ -108,7 +108,7 @@ Finally, a few more important parameters: ```go func NewBaseApp( - name string, logger log.Logger, db dbm.DB, txDecoder sdk.TxDecoder, options ...func(*BaseApp), + name string, logger log.Logger, db corestore.KVStoreWithBatch, txDecoder sdk.TxDecoder, options ...func(*BaseApp), ) *BaseApp { // ... diff --git a/docs/learn/advanced/04-store.md b/docs/learn/advanced/04-store.md index c426fb8322fe..fdfdd9fad6d6 100644 --- a/docs/learn/advanced/04-store.md +++ b/docs/learn/advanced/04-store.md @@ -141,13 +141,13 @@ The documentation on the IAVL Tree is located [here](https://github.com/cosmos/i ### `DbAdapter` Store -`dbadapter.Store` is an adapter for `dbm.DB` making it fulfilling the `KVStore` interface. +`dbadapter.Store` is an adapter for `corestore.KVStoreWithBatch` making it fulfilling the `KVStore` interface. ```go reference https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/dbadapter/store.go#L13-L16 ``` -`dbadapter.Store` embeds `dbm.DB`, meaning most of the `KVStore` interface functions are implemented. The other functions (mostly miscellaneous) are manually implemented. This store is primarily used within [Transient Stores](#transient-store) +`dbadapter.Store` embeds `corestore.KVStoreWithBatch`, meaning most of the `KVStore` interface functions are implemented. The other functions (mostly miscellaneous) are manually implemented. This store is primarily used within [Transient Stores](#transient-store) ### `Transient` Store diff --git a/docs/rfc/README.md b/docs/rfc/README.md index 940d361079d4..13f9d8a3fc75 100644 --- a/docs/rfc/README.md +++ b/docs/rfc/README.md @@ -38,5 +38,6 @@ sections. * [RFC-001: Tx Validation](./rfc-001-tx-validation.md) * [RFC-002: Zero Copy Encoding](./rfc-002-zero-copy-encoding.md) +* [RFC-003: Cross Language Account/Module Execution Model](./rfc-003-crosslang.md) * [RFC-004: Accounts](./rfc-004-accounts.md) * [RFC-005: Optimistic Execution](./rfc-005-optimistic-execution.md) diff --git a/docs/rfc/rfc-003-crosslang.md b/docs/rfc/rfc-003-crosslang.md new file mode 100644 index 000000000000..b71db170e0ec --- /dev/null +++ b/docs/rfc/rfc-003-crosslang.md @@ -0,0 +1,296 @@ +# RFC 003: Cross Language Account/Module Execution Model + +## Changelog + +* 2024-08-09: Reworked initial draft (previous work was in https://github.com/cosmos/cosmos-sdk/pull/15410) + +## Background + +The Cosmos SDK has historically been a Golang only framework for building blockchain applications. +However, discussions about supporting additional programming languages and virtual machine environments +have been underway since early 2023. Recently, we have identified the following key target user groups: +Recently we have identified the following key target user groups: +1. projects that want to primarily target a single programming language and virtual machine environment besides Golang but who still want to use Cosmos SDK internals for consensus and storage +2. projects that want to integrate multiple programming languages and virtual machine environments into an integrated application + +While these two user groups may have substantially different needs, +the goals of the second group are more challenging to support and require a more clearly specified unified design. + +This RFC primarily attempts to address the needs of the second group. +However, in doing so, it also intends to address the needs of the first group as we will likely build many of the components needed for this group by building an integrated cross-language, cross-VM framework. +Those needs of the first group which are not satisfactorily addressed by the cross-language framework should be addressed in separate RFCs. + +Prior work on cross-language support in the SDK includes: +- [RFC 003: Language-independent Module Semantics & ABI](https://github.com/cosmos/cosmos-sdk/pull/15410): an earlier, significantly different and unmerged version of this RFC. +- [RFC 002: Zero Copy Encoding](./rfc-002-zero-copy-encoding.md): a zero-copy encoding specification for ProtoBuf messages, which was partly implemented and may or may not still be relevant to the current work. + +Also, this design largely builds on the existing `x/accounts` module and extends that paradigm to environments beyond just Golang. +That design was specified in [RFC 004: Accounts](./rfc-004-accounts.md). + +## Proposal + +We propose a conceptual and formal model for defining **accounts** and **modules** which can interoperate with each other through **messages** in a cross-language, cross-VM environment. + +We start with the conceptual definition of core concepts from the perspective of a developer +trying to write code for a module or account. +The formal details of how these concepts are represented in a specific coding environment may vary significantly, +however, the essence should remain more or less the same in most coding environments. + +This specification is intentionally kept minimal as it is always easier to add features than to remove them. +Where possible, other layers of the system should be specified in a complementary, modular way in separate specifications. + +### Account + +An **account** is defined as having: +* a unique **address** +* an **account handler** which is some code which can process **messages** and send **messages** to other **accounts** + +### Address + +An **address** is defined as a variable-length byte array of up to 63 bytes +so that an address can be represented as a 64-byte array with the first byte indicating the length of the address. + +### Message + +A **message** is defined as a tuple of: +* a **message name** +* and **message data** + +A **message name** is an ASCII string of up to 127 characters +so that it can be represented as a 128-byte array with the first byte indicating the length of the string. +**Message names** can only contain letters, numbers and the special characters `:`, `_`, `/`, and `.`. + +**Message data** will be defined in more detail later. + +### Account Handler + +The code that implements an account's message handling is known as the **account handler**. The handler receives a **message request** and can return some **message response** or an error. + +The handler for a specific message within an **account handler** is known as a **message handler**. + +### Message Request + +A **message request** contains: +* the **address** of the **account** (its own address) +* the **address** of the account sending the message (the **caller**), which will be empty if the message is a query +* the **message name** +* the **message data** +* a 32-byte **state token** +* a 32-byte **context token** +* a `uint64` **gas limit** + +**Message requests** can also be prepared by **account handlers** to send **messages** to other accounts. + +### Modules and Modules Messages + +There is a special class of **message**s known as **module messages**, +where the caller should omit the address of the receiving account. +The routing framework can look up the address of the receiving account based on the message name of a **module message**. + +Accounts which define handlers for **module messages** are known as **modules**. + +**Module messages** are distinguished from other messages because their message name must start with the `module:` prefix. + +The special kind of account handler which handles **module messages** is known as a **module handler**. +A **module** is thus an instance of a **module handler** with a specific address +in the same way that an account is an instance of an account handler. +In addition to an address, **modules** also have a human-readable **module name**. + +More details on **modules** and **module messages** will be given later. + +### Account Handler and Message Metadata + +Every **account handler** is expected to provide metadata which provides: +* a list of the **message names** it defines **message handlers** and for each of these, its: + * **volatility** (described below) + * optional additional bytes, which are not standardized at this level +* **state config** bytes which are sent to the **state handler** (described below) but are otherwise opaque +* some optional additional bytes, which are not standardized at this level + +### Account Lifecycle + +**Accounts** can be created, destroyed and migrated to new **account handlers**. + +**Account handlers** can define message handlers for the following special message name's: +* `on_create`: called when an account is created with message data containing arbitrary initialization data. +* `on_migrate`: called when an account is migrated to a new code handler. Such handlers receive structured message data specifying the old code handler so that the account can perform migration operations or return an error if migration is not possible. + +### Hypervisor and Virtual Machines + +Formally, a coding environment where **account handlers** are run is known as a **virtual machine**. +These **virtual machine**s may or may not be sandboxed virtual machines in the traditional sense. +For instance, the existing Golang SDK module environment (currently specified by `cosmossdk.io/core`), will +be known as the "native Golang" virtual machine. +For consistency, however, +we refer to these all as **virtual machines** because from the perspective of the cross-language framework, +they must implement the same interface. + +The special module which manages **virtual machines** and **accounts** is known as the **hypervisor**. + +Each **virtual machine** that is loaded by the **hypervisor** will get a unique **machine id** string. +Each **account handler** that a **virtual machine** can load is referenced by a unique **handler id** string. + +There are two forms of **handler ids**: +* **module handlers** which take the form `module:` +* **account handlers** which take the form `:`, where `machine_handler_id` is a unique string scoped to the **virtual machine** + +Each **virtual machine** must expose a list of all the **module handlers** it can run, +and the **hypervisor** will ensure that the **module handlers** are unique across all **virtual machines**. + +Each **virtual machine** is expected to expose a method which takes a **handler id** +and returns a reference to an **account handler** +which can be used to run **messages**. +**Virtual machines** will also receive an `invoke` function +so that their **account handlers** can send messages to other **accounts**. +**Virtual machines** must also implement a method to return the metadata for each **account handler** by **handler id**. + +### State and Volatility + +Accounts generally also have some mutable state, but within this specification, +state is mostly expected to be handled by some special state module defined by separate specifications. +The few main concepts of **state handler**, **state token**, **state config** and **volatility** are defined here. + +The **state handler** is a system component which the hypervisor has a reference to, +and which is responsible for managing the state of all accounts. +It only exposes the following methods to the hypervisor: +- `create(account address, state config)`: creates a new account state with the specified address and **state config**. +- `migrate(account address, new state config)`: migrates the account state with the specified address to a new state config +- `destroy(account address)`: destroys the account state with the specified address + +**State config** are optional bytes that each account handler's metadata can define which get passed to the **state handler** when an account is created. +These bytes can be used by the **state handler** to determine what type of state and commitment store the **account** needs. + +A **state token** is an opaque array of 32-bytes that is passed in each message request. +The hypervisor has no knowledge of what this token represents or how it is created, +but it is expected that modules that mange state do understand this token and use it to manage all state changes +in consistent transactions. +All side effects regarding state, events, etc. are expected to coordinate around the usage of this token. +It is possible that state modules expose methods for creating new **state tokens** +for nesting transactions. + +**Volatility** describes a message handler's behavior with respect to state and side effects. +It is an enum value that can have one of the following values: +* `volatile`: the handler can have side effects and send `volatile`, `radonly` or `pure` messages to other accounts. Such handlers are expected to both read and write state. +* `readonly`: the handler cannot cause effects side effects and can only send `readonly` or `pure` messages to other accounts. Such handlers are expected to only read state. +* `pure`: the handler cannot cause any side effects and can only call other pure handlers. Such handlers are expected to neither read nor write state. + +The hypervisor will enforce **volatility** rules when routing messages to account handlers. +Caller addresses are always passed to `volatile` methods, +they are not required when calling `readonly` methods but will be passed when available, +and they are not passed at all to `pure` methods. + +### Management of Account Lifecycle with the Hypervisor + +In order to manage **accounts** and their mapping to **account handlers**, the **hypervisor** contains stateful mappings for: +* **account address** to **handler id** +* **module name** to module **account address** and **module config** +* **message name** to **account address** for **module messages** + +The **hypervisor** as a first-class module itself handles the following special **module messages** to manage account +creation, destruction, and migration: +* `create(handler_id, init_data) -> address`: creates a new account in the specified code environment with the specified handler id and returns the address of the new account. The `on_create` message is called if it is implemented by the account. Addresses are generated deterministically by the hypervisor with a configurable algorithm which will allow public key accounts to get predictable addresses. +* `destroy(address)`: deletes the account with the specified address. `destroy` can only be called by the account itself. +* `migrate(address, new_handler_id)`: migrates the account with the specified address to the new account handler. The `on_migrate` message must be implemented by the new code and must not return an error for migration to succeed. `migrate` can only be called by the account itself. +* `force_migrate(address, new_handler_id, init_data)`: this can be used when no `on_migrate` handler can perform a proper migration to the new account handler. In this case, the old account state will be destroyed, and `on_create` will be called on the new code. This is a destructive operation and should be used with caution. + +The **hypervisor** will call the **state handler**'s `create`, `migrate`, +and `destroy` methods as needed when accounts are created, migrated, or destroyed. + +### Module Lifecycle & Module Messages + +For legacy purposes, **modules** have specific lifecycles and **module messages** have special semantics. +A **module handler** cannot be loaded with the `create` message, +but must be loaded by an external call to the hypervisor +which includes the **module name** and **module config** bytes. +The existing `cosmos.app.v1alpha1.Config` can be used for this purpose if desired. + +**Module messages** also allow the definition of pre- and post-handlers. +These are special message handlers that can only be defined in **module handlers** +and must be prefixed by the `module:pre:` or `module:post:` prefixes +When modules are loaded in the hypervisor, a composite message handler will be composed using all the defined +pre- and post-handlers for a given message name in the loaded module set. +By default, the ordering will be done alphabetically by module name. + +### Authorization and Delegated Execution + +When a message handler creates a message request, it can pass any address as the caller address, +but it must pass the same **context token** that it received in its message request. +The hypervisor will use the **context token** to verify the "real" caller address. +Every nested message call will receive a new non-forgeable **context token** so that virtual machines +and their account handlers cannot arbitrarily fool the hypervisor about the real caller address. + +By default, the hypervisor will only allow the real caller to act as the caller. + +There are use cases, however, for delegated authorization of messages or even for modules which can execute +a message on behalf of any account. +To support these, the hypervisor will accept an **authorization middleware** parameter which checks +whether a given real caller account (verified by the hypervisor) is authorized to act as a different caller +account for a given message request. + +### Message Data and Packet Specification + +To facilitate efficient cross-language and cross-VM message passing, the precise layout of **message packets** is important +as it reduces the need for serialization and deserialization in the core hypervisor and virtual machine layers. + +We start by defining a **message packet** as a 64kb (65,536 bytes) array which is aligned to a 64kb boundary. +For most message handlers, this single packet should be large enough to contain a full **message request**, +including all **message data** as well as message return data. +In cases where the packet size is too small, additional buffers can be referenced from within the **message packet**. + +More details on the specific layout of **message packets** will be specified in a future update to this RFC +or a separate RFC. +For now, we specify that within a 64kb **message packet**, +at least 56kb will be available for **message data** and message responses. + +## Abandoned Ideas (Optional) + +## Decision + +Based on internal discussions, we have decided to move forward with this design. + +## Consequences (optional) + +### Backwards Compatibility + +It is intended that existing SDK modules built using `cosmossdk.io/core` and +account handlers built with `cosmossdk.io/x/accounts` can be integrated into this system with zero or minimal changes. + +### Positive + +This design will allow native SDK modules to be built using other languages such as Rust and Zig, and +for modules to be executed in different virtual machine environments such as Wasm and the EVM. +It also extends the concept of a module to first-class accounts in the style of the existing `x/accounts` module +and EVM contracts. + +### Negative + +### Neutral + +Similar to other message passing designs, +the raw performance invoking a message handler will be slower than a golang method call as in the existing keeper paradigm. + +However, this design does nothing to preclude the continued existence of golang native keeper passing, and it is likely +that we can find performance optimizations in other areas to mitigate any performance loss. +In addition, a cross-language, cross-VM is simply not possible without some overhead. + + +### References + +- [Abandoned RFC 003: Language-independent Module Semantics & ABI](https://github.com/cosmos/cosmos-sdk/pull/15410) +- [RFC 002: Zero Copy Encoding](./rfc-002-zero-copy-encoding.md) +- [RFC 004: Accounts](./rfc-004-accounts.md) + +## Discussion + +This specification does not cover many important parts of a complete system such as the encoding of message data, +storage, events, transaction execution, or interaction with consensus environments. +It is the intention of this specification to specify the minimum necessary for this layer in a modular layer. +The full framework should be composed of a set of independent, minimally defined layers that together +form a "standard" execution environment, but that at the same time can be replaced and recomposed by +different applications with different needs. + +The basic set of standards necessary to provide a coherent framework includes: +* message encoding and naming, including compatibility with the existing protobuf-based message encoding +* storage +* events +* authorization middleware diff --git a/docs/rfc/rfc-006-handlers.md b/docs/rfc/rfc-006-handlers.md index 479b2006300f..a22992ccdb0c 100644 --- a/docs/rfc/rfc-006-handlers.md +++ b/docs/rfc/rfc-006-handlers.md @@ -79,11 +79,11 @@ import ( type PreMsgHandlerRouter interface { // RegisterGlobalPreMsgHandler will register a pre msg handler that hooks before any message executes. // Handler will be called before ANY message executes. - RegisterGlobalPreMsgHandler(handler func(ctx context.Context, msg protoiface.MessageV1) error) + RegisterGlobalPreMsgHandler(handler func(ctx context.Context, msg transaction.Msg) error) // RegisterPreMsgHandler will register a pre msg handler that hooks before the provided message // with the given message name executes. Handler will be called before the message is executed // by the module. - RegisterPreMsgHandler(msgName string, handler func(ctx context.Context, msg protoiface.MessageV1) error) + RegisterPreMsgHandler(msgName string, handler func(ctx context.Context, msg transaction.Msg) error) } type HasPreMsgHandler interface { @@ -105,11 +105,11 @@ import ( type PostMsgHandlerRouter interface { // RegisterGlobalPostMsgHandler will register a post msg handler that hooks after any message executes. // Handler will be called after ANY message executes, alongside the response. - RegisterGlobalPostMsgHandler(handler func(ctx context.Context, msg, msgResp protoiface.MessageV1) error) + RegisterGlobalPostMsgHandler(handler func(ctx context.Context, msg, msgResp transaction.Msg) error) // RegisterPostMsgHandler will register a pre msg handler that hooks after the provided message // with the given message name executes. Handler will be called after the message is executed // by the module, alongside the response returned by the module. - RegisterPostMsgHandler(msgName string, handler func(ctx context.Context, msg, msgResp protoiface.MessageV1) error) + RegisterPostMsgHandler(msgName string, handler func(ctx context.Context, msg, msgResp transaction.Msg) error) } type HasPostMsgHandler interface { @@ -142,7 +142,7 @@ import ( ) type MsgHandlerRouter interface { - RegisterMsgHandler(msgName string, handler func(ctx context.Context, msg protoiface.MessageV1) (msgResp protoiface.MessageV1, err error)) + RegisterMsgHandler(msgName string, handler func(ctx context.Context, msg transaction.Msg) (msgResp transaction.Msg, err error)) } type HasMsgHandler interface { @@ -150,7 +150,7 @@ type HasMsgHandler interface { } // RegisterMsgHandler is a helper function to retain type safety when creating handlers, so we do not need to cast messages. -func RegisterMsgHandler[Req, Resp protoiface.MessageV1](router MsgHandlerRouter, handler func(ctx context.Context, req Req) (resp Resp, err error)) { +func RegisterMsgHandler[Req, Resp transaction.Msg](router MsgHandlerRouter, handler func(ctx context.Context, req Req) (resp Resp, err error)) { // impl detail } ``` @@ -186,7 +186,7 @@ import ( ) type QueryHandlerRouter interface { - RegisterQueryHandler(msgName string, handler func(ctx context.Context, req protoiface.MessageV1) (resp protoiface.MessageV1, err error)) + RegisterQueryHandler(msgName string, handler func(ctx context.Context, req transaction.Msg) (resp transaction.Msg, err error)) } type HasQueryHandler interface { @@ -194,7 +194,7 @@ type HasQueryHandler interface { } // RegisterQueryHandler is a helper function to retain type safety when creating handlers, so we do not need to cast messages. -func RegisterQueryHandler[Req, Resp protoiface.MessageV1](router QueryHandlerRouter, handler func(ctx context.Context, req Req) (resp Resp, err error)) { +func RegisterQueryHandler[Req, Resp transaction.Msg](router QueryHandlerRouter, handler func(ctx context.Context, req Req) (resp Resp, err error)) { // impl detail } diff --git a/flake.lock b/flake.lock index 25cc4479a38a..e442eb8cdd43 100644 --- a/flake.lock +++ b/flake.lock @@ -44,11 +44,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1714656196, - "narHash": "sha256-kjQkA98lMcsom6Gbhw8SYzmwrSo+2nruiTcTZp5jK7o=", + "lastModified": 1723603349, + "narHash": "sha256-VMg6N7MryOuvSJ8Sj6YydarnUCkL7cvMdrMcnsJnJCE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "94035b482d181af0a0f8f77823a790b256b7c3cc", + "rev": "daf7bb95821b789db24fc1ac21f613db0c1bf2cb", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 69569230fc76..4313af441445 100644 --- a/flake.nix +++ b/flake.nix @@ -54,7 +54,7 @@ devShells = rec { default = with pkgs; mkShell { buildInputs = [ - go_1_22 # Use Go 1.22 version + go_1_23 # Use Go 1.23 version rocksdb gomod2nix ]; diff --git a/go.mod b/go.mod index 5de1ecdec5aa..f63f8f53addd 100644 --- a/go.mod +++ b/go.mod @@ -1,19 +1,18 @@ -go 1.22.2 +go 1.23 module github.com/cosmos/cosmos-sdk require ( cosmossdk.io/api v0.7.5 cosmossdk.io/collections v0.4.0 - cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 + cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 cosmossdk.io/depinject v1.0.0 cosmossdk.io/errors v1.0.1 - cosmossdk.io/log v1.4.0 + cosmossdk.io/log v1.4.1 cosmossdk.io/math v1.3.0 - cosmossdk.io/schema v0.1.1 + cosmossdk.io/schema v0.2.0 cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc - cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 @@ -23,7 +22,7 @@ require ( github.com/cometbft/cometbft v1.0.0-rc1 github.com/cometbft/cometbft/api v1.0.0-rc.1 github.com/cosmos/btcutil v1.0.5 - github.com/cosmos/cosmos-db v1.0.2 + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/crypto v0.1.2 github.com/cosmos/go-bip39 v1.0.0 @@ -46,8 +45,8 @@ require ( github.com/mattn/go-isatty v0.0.20 github.com/mdp/qrterminal/v3 v3.2.0 github.com/muesli/termenv v0.15.2 - github.com/prometheus/client_golang v1.19.1 - github.com/prometheus/common v0.55.0 + github.com/prometheus/client_golang v1.20.2 + github.com/prometheus/common v0.57.0 github.com/rs/zerolog v1.33.0 github.com/spf13/cast v1.7.0 github.com/spf13/cobra v1.8.1 @@ -57,10 +56,9 @@ require ( github.com/tendermint/go-amino v0.16.0 gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b golang.org/x/crypto v0.26.0 - golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc golang.org/x/sync v0.8.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 - google.golang.org/grpc v1.65.0 + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 + google.golang.org/grpc v1.66.0 google.golang.org/protobuf v1.34.2 gotest.tools/v3 v3.5.1 pgregory.net/rapid v1.1.0 @@ -86,7 +84,7 @@ require ( github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/cometbft/cometbft-db v0.12.0 // indirect github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dgraph-io/badger/v4 v4.2.0 // indirect @@ -122,7 +120,7 @@ require ( github.com/iancoleman/strcase v0.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect @@ -139,7 +137,7 @@ require ( github.com/nxadm/tail v1.4.8 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -164,6 +162,7 @@ require ( go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect go.opencensus.io v0.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect + golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sys v0.24.0 // indirect @@ -171,7 +170,7 @@ require ( golang.org/x/text v0.17.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect rsc.io/qr v0.2.0 // indirect @@ -183,14 +182,14 @@ require ( // // ) // TODO remove after all modules have their own go.mods +replace github.com/cosmos/iavl => github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e + replace ( cosmossdk.io/api => ./api cosmossdk.io/collections => ./collections cosmossdk.io/core => ./core cosmossdk.io/core/testing => ./core/testing cosmossdk.io/store => ./store - cosmossdk.io/x/accounts => ./x/accounts - cosmossdk.io/x/auth => ./x/auth cosmossdk.io/x/bank => ./x/bank cosmossdk.io/x/consensus => ./x/consensus cosmossdk.io/x/staking => ./x/staking diff --git a/go.sum b/go.sum index beba6eba2872..c7a9987b33d1 100644 --- a/go.sum +++ b/go.sum @@ -8,12 +8,12 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= -cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= +cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk= +cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= @@ -95,8 +95,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/crypto v0.1.2 h1:Yn500sPY+9sKVdhiPUSDtt8JOpBGMB515dOmla4zfls= @@ -108,10 +108,10 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e h1:LEii0v/FxtXa/F7mRn+tijZ0zaXBPn2ZkKwb6Qm4rqE= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e/go.mod h1:3ywr0wDnWeD7MUH6qu50wZ5bxuKH3LBrGG4/lZX8lVY= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= @@ -302,8 +302,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -313,6 +313,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -382,8 +384,8 @@ github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4 github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba h1:3jPgmsFGBID1wFfU2AbYocNcN4wqU68UaHSdMjiw/7U= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= @@ -400,8 +402,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -410,8 +412,8 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -469,7 +471,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -501,6 +502,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= @@ -630,10 +633,10 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEY google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -644,8 +647,8 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/go.work.example b/go.work.example index 035cbb3e3496..834c86da2181 100644 --- a/go.work.example +++ b/go.work.example @@ -1,4 +1,4 @@ -go 1.22.2 +go 1.23 use ( . diff --git a/indexer/postgres/base_sql.go b/indexer/postgres/base_sql.go index 32eb38f364c0..ac79b0929a49 100644 --- a/indexer/postgres/base_sql.go +++ b/indexer/postgres/base_sql.go @@ -1,7 +1,7 @@ package postgres -// BaseSQL is the base SQL that is always included in the schema. -const BaseSQL = ` +// baseSQL is the base SQL that is always included in the schema. +const baseSQL = ` CREATE OR REPLACE FUNCTION nanos_to_timestamptz(nanos bigint) RETURNS timestamptz AS $$ SELECT to_timestamp(nanos / 1000000000) + (nanos / 1000000000) * INTERVAL '1 microsecond' $$ LANGUAGE SQL IMMUTABLE; diff --git a/indexer/postgres/column.go b/indexer/postgres/column.go index 188e9d8da651..01975e112177 100644 --- a/indexer/postgres/column.go +++ b/indexer/postgres/column.go @@ -8,7 +8,7 @@ import ( ) // createColumnDefinition writes a column definition within a CREATE TABLE statement for the field. -func (tm *ObjectIndexer) createColumnDefinition(writer io.Writer, field schema.Field) error { +func (tm *objectIndexer) createColumnDefinition(writer io.Writer, field schema.Field) error { _, err := fmt.Fprintf(writer, "%q ", field.Name) if err != nil { return err @@ -25,7 +25,7 @@ func (tm *ObjectIndexer) createColumnDefinition(writer io.Writer, field schema.F } else { switch field.Kind { case schema.EnumKind: - _, err = fmt.Fprintf(writer, "%q", enumTypeName(tm.moduleName, field.EnumType)) + _, err = fmt.Fprintf(writer, "%q", enumTypeName(tm.moduleName, field.ReferencedType)) if err != nil { return err } @@ -110,7 +110,7 @@ func simpleColumnType(kind schema.Kind) string { // updatableColumnName is the name of the insertable/updatable column name for the field. // This is the field name in most cases, except for time columns which are stored as nanos // and then converted to timestamp generated columns. -func (tm *ObjectIndexer) updatableColumnName(field schema.Field) (name string, err error) { +func (tm *objectIndexer) updatableColumnName(field schema.Field) (name string, err error) { name = field.Name if field.Kind == schema.TimeKind { name = fmt.Sprintf("%s_nanos", name) diff --git a/indexer/postgres/conn.go b/indexer/postgres/conn.go index de8c1cac6b47..2e9c96c7c5ad 100644 --- a/indexer/postgres/conn.go +++ b/indexer/postgres/conn.go @@ -5,8 +5,8 @@ import ( "database/sql" ) -// DBConn is an interface that abstracts the *sql.DB, *sql.Tx and *sql.Conn types. -type DBConn interface { +// dbConn is an interface that abstracts the *sql.DB, *sql.Tx and *sql.Conn types. +type dbConn interface { ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) diff --git a/indexer/postgres/create_table.go b/indexer/postgres/create_table.go index 8f5f0e6ca206..0f8dc652190e 100644 --- a/indexer/postgres/create_table.go +++ b/indexer/postgres/create_table.go @@ -7,25 +7,25 @@ import ( "strings" ) -// CreateTable creates the table for the object type. -func (tm *ObjectIndexer) CreateTable(ctx context.Context, conn DBConn) error { +// createTable creates the table for the object type. +func (tm *objectIndexer) createTable(ctx context.Context, conn dbConn) error { buf := new(strings.Builder) - err := tm.CreateTableSql(buf) + err := tm.createTableSql(buf) if err != nil { return err } sqlStr := buf.String() - if tm.options.Logger != nil { - tm.options.Logger(fmt.Sprintf("Creating table %s", tm.TableName()), sqlStr) + if tm.options.logger != nil { + tm.options.logger.Debug("Creating table %s", "table", tm.tableName(), "sql", sqlStr) } _, err = conn.ExecContext(ctx, sqlStr) return err } -// CreateTableSql generates a CREATE TABLE statement for the object type. -func (tm *ObjectIndexer) CreateTableSql(writer io.Writer) error { - _, err := fmt.Fprintf(writer, "CREATE TABLE IF NOT EXISTS %q (\n\t", tm.TableName()) +// createTableSql generates a CREATE TABLE statement for the object type. +func (tm *objectIndexer) createTableSql(writer io.Writer) error { + _, err := fmt.Fprintf(writer, "CREATE TABLE IF NOT EXISTS %q (\n\t", tm.tableName()) if err != nil { return err } @@ -53,7 +53,7 @@ func (tm *ObjectIndexer) CreateTableSql(writer io.Writer) error { } // add _deleted column when we have RetainDeletions set and enabled - if !tm.options.DisableRetainDeletions && tm.typ.RetainDeletions { + if !tm.options.disableRetainDeletions && tm.typ.RetainDeletions { _, err = fmt.Fprintf(writer, "_deleted BOOLEAN NOT NULL DEFAULT FALSE,\n\t") if err != nil { return err @@ -87,7 +87,7 @@ func (tm *ObjectIndexer) CreateTableSql(writer io.Writer) error { // we GRANT SELECT on the table to PUBLIC so that the table is automatically available // for querying using off-the-shelf tools like pg_graphql, Postgrest, Postgraphile, etc. // without any login permissions - _, err = fmt.Fprintf(writer, "GRANT SELECT ON TABLE %q TO PUBLIC;", tm.TableName()) + _, err = fmt.Fprintf(writer, "GRANT SELECT ON TABLE %q TO PUBLIC;", tm.tableName()) if err != nil { return err } diff --git a/indexer/postgres/create_table_test.go b/indexer/postgres/create_table_test.go index 2538338319e7..67851008e40b 100644 --- a/indexer/postgres/create_table_test.go +++ b/indexer/postgres/create_table_test.go @@ -5,9 +5,10 @@ import ( "cosmossdk.io/indexer/postgres/internal/testdata" "cosmossdk.io/schema" + "cosmossdk.io/schema/logutil" ) -func ExampleObjectIndexer_CreateTableSql_allKinds() { +func Example_objectIndexer_createTableSql_allKinds() { exampleCreateTable(testdata.AllKindsObject) // Output: // CREATE TABLE IF NOT EXISTS "test_all_kinds" ( @@ -40,7 +41,7 @@ func ExampleObjectIndexer_CreateTableSql_allKinds() { // GRANT SELECT ON TABLE "test_all_kinds" TO PUBLIC; } -func ExampleObjectIndexer_CreateTableSql_singleton() { +func Example_objectIndexer_createTableSql_singleton() { exampleCreateTable(testdata.SingletonObject) // Output: // CREATE TABLE IF NOT EXISTS "test_singleton" ( @@ -53,7 +54,7 @@ func ExampleObjectIndexer_CreateTableSql_singleton() { // GRANT SELECT ON TABLE "test_singleton" TO PUBLIC; } -func ExampleObjectIndexer_CreateTableSql_vote() { +func Example_objectIndexer_createTableSql_vote() { exampleCreateTable(testdata.VoteObject) // Output: // CREATE TABLE IF NOT EXISTS "test_vote" ( @@ -66,7 +67,7 @@ func ExampleObjectIndexer_CreateTableSql_vote() { // GRANT SELECT ON TABLE "test_vote" TO PUBLIC; } -func ExampleObjectIndexer_CreateTableSql_vote_no_retain_delete() { +func Example_objectIndexer_createTableSql_vote_no_retain_delete() { exampleCreateTableOpt(testdata.VoteObject, true) // Output: // CREATE TABLE IF NOT EXISTS "test_vote" ( @@ -83,11 +84,11 @@ func exampleCreateTable(objectType schema.ObjectType) { } func exampleCreateTableOpt(objectType schema.ObjectType, noRetainDelete bool) { - tm := NewObjectIndexer("test", objectType, Options{ - Logger: func(msg, sql string, params ...interface{}) {}, - DisableRetainDeletions: noRetainDelete, + tm := newObjectIndexer("test", objectType, options{ + logger: logutil.NoopLogger{}, + disableRetainDeletions: noRetainDelete, }) - err := tm.CreateTableSql(os.Stdout) + err := tm.createTableSql(os.Stdout) if err != nil { panic(err) } diff --git a/indexer/postgres/enum.go b/indexer/postgres/enum.go index 709fc9039562..62332f67d0e8 100644 --- a/indexer/postgres/enum.go +++ b/indexer/postgres/enum.go @@ -10,9 +10,9 @@ import ( "cosmossdk.io/schema" ) -// CreateEnumType creates an enum type in the database. -func (m *ModuleIndexer) CreateEnumType(ctx context.Context, conn DBConn, enum schema.EnumType) error { - typeName := enumTypeName(m.moduleName, enum) +// createEnumType creates an enum type in the database. +func (m *moduleIndexer) createEnumType(ctx context.Context, conn dbConn, enum schema.EnumType) error { + typeName := enumTypeName(m.moduleName, enum.Name) row := conn.QueryRowContext(ctx, "SELECT 1 FROM pg_type WHERE typname = $1", typeName) var res interface{} if err := row.Scan(&res); err != nil { @@ -25,22 +25,22 @@ func (m *ModuleIndexer) CreateEnumType(ctx context.Context, conn DBConn, enum sc } buf := new(strings.Builder) - err := CreateEnumTypeSql(buf, m.moduleName, enum) + err := createEnumTypeSql(buf, m.moduleName, enum) if err != nil { return err } sqlStr := buf.String() - if m.options.Logger != nil { - m.options.Logger("Creating enum type", sqlStr) + if m.options.logger != nil { + m.options.logger.Debug("Creating enum type", "sql", sqlStr) } _, err = conn.ExecContext(ctx, sqlStr) return err } -// CreateEnumTypeSql generates a CREATE TYPE statement for the enum definition. -func CreateEnumTypeSql(writer io.Writer, moduleName string, enum schema.EnumType) error { - _, err := fmt.Fprintf(writer, "CREATE TYPE %q AS ENUM (", enumTypeName(moduleName, enum)) +// createEnumTypeSql generates a CREATE TYPE statement for the enum definition. +func createEnumTypeSql(writer io.Writer, moduleName string, enum schema.EnumType) error { + _, err := fmt.Fprintf(writer, "CREATE TYPE %q AS ENUM (", enumTypeName(moduleName, enum.Name)) if err != nil { return err } @@ -52,7 +52,7 @@ func CreateEnumTypeSql(writer io.Writer, moduleName string, enum schema.EnumType return err } } - _, err = fmt.Fprintf(writer, "'%s'", value) + _, err = fmt.Fprintf(writer, "'%s'", value.Name) if err != nil { return err } @@ -63,6 +63,6 @@ func CreateEnumTypeSql(writer io.Writer, moduleName string, enum schema.EnumType } // enumTypeName returns the name of the enum type scoped to the module. -func enumTypeName(moduleName string, enum schema.EnumType) string { - return fmt.Sprintf("%s_%s", moduleName, enum.Name) +func enumTypeName(moduleName, enumName string) string { + return fmt.Sprintf("%s_%s", moduleName, enumName) } diff --git a/indexer/postgres/enum_test.go b/indexer/postgres/enum_test.go index 22d8870171c3..c65475d0dd39 100644 --- a/indexer/postgres/enum_test.go +++ b/indexer/postgres/enum_test.go @@ -6,8 +6,8 @@ import ( "cosmossdk.io/indexer/postgres/internal/testdata" ) -func ExampleCreateEnumTypeSql() { - err := CreateEnumTypeSql(os.Stdout, "test", testdata.MyEnum) +func Example_createEnumTypeSql() { + err := createEnumTypeSql(os.Stdout, "test", testdata.MyEnum) if err != nil { panic(err) } diff --git a/indexer/postgres/indexer.go b/indexer/postgres/indexer.go index a69eefff1cd0..2c37e9a79b11 100644 --- a/indexer/postgres/indexer.go +++ b/indexer/postgres/indexer.go @@ -3,10 +3,11 @@ package postgres import ( "context" "database/sql" + "encoding/json" "errors" - "fmt" - "cosmossdk.io/schema/appdata" + "cosmossdk.io/schema/indexer" + "cosmossdk.io/schema/logutil" ) type Config struct { @@ -22,9 +23,28 @@ type Config struct { type SqlLogger = func(msg, sql string, params ...interface{}) -func StartIndexer(ctx context.Context, logger SqlLogger, config Config) (appdata.Listener, error) { +type indexerImpl struct { + ctx context.Context + db *sql.DB + tx *sql.Tx + opts options + modules map[string]*moduleIndexer + logger logutil.Logger +} + +func StartIndexer(params indexer.InitParams) (indexer.InitResult, error) { + config, err := decodeConfig(params.Config.Config) + if err != nil { + return indexer.InitResult{}, err + } + + ctx := params.Context + if ctx == nil { + ctx = context.Background() + } + if config.DatabaseURL == "" { - return appdata.Listener{}, errors.New("missing database URL") + return indexer.InitResult{}, errors.New("missing database URL") } driver := config.DatabaseDriver @@ -34,48 +54,51 @@ func StartIndexer(ctx context.Context, logger SqlLogger, config Config) (appdata db, err := sql.Open(driver, config.DatabaseURL) if err != nil { - return appdata.Listener{}, err + return indexer.InitResult{}, err } tx, err := db.BeginTx(ctx, nil) if err != nil { - return appdata.Listener{}, err + return indexer.InitResult{}, err } // commit base schema - _, err = tx.Exec(BaseSQL) + _, err = tx.Exec(baseSQL) if err != nil { - return appdata.Listener{}, err + return indexer.InitResult{}, err + } + + moduleIndexers := map[string]*moduleIndexer{} + opts := options{ + disableRetainDeletions: config.DisableRetainDeletions, + logger: params.Logger, } - moduleIndexers := map[string]*ModuleIndexer{} - opts := Options{ - DisableRetainDeletions: config.DisableRetainDeletions, - Logger: logger, + idx := &indexerImpl{ + ctx: ctx, + db: db, + tx: tx, + opts: opts, + modules: moduleIndexers, + logger: params.Logger, } - return appdata.Listener{ - InitializeModuleData: func(data appdata.ModuleInitializationData) error { - moduleName := data.ModuleName - modSchema := data.Schema - _, ok := moduleIndexers[moduleName] - if ok { - return fmt.Errorf("module %s already initialized", moduleName) - } - - mm := NewModuleIndexer(moduleName, modSchema, opts) - moduleIndexers[moduleName] = mm - - return mm.InitializeSchema(ctx, tx) - }, - Commit: func(data appdata.CommitData) error { - err = tx.Commit() - if err != nil { - return err - } - - tx, err = db.BeginTx(ctx, nil) - return err - }, + return indexer.InitResult{ + Listener: idx.listener(), }, nil } + +func decodeConfig(rawConfig map[string]interface{}) (*Config, error) { + bz, err := json.Marshal(rawConfig) + if err != nil { + return nil, err + } + + var config Config + err = json.Unmarshal(bz, &config) + if err != nil { + return nil, err + } + + return &config, nil +} diff --git a/indexer/postgres/internal/testdata/example_schema.go b/indexer/postgres/internal/testdata/example_schema.go index ff2d4f2ed1b4..a40d794034b7 100644 --- a/indexer/postgres/internal/testdata/example_schema.go +++ b/indexer/postgres/internal/testdata/example_schema.go @@ -29,26 +29,20 @@ func init() { switch i { case schema.EnumKind: - field.EnumType = MyEnum + field.ReferencedType = MyEnum.Name default: } AllKindsObject.ValueFields = append(AllKindsObject.ValueFields, field) } - ExampleSchema = mustModuleSchema([]schema.ObjectType{ + ExampleSchema = schema.MustCompileModuleSchema( AllKindsObject, SingletonObject, VoteObject, - }) -} - -func mustModuleSchema(objectTypes []schema.ObjectType) schema.ModuleSchema { - s, err := schema.NewModuleSchema(objectTypes) - if err != nil { - panic(err) - } - return s + MyEnum, + VoteType, + ) } var SingletonObject = schema.ObjectType{ @@ -64,9 +58,9 @@ var SingletonObject = schema.ObjectType{ Nullable: true, }, { - Name: "an_enum", - Kind: schema.EnumKind, - EnumType: MyEnum, + Name: "an_enum", + Kind: schema.EnumKind, + ReferencedType: MyEnum.Name, }, }, } @@ -85,18 +79,28 @@ var VoteObject = schema.ObjectType{ }, ValueFields: []schema.Field{ { - Name: "vote", - Kind: schema.EnumKind, - EnumType: schema.EnumType{ - Name: "vote_type", - Values: []string{"yes", "no", "abstain"}, - }, + Name: "vote", + Kind: schema.EnumKind, + ReferencedType: VoteType.Name, }, }, RetainDeletions: true, } +var VoteType = schema.EnumType{ + Name: "vote_type", + Values: []schema.EnumValueDefinition{ + {Name: "yes", Value: 1}, + {Name: "no", Value: 2}, + {Name: "abstain", Value: 3}, + }, +} + var MyEnum = schema.EnumType{ - Name: "my_enum", - Values: []string{"a", "b", "c"}, + Name: "my_enum", + Values: []schema.EnumValueDefinition{ + {Name: "a", Value: 1}, + {Name: "b", Value: 2}, + {Name: "c", Value: 3}, + }, } diff --git a/indexer/postgres/listener.go b/indexer/postgres/listener.go new file mode 100644 index 000000000000..1f46c1c7c55c --- /dev/null +++ b/indexer/postgres/listener.go @@ -0,0 +1,38 @@ +package postgres + +import ( + "fmt" + + "cosmossdk.io/schema/appdata" +) + +func (i *indexerImpl) listener() appdata.Listener { + return appdata.Listener{ + InitializeModuleData: func(data appdata.ModuleInitializationData) error { + moduleName := data.ModuleName + modSchema := data.Schema + _, ok := i.modules[moduleName] + if ok { + return fmt.Errorf("module %s already initialized", moduleName) + } + + mm := newModuleIndexer(moduleName, modSchema, i.opts) + i.modules[moduleName] = mm + + return mm.initializeSchema(i.ctx, i.tx) + }, + StartBlock: func(data appdata.StartBlockData) error { + _, err := i.tx.Exec("INSERT INTO block (number) VALUES ($1)", data.Height) + return err + }, + Commit: func(data appdata.CommitData) (func() error, error) { + err := i.tx.Commit() + if err != nil { + return nil, err + } + + i.tx, err = i.db.BeginTx(i.ctx, nil) + return nil, err + }, + } +} diff --git a/indexer/postgres/module.go b/indexer/postgres/module.go index 0d6a28e2ef72..ffba1a4b2da9 100644 --- a/indexer/postgres/module.go +++ b/indexer/postgres/module.go @@ -7,32 +7,32 @@ import ( "cosmossdk.io/schema" ) -// ModuleIndexer manages the tables for a module. -type ModuleIndexer struct { +// moduleIndexer manages the tables for a module. +type moduleIndexer struct { moduleName string schema schema.ModuleSchema - tables map[string]*ObjectIndexer + tables map[string]*objectIndexer definedEnums map[string]schema.EnumType - options Options + options options } -// NewModuleIndexer creates a new ModuleIndexer for the given module schema. -func NewModuleIndexer(moduleName string, modSchema schema.ModuleSchema, options Options) *ModuleIndexer { - return &ModuleIndexer{ +// newModuleIndexer creates a new moduleIndexer for the given module schema. +func newModuleIndexer(moduleName string, modSchema schema.ModuleSchema, options options) *moduleIndexer { + return &moduleIndexer{ moduleName: moduleName, schema: modSchema, - tables: map[string]*ObjectIndexer{}, + tables: map[string]*objectIndexer{}, definedEnums: map[string]schema.EnumType{}, options: options, } } -// InitializeSchema creates tables for all object types in the module schema and creates enum types. -func (m *ModuleIndexer) InitializeSchema(ctx context.Context, conn DBConn) error { +// initializeSchema creates tables for all object types in the module schema and creates enum types. +func (m *moduleIndexer) initializeSchema(ctx context.Context, conn dbConn) error { // create enum types var err error m.schema.EnumTypes(func(enumType schema.EnumType) bool { - err = m.CreateEnumType(ctx, conn, enumType) + err = m.createEnumType(ctx, conn, enumType) return err == nil }) if err != nil { @@ -41,9 +41,9 @@ func (m *ModuleIndexer) InitializeSchema(ctx context.Context, conn DBConn) error // create tables for all object types m.schema.ObjectTypes(func(typ schema.ObjectType) bool { - tm := NewObjectIndexer(m.moduleName, typ, m.options) + tm := newObjectIndexer(m.moduleName, typ, m.options) m.tables[typ.Name] = tm - err = tm.CreateTable(ctx, conn) + err = tm.createTable(ctx, conn) if err != nil { err = fmt.Errorf("failed to create table for %s in module %s: %v", typ.Name, m.moduleName, err) //nolint:errorlint // using %v for go 1.12 compat } @@ -52,8 +52,3 @@ func (m *ModuleIndexer) InitializeSchema(ctx context.Context, conn DBConn) error return err } - -// ObjectIndexers returns the object indexers for the module. -func (m *ModuleIndexer) ObjectIndexers() map[string]*ObjectIndexer { - return m.tables -} diff --git a/indexer/postgres/object.go b/indexer/postgres/object.go index 78bbfdf636b1..ce98790a73bb 100644 --- a/indexer/postgres/object.go +++ b/indexer/postgres/object.go @@ -6,17 +6,17 @@ import ( "cosmossdk.io/schema" ) -// ObjectIndexer is a helper struct that generates SQL for a given object type. -type ObjectIndexer struct { +// objectIndexer is a helper struct that generates SQL for a given object type. +type objectIndexer struct { moduleName string typ schema.ObjectType valueFields map[string]schema.Field allFields map[string]schema.Field - options Options + options options } -// NewObjectIndexer creates a new ObjectIndexer for the given object type. -func NewObjectIndexer(moduleName string, typ schema.ObjectType, options Options) *ObjectIndexer { +// newObjectIndexer creates a new objectIndexer for the given object type. +func newObjectIndexer(moduleName string, typ schema.ObjectType, options options) *objectIndexer { allFields := make(map[string]schema.Field) valueFields := make(map[string]schema.Field) @@ -29,7 +29,7 @@ func NewObjectIndexer(moduleName string, typ schema.ObjectType, options Options) allFields[field.Name] = field } - return &ObjectIndexer{ + return &objectIndexer{ moduleName: moduleName, typ: typ, allFields: allFields, @@ -38,7 +38,7 @@ func NewObjectIndexer(moduleName string, typ schema.ObjectType, options Options) } } -// TableName returns the name of the table for the object type scoped to its module. -func (tm *ObjectIndexer) TableName() string { +// tableName returns the name of the table for the object type scoped to its module. +func (tm *objectIndexer) tableName() string { return fmt.Sprintf("%s_%s", tm.moduleName, tm.typ.Name) } diff --git a/indexer/postgres/options.go b/indexer/postgres/options.go index be93d43b6c76..d18a4c4d7f2c 100644 --- a/indexer/postgres/options.go +++ b/indexer/postgres/options.go @@ -1,10 +1,12 @@ package postgres -// Options are the options for module and object indexers. -type Options struct { - // DisableRetainDeletions disables retain deletions functionality even on object types that have it set. - DisableRetainDeletions bool +import "cosmossdk.io/schema/logutil" - // Logger is the logger for the indexer to use. - Logger SqlLogger +// options are the options for module and object indexers. +type options struct { + // disableRetainDeletions disables retain deletions functionality even on object types that have it set. + disableRetainDeletions bool + + // logger is the logger for the indexer to use. It may be nil. + logger logutil.Logger } diff --git a/indexer/postgres/tests/config.go b/indexer/postgres/tests/config.go new file mode 100644 index 000000000000..78e41f6059b5 --- /dev/null +++ b/indexer/postgres/tests/config.go @@ -0,0 +1,26 @@ +package tests + +import ( + "encoding/json" + + "cosmossdk.io/indexer/postgres" + "cosmossdk.io/schema/indexer" +) + +func postgresConfigToIndexerConfig(cfg postgres.Config) (indexer.Config, error) { + cfgBz, err := json.Marshal(cfg) + if err != nil { + return indexer.Config{}, err + } + + var cfgMap map[string]interface{} + err = json.Unmarshal(cfgBz, &cfgMap) + if err != nil { + return indexer.Config{}, err + } + + return indexer.Config{ + Type: "postgres", + Config: cfgMap, + }, nil +} diff --git a/indexer/postgres/tests/go.mod b/indexer/postgres/tests/go.mod index 58d26c50693c..a72a1dc7fc07 100644 --- a/indexer/postgres/tests/go.mod +++ b/indexer/postgres/tests/go.mod @@ -1,9 +1,11 @@ module cosmossdk.io/indexer/postgres/testing +go 1.23 + require ( cosmossdk.io/indexer/postgres v0.0.0-00010101000000-000000000000 cosmossdk.io/schema v0.1.1 - github.com/fergusstrange/embedded-postgres v1.28.0 + github.com/fergusstrange/embedded-postgres v1.29.0 github.com/hashicorp/consul/sdk v0.16.1 github.com/jackc/pgx/v5 v5.6.0 github.com/stretchr/testify v1.9.0 @@ -31,5 +33,3 @@ require ( replace cosmossdk.io/indexer/postgres => ../. replace cosmossdk.io/schema => ../../../schema - -go 1.22 diff --git a/indexer/postgres/tests/go.sum b/indexer/postgres/tests/go.sum index b9ddc2522327..809d5040b848 100644 --- a/indexer/postgres/tests/go.sum +++ b/indexer/postgres/tests/go.sum @@ -2,8 +2,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fergusstrange/embedded-postgres v1.28.0 h1:Atixd24HCuBHBavnG4eiZAjRizOViwUahKGSjJdz1SU= -github.com/fergusstrange/embedded-postgres v1.28.0/go.mod h1:t/MLs0h9ukYM6FSt99R7InCHs1nW0ordoVCcnzmpTYw= +github.com/fergusstrange/embedded-postgres v1.29.0 h1:Uv8hdhoiaNMuH0w8UuGXDHr60VoAQPFdgx7Qf3bzXJM= +github.com/fergusstrange/embedded-postgres v1.29.0/go.mod h1:t/MLs0h9ukYM6FSt99R7InCHs1nW0ordoVCcnzmpTYw= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/hashicorp/consul/sdk v0.16.1 h1:V8TxTnImoPD5cj0U9Spl0TUxcytjcbbJeADFF07KdHg= diff --git a/indexer/postgres/tests/init_schema_test.go b/indexer/postgres/tests/init_schema_test.go index 8c4288ba344f..4257f37d5ab7 100644 --- a/indexer/postgres/tests/init_schema_test.go +++ b/indexer/postgres/tests/init_schema_test.go @@ -2,7 +2,6 @@ package tests import ( "context" - "fmt" "os" "strings" "testing" @@ -16,6 +15,7 @@ import ( "cosmossdk.io/indexer/postgres" "cosmossdk.io/indexer/postgres/internal/testdata" "cosmossdk.io/schema/appdata" + "cosmossdk.io/schema/indexer" ) func TestInitSchema(t *testing.T) { @@ -33,24 +33,21 @@ func testInitSchema(t *testing.T, disableRetainDeletions bool, goldenFileName st connectionUrl := createTestDB(t) buf := &strings.Builder{} - logger := func(msg, sql string, params ...interface{}) { - _, err := fmt.Fprintln(buf, msg) - require.NoError(t, err) - _, err = fmt.Fprintln(buf, sql) - require.NoError(t, err) - if len(params) != 0 { - _, err = fmt.Fprintln(buf, "Params:", params) - require.NoError(t, err) - } - _, err = fmt.Fprintln(buf) - require.NoError(t, err) - } - listener, err := postgres.StartIndexer(context.Background(), logger, postgres.Config{ + + cfg, err := postgresConfigToIndexerConfig(postgres.Config{ DatabaseURL: connectionUrl, DisableRetainDeletions: disableRetainDeletions, }) require.NoError(t, err) + res, err := postgres.StartIndexer(indexer.InitParams{ + Config: cfg, + Context: context.Background(), + Logger: &prettyLogger{buf}, + }) + require.NoError(t, err) + listener := res.Listener + require.NotNil(t, listener.InitializeModuleData) require.NoError(t, listener.InitializeModuleData(appdata.ModuleInitializationData{ ModuleName: "test", @@ -58,7 +55,11 @@ func testInitSchema(t *testing.T, disableRetainDeletions bool, goldenFileName st })) require.NotNil(t, listener.Commit) - require.NoError(t, listener.Commit(appdata.CommitData{})) + cb, err := listener.Commit(appdata.CommitData{}) + require.NoError(t, err) + if cb != nil { + require.NoError(t, cb()) + } golden.Assert(t, buf.String(), goldenFileName) } diff --git a/indexer/postgres/tests/log.go b/indexer/postgres/tests/log.go new file mode 100644 index 000000000000..533a401305cc --- /dev/null +++ b/indexer/postgres/tests/log.go @@ -0,0 +1,44 @@ +package tests + +import ( + "fmt" + "io" + + "cosmossdk.io/schema/logutil" +) + +type prettyLogger struct { + out io.Writer +} + +func (l prettyLogger) Info(msg string, keyVals ...interface{}) { + l.write("INFO", msg, keyVals...) +} + +func (l prettyLogger) Warn(msg string, keyVals ...interface{}) { + l.write("WARN", msg, keyVals...) +} + +func (l prettyLogger) Error(msg string, keyVals ...interface{}) { + l.write("ERROR", msg, keyVals...) +} + +func (l prettyLogger) Debug(msg string, keyVals ...interface{}) { + l.write("DEBUG", msg, keyVals...) +} + +func (l prettyLogger) write(level, msg string, keyVals ...interface{}) { + _, err := fmt.Fprintf(l.out, "%s: %s\n", level, msg) + if err != nil { + panic(err) + } + + for i := 0; i < len(keyVals); i += 2 { + _, err = fmt.Fprintf(l.out, " %s: %v\n", keyVals[i], keyVals[i+1]) + if err != nil { + panic(err) + } + } +} + +var _ logutil.Logger = &prettyLogger{} diff --git a/indexer/postgres/tests/testdata/init_schema.txt b/indexer/postgres/tests/testdata/init_schema.txt index ce807a8f7d17..4d18d2fb23b1 100644 --- a/indexer/postgres/tests/testdata/init_schema.txt +++ b/indexer/postgres/tests/testdata/init_schema.txt @@ -1,11 +1,10 @@ -Creating enum type -CREATE TYPE "test_my_enum" AS ENUM ('a', 'b', 'c'); - -Creating enum type -CREATE TYPE "test_vote_type" AS ENUM ('yes', 'no', 'abstain'); - -Creating table test_all_kinds -CREATE TABLE IF NOT EXISTS "test_all_kinds" ( +DEBUG: Creating enum type + sql: CREATE TYPE "test_my_enum" AS ENUM ('a', 'b', 'c'); +DEBUG: Creating enum type + sql: CREATE TYPE "test_vote_type" AS ENUM ('yes', 'no', 'abstain'); +DEBUG: Creating table %s + table: test_all_kinds + sql: CREATE TABLE IF NOT EXISTS "test_all_kinds" ( "id" BIGINT NOT NULL, "ts" TIMESTAMPTZ GENERATED ALWAYS AS (nanos_to_timestamptz("ts_nanos")) STORED, "ts_nanos" BIGINT NOT NULL, @@ -33,9 +32,9 @@ CREATE TABLE IF NOT EXISTS "test_all_kinds" ( PRIMARY KEY ("id", "ts_nanos") ); GRANT SELECT ON TABLE "test_all_kinds" TO PUBLIC; - -Creating table test_singleton -CREATE TABLE IF NOT EXISTS "test_singleton" ( +DEBUG: Creating table %s + table: test_singleton + sql: CREATE TABLE IF NOT EXISTS "test_singleton" ( _id INTEGER NOT NULL CHECK (_id = 1), "foo" TEXT NOT NULL, "bar" INTEGER NULL, @@ -43,9 +42,9 @@ CREATE TABLE IF NOT EXISTS "test_singleton" ( PRIMARY KEY (_id) ); GRANT SELECT ON TABLE "test_singleton" TO PUBLIC; - -Creating table test_vote -CREATE TABLE IF NOT EXISTS "test_vote" ( +DEBUG: Creating table %s + table: test_vote + sql: CREATE TABLE IF NOT EXISTS "test_vote" ( "proposal" BIGINT NOT NULL, "address" TEXT NOT NULL, "vote" "test_vote_type" NOT NULL, @@ -53,4 +52,3 @@ CREATE TABLE IF NOT EXISTS "test_vote" ( PRIMARY KEY ("proposal", "address") ); GRANT SELECT ON TABLE "test_vote" TO PUBLIC; - diff --git a/indexer/postgres/tests/testdata/init_schema_no_retain_delete.txt b/indexer/postgres/tests/testdata/init_schema_no_retain_delete.txt index 0dbfbddb4e0e..0ec17ae1ea1d 100644 --- a/indexer/postgres/tests/testdata/init_schema_no_retain_delete.txt +++ b/indexer/postgres/tests/testdata/init_schema_no_retain_delete.txt @@ -1,11 +1,10 @@ -Creating enum type -CREATE TYPE "test_my_enum" AS ENUM ('a', 'b', 'c'); - -Creating enum type -CREATE TYPE "test_vote_type" AS ENUM ('yes', 'no', 'abstain'); - -Creating table test_all_kinds -CREATE TABLE IF NOT EXISTS "test_all_kinds" ( +DEBUG: Creating enum type + sql: CREATE TYPE "test_my_enum" AS ENUM ('a', 'b', 'c'); +DEBUG: Creating enum type + sql: CREATE TYPE "test_vote_type" AS ENUM ('yes', 'no', 'abstain'); +DEBUG: Creating table %s + table: test_all_kinds + sql: CREATE TABLE IF NOT EXISTS "test_all_kinds" ( "id" BIGINT NOT NULL, "ts" TIMESTAMPTZ GENERATED ALWAYS AS (nanos_to_timestamptz("ts_nanos")) STORED, "ts_nanos" BIGINT NOT NULL, @@ -33,9 +32,9 @@ CREATE TABLE IF NOT EXISTS "test_all_kinds" ( PRIMARY KEY ("id", "ts_nanos") ); GRANT SELECT ON TABLE "test_all_kinds" TO PUBLIC; - -Creating table test_singleton -CREATE TABLE IF NOT EXISTS "test_singleton" ( +DEBUG: Creating table %s + table: test_singleton + sql: CREATE TABLE IF NOT EXISTS "test_singleton" ( _id INTEGER NOT NULL CHECK (_id = 1), "foo" TEXT NOT NULL, "bar" INTEGER NULL, @@ -43,13 +42,12 @@ CREATE TABLE IF NOT EXISTS "test_singleton" ( PRIMARY KEY (_id) ); GRANT SELECT ON TABLE "test_singleton" TO PUBLIC; - -Creating table test_vote -CREATE TABLE IF NOT EXISTS "test_vote" ( +DEBUG: Creating table %s + table: test_vote + sql: CREATE TABLE IF NOT EXISTS "test_vote" ( "proposal" BIGINT NOT NULL, "address" TEXT NOT NULL, "vote" "test_vote_type" NOT NULL, PRIMARY KEY ("proposal", "address") ); GRANT SELECT ON TABLE "test_vote" TO PUBLIC; - diff --git a/log/CHANGELOG.md b/log/CHANGELOG.md index 2b8c5ba0da53..c9f2475683e9 100644 --- a/log/CHANGELOG.md +++ b/log/CHANGELOG.md @@ -22,6 +22,10 @@ Each entry must include the Github issue reference in the following format: ## [Unreleased] +## [v1.4.1](https://github.com/cosmos/cosmos-sdk/releases/tag/log/v1.4.1) - 2024-08-16 + +* [#21326](https://github.com/cosmos/cosmos-sdk/pull/21326) Avoid context key collision. + ## [v1.4.0](https://github.com/cosmos/cosmos-sdk/releases/tag/log/v1.4.0) - 2024-08-07 * [#21045](https://github.com/cosmos/cosmos-sdk/pull/21045) Add `WithContext` method implementations to make all returned loggers compatible with `cosmossdk.io/core/log.Logger` (v1) without a direct dependency. diff --git a/log/logger.go b/log/logger.go index 38802ed88e73..8a27538e80ff 100644 --- a/log/logger.go +++ b/log/logger.go @@ -30,7 +30,9 @@ func init() { const ModuleKey = "module" // ContextKey is used to store the logger in the context. -var ContextKey struct{} +var ContextKey contextKey + +type contextKey struct{} // Logger is the Cosmos SDK logger interface. // It extends cosmossdk.io/core/log.Logger to return a child logger. diff --git a/orm/go.mod b/orm/go.mod index 39aab59013f9..902570c289c4 100644 --- a/orm/go.mod +++ b/orm/go.mod @@ -1,13 +1,13 @@ module cosmossdk.io/orm -go 1.21 +go 1.23 require ( cosmossdk.io/api v0.7.5 cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 cosmossdk.io/depinject v1.0.0 cosmossdk.io/errors v1.0.1 - github.com/cosmos/cosmos-db v1.0.2 + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/golang/mock v1.6.0 github.com/google/go-cmp v0.6.0 @@ -15,7 +15,7 @@ require ( github.com/regen-network/gocuke v1.1.1 github.com/stretchr/testify v1.9.0 golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 - google.golang.org/grpc v1.65.0 + google.golang.org/grpc v1.66.0 google.golang.org/protobuf v1.34.2 gotest.tools/v3 v3.5.1 pgregory.net/rapid v1.1.0 @@ -43,7 +43,7 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect - github.com/klauspost/compress v1.17.7 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/linxGnu/grocksdb v1.8.14 // indirect @@ -51,9 +51,9 @@ require ( github.com/onsi/gomega v1.20.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/spf13/cast v1.7.0 // indirect @@ -62,8 +62,8 @@ require ( golang.org/x/net v0.28.0 // indirect golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect gopkg.in/yaml.v3 v3.0.1 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/orm/go.sum b/orm/go.sum index ce43943b9feb..3c547135feaf 100644 --- a/orm/go.sum +++ b/orm/go.sum @@ -29,8 +29,8 @@ github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwP github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= @@ -74,8 +74,8 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= @@ -97,8 +97,8 @@ github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47 github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= -github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -131,12 +131,12 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/regen-network/gocuke v1.1.1 h1:13D3n5xLbpzA/J2ELHC9jXYq0+XyEr64A3ehjvfmBbE= @@ -228,12 +228,12 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/orm/internal/testkv/db.go b/orm/internal/testkv/db.go index e9800d1f7123..1f7a35111152 100644 --- a/orm/internal/testkv/db.go +++ b/orm/internal/testkv/db.go @@ -1,13 +1,11 @@ package testkv import ( - dbm "github.com/cosmos/cosmos-db" - "cosmossdk.io/core/store" ) type TestStore struct { - Db dbm.DB + Db store.KVStoreWithBatch } func (ts TestStore) Get(bz []byte) ([]byte, error) { @@ -23,22 +21,12 @@ func (ts TestStore) Set(k, v []byte) error { return ts.Db.Set(k, v) } -// SetSync sets the value for the given key, and flushes it to storage before returning. -func (ts TestStore) SetSync(k, v []byte) error { - return ts.Db.SetSync(k, v) -} - // Delete deletes the key, or does nothing if the key does not exist. // CONTRACT: key readonly []byte func (ts TestStore) Delete(bz []byte) error { return ts.Db.Delete(bz) } -// DeleteSync deletes the key, and flushes the delete to storage before returning. -func (ts TestStore) DeleteSync(bz []byte) error { - return ts.Db.DeleteSync(bz) -} - func (ts TestStore) Iterator(start, end []byte) (store.Iterator, error) { itr, err := ts.Db.Iterator(start, end) return IteratorWrapper{itr: itr}, err @@ -55,30 +43,20 @@ func (ts TestStore) Close() error { } // NewBatch creates a batch for atomic updates. The caller must call Batch.Close. -func (ts TestStore) NewBatch() dbm.Batch { +func (ts TestStore) NewBatch() store.Batch { return ts.Db.NewBatch() } // NewBatchWithSize create a new batch for atomic updates, but with pre-allocated size. // This will does the same thing as NewBatch if the batch implementation doesn't support pre-allocation. -func (ts TestStore) NewBatchWithSize(i int) dbm.Batch { +func (ts TestStore) NewBatchWithSize(i int) store.Batch { return ts.Db.NewBatchWithSize(i) } -// Print is used for debugging. -func (ts TestStore) Print() error { - return ts.Db.Print() -} - -// Stats returns a map of property values for all keys and the size of the cache. -func (ts TestStore) Stats() map[string]string { - return ts.Db.Stats() -} - var _ store.Iterator = IteratorWrapper{} type IteratorWrapper struct { - itr dbm.Iterator + itr store.Iterator } // Domain returns the start (inclusive) and end (exclusive) limits of the iterator. diff --git a/orm/model/ormdb/module_test.go b/orm/model/ormdb/module_test.go index 4127a0b88bfe..8a80bbf8d6c7 100644 --- a/orm/model/ormdb/module_test.go +++ b/orm/model/ormdb/module_test.go @@ -18,6 +18,7 @@ import ( ormv1alpha1 "cosmossdk.io/api/cosmos/orm/v1alpha1" "cosmossdk.io/core/genesis" "cosmossdk.io/core/store" + corestore "cosmossdk.io/core/store" "cosmossdk.io/depinject" "cosmossdk.io/depinject/appconfig" _ "cosmossdk.io/orm" // required for ORM module registration @@ -357,7 +358,7 @@ func TestHooks(t *testing.T) { } type testStoreService struct { - db dbm.DB + db corestore.KVStoreWithBatch } func (t testStoreService) OpenKVStore(context.Context) store.KVStore { diff --git a/proto/cosmos/base/abci/v1beta1/abci.proto b/proto/cosmos/base/abci/v1beta1/abci.proto index 5a8fe6227169..63a09e73091e 100644 --- a/proto/cosmos/base/abci/v1beta1/abci.proto +++ b/proto/cosmos/base/abci/v1beta1/abci.proto @@ -45,8 +45,6 @@ message TxResponse { // these events include those emitted by processing all the messages and those // emitted from the ante. Whereas Logs contains the events, with // additional metadata, emitted only by processing the messages. - // - // Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 repeated cometbft.abci.v1.Event events = 13 [(gogoproto.nullable) = false, (cosmos_proto.field_added_in) = "cosmos-sdk 0.45"]; } diff --git a/proto/cosmos/tx/config/v1/config.proto b/proto/cosmos/tx/config/v1/config.proto index ec3b3b1b2444..65c6b6bbac8d 100644 --- a/proto/cosmos/tx/config/v1/config.proto +++ b/proto/cosmos/tx/config/v1/config.proto @@ -7,7 +7,7 @@ import "cosmos/app/v1alpha1/module.proto"; // Config is the config object of the x/auth/tx package. message Config { option (cosmos.app.v1alpha1.module) = { - go_import: "cosmossdk.io/x/auth/tx" + go_import: "github.com/cosmos/cosmos-sdk/x/auth/tx" }; // skip_ante_handler defines whether the ante handler registration should be skipped in case an app wants to override diff --git a/runtime/app.go b/runtime/app.go index 2481da380995..c5533d79ce1b 100644 --- a/runtime/app.go +++ b/runtime/app.go @@ -13,7 +13,6 @@ import ( "cosmossdk.io/core/legacy" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" - authtx "cosmossdk.io/x/auth/tx" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" @@ -27,6 +26,8 @@ import ( servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/x/auth/ante/unorderedtx" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" ) // App is a wrapper around BaseApp and ModuleManager that can be used in hybrid @@ -41,7 +42,9 @@ import ( type App struct { *baseapp.BaseApp - ModuleManager *module.Manager + ModuleManager *module.Manager + UnorderedTxManager *unorderedtx.Manager + configurator module.Configurator // nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1. config *runtimev1alpha1.Module storeKeys []storetypes.StoreKey @@ -154,6 +157,20 @@ func (a *App) Load(loadLatest bool) error { return nil } +// Close closes all necessary application resources. +// It implements servertypes.Application. +func (a *App) Close() error { + // the unordered tx manager could be nil (unlikely but possible) + // if the app has no app options supplied. + if a.UnorderedTxManager != nil { + if err := a.UnorderedTxManager.Close(); err != nil { + return err + } + } + + return a.BaseApp.Close() +} + // PreBlocker application updates every pre block func (a *App) PreBlocker(ctx sdk.Context, _ *abci.FinalizeBlockRequest) error { return a.ModuleManager.PreBlock(ctx) @@ -171,16 +188,14 @@ func (a *App) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) { // Precommiter application updates every commit func (a *App) Precommiter(ctx sdk.Context) { - err := a.ModuleManager.Precommit(ctx) - if err != nil { + if err := a.ModuleManager.Precommit(ctx); err != nil { panic(err) } } // PrepareCheckStater application updates every commit func (a *App) PrepareCheckStater(ctx sdk.Context) { - err := a.ModuleManager.PrepareCheckState(ctx) - if err != nil { + if err := a.ModuleManager.PrepareCheckState(ctx); err != nil { panic(err) } } @@ -247,11 +262,6 @@ func (a *App) DefaultGenesis() map[string]json.RawMessage { return a.ModuleManager.DefaultGenesis() } -// GetStoreKeys returns all the stored store keys. -func (a *App) GetStoreKeys() []storetypes.StoreKey { - return a.storeKeys -} - // SetInitChainer sets the init chainer function // It wraps `BaseApp.SetInitChainer` to allow setting a custom init chainer from an app. func (a *App) SetInitChainer(initChainer sdk.InitChainer) { @@ -259,6 +269,23 @@ func (a *App) SetInitChainer(initChainer sdk.InitChainer) { a.BaseApp.SetInitChainer(initChainer) } +// GetStoreKeys returns all the stored store keys. +func (a *App) GetStoreKeys() []storetypes.StoreKey { + return a.storeKeys +} + +// GetKey returns the KVStoreKey for the provided store key. +// +// NOTE: This should only be used in testing. +func (a *App) GetKey(storeKey string) *storetypes.KVStoreKey { + sk := a.UnsafeFindStoreKey(storeKey) + kvStoreKey, ok := sk.(*storetypes.KVStoreKey) + if !ok { + return nil + } + return kvStoreKey +} + // UnsafeFindStoreKey fetches a registered StoreKey from the App in linear time. // // NOTE: This should only be used in testing. diff --git a/runtime/builder.go b/runtime/builder.go index c96af6ecd6ee..68b58b66a000 100644 --- a/runtime/builder.go +++ b/runtime/builder.go @@ -2,13 +2,21 @@ package runtime import ( "encoding/json" + "fmt" "io" + "path/filepath" - dbm "github.com/cosmos/cosmos-db" + "github.com/spf13/cast" + + corestore "cosmossdk.io/core/store" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/client/flags" + servertypes "github.com/cosmos/cosmos-sdk/server/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/version" + "github.com/cosmos/cosmos-sdk/x/auth/ante/unorderedtx" ) // AppBuilder is a type that is injected into a container by the runtime module @@ -16,6 +24,8 @@ import ( // the existing app.go initialization conventions. type AppBuilder struct { app *App + + appOptions servertypes.AppOptions } // DefaultGenesis returns a default genesis from the registered modules. @@ -24,7 +34,7 @@ func (a *AppBuilder) DefaultGenesis() map[string]json.RawMessage { } // Build builds an *App instance. -func (a *AppBuilder) Build(db dbm.DB, traceStore io.Writer, baseAppOptions ...func(*baseapp.BaseApp)) *App { +func (a *AppBuilder) Build(db corestore.KVStoreWithBatch, traceStore io.Writer, baseAppOptions ...func(*baseapp.BaseApp)) *App { for _, option := range a.app.baseAppOptions { baseAppOptions = append(baseAppOptions, option) } @@ -40,9 +50,63 @@ func (a *AppBuilder) Build(db dbm.DB, traceStore io.Writer, baseAppOptions ...fu a.app.BaseApp = bApp a.app.configurator = module.NewConfigurator(a.app.cdc, a.app.MsgServiceRouter(), a.app.GRPCQueryRouter()) + if a.appOptions != nil { + // register unordered tx manager + if err := a.registerUnorderedTxManager(); err != nil { + panic(err) + } + + // register indexer if enabled + if err := a.registerIndexer(); err != nil { + panic(err) + } + } + + // register services if err := a.app.ModuleManager.RegisterServices(a.app.configurator); err != nil { panic(err) } return a.app } + +// register unordered tx manager +func (a *AppBuilder) registerUnorderedTxManager() error { + // create, start, and load the unordered tx manager + utxDataDir := filepath.Join(cast.ToString(a.appOptions.Get(flags.FlagHome)), "data") + a.app.UnorderedTxManager = unorderedtx.NewManager(utxDataDir) + a.app.UnorderedTxManager.Start() + + if err := a.app.UnorderedTxManager.OnInit(); err != nil { + return fmt.Errorf("failed to initialize unordered tx manager: %w", err) + } + + return nil +} + +// register indexer +func (a *AppBuilder) registerIndexer() error { + // if we have indexer options in app.toml, then enable the built-in indexer framework + if indexerOpts := a.appOptions.Get("indexer"); indexerOpts != nil { + moduleSet := map[string]any{} + for modName, mod := range a.app.ModuleManager.Modules { + moduleSet[modName] = mod + } + + return a.app.EnableIndexer(indexerOpts, a.kvStoreKeys(), moduleSet) + } + + // register legacy streaming services if we don't have the built-in indexer enabled + return a.app.RegisterStreamingServices(a.appOptions, a.kvStoreKeys()) +} + +func (a *AppBuilder) kvStoreKeys() map[string]*storetypes.KVStoreKey { + keys := make(map[string]*storetypes.KVStoreKey) + for _, k := range a.app.GetStoreKeys() { + if kv, ok := k.(*storetypes.KVStoreKey); ok { + keys[kv.Name()] = kv + } + } + + return keys +} diff --git a/runtime/environment.go b/runtime/environment.go index 3fc3c863958a..cfe70414f169 100644 --- a/runtime/environment.go +++ b/runtime/environment.go @@ -64,7 +64,7 @@ func EnvWithMemStoreService(memStoreService store.MemoryStoreService) EnvOption } // failingMsgRouter is a message router that panics when accessed -// this is to ensure all fields are set by in environment +// this is to ensure all fields are set in environment type failingMsgRouter struct { baseapp.MessageRouter } @@ -86,7 +86,7 @@ func (failingMsgRouter) HybridHandlerByMsgName(msgName string) func(ctx context. } // failingQueryRouter is a query router that panics when accessed -// this is to ensure all fields are set by in environment +// this is to ensure all fields are set in environment type failingQueryRouter struct { baseapp.QueryRouter } @@ -112,7 +112,7 @@ func (failingQueryRouter) SetInterfaceRegistry(interfaceRegistry codectypes.Inte } // failingMemStore is a memstore that panics when accessed -// this is to ensure all fields are set by in environment +// this is to ensure all fields are set in environment type failingMemStore struct { store.MemoryStoreService } diff --git a/runtime/gas.go b/runtime/gas.go index 75d711f9f4da..64d564827bbf 100644 --- a/runtime/gas.go +++ b/runtime/gas.go @@ -36,6 +36,10 @@ func (cgm CoreGasmeter) Consume(amount gas.Gas, descriptor string) error { return nil } +func (cgm CoreGasmeter) Consumed() gas.Gas { + return cgm.gm.GasConsumed() +} + func (cgm CoreGasmeter) Refund(amount gas.Gas, descriptor string) error { cgm.gm.RefundGas(amount, descriptor) return nil @@ -55,14 +59,14 @@ type SDKGasMeter struct { } func (gm SDKGasMeter) GasConsumed() storetypes.Gas { - return gm.gm.Remaining() + return gm.gm.Consumed() } func (gm SDKGasMeter) GasConsumedToLimit() storetypes.Gas { if gm.IsPastLimit() { return gm.gm.Limit() } - return gm.gm.Remaining() + return gm.gm.Consumed() } func (gm SDKGasMeter) GasRemaining() storetypes.Gas { diff --git a/runtime/module.go b/runtime/module.go index 43da40efb237..f8883e0e8e27 100644 --- a/runtime/module.go +++ b/runtime/module.go @@ -12,10 +12,10 @@ import ( runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1" autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" - "cosmossdk.io/core/app" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/comet" "cosmossdk.io/core/legacy" + "cosmossdk.io/core/server" "cosmossdk.io/core/store" "cosmossdk.io/depinject" "cosmossdk.io/depinject/appconfig" @@ -25,6 +25,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" + servertypes "github.com/cosmos/cosmos-sdk/server/types" "github.com/cosmos/cosmos-sdk/std" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/types/msgservice" @@ -120,7 +121,6 @@ func ProvideApp( appmodule.AppModule, protodesc.Resolver, protoregistry.MessageTypeResolver, - error, ) { protoFiles := proto.HybridResolver protoTypes := protoregistry.GlobalTypes @@ -145,9 +145,9 @@ func ProvideApp( msgServiceRouter: msgServiceRouter, grpcQueryRouter: grpcQueryRouter, } - appBuilder := &AppBuilder{app} + appBuilder := &AppBuilder{app: app} - return appBuilder, msgServiceRouter, grpcQueryRouter, appModule{app}, protoFiles, protoTypes, nil + return appBuilder, msgServiceRouter, grpcQueryRouter, appModule{app}, protoFiles, protoTypes } type AppInputs struct { @@ -160,6 +160,7 @@ type AppInputs struct { BaseAppOptions []BaseAppOption InterfaceRegistry codectypes.InterfaceRegistry LegacyAmino legacy.Amino + AppOptions servertypes.AppOptions `optional:"true"` // can be nil in client wiring } func SetupAppBuilder(inputs AppInputs) { @@ -170,6 +171,10 @@ func SetupAppBuilder(inputs AppInputs) { app.ModuleManager = inputs.ModuleManager app.ModuleManager.RegisterInterfaces(inputs.InterfaceRegistry) app.ModuleManager.RegisterLegacyAminoCodec(inputs.LegacyAmino) + + if inputs.AppOptions != nil { + inputs.AppBuilder.appOptions = inputs.AppOptions + } } func registerStoreKey(wrapper *AppBuilder, key storetypes.StoreKey) { @@ -288,7 +293,7 @@ func ProvideTransientStoreService( return transientStoreService{key: storeKey} } -func ProvideAppVersionModifier(app *AppBuilder) app.VersionModifier { +func ProvideAppVersionModifier(app *AppBuilder) server.VersionModifier { return app.app } diff --git a/runtime/router.go b/runtime/router.go index 8c30f2a27929..ff873f271738 100644 --- a/runtime/router.go +++ b/runtime/router.go @@ -15,7 +15,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" ) -// NewMsgRouterService implements router.Service. +// NewMsgRouterService return new implementation of router.Service. func NewMsgRouterService(msgRouter baseapp.MessageRouter) router.Service { return &msgRouterService{ router: msgRouter, @@ -45,21 +45,8 @@ func (m *msgRouterService) CanInvoke(ctx context.Context, typeURL string) error return nil } -// InvokeTyped execute a message and fill-in a response. -// The response must be known and passed as a parameter. -// Use InvokeUntyped if the response type is not known. -func (m *msgRouterService) InvokeTyped(ctx context.Context, msg, resp gogoproto.Message) error { - messageName := msgTypeURL(msg) - handler := m.router.HybridHandlerByMsgName(messageName) - if handler == nil { - return fmt.Errorf("unknown message: %s", messageName) - } - - return handler(ctx, msg, resp) -} - -// InvokeUntyped execute a message and returns a response. -func (m *msgRouterService) InvokeUntyped(ctx context.Context, msg gogoproto.Message) (gogoproto.Message, error) { +// Invoke execute a message and returns a response. +func (m *msgRouterService) Invoke(ctx context.Context, msg gogoproto.Message) (gogoproto.Message, error) { messageName := msgTypeURL(msg) respName := m.router.ResponseNameByMsgName(messageName) if respName == "" { @@ -76,10 +63,19 @@ func (m *msgRouterService) InvokeUntyped(ctx context.Context, msg gogoproto.Mess return nil, fmt.Errorf("could not create response message %s", respName) } - return msgResp, m.InvokeTyped(ctx, msg, msgResp) + handler := m.router.HybridHandlerByMsgName(messageName) + if handler == nil { + return nil, fmt.Errorf("unknown message: %s", messageName) + } + + if err := handler(ctx, msg, msgResp); err != nil { + return nil, err + } + + return msgResp, nil } -// NewQueryRouterService implements router.Service. +// NewQueryRouterService return new implementation of router.Service. func NewQueryRouterService(queryRouter baseapp.QueryRouter) router.Service { return &queryRouterService{ router: queryRouter, @@ -110,27 +106,12 @@ func (m *queryRouterService) CanInvoke(ctx context.Context, typeURL string) erro return nil } -// InvokeTyped execute a message and fill-in a response. -// The response must be known and passed as a parameter. -// Use InvokeUntyped if the response type is not known. -func (m *queryRouterService) InvokeTyped(ctx context.Context, req, resp gogoproto.Message) error { - reqName := msgTypeURL(req) - handlers := m.router.HybridHandlerByRequestName(reqName) - if len(handlers) == 0 { - return fmt.Errorf("unknown request: %s", reqName) - } else if len(handlers) > 1 { - return fmt.Errorf("ambiguous request, query have multiple handlers: %s", reqName) - } - - return handlers[0](ctx, req, resp) -} - -// InvokeUntyped execute a message and returns a response. -func (m *queryRouterService) InvokeUntyped(ctx context.Context, req gogoproto.Message) (gogoproto.Message, error) { +// Invoke execute a message and returns a response. +func (m *queryRouterService) Invoke(ctx context.Context, req gogoproto.Message) (gogoproto.Message, error) { reqName := msgTypeURL(req) respName := m.router.ResponseNameByRequestName(reqName) if respName == "" { - return nil, fmt.Errorf("could not find response type for request %s (%T)", reqName, req) + return nil, fmt.Errorf("unknown request: could not find response type for request %s (%T)", reqName, req) } // get response type @@ -143,7 +124,18 @@ func (m *queryRouterService) InvokeUntyped(ctx context.Context, req gogoproto.Me return nil, fmt.Errorf("could not create response request %s", respName) } - return reqResp, m.InvokeTyped(ctx, req, reqResp) + handlers := m.router.HybridHandlerByRequestName(reqName) + if len(handlers) == 0 { + return nil, fmt.Errorf("unknown request: %s", reqName) + } else if len(handlers) > 1 { + return nil, fmt.Errorf("ambiguous request, query have multiple handlers: %s", reqName) + } + + if err := handlers[0](ctx, req, reqResp); err != nil { + return nil, err + } + + return reqResp, nil } // msgTypeURL returns the TypeURL of a proto message. diff --git a/runtime/router_test.go b/runtime/router_test.go index 2eec2197a4db..00e20ccdd091 100644 --- a/runtime/router_test.go +++ b/runtime/router_test.go @@ -6,7 +6,6 @@ import ( "github.com/stretchr/testify/require" bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" - counterv1 "cosmossdk.io/api/cosmos/counter/v1" coretesting "cosmossdk.io/core/testing" storetypes "cosmossdk.io/store/types" @@ -38,12 +37,12 @@ func TestRouterService(t *testing.T) { // Messages t.Run("invalid msg", func(t *testing.T) { - _, err := messageRouterService.InvokeUntyped(testCtx.Ctx, &bankv1beta1.MsgSend{}) + _, err := messageRouterService.Invoke(testCtx.Ctx, &bankv1beta1.MsgSend{}) require.ErrorContains(t, err, "could not find response type for message cosmos.bank.v1beta1.MsgSend") }) - t.Run("invoke untyped: valid msg (proto v1)", func(t *testing.T) { - resp, err := messageRouterService.InvokeUntyped(testCtx.Ctx, &countertypes.MsgIncreaseCounter{ + t.Run("invoke: valid msg (proto v1)", func(t *testing.T) { + resp, err := messageRouterService.Invoke(testCtx.Ctx, &countertypes.MsgIncreaseCounter{ Signer: "cosmos1", Count: 42, }) @@ -51,57 +50,17 @@ func TestRouterService(t *testing.T) { require.NotNil(t, resp) }) - t.Run("invoke typed: valid msg (proto v1)", func(t *testing.T) { - resp := &countertypes.MsgIncreaseCountResponse{} - err := messageRouterService.InvokeTyped(testCtx.Ctx, &countertypes.MsgIncreaseCounter{ - Signer: "cosmos1", - Count: 42, - }, resp) - require.NoError(t, err) - require.NotNil(t, resp) - }) - - t.Run("invoke typed: valid msg (proto v2)", func(t *testing.T) { - resp := &counterv1.MsgIncreaseCountResponse{} - err := messageRouterService.InvokeTyped(testCtx.Ctx, &counterv1.MsgIncreaseCounter{ - Signer: "cosmos1", - Count: 42, - }, resp) - require.NoError(t, err) - require.NotNil(t, resp) - }) - // Queries t.Run("invalid query", func(t *testing.T) { - err := queryRouterService.InvokeTyped(testCtx.Ctx, &bankv1beta1.QueryBalanceRequest{}, &bankv1beta1.QueryBalanceResponse{}) - require.ErrorContains(t, err, "unknown request: cosmos.bank.v1beta1.QueryBalanceRequest") - }) - - t.Run("invoke typed: valid query (proto v1)", func(t *testing.T) { - _ = counterKeeper.CountStore.Set(testCtx.Ctx, 42) - - resp := &countertypes.QueryGetCountResponse{} - err := queryRouterService.InvokeTyped(testCtx.Ctx, &countertypes.QueryGetCountRequest{}, resp) - require.NoError(t, err) - require.NotNil(t, resp) - require.Equal(t, int64(42), resp.TotalCount) - }) - - t.Run("invoke typed: valid query (proto v2)", func(t *testing.T) { - _ = counterKeeper.CountStore.Set(testCtx.Ctx, 42) - - resp := &counterv1.QueryGetCountResponse{} - err := queryRouterService.InvokeTyped(testCtx.Ctx, &counterv1.QueryGetCountRequest{}, resp) - require.NoError(t, err) - require.NotNil(t, resp) - require.Equal(t, int64(42), resp.TotalCount) + _, err := queryRouterService.Invoke(testCtx.Ctx, &bankv1beta1.QueryBalanceRequest{}) + require.ErrorContains(t, err, "could not find response type for request cosmos.bank.v1beta1.QueryBalanceRequest") }) - t.Run("invoke untyped: valid query (proto v1)", func(t *testing.T) { + t.Run("invoke: valid query (proto v1)", func(t *testing.T) { _ = counterKeeper.CountStore.Set(testCtx.Ctx, 42) - resp, err := queryRouterService.InvokeUntyped(testCtx.Ctx, &countertypes.QueryGetCountRequest{}) + resp, err := queryRouterService.Invoke(testCtx.Ctx, &countertypes.QueryGetCountRequest{}) require.NoError(t, err) require.NotNil(t, resp) respVal, ok := resp.(*countertypes.QueryGetCountResponse) diff --git a/runtime/store.go b/runtime/store.go index 817d9719a64a..a9a3a2b1b554 100644 --- a/runtime/store.go +++ b/runtime/store.go @@ -4,8 +4,6 @@ import ( "context" "io" - dbm "github.com/cosmos/cosmos-db" - "cosmossdk.io/core/store" storetypes "cosmossdk.io/store/types" @@ -63,34 +61,32 @@ func (failingStoreService) OpenTransientStore(ctx context.Context) store.KVStore } // CoreKVStore is a wrapper of Core/Store kvstore interface -// Remove after https://github.com/cosmos/cosmos-sdk/issues/14714 is closed type coreKVStore struct { kvStore storetypes.KVStore } // NewKVStore returns a wrapper of Core/Store kvstore interface -// Remove once store migrates to core/store kvstore interface func newKVStore(store storetypes.KVStore) store.KVStore { return coreKVStore{kvStore: store} } -// Get returns nil iff key doesn't exist. Errors on nil key. +// Get returns value corresponding to the key. Panics on nil key. func (store coreKVStore) Get(key []byte) ([]byte, error) { return store.kvStore.Get(key), nil } -// Has checks if a key exists. Errors on nil key. +// Has checks if a key exists. Panics on nil key. func (store coreKVStore) Has(key []byte) (bool, error) { return store.kvStore.Has(key), nil } -// Set sets the key. Errors on nil key or value. +// Set sets the key. Panics on nil key or value. func (store coreKVStore) Set(key, value []byte) error { store.kvStore.Set(key, value) return nil } -// Delete deletes the key. Errors on nil key. +// Delete deletes the key. Panics on nil key. func (store coreKVStore) Delete(key []byte) error { store.kvStore.Delete(key) return nil @@ -164,7 +160,7 @@ func (s kvStoreAdapter) Set(key, value []byte) { } } -func (s kvStoreAdapter) Iterator(start, end []byte) dbm.Iterator { +func (s kvStoreAdapter) Iterator(start, end []byte) store.Iterator { it, err := s.store.Iterator(start, end) if err != nil { panic(err) @@ -172,7 +168,7 @@ func (s kvStoreAdapter) Iterator(start, end []byte) dbm.Iterator { return it } -func (s kvStoreAdapter) ReverseIterator(start, end []byte) dbm.Iterator { +func (s kvStoreAdapter) ReverseIterator(start, end []byte) store.Iterator { it, err := s.store.ReverseIterator(start, end) if err != nil { panic(err) diff --git a/runtime/v2/app.go b/runtime/v2/app.go index ba46e001fcb3..1fdbd2aa0b65 100644 --- a/runtime/v2/app.go +++ b/runtime/v2/app.go @@ -3,9 +3,9 @@ package runtime import ( "encoding/json" "errors" + "slices" gogoproto "github.com/cosmos/gogoproto/proto" - "golang.org/x/exp/slices" runtimev2 "cosmossdk.io/api/cosmos/app/runtime/v2" "cosmossdk.io/core/legacy" @@ -79,6 +79,11 @@ func (a *App[T]) LoadHeight(height uint64) error { return a.db.LoadVersion(height) } +// LoadLatestHeight loads the latest height. +func (a *App[T]) LoadLatestHeight() (uint64, error) { + return a.db.GetLatestVersion() +} + // Close is called in start cmd to gracefully cleanup resources. func (a *App[T]) Close() error { return nil @@ -105,11 +110,6 @@ func (a *App[T]) GetStore() Store { return a.db } -// GetLogger returns the app logger. -func (a *App[T]) GetLogger() log.Logger { - return a.logger -} - func (a *App[T]) GetAppManager() *appmanager.AppManager[T] { return a.AppManager } diff --git a/runtime/v2/builder.go b/runtime/v2/builder.go index b7869fa3f0a7..33e4f46bb77a 100644 --- a/runtime/v2/builder.go +++ b/runtime/v2/builder.go @@ -69,7 +69,7 @@ func (a *AppBuilder[T]) RegisterModules(modules map[string]appmodulev2.AppModule // RegisterStores registers the provided store keys. // This method should only be used for registering extra stores -// wiich is necessary for modules that not registered using the app config. +// which is necessary for modules that not registered using the app config. // To be used in combination of RegisterModules. func (a *AppBuilder[T]) RegisterStores(keys ...string) { a.app.storeKeys = append(a.app.storeKeys, keys...) @@ -124,17 +124,15 @@ func (a *AppBuilder[T]) Build(opts ...AppBuilderOption[T]) (*App[T], error) { } a.app.stf = stf - v := a.viper - home := v.GetString(FlagHome) - storeOpts := rootstore.DefaultStoreOptions() - if s := v.Sub("store.options"); s != nil { + if s := a.viper.Sub("store.options"); s != nil { if err := s.Unmarshal(&storeOpts); err != nil { - return nil, fmt.Errorf("failed to store options: %w", err) + return nil, fmt.Errorf("failed to unmarshal store options: %w", err) } } - scRawDb, err := db.NewDB(db.DBType(v.GetString("store.app-db-backend")), "application", filepath.Join(home, "data"), nil) + home := a.viper.GetString(FlagHome) + scRawDb, err := db.NewDB(db.DBType(a.viper.GetString("store.app-db-backend")), "application", filepath.Join(home, "data"), nil) if err != nil { panic(err) } @@ -175,6 +173,19 @@ func (a *AppBuilder[T]) Build(opts ...AppBuilderOption[T]) (*App[T], error) { } return nil }, + ExportGenesis: func(ctx context.Context, version uint64) ([]byte, error) { + genesisJson, err := a.app.moduleManager.ExportGenesisForModules(ctx) + if err != nil { + return nil, fmt.Errorf("failed to export genesis: %w", err) + } + + bz, err := json.Marshal(genesisJson) + if err != nil { + return nil, fmt.Errorf("failed to marshal genesis: %w", err) + } + + return bz, nil + }, } appManager, err := appManagerBuilder.Build() diff --git a/runtime/v2/go.mod b/runtime/v2/go.mod index ac1c10201508..bd230d4cadb7 100644 --- a/runtime/v2/go.mod +++ b/runtime/v2/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/runtime/v2 -go 1.22.2 +go 1.23 // server v2 integration replace ( @@ -15,17 +15,16 @@ replace ( require ( cosmossdk.io/api v0.7.5 - cosmossdk.io/core v0.12.1-0.20240725072823-6a2d039e1212 + cosmossdk.io/core v1.0.0 cosmossdk.io/depinject v1.0.0 - cosmossdk.io/log v1.4.0 + cosmossdk.io/log v1.4.1 cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000 cosmossdk.io/server/v2/stf v0.0.0-00010101000000-000000000000 cosmossdk.io/store/v2 v2.0.0-00010101000000-000000000000 cosmossdk.io/x/tx v0.13.3 github.com/cosmos/gogoproto v1.7.0 github.com/spf13/viper v1.19.0 - golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc - google.golang.org/grpc v1.65.0 + google.golang.org/grpc v1.66.0 google.golang.org/protobuf v1.34.2 ) @@ -42,10 +41,10 @@ require ( github.com/cockroachdb/pebble v1.1.0 // indirect github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect - github.com/cosmos/cosmos-db v1.0.2 // indirect + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 // indirect github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect github.com/cosmos/iavl v1.2.1-0.20240731145221-594b181f427e // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/emicklei/dot v1.6.2 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect @@ -58,7 +57,7 @@ require ( github.com/hashicorp/go-metrics v0.5.3 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/linxGnu/grocksdb v1.8.14 // indirect @@ -72,9 +71,9 @@ require ( github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/rs/zerolog v1.33.0 // indirect @@ -91,12 +90,13 @@ require ( github.com/tidwall/btree v1.7.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.26.0 // indirect + golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect sigs.k8s.io/yaml v1.4.0 // indirect diff --git a/runtime/v2/go.sum b/runtime/v2/go.sum index c560612f291f..0ddd61c98582 100644 --- a/runtime/v2/go.sum +++ b/runtime/v2/go.sum @@ -6,8 +6,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 h1:IQNdY2kB+k+1OM2DvqFG1+UgeU1JzZrWtwuWzI3ZfwA= cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5/go.mod h1:0CuYKkFHxc1vw2JC+t21THBCALJVROrWVR/3PQ1urpc= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= @@ -40,16 +40,16 @@ github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.2.1-0.20240731145221-594b181f427e h1:5bxw1E0peLMrr8ZO9mYT0d9sxy0WgR1ZEWb92yjKnnk= github.com/cosmos/iavl v1.2.1-0.20240731145221-594b181f427e/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -92,8 +92,8 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= @@ -132,8 +132,8 @@ github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -197,8 +197,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -206,8 +206,8 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -341,12 +341,12 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/runtime/v2/manager.go b/runtime/v2/manager.go index a773f52a1dfc..ddec8015fe21 100644 --- a/runtime/v2/manager.go +++ b/runtime/v2/manager.go @@ -5,11 +5,12 @@ import ( "encoding/json" "errors" "fmt" + "maps" "reflect" + "slices" "sort" gogoproto "github.com/cosmos/gogoproto/proto" - "golang.org/x/exp/maps" "google.golang.org/grpc" proto "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" @@ -41,7 +42,7 @@ func NewModuleManager[T transaction.Tx]( modules map[string]appmodulev2.AppModule, ) *MM[T] { // good defaults for the module manager order - modulesName := maps.Keys(modules) + modulesName := slices.Sorted(maps.Keys(modules)) if len(config.PreBlockers) == 0 { config.PreBlockers = modulesName } @@ -203,45 +204,31 @@ func (m *MM[T]) ExportGenesisForModules( return nil, err } - type genesisResult struct { - bz json.RawMessage - err error - } - type ModuleI interface { ExportGenesis(ctx context.Context) (json.RawMessage, error) } - channels := make(map[string]chan genesisResult) + genesisData := make(map[string]json.RawMessage) + + // TODO: make async export genesis https://github.com/cosmos/cosmos-sdk/issues/21303 for _, moduleName := range modulesToExport { mod := m.modules[moduleName] var moduleI ModuleI if module, hasGenesis := mod.(appmodulev2.HasGenesis); hasGenesis { moduleI = module.(ModuleI) - } else if module, hasABCIGenesis := mod.(appmodulev2.HasGenesis); hasABCIGenesis { + } else if module, hasABCIGenesis := mod.(appmodulev2.HasABCIGenesis); hasABCIGenesis { moduleI = module.(ModuleI) + } else { + continue } - channels[moduleName] = make(chan genesisResult) - go func(moduleI ModuleI, ch chan genesisResult) { - jm, err := moduleI.ExportGenesis(ctx) - if err != nil { - ch <- genesisResult{nil, err} - return - } - ch <- genesisResult{jm, nil} - }(moduleI, channels[moduleName]) - } - - genesisData := make(map[string]json.RawMessage) - for moduleName := range channels { - res := <-channels[moduleName] - if res.err != nil { - return nil, fmt.Errorf("genesis export error in %s: %w", moduleName, res.err) + res, err := moduleI.ExportGenesis(ctx) + if err != nil { + return nil, err } - genesisData[moduleName] = res.bz + genesisData[moduleName] = res } return genesisData, nil @@ -370,8 +357,56 @@ func (m *MM[T]) TxValidators() func(ctx context.Context, tx T) error { } } -// TODO write as descriptive godoc as module manager v1. -// TODO include feedback from https://github.com/cosmos/cosmos-sdk/issues/15120 +// RunMigrations performs in-place store migrations for all modules. This +// function MUST be called inside an x/upgrade UpgradeHandler. +// +// Recall that in an upgrade handler, the `fromVM` VersionMap is retrieved from +// x/upgrade's store, and the function needs to return the target VersionMap +// that will in turn be persisted to the x/upgrade's store. In general, +// returning RunMigrations should be enough: +// +// Example: +// +// app.UpgradeKeeper.SetUpgradeHandler("my-plan", func(ctx context.Context, plan upgradetypes.Plan, fromVM appmodule.VersionMap) (appmodule.VersionMap, error) { +// return app.ModuleManager().RunMigrations(ctx, fromVM) +// }) +// +// Internally, RunMigrations will perform the following steps: +// - create an `updatedVM` VersionMap of module with their latest ConsensusVersion +// - if module implements `HasConsensusVersion` interface get the consensus version as `toVersion`, +// if not `toVersion` is set to 0. +// - get `fromVersion` from `fromVM` with module's name. +// - if the module's name exists in `fromVM` map, then run in-place store migrations +// for that module between `fromVersion` and `toVersion`. +// - if the module does not exist in the `fromVM` (which means that it's a new module, +// because it was not in the previous x/upgrade's store), then run +// `InitGenesis` on that module. +// +// - return the `updatedVM` to be persisted in the x/upgrade's store. +// +// Migrations are run in an order defined by `mm.config.OrderMigrations`. +// +// As an app developer, if you wish to skip running InitGenesis for your new +// module "foo", you need to manually pass a `fromVM` argument to this function +// foo's module version set to its latest ConsensusVersion. That way, the diff +// between the function's `fromVM` and `udpatedVM` will be empty, hence not +// running anything for foo. +// +// Example: +// +// app.UpgradeKeeper.SetUpgradeHandler("my-plan", func(ctx context.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { +// // Assume "foo" is a new module. +// // `fromVM` is fetched from existing x/upgrade store. Since foo didn't exist +// // before this upgrade, `v, exists := fromVM["foo"]; exists == false`, and RunMigration will by default +// // run InitGenesis on foo. +// // To skip running foo's InitGenesis, you need set `fromVM`'s foo to its latest +// // consensus version: +// fromVM["foo"] = foo.AppModule{}.ConsensusVersion() +// +// return app.ModuleManager().RunMigrations(ctx, fromVM) +// }) +// +// Please also refer to https://docs.cosmos.network/main/core/upgrade for more information. func (m *MM[T]) RunMigrations(ctx context.Context, fromVM appmodulev2.VersionMap) (appmodulev2.VersionMap, error) { updatedVM := appmodulev2.VersionMap{} for _, moduleName := range m.config.OrderMigrations { @@ -438,7 +473,14 @@ func (m *MM[T]) RegisterServices(app *App[T]) error { } } - // TODO: register pre and post msg + // register pre and post msg + if module, ok := module.(appmodulev2.HasPreMsgHandlers); ok { + module.RegisterPreMsgHandlers(app.msgRouterBuilder) + } + + if module, ok := module.(appmodulev2.HasPostMsgHandlers); ok { + module.RegisterPostMsgHandlers(app.msgRouterBuilder) + } } return nil @@ -449,8 +491,8 @@ func (m *MM[T]) RegisterServices(app *App[T]) error { func (m *MM[T]) validateConfig() error { if err := m.assertNoForgottenModules("PreBlockers", m.config.PreBlockers, func(moduleName string) bool { module := m.modules[moduleName] - _, hasBlock := module.(appmodulev2.HasPreBlocker) - return !hasBlock + _, hasPreBlock := module.(appmodulev2.HasPreBlocker) + return !hasPreBlock }); err != nil { return err } diff --git a/runtime/v2/migrations.go b/runtime/v2/migrations.go index c0d4d9710017..25597448d926 100644 --- a/runtime/v2/migrations.go +++ b/runtime/v2/migrations.go @@ -14,7 +14,7 @@ type migrationRegistrar struct { migrations map[string]map[uint64]appmodulev2.MigrationHandler } -// newMigrationRegistrar is constructor for registering in-place store migrations for modules. +// newMigrationRegistrar is a constructor for registering in-place store migrations for modules. func newMigrationRegistrar() *migrationRegistrar { return &migrationRegistrar{ migrations: make(map[string]map[uint64]appmodulev2.MigrationHandler), diff --git a/runtime/v2/module.go b/runtime/v2/module.go index a3fc7e87a98e..6ae735505d02 100644 --- a/runtime/v2/module.go +++ b/runtime/v2/module.go @@ -15,11 +15,11 @@ import ( appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1" autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" - "cosmossdk.io/core/app" appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/comet" "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" + "cosmossdk.io/core/server" "cosmossdk.io/core/store" "cosmossdk.io/core/transaction" "cosmossdk.io/depinject" @@ -148,7 +148,7 @@ type AppInputs struct { InterfaceRegistrar registry.InterfaceRegistrar LegacyAmino legacy.Amino Logger log.Logger - Viper *viper.Viper `optional:"true"` + Viper *viper.Viper `optional:"true"` // can be nil in client wiring } func SetupAppBuilder(inputs AppInputs) { @@ -240,8 +240,8 @@ func ProvideCometService() comet.Service { return &services.ContextAwareCometInfoService{} } -// ProvideAppVersionModifier returns nil, `app.VersionModifier` is a feature of BaseApp and neither used nor required for runtim/v2. +// ProvideAppVersionModifier returns nil, `app.VersionModifier` is a feature of BaseApp and neither used nor required for runtime/v2. // nil is acceptable, see: https://github.com/cosmos/cosmos-sdk/blob/0a6ee406a02477ae8ccbfcbe1b51fc3930087f4c/x/upgrade/keeper/keeper.go#L438 -func ProvideAppVersionModifier[T transaction.Tx](app *AppBuilder[T]) app.VersionModifier { +func ProvideAppVersionModifier[T transaction.Tx](app *AppBuilder[T]) server.VersionModifier { return nil } diff --git a/runtime/v2/store.go b/runtime/v2/store.go index e40467fa3bf2..78223d4fdf24 100644 --- a/runtime/v2/store.go +++ b/runtime/v2/store.go @@ -23,7 +23,7 @@ type Store interface { StateLatest() (uint64, store.ReaderMap, error) // StateAt returns a readonly view over the provided - // state. Must error when the version does not exist. + // version. Must error when the version does not exist. StateAt(version uint64) (store.ReaderMap, error) // SetInitialVersion sets the initial version of the store. @@ -52,5 +52,6 @@ type Store interface { // latest version implicitly. LoadLatestVersion() error + // LastCommitID returns the latest commit ID LastCommitID() (proof.CommitID, error) } diff --git a/runtime/v2/types.go b/runtime/v2/types.go index 0138dd802c82..baa20182b512 100644 --- a/runtime/v2/types.go +++ b/runtime/v2/types.go @@ -17,7 +17,7 @@ const ( FlagHome = "home" ) -// ValidateProtoAnnotations validates that the proto annotations are correct. +// validateProtoAnnotations validates that the proto annotations are correct. // More specifically, it verifies: // - all services named "Msg" have `(cosmos.msg.v1.service) = true`, // diff --git a/schema/addressutil/codec.go b/schema/addressutil/codec.go new file mode 100644 index 000000000000..cadde8e516cd --- /dev/null +++ b/schema/addressutil/codec.go @@ -0,0 +1,8 @@ +package addressutil + +type AddressCodec interface { + // StringToBytes decodes text to bytes + StringToBytes(text string) ([]byte, error) + // BytesToString encodes bytes to text + BytesToString(bz []byte) (string, error) +} diff --git a/schema/addressutil/hex.go b/schema/addressutil/hex.go new file mode 100644 index 000000000000..1d6ecae467ce --- /dev/null +++ b/schema/addressutil/hex.go @@ -0,0 +1,24 @@ +package addressutil + +import ( + "encoding/hex" + "fmt" +) + +// HexAddressCodec is a basic address codec that encodes and decodes addresses as hex strings. +// It is intended to be used as a fallback codec when no other codec is provided. +type HexAddressCodec struct{} + +func (h HexAddressCodec) StringToBytes(text string) ([]byte, error) { + if len(text) < 2 || text[:2] != "0x" { + return nil, fmt.Errorf("invalid hex address: %s", text) + } + + return hex.DecodeString(text[2:]) +} + +func (h HexAddressCodec) BytesToString(bz []byte) (string, error) { + return fmt.Sprintf("0x%x", bz), nil +} + +var _ AddressCodec = HexAddressCodec{} diff --git a/schema/addressutil/hex_test.go b/schema/addressutil/hex_test.go new file mode 100644 index 000000000000..e4a0f0ee01f9 --- /dev/null +++ b/schema/addressutil/hex_test.go @@ -0,0 +1,54 @@ +package addressutil + +import ( + "bytes" + "testing" +) + +func TestHexAddressCodec(t *testing.T) { + tt := []struct { + text string + bz []byte + err bool + }{ + { + text: "0x1234", + bz: []byte{0x12, 0x34}, + }, + { + text: "0x", + bz: []byte{}, + }, + { + text: "0x123", + err: true, + }, + { + text: "1234", + err: true, + }, + } + + h := HexAddressCodec{} + for _, tc := range tt { + bz, err := h.StringToBytes(tc.text) + if tc.err && err == nil { + t.Fatalf("expected error, got none") + } + if !tc.err && err != nil { + t.Fatalf("unexpected error: %v", err) + } + if !tc.err && !bytes.Equal(bz, tc.bz) { + t.Fatalf("expected %v, got %v", tc.bz, bz) + } + + // check address rendering if no error + if !tc.err { + if str, err := h.BytesToString(tc.bz); err != nil { + t.Fatalf("unexpected error: %v", err) + } else if str != tc.text { + t.Fatalf("expected %s, got %s", tc.text, str) + } + } + } +} diff --git a/schema/appdata/async.go b/schema/appdata/async.go index 4112ae839fe9..b85d0e492e90 100644 --- a/schema/appdata/async.go +++ b/schema/appdata/async.go @@ -19,50 +19,24 @@ type AsyncListenerOptions struct { DoneWaitGroup *sync.WaitGroup } -// AsyncListenerMux returns a listener that forwards received events to all the provided listeners asynchronously -// with each listener processing in a separate go routine. All callbacks in the returned listener will return nil -// except for Commit which will return an error or nil once all listeners have processed the commit. The context -// is used to signal that the listeners should stop listening and return. bufferSize is the size of the buffer for the -// channels used to send events to the listeners. +// AsyncListenerMux is a convenience function that calls AsyncListener for each listener +// with the provided options and combines them using ListenerMux. func AsyncListenerMux(opts AsyncListenerOptions, listeners ...Listener) Listener { asyncListeners := make([]Listener, len(listeners)) - commitChans := make([]chan error, len(listeners)) for i, l := range listeners { - commitChan := make(chan error) - commitChans[i] = commitChan - asyncListeners[i] = AsyncListener(opts, commitChan, l) + asyncListeners[i] = AsyncListener(opts, l) } - mux := ListenerMux(asyncListeners...) - muxCommit := mux.Commit - mux.Commit = func(data CommitData) error { - if muxCommit != nil { - err := muxCommit(data) - if err != nil { - return err - } - } - - for _, commitChan := range commitChans { - err := <-commitChan - if err != nil { - return err - } - } - return nil - } - - return mux + return ListenerMux(asyncListeners...) } // AsyncListener returns a listener that forwards received events to the provided listener listening in asynchronously // in a separate go routine. The listener that is returned will return nil for all methods including Commit and -// an error or nil will only be returned in commitChan once the sender has sent commit and the receiving listener has -// processed it. Thus commitChan can be used as a synchronization and error checking mechanism. The go routine +// an error or nil will only be returned when the callback returned by Commit is called. +// Thus Commit() can be used as a synchronization and error checking mechanism. The go routine // that is being used for listening will exit when context.Done() returns and no more events will be received by the listener. // bufferSize is the size of the buffer for the channel that is used to send events to the listener. -// Instead of using AsyncListener directly, it is recommended to use AsyncListenerMux which does coordination directly -// via its Commit callback. -func AsyncListener(opts AsyncListenerOptions, commitChan chan<- error, listener Listener) Listener { +func AsyncListener(opts AsyncListenerOptions, listener Listener) Listener { + commitChan := make(chan error) packetChan := make(chan Packet, opts.BufferSize) res := Listener{} ctx := opts.Context @@ -151,11 +125,16 @@ func AsyncListener(opts AsyncListenerOptions, commitChan chan<- error, listener } } - if listener.Commit != nil { - res.Commit = func(data CommitData) error { - packetChan <- data - return nil - } + res.Commit = func(data CommitData) (func() error, error) { + packetChan <- data + return func() error { + return <-commitChan + }, nil + } + + res.onBatch = func(batch PacketBatch) error { + packetChan <- batch + return nil } return res diff --git a/schema/appdata/async_test.go b/schema/appdata/async_test.go index c1df2d4ca6c0..bd802457d775 100644 --- a/schema/appdata/async_test.go +++ b/schema/appdata/async_test.go @@ -2,7 +2,7 @@ package appdata import ( "context" - "fmt" + "errors" "sync" "testing" ) @@ -47,7 +47,12 @@ func TestAsyncListenerMux(t *testing.T) { BufferSize: 16, Context: ctx, DoneWaitGroup: wg, }, listener1, listener2) - callAllCallbacksOnces(t, res) + completeCb := callAllCallbacksOnces(t, res) + if completeCb != nil { + if err := completeCb(); err != nil { + t.Fatal(err) + } + } expectedCalls := []string{ "InitializeModuleData", @@ -72,15 +77,23 @@ func TestAsyncListenerMux(t *testing.T) { listener1 := callCollector(1, func(name string, _ int, _ Packet) { calls1 = append(calls1, name) }) - listener1.Commit = func(data CommitData) error { - return fmt.Errorf("error") + listener1.Commit = func(data CommitData) (completionCallback func() error, err error) { + return nil, errors.New("error") } listener2 := callCollector(2, func(name string, _ int, _ Packet) { calls2 = append(calls2, name) }) res := AsyncListenerMux(AsyncListenerOptions{}, listener1, listener2) - err := res.Commit(CommitData{}) + cb, err := res.Commit(CommitData{}) + if err != nil { + t.Fatalf("expected first error to be nil, got %v", err) + } + if cb == nil { + t.Fatalf("expected completion callback") + } + + err = cb() if err == nil || err.Error() != "error" { t.Fatalf("expected error, got %v", err) } @@ -89,21 +102,19 @@ func TestAsyncListenerMux(t *testing.T) { func TestAsyncListener(t *testing.T) { t.Run("call cancel", func(t *testing.T) { - commitChan := make(chan error) ctx, cancel := context.WithCancel(context.Background()) wg := &sync.WaitGroup{} var calls []string listener := callCollector(1, func(name string, _ int, _ Packet) { calls = append(calls, name) }) - res := AsyncListener(AsyncListenerOptions{BufferSize: 16, Context: ctx, DoneWaitGroup: wg}, - commitChan, listener) - - callAllCallbacksOnces(t, res) + res := AsyncListener(AsyncListenerOptions{BufferSize: 16, Context: ctx, DoneWaitGroup: wg}, listener) - err := <-commitChan - if err != nil { - t.Fatalf("expected nil, got %v", err) + completeCb := callAllCallbacksOnces(t, res) + if completeCb != nil { + if err := completeCb(); err != nil { + t.Fatal(err) + } } checkExpectedCallOrder(t, calls, []string{ @@ -124,21 +135,23 @@ func TestAsyncListener(t *testing.T) { }) t.Run("error", func(t *testing.T) { - commitChan := make(chan error) var calls []string listener := callCollector(1, func(name string, _ int, _ Packet) { calls = append(calls, name) }) listener.OnKVPair = func(updates KVPairData) error { - return fmt.Errorf("error") + return errors.New("error") } - res := AsyncListener(AsyncListenerOptions{BufferSize: 16}, commitChan, listener) + res := AsyncListener(AsyncListenerOptions{BufferSize: 16}, listener) - callAllCallbacksOnces(t, res) + completeCb := callAllCallbacksOnces(t, res) + if completeCb == nil { + t.Fatalf("expected completion callback") + } - err := <-commitChan + err := completeCb() if err == nil || err.Error() != "error" { t.Fatalf("expected error, got %v", err) } diff --git a/schema/appdata/batch.go b/schema/appdata/batch.go new file mode 100644 index 000000000000..1d4802092bea --- /dev/null +++ b/schema/appdata/batch.go @@ -0,0 +1,41 @@ +package appdata + +// BatchablePacket is the interface that packet types which can be batched implement. +// All types that implement Packet except CommitData also implement BatchablePacket. +// CommitData should not be batched because it forces synchronization of asynchronous listeners. +type BatchablePacket interface { + Packet + isBatchablePacket() +} + +// PacketBatch is a batch of packets that can be sent to a listener. +// If listener processing is asynchronous, the batch of packets will be sent +// all at once in a single operation which can be more efficient than sending +// each packet individually. +type PacketBatch []BatchablePacket + +func (p PacketBatch) apply(l *Listener) error { + if l.onBatch != nil { + return l.onBatch(p) + } + + for _, packet := range p { + if err := packet.apply(l); err != nil { + return err + } + } + + return nil +} + +func (ModuleInitializationData) isBatchablePacket() {} + +func (StartBlockData) isBatchablePacket() {} + +func (TxData) isBatchablePacket() {} + +func (EventData) isBatchablePacket() {} + +func (KVPairData) isBatchablePacket() {} + +func (ObjectUpdateData) isBatchablePacket() {} diff --git a/schema/appdata/batch_test.go b/schema/appdata/batch_test.go new file mode 100644 index 000000000000..0f43f07ba063 --- /dev/null +++ b/schema/appdata/batch_test.go @@ -0,0 +1,85 @@ +package appdata + +import ( + "context" + "reflect" + "testing" +) + +func TestBatch(t *testing.T) { + l, got := batchListener() + + if err := l.SendPacket(testBatch); err != nil { + t.Error(err) + } + + if !reflect.DeepEqual(*got, testBatch) { + t.Errorf("got %v, expected %v", *got, testBatch) + } +} + +var testBatch = PacketBatch{ + ModuleInitializationData{}, + StartBlockData{}, + TxData{}, + EventData{}, + KVPairData{}, + ObjectUpdateData{}, +} + +func batchListener() (Listener, *PacketBatch) { + got := new(PacketBatch) + l := Listener{ + InitializeModuleData: func(m ModuleInitializationData) error { + *got = append(*got, m) + return nil + }, + StartBlock: func(b StartBlockData) error { + *got = append(*got, b) + return nil + }, + OnTx: func(t TxData) error { + *got = append(*got, t) + return nil + }, + OnEvent: func(e EventData) error { + *got = append(*got, e) + return nil + }, + OnKVPair: func(k KVPairData) error { + *got = append(*got, k) + return nil + }, + OnObjectUpdate: func(o ObjectUpdateData) error { + *got = append(*got, o) + return nil + }, + } + + return l, got +} + +func TestBatchAsync(t *testing.T) { + l, got := batchListener() + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + l = AsyncListenerMux(AsyncListenerOptions{Context: ctx}, l) + + if err := l.SendPacket(testBatch); err != nil { + t.Error(err) + } + + // commit to synchronize + cb, err := l.Commit(CommitData{}) + if err != nil { + t.Error(err) + } + if err := cb(); err != nil { + t.Error(err) + } + + if !reflect.DeepEqual(*got, testBatch) { + t.Errorf("got %v, expected %v", *got, testBatch) + } +} diff --git a/schema/appdata/data.go b/schema/appdata/data.go index 7e02fbc5db8f..1ef3f012c11e 100644 --- a/schema/appdata/data.go +++ b/schema/appdata/data.go @@ -41,8 +41,14 @@ type TxData struct { JSON ToJSON } -// EventData represents event data that is passed to a listener. +// EventData represents event data that is passed to a listener when events are received. type EventData struct { + // Events are the events that are received. + Events []Event +} + +// Event represents the data for a single event. +type Event struct { // TxIndex is the index of the transaction in the block to which this event is associated. // It should be set to a negative number if the event is not associated with a transaction. // Canonically -1 should be used to represent begin block processing and -2 should be used to @@ -52,16 +58,23 @@ type EventData struct { // MsgIndex is the index of the message in the transaction to which this event is associated. // If TxIndex is negative, this index could correspond to the index of the message in // begin or end block processing if such indexes exist, or it can be set to zero. - MsgIndex uint32 + MsgIndex int32 // EventIndex is the index of the event in the message to which this event is associated. - EventIndex uint32 + EventIndex int32 // Type is the type of the event. Type string - // Data is the JSON representation of the event data. It should generally be a JSON object. + // Data lazily returns the JSON representation of the event. Data ToJSON + + // Attributes lazily returns the key-value attribute representation of the event. + Attributes ToEventAttributes +} + +type EventAttribute = struct { + Key, Value string } // ToBytes is a function that lazily returns the raw byte representation of data. @@ -70,18 +83,21 @@ type ToBytes = func() ([]byte, error) // ToJSON is a function that lazily returns the JSON representation of data. type ToJSON = func() (json.RawMessage, error) +// ToEventAttributes is a function that lazily returns the key-value attribute representation of an event. +type ToEventAttributes = func() ([]EventAttribute, error) + // KVPairData represents a batch of key-value pair data that is passed to a listener. type KVPairData struct { - Updates []ModuleKVPairUpdate + Updates []ActorKVPairUpdate } -// ModuleKVPairUpdate represents a key-value pair update for a specific module. -type ModuleKVPairUpdate struct { - // ModuleName is the name of the module that the key-value pair belongs to. - ModuleName string +// ActorKVPairUpdate represents a key-value pair update for a specific module or account. +type ActorKVPairUpdate = struct { + // Actor is the byte representation of the module or account that is updating the key-value pair. + Actor []byte - // Update is the key-value pair update. - Update schema.KVPairUpdate + // StateChanges are key-value pair updates. + StateChanges []schema.KVPairUpdate } // ObjectUpdateData represents object update data that is passed to a listener. diff --git a/schema/appdata/forwarder.go b/schema/appdata/forwarder.go index 2fb4113c8564..973b3c3bbacc 100644 --- a/schema/appdata/forwarder.go +++ b/schema/appdata/forwarder.go @@ -10,6 +10,6 @@ func PacketForwarder(f func(Packet) error) Listener { OnKVPair: func(data KVPairData) error { return f(data) }, OnObjectUpdate: func(data ObjectUpdateData) error { return f(data) }, StartBlock: func(data StartBlockData) error { return f(data) }, - Commit: func(data CommitData) error { return f(data) }, + Commit: func(data CommitData) (func() error, error) { return nil, f(data) }, } } diff --git a/schema/appdata/listener.go b/schema/appdata/listener.go index d4786cb02564..f02b4c467bd4 100644 --- a/schema/appdata/listener.go +++ b/schema/appdata/listener.go @@ -37,5 +37,19 @@ type Listener struct { // indexers should commit their data when this is called and return an error if // they are unable to commit. Data sources MUST call Commit when data is committed, // otherwise it should be assumed that indexers have not persisted their state. - Commit func(CommitData) error + // Commit is designed to support async processing so that implementations may return + // a completion callback to wait for commit to complete. Callers should first check + // if err is nil and then if it is, check if completionCallback is nil and if not + // call it and check for an error. Commit should be designed to be non-blocking if + // possible, but calling completionCallback should be blocking. + // When listener processing is pushed into background go routines using AsyncListener + // or AsyncListenerMux, the Commit completion callback will synchronize the processing of + // all listeners. Producers that do not want to block on Commit in a given block + // can delay calling the completion callback until the start of the next block to + // give listeners time to complete their processing. + Commit func(CommitData) (completionCallback func() error, err error) + + // onBatch can be used internally to efficiently forward packet batches to + // async listeners. + onBatch func(PacketBatch) error } diff --git a/schema/appdata/mux.go b/schema/appdata/mux.go index 8e6b886577d2..81a4fa795db8 100644 --- a/schema/appdata/mux.go +++ b/schema/appdata/mux.go @@ -107,21 +107,44 @@ func ListenerMux(listeners ...Listener) Listener { } } - commitCbs := make([]func(CommitData) error, 0, len(listeners)) + commitCbs := make([]func(CommitData) (func() error, error), 0, len(listeners)) for _, l := range listeners { if l.Commit != nil { commitCbs = append(commitCbs, l.Commit) } } - if len(commitCbs) > 0 { - mux.Commit = func(data CommitData) error { + n := len(commitCbs) + if n > 0 { + mux.Commit = func(data CommitData) (func() error, error) { + waitCbs := make([]func() error, 0, n) for _, cb := range commitCbs { - if err := cb(data); err != nil { - return err + wait, err := cb(data) + if err != nil { + return nil, err + } + if wait != nil { + waitCbs = append(waitCbs, wait) } } - return nil + return func() error { + for _, cb := range waitCbs { + if err := cb(); err != nil { + return err + } + } + return nil + }, nil + } + } + + mux.onBatch = func(batch PacketBatch) error { + for _, listener := range listeners { + err := batch.apply(&listener) + if err != nil { + return err + } } + return nil } return mux diff --git a/schema/appdata/mux_test.go b/schema/appdata/mux_test.go index 70787fada8a5..4f3897238cf5 100644 --- a/schema/appdata/mux_test.go +++ b/schema/appdata/mux_test.go @@ -40,7 +40,12 @@ func TestListenerMux(t *testing.T) { res := ListenerMux(callCollector(1, onCall), callCollector(2, onCall)) - callAllCallbacksOnces(t, res) + completeCb := callAllCallbacksOnces(t, res) + if completeCb != nil { + if err := completeCb(); err != nil { + t.Fatal(err) + } + } checkExpectedCallOrder(t, calls, []string{ "InitializeModuleData 1", @@ -61,7 +66,7 @@ func TestListenerMux(t *testing.T) { }) } -func callAllCallbacksOnces(t *testing.T, listener Listener) { +func callAllCallbacksOnces(t *testing.T, listener Listener) (completeCb func() error) { t.Helper() if err := listener.InitializeModuleData(ModuleInitializationData{}); err != nil { t.Error(err) @@ -81,9 +86,12 @@ func callAllCallbacksOnces(t *testing.T, listener Listener) { if err := listener.OnObjectUpdate(ObjectUpdateData{}); err != nil { t.Error(err) } - if err := listener.Commit(CommitData{}); err != nil { + var err error + completeCb, err = listener.Commit(CommitData{}) + if err != nil { t.Error(err) } + return completeCb } func callCollector(i int, onCall func(string, int, Packet)) Listener { @@ -112,9 +120,9 @@ func callCollector(i int, onCall func(string, int, Packet)) Listener { onCall("OnObjectUpdate", i, nil) return nil }, - Commit: func(CommitData) error { + Commit: func(data CommitData) (completionCallback func() error, err error) { onCall("Commit", i, nil) - return nil + return nil, nil }, } } diff --git a/schema/appdata/packet.go b/schema/appdata/packet.go index e5fe6be966b7..ff824ea7a83d 100644 --- a/schema/appdata/packet.go +++ b/schema/appdata/packet.go @@ -2,6 +2,8 @@ package appdata // Packet is the interface that all listener data structures implement so that this data can be "packetized" // and processed in a stream, possibly asynchronously. +// Valid implementations are ModuleInitializationData, StartBlockData, TxData, EventData, KVPairData, ObjectUpdateData, +// and CommitData. type Packet interface { apply(*Listener) error } @@ -57,5 +59,12 @@ func (c CommitData) apply(l *Listener) error { if l.Commit == nil { return nil } - return l.Commit(c) + cb, err := l.Commit(c) + if err != nil { + return err + } + if cb != nil { + return cb() + } + return nil } diff --git a/schema/decoding/decoding_test.go b/schema/decoding/decoding_test.go index a671d2f4c35b..7e1a08c92b7c 100644 --- a/schema/decoding/decoding_test.go +++ b/schema/decoding/decoding_test.go @@ -297,12 +297,14 @@ func (t testStore) GetUInt64(key []byte) uint64 { func (t testStore) Set(key, value []byte) { if t.listener.OnKVPair != nil { - err := t.listener.OnKVPair(appdata.KVPairData{Updates: []appdata.ModuleKVPairUpdate{ + err := t.listener.OnKVPair(appdata.KVPairData{Updates: []appdata.ActorKVPairUpdate{ { - ModuleName: t.modName, - Update: schema.KVPairUpdate{ - Key: key, - Value: value, + Actor: []byte(t.modName), + StateChanges: []schema.KVPairUpdate{ + { + Key: key, + Value: value, + }, }, }, }}) @@ -369,24 +371,22 @@ func (e exampleBankModule) subBalance(acct, denom string, amount uint64) error { func init() { var err error - exampleBankSchema, err = schema.NewModuleSchema([]schema.ObjectType{ - { - Name: "balances", - KeyFields: []schema.Field{ - { - Name: "account", - Kind: schema.StringKind, - }, - { - Name: "denom", - Kind: schema.StringKind, - }, + exampleBankSchema, err = schema.CompileModuleSchema(schema.ObjectType{ + Name: "balances", + KeyFields: []schema.Field{ + { + Name: "account", + Kind: schema.StringKind, }, - ValueFields: []schema.Field{ - { - Name: "amount", - Kind: schema.Uint64Kind, - }, + { + Name: "denom", + Kind: schema.StringKind, + }, + }, + ValueFields: []schema.Field{ + { + Name: "amount", + Kind: schema.Uint64Kind, }, }, }) @@ -435,16 +435,12 @@ type oneValueModule struct { func init() { var err error - oneValueModSchema, err = schema.NewModuleSchema( - []schema.ObjectType{ - { - Name: "item", - ValueFields: []schema.Field{ - {Name: "value", Kind: schema.StringKind}, - }, - }, + oneValueModSchema, err = schema.CompileModuleSchema(schema.ObjectType{ + Name: "item", + ValueFields: []schema.Field{ + {Name: "value", Kind: schema.StringKind}, }, - ) + }) if err != nil { panic(err) } diff --git a/schema/decoding/middleware.go b/schema/decoding/middleware.go index 57c0783c6281..2c269dcab417 100644 --- a/schema/decoding/middleware.go +++ b/schema/decoding/middleware.go @@ -23,6 +23,7 @@ func Middleware(target appdata.Listener, resolver DecoderResolver, opts Middlewa onKVPair := target.OnKVPair moduleCodecs := map[string]*schema.ModuleCodec{} + moduleNames := map[string]string{} target.OnKVPair = func(data appdata.KVPairData) error { // first forward kv pair updates @@ -34,17 +35,28 @@ func Middleware(target appdata.Listener, resolver DecoderResolver, opts Middlewa } for _, kvUpdate := range data.Updates { + moduleName, ok := moduleNames[string(kvUpdate.Actor)] + if !ok { + var err error + moduleName, err = resolver.DecodeModuleName(kvUpdate.Actor) + if err != nil { + return err + } + + moduleNames[string(kvUpdate.Actor)] = moduleName + } + // look for an existing codec - pcdc, ok := moduleCodecs[kvUpdate.ModuleName] + pcdc, ok := moduleCodecs[moduleName] if !ok { - if opts.ModuleFilter != nil && !opts.ModuleFilter(kvUpdate.ModuleName) { + if opts.ModuleFilter != nil && !opts.ModuleFilter(moduleName) { // we don't care about this module so store nil and continue - moduleCodecs[kvUpdate.ModuleName] = nil + moduleCodecs[moduleName] = nil continue } // look for a new codec - cdc, found, err := resolver.LookupDecoder(kvUpdate.ModuleName) + cdc, found, err := resolver.LookupDecoder(moduleName) if err != nil { return err } @@ -52,16 +64,16 @@ func Middleware(target appdata.Listener, resolver DecoderResolver, opts Middlewa if !found { // store nil to indicate we've seen this module and don't have a codec // and keep processing the kv updates - moduleCodecs[kvUpdate.ModuleName] = nil + moduleCodecs[moduleName] = nil continue } pcdc = &cdc - moduleCodecs[kvUpdate.ModuleName] = pcdc + moduleCodecs[moduleName] = pcdc if initializeModuleData != nil { err = initializeModuleData(appdata.ModuleInitializationData{ - ModuleName: kvUpdate.ModuleName, + ModuleName: moduleName, Schema: cdc.Schema, }) if err != nil { @@ -80,22 +92,24 @@ func Middleware(target appdata.Listener, resolver DecoderResolver, opts Middlewa continue } - updates, err := pcdc.KVDecoder(kvUpdate.Update) - if err != nil { - return err - } + for _, u := range kvUpdate.StateChanges { + updates, err := pcdc.KVDecoder(u) + if err != nil { + return err + } - if len(updates) == 0 { - // no updates - continue - } + if len(updates) == 0 { + // no updates + continue + } - err = target.OnObjectUpdate(appdata.ObjectUpdateData{ - ModuleName: kvUpdate.ModuleName, - Updates: updates, - }) - if err != nil { - return err + err = target.OnObjectUpdate(appdata.ObjectUpdateData{ + ModuleName: moduleName, + Updates: updates, + }) + if err != nil { + return err + } } } diff --git a/schema/decoding/resolver.go b/schema/decoding/resolver.go index db0ec0bb1726..cb022dbb6947 100644 --- a/schema/decoding/resolver.go +++ b/schema/decoding/resolver.go @@ -1,6 +1,7 @@ package decoding import ( + "fmt" "sort" "cosmossdk.io/schema" @@ -8,6 +9,12 @@ import ( // DecoderResolver is an interface that allows indexers to discover and use module decoders. type DecoderResolver interface { + // DecodeModuleName decodes a module name from a byte slice passed as the actor in a KVPairUpdate. + DecodeModuleName([]byte) (string, error) + + // EncodeModuleName encodes a module name into a byte slice that can be used as the actor in a KVPairUpdate. + EncodeModuleName(string) ([]byte, error) + // IterateAll iterates over all available module decoders. IterateAll(func(moduleName string, cdc schema.ModuleCodec) error) error @@ -27,6 +34,20 @@ type moduleSetDecoderResolver struct { moduleSet map[string]interface{} } +func (a moduleSetDecoderResolver) DecodeModuleName(bytes []byte) (string, error) { + if _, ok := a.moduleSet[string(bytes)]; ok { + return string(bytes), nil + } + return "", fmt.Errorf("module %s not found", bytes) +} + +func (a moduleSetDecoderResolver) EncodeModuleName(s string) ([]byte, error) { + if _, ok := a.moduleSet[s]; ok { + return []byte(s), nil + } + return nil, fmt.Errorf("module %s not found", s) +} + func (a moduleSetDecoderResolver) IterateAll(f func(string, schema.ModuleCodec) error) error { keys := make([]string, 0, len(a.moduleSet)) for k := range a.moduleSet { diff --git a/schema/decoding/resolver_test.go b/schema/decoding/resolver_test.go index a5e9fa33c947..397b97bd6c33 100644 --- a/schema/decoding/resolver_test.go +++ b/schema/decoding/resolver_test.go @@ -10,7 +10,7 @@ import ( type modA struct{} func (m modA) ModuleCodec() (schema.ModuleCodec, error) { - modSchema, err := schema.NewModuleSchema([]schema.ObjectType{{Name: "A", KeyFields: []schema.Field{{Name: "field1", Kind: schema.StringKind}}}}) + modSchema, err := schema.CompileModuleSchema(schema.ObjectType{Name: "A", KeyFields: []schema.Field{{Name: "field1", Kind: schema.StringKind}}}) if err != nil { return schema.ModuleCodec{}, err } @@ -22,7 +22,7 @@ func (m modA) ModuleCodec() (schema.ModuleCodec, error) { type modB struct{} func (m modB) ModuleCodec() (schema.ModuleCodec, error) { - modSchema, err := schema.NewModuleSchema([]schema.ObjectType{{Name: "B", KeyFields: []schema.Field{{Name: "field2", Kind: schema.StringKind}}}}) + modSchema, err := schema.CompileModuleSchema(schema.ObjectType{Name: "B", KeyFields: []schema.Field{{Name: "field2", Kind: schema.StringKind}}}) if err != nil { return schema.ModuleCodec{}, err } @@ -44,7 +44,7 @@ var testResolver = ModuleSetDecoderResolver(moduleSet) func TestModuleSetDecoderResolver_IterateAll(t *testing.T) { objectTypes := map[string]bool{} err := testResolver.IterateAll(func(moduleName string, cdc schema.ModuleCodec) error { - cdc.Schema.Types(func(t schema.Type) bool { + cdc.Schema.AllTypes(func(t schema.Type) bool { objTyp, ok := t.(schema.ObjectType) if ok { objectTypes[objTyp.Name] = true diff --git a/schema/diff/diff.go b/schema/diff/diff.go new file mode 100644 index 000000000000..febb56c3e33f --- /dev/null +++ b/schema/diff/diff.go @@ -0,0 +1,126 @@ +package diff + +import "cosmossdk.io/schema" + +// ModuleSchemaDiff represents the difference between two module schemas. +type ModuleSchemaDiff struct { + // AddedObjectTypes is a list of object types that were added. + AddedObjectTypes []schema.ObjectType + + // ChangedObjectTypes is a list of object types that were changed. + ChangedObjectTypes []ObjectTypeDiff + + // RemovedObjectTypes is a list of object types that were removed. + RemovedObjectTypes []schema.ObjectType + + // AddedEnumTypes is a list of enum types that were added. + AddedEnumTypes []schema.EnumType + + // ChangedEnumTypes is a list of enum types that were changed. + ChangedEnumTypes []EnumTypeDiff + + // RemovedEnumTypes is a list of enum types that were removed. + RemovedEnumTypes []schema.EnumType +} + +// CompareModuleSchemas compares an old and a new module schemas and returns the difference between them. +// If the schemas are equivalent, the Empty method of the returned ModuleSchemaDiff will return true. +// +// Indexer implementations can use these diffs to perform automatic schema migration. +// The specific supported changes that a specific indexer supports are defined by that indexer implementation. +// However, as a general rule, it is suggested that indexers support the following changes to module schemas: +// - Adding object types +// - Adding enum types +// - Adding nullable value fields to object types +// - Adding enum values to enum types +// +// These changes are officially considered "compatible" changes, and the HasCompatibleChanges method of the returned +// ModuleSchemaDiff will return true if only compatible changes are present. +// Module authors can use the above guidelines as a reference point for what changes are generally +// considered safe to make to a module schema without breaking existing indexers. +func CompareModuleSchemas(oldSchema, newSchema schema.ModuleSchema) ModuleSchemaDiff { + diff := ModuleSchemaDiff{} + + oldSchema.ObjectTypes(func(oldObj schema.ObjectType) bool { + newTyp, found := newSchema.LookupType(oldObj.Name) + newObj, typeMatch := newTyp.(schema.ObjectType) + if !found || !typeMatch { + diff.RemovedObjectTypes = append(diff.RemovedObjectTypes, oldObj) + return true + } + objDiff := compareObjectType(oldObj, newObj) + if !objDiff.Empty() { + diff.ChangedObjectTypes = append(diff.ChangedObjectTypes, objDiff) + } + return true + }) + + newSchema.ObjectTypes(func(newObj schema.ObjectType) bool { + oldTyp, found := oldSchema.LookupType(newObj.TypeName()) + _, typeMatch := oldTyp.(schema.ObjectType) + if !found || !typeMatch { + diff.AddedObjectTypes = append(diff.AddedObjectTypes, newObj) + } + return true + }) + + oldSchema.EnumTypes(func(oldEnum schema.EnumType) bool { + newTyp, found := newSchema.LookupType(oldEnum.Name) + newEnum, typeMatch := newTyp.(schema.EnumType) + if !found || !typeMatch { + diff.RemovedEnumTypes = append(diff.RemovedEnumTypes, oldEnum) + return true + } + enumDiff := compareEnumType(oldEnum, newEnum) + if !enumDiff.Empty() { + diff.ChangedEnumTypes = append(diff.ChangedEnumTypes, enumDiff) + } + return true + }) + + newSchema.EnumTypes(func(newEnum schema.EnumType) bool { + oldTyp, found := oldSchema.LookupType(newEnum.TypeName()) + _, typeMatch := oldTyp.(schema.EnumType) + if !found || !typeMatch { + diff.AddedEnumTypes = append(diff.AddedEnumTypes, newEnum) + } + return true + }) + + return diff +} + +func (m ModuleSchemaDiff) Empty() bool { + return len(m.AddedObjectTypes) == 0 && + len(m.ChangedObjectTypes) == 0 && + len(m.RemovedObjectTypes) == 0 && + len(m.AddedEnumTypes) == 0 && + len(m.ChangedEnumTypes) == 0 && + len(m.RemovedEnumTypes) == 0 +} + +// HasCompatibleChanges returns true if the diff contains only compatible changes. +// Compatible changes are changes that are generally safe to make to a module schema without breaking existing indexers +// and indexers should aim to automatically migrate to such changes. +// See the CompareModuleSchemas function for a list of changes that are considered compatible. +func (m ModuleSchemaDiff) HasCompatibleChanges() bool { + // object and enum types can be added but not removed + // changed object and enum types must have compatible changes + if len(m.RemovedObjectTypes) != 0 || len(m.RemovedEnumTypes) != 0 { + return false + } + + for _, objectType := range m.ChangedObjectTypes { + if !objectType.HasCompatibleChanges() { + return false + } + } + + for _, enumType := range m.ChangedEnumTypes { + if !enumType.HasCompatibleChanges() { + return false + } + } + + return true +} diff --git a/schema/diff/diff_test.go b/schema/diff/diff_test.go new file mode 100644 index 000000000000..c193cbe01ba1 --- /dev/null +++ b/schema/diff/diff_test.go @@ -0,0 +1,340 @@ +package diff + +import ( + "reflect" + "testing" + + "cosmossdk.io/schema" +) + +func TestCompareModuleSchemas(t *testing.T) { + tt := []struct { + name string + oldSchema schema.ModuleSchema + newSchema schema.ModuleSchema + diff ModuleSchemaDiff + hasCompatibleChanges bool + empty bool + }{ + { + name: "no change", + oldSchema: requireModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, + }), + newSchema: requireModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, + }), + diff: ModuleSchemaDiff{}, + hasCompatibleChanges: true, + empty: true, + }, + { + name: "object type added", + oldSchema: requireModuleSchema(t), + newSchema: requireModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, + }), + diff: ModuleSchemaDiff{ + AddedObjectTypes: []schema.ObjectType{ + { + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, + }, + }, + }, + hasCompatibleChanges: true, + }, + { + name: "object type removed", + oldSchema: requireModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, + }), + newSchema: requireModuleSchema(t), + diff: ModuleSchemaDiff{ + RemovedObjectTypes: []schema.ObjectType{ + { + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, + }, + }, + }, + hasCompatibleChanges: false, + }, + { + name: "object type changed, key field added", + oldSchema: requireModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, + }), + newSchema: requireModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}, {Name: "key2", Kind: schema.StringKind}}, + }), + diff: ModuleSchemaDiff{ + ChangedObjectTypes: []ObjectTypeDiff{ + { + Name: "object1", + KeyFieldsDiff: FieldsDiff{ + Added: []schema.Field{ + {Name: "key2", Kind: schema.StringKind}, + }, + }, + }, + }, + }, + hasCompatibleChanges: false, + }, + { + name: "object type changed, nullable value field added", + oldSchema: requireModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, + }), + newSchema: requireModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, + ValueFields: []schema.Field{{Name: "value1", Kind: schema.StringKind, Nullable: true}}, + }), + diff: ModuleSchemaDiff{ + ChangedObjectTypes: []ObjectTypeDiff{ + { + Name: "object1", + ValueFieldsDiff: FieldsDiff{ + Added: []schema.Field{{Name: "value1", Kind: schema.StringKind, Nullable: true}}, + }, + }, + }, + }, + hasCompatibleChanges: true, + }, + { + name: "object type changed, non-nullable value field added", + oldSchema: requireModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, + }), + newSchema: requireModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, + ValueFields: []schema.Field{{Name: "value1", Kind: schema.StringKind}}, + }), + diff: ModuleSchemaDiff{ + ChangedObjectTypes: []ObjectTypeDiff{ + { + Name: "object1", + ValueFieldsDiff: FieldsDiff{ + Added: []schema.Field{{Name: "value1", Kind: schema.StringKind}}, + }, + }, + }, + }, + hasCompatibleChanges: false, + }, + { + name: "object type changed, fields reordered", + oldSchema: requireModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}, {Name: "key2", Kind: schema.StringKind}}, + }), + newSchema: requireModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key2", Kind: schema.StringKind}, {Name: "key1", Kind: schema.StringKind}}, + }), + diff: ModuleSchemaDiff{ + ChangedObjectTypes: []ObjectTypeDiff{ + { + Name: "object1", + KeyFieldsDiff: FieldsDiff{ + OldOrder: []string{"key1", "key2"}, + NewOrder: []string{"key2", "key1"}, + }, + }, + }, + }, + hasCompatibleChanges: false, + }, + { + name: "enum type added, nullable value field added", + oldSchema: requireModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.Int32Kind}}, + }), + newSchema: requireModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.Int32Kind}}, + ValueFields: []schema.Field{ + { + Name: "value1", + Kind: schema.EnumKind, + ReferencedType: "enum1", + Nullable: true, + }, + }, + }, + schema.EnumType{Name: "enum1", Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}, {Name: "b", Value: 2}}}), + diff: ModuleSchemaDiff{ + ChangedObjectTypes: []ObjectTypeDiff{ + { + Name: "object1", + ValueFieldsDiff: FieldsDiff{ + Added: []schema.Field{ + { + Name: "value1", + Kind: schema.EnumKind, + ReferencedType: "enum1", + Nullable: true, + }, + }, + }, + }, + }, + AddedEnumTypes: []schema.EnumType{ + {Name: "enum1", Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}, {Name: "b", Value: 2}}}, + }, + }, + hasCompatibleChanges: true, + }, + { + name: "enum type removed", + oldSchema: requireModuleSchema(t, + schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.Int32Kind}}, + ValueFields: []schema.Field{ + { + Name: "value1", + Kind: schema.EnumKind, + ReferencedType: "enum1", + }, + }, + }, + schema.EnumType{Name: "enum1", Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}, {Name: "b", Value: 2}}}), + newSchema: requireModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.Int32Kind}}, + }), + diff: ModuleSchemaDiff{ + ChangedObjectTypes: []ObjectTypeDiff{ + { + Name: "object1", + ValueFieldsDiff: FieldsDiff{ + Removed: []schema.Field{ + { + Name: "value1", + Kind: schema.EnumKind, + ReferencedType: "enum1", + }, + }, + }, + }, + }, + RemovedEnumTypes: []schema.EnumType{ + {Name: "enum1", Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}, {Name: "b", Value: 2}}}, + }, + }, + hasCompatibleChanges: false, + }, + { + name: "enum value added", + oldSchema: requireModuleSchema(t, + schema.EnumType{Name: "enum1", Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}}}, + ), + newSchema: requireModuleSchema(t, + schema.EnumType{Name: "enum1", Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}, {Name: "b", Value: 2}}}, + ), + diff: ModuleSchemaDiff{ + ChangedEnumTypes: []EnumTypeDiff{ + { + Name: "enum1", + AddedValues: []schema.EnumValueDefinition{{Name: "b", Value: 2}}, + }, + }, + }, + hasCompatibleChanges: true, + }, + { + name: "enum value removed", + oldSchema: requireModuleSchema(t, + schema.EnumType{Name: "enum1", Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}, {Name: "b", Value: 2}, {Name: "c", Value: 3}}}, + ), + newSchema: requireModuleSchema(t, + schema.EnumType{Name: "enum1", Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}, {Name: "b", Value: 2}}}, + ), + diff: ModuleSchemaDiff{ + ChangedEnumTypes: []EnumTypeDiff{ + { + Name: "enum1", + RemovedValues: []schema.EnumValueDefinition{{Name: "c", Value: 3}}, + }, + }, + }, + hasCompatibleChanges: false, + }, + { + name: "object type and enum type name switched", + oldSchema: requireModuleSchema(t, + schema.ObjectType{ + Name: "foo", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.EnumKind, ReferencedType: "bar"}}, + }, + schema.EnumType{Name: "bar", Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}}}, + ), + newSchema: requireModuleSchema(t, + schema.ObjectType{ + Name: "bar", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.EnumKind, ReferencedType: "foo"}}, + }, + schema.EnumType{Name: "foo", Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}}}, + ), + diff: ModuleSchemaDiff{ + RemovedObjectTypes: []schema.ObjectType{ + { + Name: "foo", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.EnumKind, ReferencedType: "bar"}}, + }, + }, + AddedObjectTypes: []schema.ObjectType{ + { + Name: "bar", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.EnumKind, ReferencedType: "foo"}}, + }, + }, + RemovedEnumTypes: []schema.EnumType{ + {Name: "bar", Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}}}, + }, + AddedEnumTypes: []schema.EnumType{ + {Name: "foo", Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}}}, + }, + }, + hasCompatibleChanges: false, + }, + } + + for _, tc := range tt { + t.Run(tc.name, func(t *testing.T) { + got := CompareModuleSchemas(tc.oldSchema, tc.newSchema) + if !reflect.DeepEqual(got, tc.diff) { + t.Errorf("CompareModuleSchemas() = %v, want %v", got, tc.diff) + } + hasCompatibleChanges := got.HasCompatibleChanges() + if hasCompatibleChanges != tc.hasCompatibleChanges { + t.Errorf("HasCompatibleChanges() = %v, want %v", hasCompatibleChanges, tc.hasCompatibleChanges) + } + if tc.empty != got.Empty() { + t.Errorf("Empty() = %v, want %v", got.Empty(), tc.empty) + } + }) + } +} + +func requireModuleSchema(t *testing.T, types ...schema.Type) schema.ModuleSchema { + s, err := schema.CompileModuleSchema(types...) + if err != nil { + t.Fatal(err) + } + return s +} diff --git a/schema/diff/doc.go b/schema/diff/doc.go new file mode 100644 index 000000000000..54b0d5e87fd1 --- /dev/null +++ b/schema/diff/doc.go @@ -0,0 +1,4 @@ +// Package diff provides the CompareModuleSchemas function which compares module schemas +// and their types and generates a structured diff. This diff can be used to check +// compatibility between different versions of a module schema. +package diff diff --git a/schema/diff/enum_diff.go b/schema/diff/enum_diff.go new file mode 100644 index 000000000000..15d6a52a2832 --- /dev/null +++ b/schema/diff/enum_diff.go @@ -0,0 +1,95 @@ +package diff + +import "cosmossdk.io/schema" + +// EnumTypeDiff represents the difference between two enum types. +type EnumTypeDiff struct { + // Name is the name of the enum type. + Name string + + // AddedValues is a list of values that were added. + AddedValues []schema.EnumValueDefinition + + // RemovedValues is a list of values that were removed. + RemovedValues []schema.EnumValueDefinition + + // ChangedValues is a list of values whose numeric values were changed. + ChangedValues []EnumValueDefinitionDiff + + // OldNumericKind is the numeric kind used to represent the enum values numerically in the old enum type. + // It will be empty if the kind did not change. + OldNumericKind schema.Kind + + // NewNumericKind is the numeric kind used to represent the enum values numerically in the new enum type. + // It will be empty if the kind did not change. + NewNumericKind schema.Kind +} + +// EnumValueDefinitionDiff represents the difference between two enum values definitions. +type EnumValueDefinitionDiff struct { + // Name is the name of the enum value. + Name string + + // OldValue is the old numeric value of the enum value. + OldValue int32 + + // NewValue is the new numeric value of the enum value. + NewValue int32 +} + +func compareEnumType(oldEnum, newEnum schema.EnumType) EnumTypeDiff { + diff := EnumTypeDiff{ + Name: oldEnum.TypeName(), + } + + if oldEnum.GetNumericKind() != newEnum.GetNumericKind() { + diff.OldNumericKind = oldEnum.GetNumericKind() + diff.NewNumericKind = newEnum.GetNumericKind() + } + + newValues := make(map[string]schema.EnumValueDefinition) + for _, v := range newEnum.Values { + newValues[v.Name] = v + } + + oldValues := make(map[string]schema.EnumValueDefinition) + for _, v := range oldEnum.Values { + oldValues[v.Name] = v + newV, ok := newValues[v.Name] + if !ok { + diff.RemovedValues = append(diff.RemovedValues, v) + } else if newV.Value != v.Value { + diff.ChangedValues = append(diff.ChangedValues, EnumValueDefinitionDiff{ + Name: v.Name, + OldValue: v.Value, + NewValue: newV.Value, + }) + } + } + + for _, v := range newEnum.Values { + if _, ok := oldValues[v.Name]; !ok { + diff.AddedValues = append(diff.AddedValues, v) + } + } + + return diff +} + +// Empty returns true if the enum type diff has no changes. +func (e EnumTypeDiff) Empty() bool { + return len(e.AddedValues) == 0 && + e.HasCompatibleChanges() +} + +// HasCompatibleChanges returns true if the diff contains only compatible changes. +// The only supported compatible change is adding values. +func (e EnumTypeDiff) HasCompatibleChanges() bool { + return len(e.RemovedValues) == 0 && + len(e.ChangedValues) == 0 && + !e.KindChanged() +} + +func (e EnumTypeDiff) KindChanged() bool { + return e.OldNumericKind != e.NewNumericKind +} diff --git a/schema/diff/enum_diff_test.go b/schema/diff/enum_diff_test.go new file mode 100644 index 000000000000..cd6bae87a921 --- /dev/null +++ b/schema/diff/enum_diff_test.go @@ -0,0 +1,98 @@ +package diff + +import ( + "reflect" + "testing" + + "cosmossdk.io/schema" +) + +func Test_compareEnumType(t *testing.T) { + tt := []struct { + name string + oldEnum schema.EnumType + newEnum schema.EnumType + diff EnumTypeDiff + hasCompatibleChanges bool + }{ + { + name: "no change", + oldEnum: schema.EnumType{ + Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}, {Name: "b", Value: 2}}, + }, + newEnum: schema.EnumType{ + Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}, {Name: "b", Value: 2}}, + }, + diff: EnumTypeDiff{}, + hasCompatibleChanges: true, + }, + { + name: "value added", + oldEnum: schema.EnumType{ + Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}}, + }, + newEnum: schema.EnumType{ + Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}, {Name: "b", Value: 2}}, + }, + diff: EnumTypeDiff{ + AddedValues: []schema.EnumValueDefinition{{Name: "b", Value: 2}}, + }, + hasCompatibleChanges: true, + }, + { + name: "value removed", + oldEnum: schema.EnumType{ + Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}, {Name: "b", Value: 2}}, + }, + newEnum: schema.EnumType{ + Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}}, + }, + diff: EnumTypeDiff{ + RemovedValues: []schema.EnumValueDefinition{{Name: "b", Value: 2}}, + }, + hasCompatibleChanges: false, + }, + { + name: "value changed", + oldEnum: schema.EnumType{ + Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}, {Name: "b", Value: 2}}, + }, + newEnum: schema.EnumType{ + Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}, {Name: "b", Value: 3}}, + }, + diff: EnumTypeDiff{ + ChangedValues: []EnumValueDefinitionDiff{{Name: "b", OldValue: 2, NewValue: 3}}, + }, + hasCompatibleChanges: false, + }, + { + name: "numeric kind changed", + oldEnum: schema.EnumType{ + NumericKind: schema.Int32Kind, + Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}}, + }, + newEnum: schema.EnumType{ + NumericKind: schema.Int16Kind, + Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}}, + }, + diff: EnumTypeDiff{ + OldNumericKind: schema.Int32Kind, + NewNumericKind: schema.Int16Kind, + }, + hasCompatibleChanges: false, + }, + } + + for _, tc := range tt { + t.Run(tc.name, func(t *testing.T) { + got := compareEnumType(tc.oldEnum, tc.newEnum) + if !reflect.DeepEqual(got, tc.diff) { + t.Errorf("compareEnumType() = %v, want %v", got, tc.diff) + } + hasCompatibleChanges := got.HasCompatibleChanges() + if hasCompatibleChanges != tc.hasCompatibleChanges { + t.Errorf("HasCompatibleChanges() = %v, want %v", hasCompatibleChanges, tc.hasCompatibleChanges) + } + }) + } +} diff --git a/schema/diff/field_diff.go b/schema/diff/field_diff.go new file mode 100644 index 000000000000..ffc6c71ed1a4 --- /dev/null +++ b/schema/diff/field_diff.go @@ -0,0 +1,71 @@ +package diff + +import "cosmossdk.io/schema" + +// FieldDiff represents the difference between two fields. +// The KindChanged, NullableChanged, and ReferenceTypeChanged methods can be used to determine +// what specific changes were made to the field. +type FieldDiff struct { + // Name is the name of the field. + Name string + + // OldKind is the old kind of the field. It will be InvalidKind if there was no change. + OldKind schema.Kind + + // NewKind is the new kind of the field. It will be InvalidKind if there was no change. + NewKind schema.Kind + + // OldNullable is the old nullable property of the field. + OldNullable bool + + // NewNullable is the new nullable property of the field. + NewNullable bool + + // OldReferencedType is the name of the old referenced type. + // It will be empty if the field is not a reference type or if there was no change. + OldReferencedType string + + // NewReferencedType is the name of the new referenced type. + // It will be empty if the field is not a reference type or if there was no change. + NewReferencedType string +} + +func compareField(oldField, newField schema.Field) FieldDiff { + diff := FieldDiff{ + Name: oldField.Name, + } + if oldField.Kind != newField.Kind { + diff.OldKind = oldField.Kind + diff.NewKind = newField.Kind + } + + diff.OldNullable = oldField.Nullable + diff.NewNullable = newField.Nullable + + if oldField.ReferencedType != newField.ReferencedType { + diff.OldReferencedType = oldField.ReferencedType + diff.NewReferencedType = newField.ReferencedType + } + + return diff +} + +// Empty returns true if the field diff has no changes. +func (d FieldDiff) Empty() bool { + return !d.KindChanged() && !d.NullableChanged() && !d.ReferenceTypeChanged() +} + +// KindChanged returns true if the field kind changed. +func (d FieldDiff) KindChanged() bool { + return d.OldKind != d.NewKind +} + +// NullableChanged returns true if the field nullable property changed. +func (d FieldDiff) NullableChanged() bool { + return d.OldNullable != d.NewNullable +} + +// ReferenceTypeChanged returns true if the referenced type changed. +func (d FieldDiff) ReferenceTypeChanged() bool { + return d.OldReferencedType != d.NewReferencedType +} diff --git a/schema/diff/field_diff_test.go b/schema/diff/field_diff_test.go new file mode 100644 index 000000000000..d584aae5a48c --- /dev/null +++ b/schema/diff/field_diff_test.go @@ -0,0 +1,63 @@ +package diff + +import ( + "fmt" + "reflect" + "testing" + + "cosmossdk.io/schema" +) + +func Test_compareField(t *testing.T) { + tests := []struct { + oldField schema.Field + newField schema.Field + wantDiff FieldDiff + trueF func(FieldDiff) bool + }{ + { + oldField: schema.Field{Kind: schema.Int32Kind}, + newField: schema.Field{Kind: schema.Int32Kind}, + wantDiff: FieldDiff{}, + trueF: FieldDiff.Empty, + }, + { + oldField: schema.Field{Kind: schema.StringKind}, + newField: schema.Field{Kind: schema.Int32Kind}, + wantDiff: FieldDiff{ + OldKind: schema.StringKind, + NewKind: schema.Int32Kind, + }, + trueF: FieldDiff.KindChanged, + }, + { + oldField: schema.Field{Kind: schema.StringKind}, + newField: schema.Field{Kind: schema.StringKind, Nullable: true}, + wantDiff: FieldDiff{ + NewNullable: true, + }, + trueF: FieldDiff.NullableChanged, + }, + { + oldField: schema.Field{Kind: schema.EnumKind, ReferencedType: "old"}, + newField: schema.Field{Kind: schema.EnumKind, ReferencedType: "new"}, + wantDiff: FieldDiff{ + OldReferencedType: "old", + NewReferencedType: "new", + }, + trueF: FieldDiff.ReferenceTypeChanged, + }, + } + + for i, tt := range tests { + t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { + gotDiff := compareField(tt.oldField, tt.newField) + if !reflect.DeepEqual(gotDiff, tt.wantDiff) { + t.Errorf("compareField() = %v, want %v", gotDiff, tt.wantDiff) + } + if tt.trueF != nil && !tt.trueF(gotDiff) { + t.Errorf("trueF() = false, want true") + } + }) + } +} diff --git a/schema/diff/object_type_diff.go b/schema/diff/object_type_diff.go new file mode 100644 index 000000000000..9f169a6df9ea --- /dev/null +++ b/schema/diff/object_type_diff.go @@ -0,0 +1,146 @@ +package diff + +import "cosmossdk.io/schema" + +// ObjectTypeDiff represents the difference between two object types. +// The Empty method of KeyFieldsDiff and ValueFieldsDiff can be used to determine +// if there were any changes to the key fields or value fields. +type ObjectTypeDiff struct { + // Name is the name of the object type. + Name string + + // KeyFieldsDiff is the difference between the key fields of the object type. + KeyFieldsDiff FieldsDiff + + // ValueFieldsDiff is the difference between the value fields of the object type. + ValueFieldsDiff FieldsDiff +} + +// FieldsDiff represents the difference between two lists of fields. +// Fields will be compared based on name first, and then if there is any +// difference in ordering that will be reported in OldOrder and NewOrder. +// If there is any order change, the OrderChanged method will return true. +// If fields were only added or removed but the order otherwise didn't change, +// then the OldOrder and NewOrder will still be empty. +type FieldsDiff struct { + // Added is a list of fields that were added. + Added []schema.Field + + // Changed is a list of fields that were changed. + Changed []FieldDiff + + // Removed is a list of fields that were removed. + Removed []schema.Field + + // OldOrder is the order of fields in the old list. It will be empty if the order has not changed. + OldOrder []string + + // NewOrder is the order of fields in the new list. It will be empty if the order has not changed. + NewOrder []string +} + +func compareObjectType(oldObj, newObj schema.ObjectType) ObjectTypeDiff { + diff := ObjectTypeDiff{ + Name: oldObj.TypeName(), + } + + diff.KeyFieldsDiff = compareFields(oldObj.KeyFields, newObj.KeyFields) + diff.ValueFieldsDiff = compareFields(oldObj.ValueFields, newObj.ValueFields) + + return diff +} + +func compareFields(oldFields, newFields []schema.Field) FieldsDiff { + diff := FieldsDiff{} + + newFieldMap := make(map[string]schema.Field) + for _, f := range newFields { + newFieldMap[f.Name] = f + } + + oldFieldMap := make(map[string]schema.Field) + for _, oldField := range oldFields { + oldFieldMap[oldField.Name] = oldField + newField, ok := newFieldMap[oldField.Name] + if !ok { + diff.Removed = append(diff.Removed, oldField) + } else { + fieldDiff := compareField(oldField, newField) + if !fieldDiff.Empty() { + diff.Changed = append(diff.Changed, fieldDiff) + } + } + } + + for _, newField := range newFields { + if _, ok := oldFieldMap[newField.Name]; !ok { + diff.Added = append(diff.Added, newField) + } + } + + oldOrder := make([]string, 0, len(oldFields)) + for _, f := range oldFields { + oldOrder = append(oldOrder, f.Name) + } + + orderChanged := false + newOrder := make([]string, 0, len(newFields)) + for i, f := range newFields { + newOrder = append(newOrder, f.Name) + if i < len(oldOrder) && f.Name != oldOrder[i] { + orderChanged = true + } + } + + if orderChanged { + diff.OldOrder = oldOrder + diff.NewOrder = newOrder + } + + return diff +} + +// Empty returns true if the object type diff has no changes. +func (o ObjectTypeDiff) Empty() bool { + return o.KeyFieldsDiff.Empty() && o.ValueFieldsDiff.Empty() +} + +// HasCompatibleChanges returns true if the diff contains only compatible changes. +// The only supported compatible change is adding nullable value fields. +func (o ObjectTypeDiff) HasCompatibleChanges() bool { + if !o.KeyFieldsDiff.Empty() { + return false + } + + if len(o.ValueFieldsDiff.Changed) != 0 || + len(o.ValueFieldsDiff.Removed) != 0 || + o.ValueFieldsDiff.OrderChanged() { + return false + } + + for _, field := range o.ValueFieldsDiff.Added { + if !field.Nullable { + return false + } + } + + return true +} + +// Empty returns true if the field diff has no changes. +func (d FieldsDiff) Empty() bool { + if len(d.Added) != 0 || len(d.Changed) != 0 || len(d.Removed) != 0 { + return false + } + + return !d.OrderChanged() +} + +// OrderChanged returns true if the field order changed. +func (d FieldsDiff) OrderChanged() bool { + if len(d.OldOrder) == 0 && len(d.NewOrder) == 0 { + return false + } + + return true +} diff --git a/schema/diff/object_type_diff_test.go b/schema/diff/object_type_diff_test.go new file mode 100644 index 000000000000..b29f8326c636 --- /dev/null +++ b/schema/diff/object_type_diff_test.go @@ -0,0 +1,269 @@ +package diff + +import ( + "reflect" + "testing" + + "cosmossdk.io/schema" +) + +func Test_objectTypeDiff(t *testing.T) { + tt := []struct { + name string + oldType schema.ObjectType + newType schema.ObjectType + diff ObjectTypeDiff + trueF func(ObjectTypeDiff) bool + hasCompatibleChanges bool + }{ + { + name: "no change", + oldType: schema.ObjectType{ + KeyFields: []schema.Field{{Name: "id", Kind: schema.Int32Kind}}, + }, + newType: schema.ObjectType{ + KeyFields: []schema.Field{{Name: "id", Kind: schema.Int32Kind}}, + }, + diff: ObjectTypeDiff{}, + trueF: ObjectTypeDiff.Empty, + hasCompatibleChanges: true, + }, + { + name: "key fields changed", + oldType: schema.ObjectType{ + KeyFields: []schema.Field{{Name: "id", Kind: schema.Int32Kind}}, + }, + newType: schema.ObjectType{ + KeyFields: []schema.Field{{Name: "id", Kind: schema.StringKind}}, + }, + diff: ObjectTypeDiff{ + KeyFieldsDiff: FieldsDiff{ + Changed: []FieldDiff{ + { + Name: "id", + OldKind: schema.Int32Kind, + NewKind: schema.StringKind, + }, + }, + }, + }, + trueF: func(d ObjectTypeDiff) bool { return !d.KeyFieldsDiff.Empty() }, + hasCompatibleChanges: false, + }, + { + name: "value fields changed", + oldType: schema.ObjectType{ + ValueFields: []schema.Field{{Name: "name", Kind: schema.StringKind}}, + }, + newType: schema.ObjectType{ + ValueFields: []schema.Field{{Name: "name", Kind: schema.Int32Kind}}, + }, + diff: ObjectTypeDiff{ + ValueFieldsDiff: FieldsDiff{ + Changed: []FieldDiff{ + { + Name: "name", + OldKind: schema.StringKind, + NewKind: schema.Int32Kind, + }, + }, + }, + }, + trueF: func(d ObjectTypeDiff) bool { return !d.ValueFieldsDiff.Empty() }, + hasCompatibleChanges: false, + }, + { + name: "nullable value field added", + oldType: schema.ObjectType{ + ValueFields: []schema.Field{{Name: "id", Kind: schema.Int32Kind}}, + }, + newType: schema.ObjectType{ + ValueFields: []schema.Field{{Name: "id", Kind: schema.Int32Kind}, {Name: "name", Kind: schema.StringKind, Nullable: true}}, + }, + diff: ObjectTypeDiff{ + ValueFieldsDiff: FieldsDiff{ + Added: []schema.Field{{Name: "name", Kind: schema.StringKind, Nullable: true}}, + }, + }, + trueF: func(d ObjectTypeDiff) bool { return !d.ValueFieldsDiff.Empty() }, + hasCompatibleChanges: true, + }, + { + name: "non-nullable value field added", + oldType: schema.ObjectType{ + ValueFields: []schema.Field{{Name: "id", Kind: schema.Int32Kind}}, + }, + newType: schema.ObjectType{ + ValueFields: []schema.Field{{Name: "id", Kind: schema.Int32Kind}, {Name: "name", Kind: schema.StringKind}}, + }, + diff: ObjectTypeDiff{ + ValueFieldsDiff: FieldsDiff{ + Added: []schema.Field{{Name: "name", Kind: schema.StringKind}}, + }, + }, + trueF: func(d ObjectTypeDiff) bool { return !d.ValueFieldsDiff.Empty() }, + hasCompatibleChanges: false, + }, + { + name: "fields reordered", + oldType: schema.ObjectType{ + KeyFields: []schema.Field{{Name: "id", Kind: schema.Int32Kind}, {Name: "name", Kind: schema.StringKind}}, + ValueFields: []schema.Field{{Name: "x", Kind: schema.Int32Kind}, {Name: "y", Kind: schema.StringKind}}, + }, + newType: schema.ObjectType{ + KeyFields: []schema.Field{{Name: "name", Kind: schema.StringKind}, {Name: "id", Kind: schema.Int32Kind}}, + ValueFields: []schema.Field{{Name: "y", Kind: schema.StringKind}, {Name: "x", Kind: schema.Int32Kind}}, + }, + diff: ObjectTypeDiff{ + KeyFieldsDiff: FieldsDiff{ + OldOrder: []string{"id", "name"}, + NewOrder: []string{"name", "id"}, + }, + ValueFieldsDiff: FieldsDiff{ + OldOrder: []string{"x", "y"}, + NewOrder: []string{"y", "x"}, + }, + }, + trueF: func(d ObjectTypeDiff) bool { return !d.KeyFieldsDiff.Empty() && !d.ValueFieldsDiff.Empty() }, + hasCompatibleChanges: false, + }, + } + + for _, tc := range tt { + t.Run(tc.name, func(t *testing.T) { + got := compareObjectType(tc.oldType, tc.newType) + if !reflect.DeepEqual(got, tc.diff) { + t.Errorf("compareObjectType() = %v, want %v", got, tc.diff) + } + hasCompatibleChanges := got.HasCompatibleChanges() + if hasCompatibleChanges != tc.hasCompatibleChanges { + t.Errorf("HasCompatibleChanges() = %v, want %v", hasCompatibleChanges, tc.hasCompatibleChanges) + } + }) + } +} + +func Test_fieldsDiff(t *testing.T) { + tt := []struct { + name string + oldFields []schema.Field + newFields []schema.Field + diff FieldsDiff + }{ + { + name: "no change", + oldFields: []schema.Field{{Name: "id", Kind: schema.Int32Kind}}, + newFields: []schema.Field{{Name: "id", Kind: schema.Int32Kind}}, + }, + { + name: "field added", + oldFields: []schema.Field{{Name: "id", Kind: schema.Int32Kind}}, + newFields: []schema.Field{{Name: "id", Kind: schema.Int32Kind}, {Name: "name", Kind: schema.StringKind}}, + diff: FieldsDiff{ + Added: []schema.Field{{Name: "name", Kind: schema.StringKind}}, + }, + }, + { + name: "field removed", + oldFields: []schema.Field{{Name: "id", Kind: schema.Int32Kind}, {Name: "name", Kind: schema.StringKind}}, + newFields: []schema.Field{{Name: "id", Kind: schema.Int32Kind}}, + diff: FieldsDiff{ + Removed: []schema.Field{{Name: "name", Kind: schema.StringKind}}, + }, + }, + { + name: "field changed", + oldFields: []schema.Field{{Name: "id", Kind: schema.Int32Kind}, {Name: "name", Kind: schema.StringKind}}, + newFields: []schema.Field{{Name: "id", Kind: schema.Int32Kind}, {Name: "name", Kind: schema.Int32Kind}}, + diff: FieldsDiff{ + Changed: []FieldDiff{ + { + Name: "name", + OldKind: schema.StringKind, + NewKind: schema.Int32Kind, + }, + }, + }, + }, + { + name: "field order changed", + oldFields: []schema.Field{{Name: "id", Kind: schema.Int32Kind}, {Name: "name", Kind: schema.StringKind}}, + newFields: []schema.Field{{Name: "name", Kind: schema.StringKind}, {Name: "id", Kind: schema.Int32Kind}}, + diff: FieldsDiff{ + OldOrder: []string{"id", "name"}, + NewOrder: []string{"name", "id"}, + }, + }, + { + name: "field order changed with added fields", + oldFields: []schema.Field{{Name: "id", Kind: schema.Int32Kind}}, + newFields: []schema.Field{{Name: "name", Kind: schema.StringKind}, {Name: "id", Kind: schema.Int32Kind}}, + diff: FieldsDiff{ + Added: []schema.Field{{Name: "name", Kind: schema.StringKind}}, + OldOrder: []string{"id"}, + NewOrder: []string{"name", "id"}, + }, + }, + { + name: "field order changed with removed fields", + oldFields: []schema.Field{{Name: "name", Kind: schema.StringKind}, {Name: "id", Kind: schema.Int32Kind}}, + newFields: []schema.Field{{Name: "id", Kind: schema.Int32Kind}}, + diff: FieldsDiff{ + Removed: []schema.Field{{Name: "name", Kind: schema.StringKind}}, + OldOrder: []string{"name", "id"}, + NewOrder: []string{"id"}, + }, + }, + { + name: "field order changed with changed fields", + oldFields: []schema.Field{{Name: "name", Kind: schema.StringKind}, {Name: "id", Kind: schema.Int32Kind}}, + newFields: []schema.Field{{Name: "id", Kind: schema.Int32Kind}, {Name: "name", Kind: schema.Int32Kind}}, + diff: FieldsDiff{ + Changed: []FieldDiff{ + { + Name: "name", + OldKind: schema.StringKind, + NewKind: schema.Int32Kind, + }, + }, + OldOrder: []string{"name", "id"}, + NewOrder: []string{"id", "name"}, + }, + }, + { + name: "added, removed, changed and reordered fields", + oldFields: []schema.Field{ + {Name: "id", Kind: schema.Int32Kind}, + {Name: "name", Kind: schema.StringKind}, + {Name: "age", Kind: schema.Int32Kind}, + }, + newFields: []schema.Field{ + {Name: "name", Kind: schema.Int32Kind}, + {Name: "age", Kind: schema.Int32Kind}, + {Name: "email", Kind: schema.StringKind}, + }, + diff: FieldsDiff{ + Added: []schema.Field{{Name: "email", Kind: schema.StringKind}}, + Removed: []schema.Field{{Name: "id", Kind: schema.Int32Kind}}, + Changed: []FieldDiff{ + { + Name: "name", + OldKind: schema.StringKind, + NewKind: schema.Int32Kind, + }, + }, + OldOrder: []string{"id", "name", "age"}, + NewOrder: []string{"name", "age", "email"}, + }, + }, + } + + for _, tc := range tt { + t.Run(tc.name, func(t *testing.T) { + got := compareFields(tc.oldFields, tc.newFields) + if !reflect.DeepEqual(got, tc.diff) { + t.Errorf("compareFields() = %v, want %v", got, tc.diff) + } + }) + } +} diff --git a/schema/enum.go b/schema/enum.go index 5ceb435313d1..4783ccff6fc6 100644 --- a/schema/enum.go +++ b/schema/enum.go @@ -7,15 +7,33 @@ import ( // EnumType represents the definition of an enum type. type EnumType struct { - // Name is the name of the enum type. It must conform to the NameFormat regular expression. + // Name is the name of the enum type. + // It must conform to the NameFormat regular expression. // Its name must be unique between all enum types and object types in the module. // The same enum, however, can be used in multiple object types and fields as long as the - // definition is identical each time - Name string + // definition is identical each time. + Name string `json:"name,omitempty"` // Values is a list of distinct, non-empty values that are part of the enum type. // Each value must conform to the NameFormat regular expression. - Values []string + Values []EnumValueDefinition `json:"values"` + + // NumericKind is the numeric kind used to represent the enum values numerically. + // If it is left empty, Int32Kind is used by default. + // Valid values are Uint8Kind, Int8Kind, Uint16Kind, Int16Kind, and Int32Kind. + NumericKind Kind `json:"numeric_kind,omitempty"` +} + +// EnumValueDefinition represents a value in an enum type. +type EnumValueDefinition struct { + // Name is the name of the enum value. + // It must conform to the NameFormat regular expression. + // Its name must be unique between all values in the enum. + Name string `json:"name"` + + // Value is the numeric value of the enum. + // It must be unique between all values in the enum. + Value int32 `json:"value"` } // TypeName implements the Type interface. @@ -26,7 +44,7 @@ func (e EnumType) TypeName() string { func (EnumType) isType() {} // Validate validates the enum definition. -func (e EnumType) Validate() error { +func (e EnumType) Validate(TypeSet) error { if !ValidateName(e.Name) { return fmt.Errorf("invalid enum definition name %q", e.Name) } @@ -34,16 +52,45 @@ func (e EnumType) Validate() error { if len(e.Values) == 0 { return errors.New("enum definition values cannot be empty") } - seen := make(map[string]bool, len(e.Values)) + names := make(map[string]bool, len(e.Values)) + values := make(map[int32]bool, len(e.Values)) for i, v := range e.Values { - if !ValidateName(v) { + if !ValidateName(v.Name) { return fmt.Errorf("invalid enum definition value %q at index %d for enum %s", v, i, e.Name) } - if seen[v] { - return fmt.Errorf("duplicate enum definition value %q for enum %s", v, e.Name) + if names[v.Name] { + return fmt.Errorf("duplicate enum value name %q for enum %s", v.Name, e.Name) + } + names[v.Name] = true + + if values[v.Value] { + return fmt.Errorf("duplicate enum numeric value %d for enum %s", v.Value, e.Name) + } + values[v.Value] = true + + switch e.GetNumericKind() { + case Int8Kind: + if v.Value < -128 || v.Value > 127 { + return fmt.Errorf("enum value %q for enum %s is out of range for Int8Kind", v.Name, e.Name) + } + case Uint8Kind: + if v.Value < 0 || v.Value > 255 { + return fmt.Errorf("enum value %q for enum %s is out of range for Uint8Kind", v.Name, e.Name) + } + case Int16Kind: + if v.Value < -32768 || v.Value > 32767 { + return fmt.Errorf("enum value %q for enum %s is out of range for Int16Kind", v.Name, e.Name) + } + case Uint16Kind: + if v.Value < 0 || v.Value > 65535 { + return fmt.Errorf("enum value %q for enum %s is out of range for Uint16Kind", v.Name, e.Name) + } + case Int32Kind: + // no range check needed + default: + return fmt.Errorf("invalid numeric kind %s for enum %s", e.NumericKind, e.Name) } - seen[v] = true } return nil } @@ -51,9 +98,18 @@ func (e EnumType) Validate() error { // ValidateValue validates that the value is a valid enum value. func (e EnumType) ValidateValue(value string) error { for _, v := range e.Values { - if v == value { + if v.Name == value { return nil } } return fmt.Errorf("value %q is not a valid enum value for %s", value, e.Name) } + +// GetNumericKind returns the numeric kind used to represent the enum values numerically. +// When EnumType.NumericKind is not set, the default value of Int32Kind is returned here. +func (e EnumType) GetNumericKind() Kind { + if e.NumericKind == InvalidKind { + return Int32Kind + } + return e.NumericKind +} diff --git a/schema/enum_test.go b/schema/enum_test.go index 51881f29ff09..387d03e2cfd6 100644 --- a/schema/enum_test.go +++ b/schema/enum_test.go @@ -15,7 +15,7 @@ func TestEnumDefinition_Validate(t *testing.T) { name: "valid enum", enum: EnumType{ Name: "test", - Values: []string{"a", "b", "c"}, + Values: []EnumValueDefinition{{Name: "a", Value: 1}, {Name: "b", Value: 2}, {Name: "c", Value: 3}}, }, errContains: "", }, @@ -23,7 +23,7 @@ func TestEnumDefinition_Validate(t *testing.T) { name: "empty name", enum: EnumType{ Name: "", - Values: []string{"a", "b", "c"}, + Values: []EnumValueDefinition{{Name: "a", Value: 1}, {Name: "b", Value: 2}, {Name: "c", Value: 3}}, }, errContains: "invalid enum definition name", }, @@ -31,31 +31,84 @@ func TestEnumDefinition_Validate(t *testing.T) { name: "empty values", enum: EnumType{ Name: "test", - Values: []string{}, + Values: []EnumValueDefinition{}, }, errContains: "enum definition values cannot be empty", }, { - name: "empty value", + name: "empty value name", enum: EnumType{ Name: "test", - Values: []string{"a", "", "c"}, + Values: []EnumValueDefinition{{Name: "a", Value: 1}, {Name: "", Value: 2}, {Name: "c", Value: 3}}, }, errContains: "invalid enum definition value", }, { - name: "duplicate value", + name: "duplicate value name", enum: EnumType{ Name: "test", - Values: []string{"a", "b", "a"}, + Values: []EnumValueDefinition{{Name: "a", Value: 1}, {Name: "a", Value: 2}, {Name: "c", Value: 3}}, }, - errContains: "duplicate enum definition value \"a\" for enum test", + errContains: `duplicate enum value name "a" for enum test`, + }, + { + name: "duplicate value numeric", + enum: EnumType{ + Name: "test", + Values: []EnumValueDefinition{{Name: "a", Value: 1}, {Name: "b", Value: 1}, {Name: "c", Value: 3}}, + }, + errContains: `duplicate enum numeric value 1 for enum test`, + }, + { + name: "invalid numeric kind", + enum: EnumType{ + Name: "test", + NumericKind: StringKind, + Values: []EnumValueDefinition{{Name: "a", Value: 1}, {Name: "b", Value: 2}, {Name: "c", Value: 3}}, + }, + errContains: "invalid numeric kind", + }, + { + name: "out of range value for Int8Kind", + enum: EnumType{ + Name: "test", + NumericKind: Int8Kind, + Values: []EnumValueDefinition{{Name: "a", Value: -129}}, + }, + errContains: "out of range", + }, + { + name: "out of range value for Uint8Kind", + enum: EnumType{ + Name: "test", + NumericKind: Uint8Kind, + Values: []EnumValueDefinition{{Name: "a", Value: -1}}, + }, + errContains: "out of range", + }, + { + name: "out of range value for Int16Kind", + enum: EnumType{ + Name: "test", + NumericKind: Int16Kind, + Values: []EnumValueDefinition{{Name: "a", Value: -32769}}, + }, + errContains: "out of range", + }, + { + name: "out of range value for Uint16Kind", + enum: EnumType{ + Name: "test", + NumericKind: Uint16Kind, + Values: []EnumValueDefinition{{Name: "a", Value: -1}}, + }, + errContains: "out of range", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - err := tt.enum.Validate() + err := tt.enum.Validate(EmptyTypeSet()) if tt.errContains == "" { if err != nil { t.Errorf("expected valid enum definition to pass validation, got: %v", err) @@ -74,7 +127,7 @@ func TestEnumDefinition_Validate(t *testing.T) { func TestEnumDefinition_ValidateValue(t *testing.T) { enum := EnumType{ Name: "test", - Values: []string{"a", "b", "c"}, + Values: []EnumValueDefinition{{Name: "a", Value: 1}, {Name: "b", Value: 2}, {Name: "c", Value: 3}}, } tests := []struct { diff --git a/schema/field.go b/schema/field.go index bd3e3997e1ed..af7374e367f7 100644 --- a/schema/field.go +++ b/schema/field.go @@ -1,27 +1,26 @@ package schema -import "fmt" +import ( + "fmt" +) // Field represents a field in an object type. type Field struct { // Name is the name of the field. It must conform to the NameFormat regular expression. - Name string + Name string `json:"name"` // Kind is the basic type of the field. - Kind Kind + Kind Kind `json:"kind"` // Nullable indicates whether null values are accepted for the field. Key fields CANNOT be nullable. - Nullable bool + Nullable bool `json:"nullable,omitempty"` - // EnumType is the definition of the enum type and is only valid when Kind is EnumKind. - // The same enum types can be reused in the same module schema, but they always must contain - // the same values for the same enum name. This possibly introduces some duplication of - // definitions but makes it easier to reason about correctness and validation in isolation. - EnumType EnumType + // ReferencedType is the referenced type name when Kind is EnumKind. + ReferencedType string `json:"referenced_type,omitempty"` } // Validate validates the field. -func (c Field) Validate() error { +func (c Field) Validate(typeSet TypeSet) error { // valid name if !ValidateName(c.Name) { return fmt.Errorf("invalid field name %q", c.Name) @@ -33,12 +32,24 @@ func (c Field) Validate() error { } // enum definition only valid with EnumKind - if c.Kind == EnumKind { - if err := c.EnumType.Validate(); err != nil { - return fmt.Errorf("invalid enum definition for field %q: %v", c.Name, err) //nolint:errorlint // false positive due to using go1.12 + switch c.Kind { + case EnumKind: + if c.ReferencedType == "" { + return fmt.Errorf("enum field %q must have a referenced type", c.Name) + } + + ty, ok := typeSet.LookupType(c.ReferencedType) + if !ok { + return fmt.Errorf("enum field %q references unknown type %q", c.Name, c.ReferencedType) + } + + if _, ok := ty.(EnumType); !ok { + return fmt.Errorf("enum field %q references non-enum type %q", c.Name, c.ReferencedType) + } + default: + if c.ReferencedType != "" { + return fmt.Errorf("field %q with kind %q cannot have a referenced type", c.Name, c.Kind) } - } else if c.Kind != EnumKind && (c.EnumType.Name != "" || c.EnumType.Values != nil) { - return fmt.Errorf("enum definition is only valid for field %q with type EnumKind", c.Name) } return nil @@ -47,7 +58,7 @@ func (c Field) Validate() error { // ValidateValue validates that the value conforms to the field's kind and nullability. // Unlike Kind.ValidateValue, it also checks that the value conforms to the EnumType // if the field is an EnumKind. -func (c Field) ValidateValue(value interface{}) error { +func (c Field) ValidateValue(value interface{}, typeSet TypeSet) error { if value == nil { if !c.Nullable { return fmt.Errorf("field %q cannot be null", c.Name) @@ -59,8 +70,21 @@ func (c Field) ValidateValue(value interface{}) error { return fmt.Errorf("invalid value for field %q: %v", c.Name, err) //nolint:errorlint // false positive due to using go1.12 } - if c.Kind == EnumKind { - return c.EnumType.ValidateValue(value.(string)) + switch c.Kind { + case EnumKind: + ty, ok := typeSet.LookupType(c.ReferencedType) + if !ok { + return fmt.Errorf("enum field %q references unknown type %q", c.Name, c.ReferencedType) + } + enumType, ok := ty.(EnumType) + if !ok { + return fmt.Errorf("enum field %q references non-enum type %q", c.Name, c.ReferencedType) + } + err := enumType.ValidateValue(value.(string)) + if err != nil { + return fmt.Errorf("invalid value for enum field %q: %v", c.Name, err) + } + default: } return nil diff --git a/schema/field_test.go b/schema/field_test.go index 5fd7d8015c73..0756f5a7ca86 100644 --- a/schema/field_test.go +++ b/schema/field_test.go @@ -1,6 +1,8 @@ package schema import ( + "encoding/json" + "reflect" "strings" "testing" ) @@ -36,35 +38,35 @@ func TestField_Validate(t *testing.T) { errContains: "invalid field kind", }, { - name: "invalid enum definition", + name: "missing enum type", field: Field{ Name: "field1", Kind: EnumKind, }, - errContains: "invalid enum definition", + errContains: `enum field "field1" must have a referenced type`, }, { name: "enum definition with non-EnumKind", field: Field{ - Name: "field1", - Kind: StringKind, - EnumType: EnumType{Name: "enum"}, + Name: "field1", + Kind: StringKind, + ReferencedType: "enum", }, - errContains: "enum definition is only valid for field \"field1\" with type EnumKind", + errContains: `field "field1" with kind "string" cannot have a referenced type`, }, { name: "valid enum", field: Field{ - Name: "field1", - Kind: EnumKind, - EnumType: EnumType{Name: "enum", Values: []string{"a", "b"}}, + Name: "field1", + Kind: EnumKind, + ReferencedType: "enum", }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - err := tt.field.Validate() + err := tt.field.Validate(testEnumSchema) if tt.errContains == "" { if err != nil { t.Errorf("expected no error, got: %v", err) @@ -128,9 +130,9 @@ func TestField_ValidateValue(t *testing.T) { { name: "valid enum", field: Field{ - Name: "field1", - Kind: EnumKind, - EnumType: EnumType{Name: "enum", Values: []string{"a", "b"}}, + Name: "field1", + Kind: EnumKind, + ReferencedType: "enum", }, value: "a", errContains: "", @@ -138,9 +140,9 @@ func TestField_ValidateValue(t *testing.T) { { name: "invalid enum", field: Field{ - Name: "field1", - Kind: EnumKind, - EnumType: EnumType{Name: "enum", Values: []string{"a", "b"}}, + Name: "field1", + Kind: EnumKind, + ReferencedType: "enum", }, value: "c", errContains: "not a valid enum value", @@ -149,7 +151,7 @@ func TestField_ValidateValue(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - err := tt.field.ValidateValue(tt.value) + err := tt.field.ValidateValue(tt.value, testEnumSchema) if tt.errContains == "" { if err != nil { t.Errorf("expected no error, got: %v", err) @@ -164,3 +166,66 @@ func TestField_ValidateValue(t *testing.T) { }) } } + +func TestFieldJSON(t *testing.T) { + tt := []struct { + field Field + json string + expectErr bool + }{ + { + field: Field{ + Name: "field1", + Kind: StringKind, + }, + json: `{"name":"field1","kind":"string"}`, + }, + { + field: Field{ + Name: "field1", + Kind: Int32Kind, + Nullable: true, + }, + json: `{"name":"field1","kind":"int32","nullable":true}`, + }, + { + field: Field{ + Name: "field1", + Kind: EnumKind, + ReferencedType: "enum", + }, + json: `{"name":"field1","kind":"enum","referenced_type":"enum"}`, + }, + } + + for _, tc := range tt { + t.Run(tc.json, func(t *testing.T) { + b, err := json.Marshal(tc.field) + if tc.expectErr { + if err == nil { + t.Fatalf("expected error, got nil") + } + } else { + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if string(b) != tc.json { + t.Fatalf("expected %s, got %s", tc.json, string(b)) + } + var field Field + err = json.Unmarshal(b, &field) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if !reflect.DeepEqual(field, tc.field) { + t.Fatalf("expected %v, got %v", tc.field, field) + } + } + }) + } +} + +var testEnumSchema = MustCompileModuleSchema(EnumType{ + Name: "enum", + Values: []EnumValueDefinition{{Name: "a", Value: 1}, {Name: "b", Value: 2}}, +}) diff --git a/schema/fields.go b/schema/fields.go index be08ca66ef3d..d0bf1106dfec 100644 --- a/schema/fields.go +++ b/schema/fields.go @@ -4,16 +4,16 @@ import "fmt" // ValidateObjectKey validates that the value conforms to the set of fields as a Key in an ObjectUpdate. // See ObjectUpdate.Key for documentation on the requirements of such keys. -func ValidateObjectKey(keyFields []Field, value interface{}) error { - return validateFieldsValue(keyFields, value) +func ValidateObjectKey(keyFields []Field, value interface{}, typeSet TypeSet) error { + return validateFieldsValue(keyFields, value, typeSet) } // ValidateObjectValue validates that the value conforms to the set of fields as a Value in an ObjectUpdate. // See ObjectUpdate.Value for documentation on the requirements of such values. -func ValidateObjectValue(valueFields []Field, value interface{}) error { +func ValidateObjectValue(valueFields []Field, value interface{}, typeSet TypeSet) error { valueUpdates, ok := value.(ValueUpdates) if !ok { - return validateFieldsValue(valueFields, value) + return validateFieldsValue(valueFields, value, typeSet) } values := map[string]interface{}{} @@ -31,7 +31,7 @@ func ValidateObjectValue(valueFields []Field, value interface{}) error { continue } - if err := field.ValidateValue(v); err != nil { + if err := field.ValidateValue(v, typeSet); err != nil { return err } @@ -45,13 +45,13 @@ func ValidateObjectValue(valueFields []Field, value interface{}) error { return nil } -func validateFieldsValue(fields []Field, value interface{}) error { +func validateFieldsValue(fields []Field, value interface{}, typeSet TypeSet) error { if len(fields) == 0 { return nil } if len(fields) == 1 { - return fields[0].ValidateValue(value) + return fields[0].ValidateValue(value, typeSet) } values, ok := value.([]interface{}) @@ -63,7 +63,7 @@ func validateFieldsValue(fields []Field, value interface{}) error { return fmt.Errorf("expected %d key fields, got %d values", len(fields), len(value.([]interface{}))) } for i, field := range fields { - if err := field.ValidateValue(values[i]); err != nil { + if err := field.ValidateValue(values[i], typeSet); err != nil { return err } } diff --git a/schema/fields_test.go b/schema/fields_test.go index befa968657d1..57b303a669bc 100644 --- a/schema/fields_test.go +++ b/schema/fields_test.go @@ -56,7 +56,7 @@ func TestValidateForKeyFields(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - err := ValidateObjectKey(tt.keyFields, tt.key) + err := ValidateObjectKey(tt.keyFields, tt.key, EmptyTypeSet()) if tt.errContains == "" { if err != nil { t.Fatalf("unexpected error: %v", err) @@ -128,7 +128,7 @@ func TestValidateForValueFields(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - err := ValidateObjectValue(tt.valueFields, tt.value) + err := ValidateObjectValue(tt.valueFields, tt.value, EmptyTypeSet()) if tt.errContains == "" { if err != nil { t.Fatalf("unexpected error: %v", err) diff --git a/schema/indexer/indexer.go b/schema/indexer/indexer.go index 57ada8bb80c1..3b82e3254e5a 100644 --- a/schema/indexer/indexer.go +++ b/schema/indexer/indexer.go @@ -3,6 +3,7 @@ package indexer import ( "context" + "cosmossdk.io/schema/addressutil" "cosmossdk.io/schema/appdata" "cosmossdk.io/schema/logutil" "cosmossdk.io/schema/view" @@ -62,6 +63,10 @@ type InitParams struct { // Logger is a logger the indexer can use to write log messages. It may be nil if the indexer does not need // to write logs. Logger logutil.Logger + + // AddressCodec is the address codec that the indexer can use to encode and decode addresses. It is + // expected to be non-nil. + AddressCodec addressutil.AddressCodec } // InitResult is the indexer initialization result and includes the indexer's listener implementation. diff --git a/schema/indexer/manager.go b/schema/indexer/manager.go index 5a7e39faad0a..60c19b4dd5c7 100644 --- a/schema/indexer/manager.go +++ b/schema/indexer/manager.go @@ -3,6 +3,7 @@ package indexer import ( "context" + "cosmossdk.io/schema/addressutil" "cosmossdk.io/schema/appdata" "cosmossdk.io/schema/decoding" "cosmossdk.io/schema/logutil" @@ -29,6 +30,11 @@ type ManagerOptions struct { // be used to pass down other parameters to indexers if necessary. If it is omitted, context.Background // will be used. Context context.Context + + // AddressCodec is the address codec that indexers can use to encode and decode addresses. It should always be + // provided, but if it is omitted, the indexer manager will use a default codec which encodes and decodes addresses + // as hex strings. + AddressCodec addressutil.AddressCodec } // ManagerConfig is the configuration of the indexer manager and contains the configuration for each indexer target. diff --git a/schema/kind.go b/schema/kind.go index 44d18e100ffd..96f9a934842e 100644 --- a/schema/kind.go +++ b/schema/kind.go @@ -9,81 +9,139 @@ import ( ) // Kind represents the basic type of a field in an object. -// Each kind defines the types of go values which should be accepted -// by listeners and generated by decoders when providing entity updates. +// Each kind defines the following encodings: +// Go Encoding: the golang type which should be accepted by listeners and +// generated by decoders when providing entity updates. +// JSON Encoding: the JSON encoding which should be used when encoding the field to JSON. +// When there is some non-determinism in an encoding, kinds should specify what +// values they accept and also what is the canonical, deterministic encoding which +// should be preferably emitted by serializers. type Kind int const ( // InvalidKind indicates that an invalid type. InvalidKind Kind = iota - // StringKind is a string type and values of this type must be of the go type string - // containing valid UTF-8 and cannot contain null characters. + // StringKind is a string type. + // Go Encoding: UTF-8 string with no null characters. + // JSON Encoding: string StringKind - // BytesKind is a bytes type and values of this type must be of the go type []byte. + // BytesKind is a bytes type. + // Go Encoding: []byte + // JSON Encoding: base64 encoded string, canonical values should be encoded with standard encoding and padding. + // Either standard or URL encoding with or without padding should be accepted. BytesKind - // Int8Kind is an int8 type and values of this type must be of the go type int8. + // Int8Kind represents an 8-bit signed integer. + // Go Encoding: int8 + // JSON Encoding: number Int8Kind - // Uint8Kind is a uint8 type and values of this type must be of the go type uint8. + // Uint8Kind represents an 8-bit unsigned integer. + // Go Encoding: uint8 + // JSON Encoding: number Uint8Kind - // Int16Kind is an int16 type and values of this type must be of the go type int16. + // Int16Kind represents a 16-bit signed integer. + // Go Encoding: int16 + // JSON Encoding: number Int16Kind - // Uint16Kind is a uint16 type and values of this type must be of the go type uint16. + // Uint16Kind represents a 16-bit unsigned integer. + // Go Encoding: uint16 + // JSON Encoding: number Uint16Kind - // Int32Kind is an int32 type and values of this type must be of the go type int32. + // Int32Kind represents a 32-bit signed integer. + // Go Encoding: int32 + // JSON Encoding: number Int32Kind - // Uint32Kind is a uint32 type and values of this type must be of the go type uint32. + // Uint32Kind represents a 32-bit unsigned integer. + // Go Encoding: uint32 + // JSON Encoding: number Uint32Kind - // Int64Kind is an int64 type and values of this type must be of the go type int64. + // Int64Kind represents a 64-bit signed integer. + // Go Encoding: int64 + // JSON Encoding: base10 integer string which matches the IntegerFormat regex + // The canonical encoding should include no leading zeros. Int64Kind - // Uint64Kind is a uint64 type and values of this type must be of the go type uint64. + // Uint64Kind represents a 64-bit unsigned integer. + // Go Encoding: uint64 + // JSON Encoding: base10 integer string which matches the IntegerFormat regex + // Canonically encoded values should include no leading zeros. Uint64Kind - // IntegerStringKind represents an arbitrary precision integer number. Values of this type must - // be of the go type string and formatted as base10 integers, specifically matching to - // the IntegerFormat regex. + // IntegerStringKind represents an arbitrary precision integer number. + // Go Encoding: string which matches the IntegerFormat regex + // JSON Encoding: base10 integer string + // Canonically encoded values should include no leading zeros. + // Equality comparison with integers should be done using numerical equality rather + // than string equality. IntegerStringKind - // DecimalStringKind represents an arbitrary precision decimal or integer number. Values of this type - // must be of the go type string and match the DecimalFormat regex. + // DecimalStringKind represents an arbitrary precision decimal or integer number. + // Go Encoding: string which matches the DecimalFormat regex + // JSON Encoding: base10 decimal string + // Canonically encoded values should include no leading zeros or trailing zeros, + // and exponential notation with a lowercase 'e' should be used for any numbers + // with an absolute value less than or equal to 1e-6 or greater than or equal to 1e6. + // Equality comparison with decimals should be done using numerical equality rather + // than string equality. DecimalStringKind - // BoolKind is a boolean type and values of this type must be of the go type bool. + // BoolKind represents a boolean true or false value. + // Go Encoding: bool + // JSON Encoding: boolean BoolKind - // TimeKind is a time type and values of this type must be of the go type time.Time. + // TimeKind represents a nanosecond precision UNIX time value (with zero representing January 1, 1970 UTC). + // Its valid range is +/- 2^63 (the range of a 64-bit signed integer). + // Go Encoding: time.Time + // JSON Encoding: Any value IS0 8601 time stamp should be accepted. + // Canonical values should be encoded with UTC time zone Z, nanoseconds should + // be encoded with no trailing zeros, and T time values should always be present + // even at 00:00:00. TimeKind - // DurationKind is a duration type and values of this type must be of the go type time.Duration. + // DurationKind represents the elapsed time between two nanosecond precision time values. + // Its valid range is +/- 2^63 (the range of a 64-bit signed integer). + // Go Encoding: time.Duration + // JSON Encoding: the number of seconds as a decimal string with no trailing zeros followed by + // a lowercase 's' character to represent seconds. DurationKind - // Float32Kind is a float32 type and values of this type must be of the go type float32. + // Float32Kind represents an IEEE-754 32-bit floating point number. + // Go Encoding: float32 + // JSON Encoding: number Float32Kind - // Float64Kind is a float64 type and values of this type must be of the go type float64. + // Float64Kind represents an IEEE-754 64-bit floating point number. + // Go Encoding: float64 + // JSON Encoding: number Float64Kind - // AddressKind represents an account address and must be of type []byte. Addresses usually have a - // human-readable rendering, such as bech32, and tooling should provide a way for apps to define a - // string encoder for friendly user-facing display. + // AddressKind represents an account address which is represented by a variable length array of bytes. + // Addresses usually have a human-readable rendering, such as bech32, and tooling should provide + // a way for apps to define a string encoder for friendly user-facing display. + // Go Encoding: []byte + // JSON Encoding: addresses should be encoded as strings using the human-readable address renderer + // provided to the JSON encoder. AddressKind - // EnumKind is an enum type and values of this type must be of the go type string. + // EnumKind represents a value of an enum type. // Fields of this type are expected to set the EnumType field in the field definition to the enum // definition. + // Go Encoding: string + // JSON Encoding: string EnumKind - // JSONKind is a JSON type and values of this type should be of go type json.RawMessage and represent - // valid JSON. + // JSONKind represents arbitrary JSON data. + // Go Encoding: json.RawMessage + // JSON Encoding: any valid JSON value JSONKind ) @@ -315,6 +373,18 @@ func (t Kind) ValidateValue(value interface{}) error { return nil } +// ValidKeyKind returns true if the kind is a valid key kind. +// All kinds except Float32Kind, Float64Kind, and JSONKind are valid key kinds +// because they do not define a strict form of equality. +func (t Kind) ValidKeyKind() bool { + switch t { + case Float32Kind, Float64Kind, JSONKind: + return false + default: + return true + } +} + var ( integerRegex = regexp.MustCompile(IntegerFormat) decimalRegex = regexp.MustCompile(DecimalFormat) @@ -361,3 +431,34 @@ func KindForGoValue(value interface{}) Kind { return InvalidKind } } + +// MarshalJSON marshals the kind to a JSON string and returns an error if the kind is invalid. +func (t Kind) MarshalJSON() ([]byte, error) { + if err := t.Validate(); err != nil { + return nil, err + } + return json.Marshal(t.String()) +} + +// UnmarshalJSON unmarshals the kind from a JSON string and returns an error if the kind is invalid. +func (t *Kind) UnmarshalJSON(data []byte) error { + var s string + err := json.Unmarshal(data, &s) + if err != nil { + return err + } + k, ok := kindStrings[s] + if !ok { + return fmt.Errorf("invalid kind: %s", s) + } + *t = k + return nil +} + +var kindStrings = map[string]Kind{} + +func init() { + for i := InvalidKind + 1; i <= MAX_VALID_KIND; i++ { + kindStrings[i.String()] = i + } +} diff --git a/schema/kind_test.go b/schema/kind_test.go index a337ba278331..ec5766655943 100644 --- a/schema/kind_test.go +++ b/schema/kind_test.go @@ -263,3 +263,58 @@ func TestKindForGoValue(t *testing.T) { }) } } + +func TestKindJSON(t *testing.T) { + tt := []struct { + kind Kind + want string + expectErr bool + }{ + {StringKind, `"string"`, false}, + {BytesKind, `"bytes"`, false}, + {Int8Kind, `"int8"`, false}, + {Uint8Kind, `"uint8"`, false}, + {Int16Kind, `"int16"`, false}, + {Uint16Kind, `"uint16"`, false}, + {Int32Kind, `"int32"`, false}, + {Uint32Kind, `"uint32"`, false}, + {Int64Kind, `"int64"`, false}, + {Uint64Kind, `"uint64"`, false}, + {IntegerStringKind, `"integer"`, false}, + {DecimalStringKind, `"decimal"`, false}, + {BoolKind, `"bool"`, false}, + {TimeKind, `"time"`, false}, + {DurationKind, `"duration"`, false}, + {Float32Kind, `"float32"`, false}, + {Float64Kind, `"float64"`, false}, + {JSONKind, `"json"`, false}, + {EnumKind, `"enum"`, false}, + {AddressKind, `"address"`, false}, + {InvalidKind, `""`, true}, + {Kind(100), `""`, true}, + } + for i, tc := range tt { + t.Run(fmt.Sprintf("test %d", i), func(t *testing.T) { + b, err := json.Marshal(tc.kind) + if tc.expectErr && err == nil { + t.Errorf("test %d: expected error, got nil", i) + } + if !tc.expectErr && err != nil { + t.Errorf("test %d: unexpected error: %v", i, err) + } + if !tc.expectErr { + if string(b) != tc.want { + t.Errorf("test %d: expected %s, got %s", i, tc.want, string(b)) + } + var k Kind + err := json.Unmarshal(b, &k) + if err != nil { + t.Errorf("test %d: unexpected error: %v", i, err) + } + if k != tc.kind { + t.Errorf("test %d: expected %s, got %s", i, tc.kind, k) + } + } + }) + } +} diff --git a/schema/module_schema.go b/schema/module_schema.go index f90a44c192b1..dbd5365f5563 100644 --- a/schema/module_schema.go +++ b/schema/module_schema.go @@ -1,6 +1,7 @@ package schema import ( + "encoding/json" "fmt" "sort" ) @@ -10,18 +11,21 @@ type ModuleSchema struct { types map[string]Type } -// NewModuleSchema constructs a new ModuleSchema and validates it. Any module schema returned without an error -// is guaranteed to be valid. -func NewModuleSchema(objectTypes []ObjectType) (ModuleSchema, error) { - types := map[string]Type{} +// CompileModuleSchema compiles the types into a ModuleSchema and validates it. +// Any module schema returned without an error is guaranteed to be valid. +func CompileModuleSchema(types ...Type) (ModuleSchema, error) { + typeMap := map[string]Type{} + + for _, typ := range types { + if _, ok := typeMap[typ.TypeName()]; ok { + return ModuleSchema{}, fmt.Errorf("duplicate type %q", typ.TypeName()) + } - for _, objectType := range objectTypes { - types[objectType.Name] = objectType + typeMap[typ.TypeName()] = typ } - res := ModuleSchema{types: types} + res := ModuleSchema{types: typeMap} - // validate adds all enum types to the type map err := res.Validate() if err != nil { return ModuleSchema{}, err @@ -30,52 +34,20 @@ func NewModuleSchema(objectTypes []ObjectType) (ModuleSchema, error) { return res, nil } -func addEnumType(types map[string]Type, field Field) error { - enumDef := field.EnumType - if enumDef.Name == "" { - return nil - } - - existing, ok := types[enumDef.Name] - if !ok { - types[enumDef.Name] = enumDef - return nil - } - - existingEnum, ok := existing.(EnumType) - if !ok { - return fmt.Errorf("enum %q already exists as a different non-enum type", enumDef.Name) - } - - if len(existingEnum.Values) != len(enumDef.Values) { - return fmt.Errorf("enum %q has different number of values in different fields", enumDef.Name) - } - - existingValues := map[string]bool{} - for _, value := range existingEnum.Values { - existingValues[value] = true - } - - for _, value := range enumDef.Values { - _, ok := existingValues[value] - if !ok { - return fmt.Errorf("enum %q has different values in different fields", enumDef.Name) - } +// MustCompileModuleSchema constructs a new ModuleSchema and panics if it is invalid. +// This should only be used in test code or static initialization where it is safe to panic! +func MustCompileModuleSchema(types ...Type) ModuleSchema { + sch, err := CompileModuleSchema(types...) + if err != nil { + panic(err) } - - return nil + return sch } // Validate validates the module schema. func (s ModuleSchema) Validate() error { for _, typ := range s.types { - objTyp, ok := typ.(ObjectType) - if !ok { - continue - } - - // all enum types get added to the type map when we call ObjectType.validate - err := objTyp.validate(s.types) + err := typ.Validate(s) if err != nil { return err } @@ -96,7 +68,7 @@ func (s ModuleSchema) ValidateObjectUpdate(update ObjectUpdate) error { return fmt.Errorf("type %q is not an object type", update.TypeName) } - return objTyp.ValidateObjectUpdate(update) + return objTyp.ValidateObjectUpdate(update, s) } // LookupType looks up a type by name in the module schema. @@ -107,7 +79,7 @@ func (s ModuleSchema) LookupType(name string) (Type, bool) { // Types calls the provided function for each type in the module schema and stops if the function returns false. // The types are iterated over in sorted order by name. This function is compatible with go 1.23 iterators. -func (s ModuleSchema) Types(f func(Type) bool) { +func (s ModuleSchema) AllTypes(f func(Type) bool) { keys := make([]string, 0, len(s.types)) for k := range s.types { keys = append(keys, k) @@ -122,7 +94,7 @@ func (s ModuleSchema) Types(f func(Type) bool) { // ObjectTypes iterators over all the object types in the schema in alphabetical order. func (s ModuleSchema) ObjectTypes(f func(ObjectType) bool) { - s.Types(func(t Type) bool { + s.AllTypes(func(t Type) bool { objTyp, ok := t.(ObjectType) if ok { return f(objTyp) @@ -133,7 +105,7 @@ func (s ModuleSchema) ObjectTypes(f func(ObjectType) bool) { // EnumTypes iterators over all the enum types in the schema in alphabetical order. func (s ModuleSchema) EnumTypes(f func(EnumType) bool) { - s.Types(func(t Type) bool { + s.AllTypes(func(t Type) bool { enumType, ok := t.(EnumType) if ok { return f(enumType) @@ -141,3 +113,62 @@ func (s ModuleSchema) EnumTypes(f func(EnumType) bool) { return true }) } + +type moduleSchemaJson struct { + ObjectTypes []ObjectType `json:"object_types"` + EnumTypes []EnumType `json:"enum_types"` +} + +// MarshalJSON implements the json.Marshaler interface for ModuleSchema. +// It marshals the module schema into a JSON object with the object types and enum types +// under the keys "object_types" and "enum_types" respectively. +func (s ModuleSchema) MarshalJSON() ([]byte, error) { + asJson := moduleSchemaJson{} + + s.ObjectTypes(func(objType ObjectType) bool { + asJson.ObjectTypes = append(asJson.ObjectTypes, objType) + return true + }) + + s.EnumTypes(func(enumType EnumType) bool { + asJson.EnumTypes = append(asJson.EnumTypes, enumType) + return true + }) + + return json.Marshal(asJson) +} + +// UnmarshalJSON implements the json.Unmarshaler interface for ModuleSchema. +// See MarshalJSON for the JSON format. +func (s *ModuleSchema) UnmarshalJSON(data []byte) error { + asJson := moduleSchemaJson{} + + err := json.Unmarshal(data, &asJson) + if err != nil { + return err + } + + types := map[string]Type{} + + for _, objType := range asJson.ObjectTypes { + types[objType.Name] = objType + } + + for _, enumType := range asJson.EnumTypes { + types[enumType.Name] = enumType + } + + s.types = types + + // validate adds all enum types to the type map + err = s.Validate() + if err != nil { + return err + } + + return nil +} + +func (ModuleSchema) isTypeSet() {} + +var _ TypeSet = ModuleSchema{} diff --git a/schema/module_schema_test.go b/schema/module_schema_test.go index 2e4a927acc5d..a52085a60f5e 100644 --- a/schema/module_schema_test.go +++ b/schema/module_schema_test.go @@ -9,13 +9,13 @@ import ( func TestModuleSchema_Validate(t *testing.T) { tests := []struct { name string - objectTypes []ObjectType + types []Type errContains string }{ { name: "valid module schema", - objectTypes: []ObjectType{ - { + types: []Type{ + ObjectType{ Name: "object1", KeyFields: []Field{ { @@ -29,8 +29,8 @@ func TestModuleSchema_Validate(t *testing.T) { }, { name: "invalid object type", - objectTypes: []ObjectType{ - { + types: []Type{ + ObjectType{ Name: "", KeyFields: []Field{ { @@ -43,121 +43,31 @@ func TestModuleSchema_Validate(t *testing.T) { errContains: "invalid object type name", }, { - name: "same enum with missing values", - objectTypes: []ObjectType{ - { - Name: "object1", - KeyFields: []Field{ - { - Name: "k", - Kind: EnumKind, - EnumType: EnumType{ - Name: "enum1", - Values: []string{"a", "b"}, - }, - }, - }, - ValueFields: []Field{ - { - Name: "v", - Kind: EnumKind, - EnumType: EnumType{ - Name: "enum1", - Values: []string{"a", "b", "c"}, - }, - }, - }, - }, - }, - errContains: "different number of values", - }, - { - name: "same enum with different values", - objectTypes: []ObjectType{ - { - Name: "object1", - KeyFields: []Field{ - { - Name: "k", - Kind: EnumKind, - EnumType: EnumType{ - Name: "enum1", - Values: []string{"a", "b"}, - }, - }, - }, - }, - { - Name: "object2", - KeyFields: []Field{ - { - Name: "k", - Kind: EnumKind, - EnumType: EnumType{ - Name: "enum1", - Values: []string{"a", "c"}, - }, - }, - }, - }, - }, - errContains: "different values", - }, - { - name: "same enum", - objectTypes: []ObjectType{ - { - Name: "object1", - KeyFields: []Field{ - { - Name: "k", - Kind: EnumKind, - EnumType: EnumType{ - Name: "enum1", - Values: []string{"a", "b"}, - }, - }, - }, - }, - { - Name: "object2", - KeyFields: []Field{ - { - Name: "k", - Kind: EnumKind, - EnumType: EnumType{ - Name: "enum1", - Values: []string{"a", "b"}, - }, - }, - }, - }, - }, - }, - { - objectTypes: []ObjectType{ - { + name: "duplicate type name", + types: []Type{ + ObjectType{ Name: "type1", ValueFields: []Field{ { - Name: "field1", - Kind: EnumKind, - EnumType: EnumType{ - Name: "type1", - Values: []string{"a", "b"}, - }, + Name: "field1", + Kind: EnumKind, + ReferencedType: "type1", }, }, }, + EnumType{ + Name: "type1", + Values: []EnumValueDefinition{{Name: "a", Value: 1}}, + }, }, - errContains: "enum \"type1\" already exists as a different non-enum type", + errContains: `duplicate type "type1"`, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - // because validate is called when calling NewModuleSchema, we just call NewModuleSchema - _, err := NewModuleSchema(tt.objectTypes) + // because validate is called when calling CompileModuleSchema, we just call CompileModuleSchema + _, err := CompileModuleSchema(tt.types...) if tt.errContains == "" { if err != nil { t.Fatalf("unexpected error: %v", err) @@ -180,8 +90,8 @@ func TestModuleSchema_ValidateObjectUpdate(t *testing.T) { }{ { name: "valid object update", - moduleSchema: requireModuleSchema(t, []ObjectType{ - { + moduleSchema: requireModuleSchema(t, + ObjectType{ Name: "object1", KeyFields: []Field{ { @@ -190,7 +100,6 @@ func TestModuleSchema_ValidateObjectUpdate(t *testing.T) { }, }, }, - }, ), objectUpdate: ObjectUpdate{ TypeName: "object1", @@ -200,8 +109,8 @@ func TestModuleSchema_ValidateObjectUpdate(t *testing.T) { }, { name: "object type not found", - moduleSchema: requireModuleSchema(t, []ObjectType{ - { + moduleSchema: requireModuleSchema(t, + ObjectType{ Name: "object1", KeyFields: []Field{ { @@ -210,7 +119,6 @@ func TestModuleSchema_ValidateObjectUpdate(t *testing.T) { }, }, }, - }, ), objectUpdate: ObjectUpdate{ TypeName: "object2", @@ -220,21 +128,21 @@ func TestModuleSchema_ValidateObjectUpdate(t *testing.T) { }, { name: "type name refers to an enum", - moduleSchema: requireModuleSchema(t, []ObjectType{ - { - Name: "obj1", - KeyFields: []Field{ - { - Name: "field1", - Kind: EnumKind, - EnumType: EnumType{ - Name: "enum1", - Values: []string{"a", "b"}, - }, - }, + moduleSchema: requireModuleSchema(t, ObjectType{ + Name: "obj1", + KeyFields: []Field{ + { + Name: "field1", + Kind: EnumKind, + ReferencedType: "enum1", }, }, - }), + }, + EnumType{ + Name: "enum1", + Values: []EnumValueDefinition{{Name: "a", Value: 1}, {Name: "b", Value: 2}}, + }, + ), objectUpdate: ObjectUpdate{ TypeName: "enum1", Key: "a", @@ -259,9 +167,9 @@ func TestModuleSchema_ValidateObjectUpdate(t *testing.T) { } } -func requireModuleSchema(t *testing.T, objectTypes []ObjectType) ModuleSchema { +func requireModuleSchema(t *testing.T, types ...Type) ModuleSchema { t.Helper() - moduleSchema, err := NewModuleSchema(objectTypes) + moduleSchema, err := CompileModuleSchema(types...) if err != nil { t.Fatalf("unexpected error: %v", err) } @@ -269,14 +177,12 @@ func requireModuleSchema(t *testing.T, objectTypes []ObjectType) ModuleSchema { } func TestModuleSchema_LookupType(t *testing.T) { - moduleSchema := requireModuleSchema(t, []ObjectType{ - { - Name: "object1", - KeyFields: []Field{ - { - Name: "field1", - Kind: StringKind, - }, + moduleSchema := requireModuleSchema(t, ObjectType{ + Name: "object1", + KeyFields: []Field{ + { + Name: "field1", + Kind: StringKind, }, }, }) @@ -298,41 +204,43 @@ func TestModuleSchema_LookupType(t *testing.T) { func exampleSchema(t *testing.T) ModuleSchema { t.Helper() - return requireModuleSchema(t, []ObjectType{ - { + return requireModuleSchema(t, + ObjectType{ Name: "object1", KeyFields: []Field{ { - Name: "field1", - Kind: EnumKind, - EnumType: EnumType{ - Name: "enum2", - Values: []string{"d", "e", "f"}, - }, + Name: "field1", + Kind: EnumKind, + ReferencedType: "enum2", }, }, }, - { + ObjectType{ Name: "object2", KeyFields: []Field{ { - Name: "field1", - Kind: EnumKind, - EnumType: EnumType{ - Name: "enum1", - Values: []string{"a", "b", "c"}, - }, + Name: "field1", + Kind: EnumKind, + ReferencedType: "enum1", }, }, }, - }) + EnumType{ + Name: "enum1", + Values: []EnumValueDefinition{{Name: "a", Value: 1}, {Name: "b", Value: 2}, {Name: "c", Value: 3}}, + }, + EnumType{ + Name: "enum2", + Values: []EnumValueDefinition{{Name: "d", Value: 4}, {Name: "e", Value: 5}, {Name: "f", Value: 6}}, + }, + ) } func TestModuleSchema_Types(t *testing.T) { moduleSchema := exampleSchema(t) var typeNames []string - moduleSchema.Types(func(typ Type) bool { + moduleSchema.AllTypes(func(typ Type) bool { typeNames = append(typeNames, typ.TypeName()) return true }) @@ -344,7 +252,7 @@ func TestModuleSchema_Types(t *testing.T) { typeNames = nil // scan just the first type and return false - moduleSchema.Types(func(typ Type) bool { + moduleSchema.AllTypes(func(typ Type) bool { typeNames = append(typeNames, typ.TypeName()) return false }) @@ -408,3 +316,27 @@ func TestModuleSchema_EnumTypes(t *testing.T) { t.Fatalf("expected %v, got %v", expected, typeNames) } } + +func TestModuleSchemaJSON(t *testing.T) { + moduleSchema := exampleSchema(t) + + b, err := moduleSchema.MarshalJSON() + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + + const expectedJson = `{"object_types":[{"name":"object1","key_fields":[{"name":"field1","kind":"enum","referenced_type":"enum2"}]},{"name":"object2","key_fields":[{"name":"field1","kind":"enum","referenced_type":"enum1"}]}],"enum_types":[{"name":"enum1","values":[{"name":"a","value":1},{"name":"b","value":2},{"name":"c","value":3}]},{"name":"enum2","values":[{"name":"d","value":4},{"name":"e","value":5},{"name":"f","value":6}]}]}` + if string(b) != expectedJson { + t.Fatalf("expected %s\n, got %s", expectedJson, string(b)) + } + + var moduleSchema2 ModuleSchema + err = moduleSchema2.UnmarshalJSON(b) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + + if !reflect.DeepEqual(moduleSchema, moduleSchema2) { + t.Fatalf("expected %v, got %v", moduleSchema, moduleSchema2) + } +} diff --git a/schema/object_type.go b/schema/object_type.go index 379d7d4a8382..f961d06062e3 100644 --- a/schema/object_type.go +++ b/schema/object_type.go @@ -6,25 +6,27 @@ import "fmt" type ObjectType struct { // Name is the name of the object type. It must be unique within the module schema amongst all object and enum // types and conform to the NameFormat regular expression. - Name string + Name string `json:"name"` // KeyFields is a list of fields that make up the primary key of the object. // It can be empty in which case indexers should assume that this object is // a singleton and only has one value. Field names must be unique within the - // object between both key and value fields. Key fields CANNOT be nullable. - KeyFields []Field + // object between both key and value fields. + // Key fields CANNOT be nullable and Float32Kind, Float64Kind, and JSONKind types + // are not allowed. + KeyFields []Field `json:"key_fields,omitempty"` // ValueFields is a list of fields that are not part of the primary key of the object. // It can be empty in the case where all fields are part of the primary key. // Field names must be unique within the object between both key and value fields. - ValueFields []Field + ValueFields []Field `json:"value_fields,omitempty"` // RetainDeletions is a flag that indicates whether the indexer should retain // deleted rows in the database and flag them as deleted rather than actually // deleting the row. For many types of data in state, the data is deleted even // though it is still valid in order to save space. Indexers will want to have // the option of retaining such data and distinguishing from other "true" deletions. - RetainDeletions bool + RetainDeletions bool `json:"retain_deletions,omitempty"` } // TypeName implements the Type interface. @@ -35,13 +37,7 @@ func (o ObjectType) TypeName() string { func (ObjectType) isType() {} // Validate validates the object type. -func (o ObjectType) Validate() error { - return o.validate(map[string]Type{}) -} - -// validate validates the object type with an enumValueMap that can be -// shared across a whole module schema. -func (o ObjectType) validate(types map[string]Type) error { +func (o ObjectType) Validate(typeSet TypeSet) error { if !ValidateName(o.Name) { return fmt.Errorf("invalid object type name %q", o.Name) } @@ -49,10 +45,14 @@ func (o ObjectType) validate(types map[string]Type) error { fieldNames := map[string]bool{} for _, field := range o.KeyFields { - if err := field.Validate(); err != nil { + if err := field.Validate(typeSet); err != nil { return fmt.Errorf("invalid key field %q: %v", field.Name, err) //nolint:errorlint // false positive due to using go1.12 } + if !field.Kind.ValidKeyKind() { + return fmt.Errorf("key field %q of kind %q uses an invalid key field kind", field.Name, field.Kind) + } + if field.Nullable { return fmt.Errorf("key field %q cannot be nullable", field.Name) } @@ -61,15 +61,10 @@ func (o ObjectType) validate(types map[string]Type) error { return fmt.Errorf("duplicate field name %q", field.Name) } fieldNames[field.Name] = true - - err := addEnumType(types, field) - if err != nil { - return err - } } for _, field := range o.ValueFields { - if err := field.Validate(); err != nil { + if err := field.Validate(typeSet); err != nil { return fmt.Errorf("invalid value field %q: %v", field.Name, err) //nolint:errorlint // false positive due to using go1.12 } @@ -77,11 +72,6 @@ func (o ObjectType) validate(types map[string]Type) error { return fmt.Errorf("duplicate field name %q", field.Name) } fieldNames[field.Name] = true - - err := addEnumType(types, field) - if err != nil { - return err - } } if len(o.KeyFields) == 0 && len(o.ValueFields) == 0 { @@ -92,12 +82,12 @@ func (o ObjectType) validate(types map[string]Type) error { } // ValidateObjectUpdate validates that the update conforms to the object type. -func (o ObjectType) ValidateObjectUpdate(update ObjectUpdate) error { +func (o ObjectType) ValidateObjectUpdate(update ObjectUpdate, typeSet TypeSet) error { if o.Name != update.TypeName { return fmt.Errorf("object type name %q does not match update type name %q", o.Name, update.TypeName) } - if err := ValidateObjectKey(o.KeyFields, update.Key); err != nil { + if err := ValidateObjectKey(o.KeyFields, update.Key, typeSet); err != nil { return fmt.Errorf("invalid key for object type %q: %v", update.TypeName, err) //nolint:errorlint // false positive due to using go1.12 } @@ -105,5 +95,5 @@ func (o ObjectType) ValidateObjectUpdate(update ObjectUpdate) error { return nil } - return ValidateObjectValue(o.ValueFields, update.Value) + return ValidateObjectValue(o.ValueFields, update.Value, typeSet) } diff --git a/schema/object_type_test.go b/schema/object_type_test.go index 68a85111b7b6..e2b68590241c 100644 --- a/schema/object_type_test.go +++ b/schema/object_type_test.go @@ -163,37 +163,49 @@ func TestObjectType_Validate(t *testing.T) { errContains: "key field \"field1\" cannot be nullable", }, { - name: "duplicate incompatible enum", + name: "float32 key field", objectType: ObjectType{ - Name: "objectWithEnums", + Name: "o1", KeyFields: []Field{ { - Name: "key", - Kind: EnumKind, - EnumType: EnumType{ - Name: "enum1", - Values: []string{"a", "b"}, - }, + Name: "field1", + Kind: Float32Kind, }, }, - ValueFields: []Field{ + }, + errContains: "invalid key field kind", + }, + { + name: "float64 key field", + objectType: ObjectType{ + Name: "o1", + KeyFields: []Field{ { - Name: "value", - Kind: EnumKind, - EnumType: EnumType{ - Name: "enum1", - Values: []string{"c", "b"}, - }, + Name: "field1", + Kind: Float64Kind, + }, + }, + }, + errContains: "invalid key field kind", + }, + { + name: "json key field", + objectType: ObjectType{ + Name: "o1", + KeyFields: []Field{ + { + Name: "field1", + Kind: JSONKind, }, }, }, - errContains: "enum \"enum1\" has different values", + errContains: "invalid key field kind", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - err := tt.objectType.Validate() + err := tt.objectType.Validate(EmptyTypeSet()) if tt.errContains == "" { if err != nil { t.Fatalf("unexpected error: %v", err) @@ -255,7 +267,7 @@ func TestObjectType_ValidateObjectUpdate(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - err := tt.objectType.ValidateObjectUpdate(tt.object) + err := tt.objectType.ValidateObjectUpdate(tt.object, EmptyTypeSet()) if tt.errContains == "" { if err != nil { t.Fatalf("unexpected error: %v", err) diff --git a/schema/testing/app.go b/schema/testing/app.go index feda6d036346..70ff5393ea42 100644 --- a/schema/testing/app.go +++ b/schema/testing/app.go @@ -14,7 +14,7 @@ var AppSchemaGen = rapid.Custom(func(t *rapid.T) map[string]schema.ModuleSchema numModules := rapid.IntRange(1, 10).Draw(t, "numModules") for i := 0; i < numModules; i++ { moduleName := NameGen.Draw(t, "moduleName") - moduleSchema := ModuleSchemaGen.Draw(t, fmt.Sprintf("moduleSchema[%s]", moduleName)) + moduleSchema := ModuleSchemaGen().Draw(t, fmt.Sprintf("moduleSchema[%s]", moduleName)) schema[moduleName] = moduleSchema } return schema diff --git a/schema/testing/appdatasim/app_data.go b/schema/testing/appdatasim/app_data.go index 2f6138bfe824..471cf5cb2b1f 100644 --- a/schema/testing/appdatasim/app_data.go +++ b/schema/testing/appdatasim/app_data.go @@ -8,6 +8,7 @@ import ( "cosmossdk.io/schema" "cosmossdk.io/schema/appdata" + schematesting "cosmossdk.io/schema/testing" "cosmossdk.io/schema/testing/statesim" "cosmossdk.io/schema/view" ) @@ -92,10 +93,10 @@ func (a *Simulator) BlockDataGenN(minUpdatesPerBlock, maxUpdatesPerBlock int) *r packets = append(packets, appdata.StartBlockData{Height: a.blockNum + 1}) updateSet := map[string]bool{} - // filter out any updates to the same key from this block, otherwise we can end up with weird errors + // filter out any updates to the same key from this block, otherwise we can end up with hard to debug errors updateGen := a.state.UpdateGen().Filter(func(data appdata.ObjectUpdateData) bool { for _, update := range data.Updates { - _, existing := updateSet[fmt.Sprintf("%s:%v", data.ModuleName, update.Key)] + _, existing := updateSet[a.formatUpdateKey(data.ModuleName, update)] if existing { return false } @@ -106,7 +107,8 @@ func (a *Simulator) BlockDataGenN(minUpdatesPerBlock, maxUpdatesPerBlock int) *r for i := 0; i < numUpdates; i++ { data := updateGen.Draw(t, fmt.Sprintf("update[%d]", i)) for _, update := range data.Updates { - updateSet[fmt.Sprintf("%s:%v", data.ModuleName, update.Key)] = true + // we need to set the update here each time so that this is used to filter out duplicates in the next round + updateSet[a.formatUpdateKey(data.ModuleName, update)] = true } packets = append(packets, data) } @@ -117,6 +119,21 @@ func (a *Simulator) BlockDataGenN(minUpdatesPerBlock, maxUpdatesPerBlock int) *r }) } +func (a *Simulator) formatUpdateKey(moduleName string, update schema.ObjectUpdate) string { + mod, err := a.state.GetModule(moduleName) + if err != nil { + panic(err) + } + + objColl, err := mod.GetObjectCollection(update.TypeName) + if err != nil { + panic(err) + } + + ks := fmt.Sprintf("%s:%s:%s", moduleName, update.TypeName, schematesting.ObjectKeyString(objColl.ObjectType(), update.Key)) + return ks +} + // ProcessBlockData processes the given block data, advancing the app state based on the object updates in the block // and forwarding all packets to the attached listener. It is expected that the data passed came from BlockDataGen, // however, other data can be passed as long as any StartBlockData packet has the height set to the current height + 1. diff --git a/schema/testing/appdatasim/app_data_test.go b/schema/testing/appdatasim/app_data_test.go index 29701c4411e7..eba8a8984ffb 100644 --- a/schema/testing/appdatasim/app_data_test.go +++ b/schema/testing/appdatasim/app_data_test.go @@ -84,9 +84,9 @@ func writerListener(w io.Writer) appdata.Listener { OnTx: nil, OnEvent: nil, OnKVPair: nil, - Commit: func(data appdata.CommitData) error { - _, err := fmt.Fprintf(w, "Commit: %v\n", data) - return err + Commit: func(data appdata.CommitData) (completionCallback func() error, err error) { + _, err = fmt.Fprintf(w, "Commit: %v\n", data) + return nil, err }, InitializeModuleData: func(data appdata.ModuleInitializationData) error { bz, err := json.Marshal(data) diff --git a/schema/testing/appdatasim/testdata/app_sim_example_schema.txt b/schema/testing/appdatasim/testdata/app_sim_example_schema.txt index 117d557ba5a4..f542fe6fe035 100644 --- a/schema/testing/appdatasim/testdata/app_sim_example_schema.txt +++ b/schema/testing/appdatasim/testdata/app_sim_example_schema.txt @@ -1,161 +1,161 @@ -InitializeModuleData: {"ModuleName":"all_kinds","Schema":{}} -InitializeModuleData: {"ModuleName":"test_cases","Schema":{}} +InitializeModuleData: {"ModuleName":"all_kinds","Schema":{"object_types":[{"name":"test_address","key_fields":[{"name":"key","kind":"address"}],"value_fields":[{"name":"valNotNull","kind":"address"},{"name":"valNullable","kind":"address","nullable":true}]},{"name":"test_bool","key_fields":[{"name":"key","kind":"bool"}],"value_fields":[{"name":"valNotNull","kind":"bool"},{"name":"valNullable","kind":"bool","nullable":true}]},{"name":"test_bytes","key_fields":[{"name":"key","kind":"bytes"}],"value_fields":[{"name":"valNotNull","kind":"bytes"},{"name":"valNullable","kind":"bytes","nullable":true}]},{"name":"test_decimal","key_fields":[{"name":"key","kind":"decimal"}],"value_fields":[{"name":"valNotNull","kind":"decimal"},{"name":"valNullable","kind":"decimal","nullable":true}]},{"name":"test_duration","key_fields":[{"name":"key","kind":"duration"}],"value_fields":[{"name":"valNotNull","kind":"duration"},{"name":"valNullable","kind":"duration","nullable":true}]},{"name":"test_enum","key_fields":[{"name":"key","kind":"enum","referenced_type":"test_enum_type"}],"value_fields":[{"name":"valNotNull","kind":"enum","referenced_type":"test_enum_type"},{"name":"valNullable","kind":"enum","nullable":true,"referenced_type":"test_enum_type"}]},{"name":"test_float32","key_fields":[{"name":"key","kind":"int32"}],"value_fields":[{"name":"valNotNull","kind":"float32"},{"name":"valNullable","kind":"float32","nullable":true}]},{"name":"test_float64","key_fields":[{"name":"key","kind":"int32"}],"value_fields":[{"name":"valNotNull","kind":"float64"},{"name":"valNullable","kind":"float64","nullable":true}]},{"name":"test_int16","key_fields":[{"name":"key","kind":"int16"}],"value_fields":[{"name":"valNotNull","kind":"int16"},{"name":"valNullable","kind":"int16","nullable":true}]},{"name":"test_int32","key_fields":[{"name":"key","kind":"int32"}],"value_fields":[{"name":"valNotNull","kind":"int32"},{"name":"valNullable","kind":"int32","nullable":true}]},{"name":"test_int64","key_fields":[{"name":"key","kind":"int64"}],"value_fields":[{"name":"valNotNull","kind":"int64"},{"name":"valNullable","kind":"int64","nullable":true}]},{"name":"test_int8","key_fields":[{"name":"key","kind":"int8"}],"value_fields":[{"name":"valNotNull","kind":"int8"},{"name":"valNullable","kind":"int8","nullable":true}]},{"name":"test_integer","key_fields":[{"name":"key","kind":"integer"}],"value_fields":[{"name":"valNotNull","kind":"integer"},{"name":"valNullable","kind":"integer","nullable":true}]},{"name":"test_string","key_fields":[{"name":"key","kind":"string"}],"value_fields":[{"name":"valNotNull","kind":"string"},{"name":"valNullable","kind":"string","nullable":true}]},{"name":"test_time","key_fields":[{"name":"key","kind":"time"}],"value_fields":[{"name":"valNotNull","kind":"time"},{"name":"valNullable","kind":"time","nullable":true}]},{"name":"test_uint16","key_fields":[{"name":"key","kind":"uint16"}],"value_fields":[{"name":"valNotNull","kind":"uint16"},{"name":"valNullable","kind":"uint16","nullable":true}]},{"name":"test_uint32","key_fields":[{"name":"key","kind":"uint32"}],"value_fields":[{"name":"valNotNull","kind":"uint32"},{"name":"valNullable","kind":"uint32","nullable":true}]},{"name":"test_uint64","key_fields":[{"name":"key","kind":"uint64"}],"value_fields":[{"name":"valNotNull","kind":"uint64"},{"name":"valNullable","kind":"uint64","nullable":true}]},{"name":"test_uint8","key_fields":[{"name":"key","kind":"uint8"}],"value_fields":[{"name":"valNotNull","kind":"uint8"},{"name":"valNullable","kind":"uint8","nullable":true}]}],"enum_types":[{"name":"test_enum_type","values":[{"name":"foo","value":1},{"name":"bar","value":2},{"name":"baz","value":3}]}]}} +InitializeModuleData: {"ModuleName":"test_cases","Schema":{"object_types":[{"name":"ManyValues","key_fields":[{"name":"Key","kind":"string"}],"value_fields":[{"name":"Value1","kind":"int32"},{"name":"Value2","kind":"bytes"},{"name":"Value3","kind":"float64"},{"name":"Value4","kind":"uint64"}]},{"name":"RetainDeletions","key_fields":[{"name":"Key","kind":"string"}],"value_fields":[{"name":"Value1","kind":"int32"},{"name":"Value2","kind":"bytes"}],"retain_deletions":true},{"name":"Simple","key_fields":[{"name":"Key","kind":"string"}],"value_fields":[{"name":"Value1","kind":"int32"},{"name":"Value2","kind":"bytes"}]},{"name":"Singleton","value_fields":[{"name":"Value","kind":"string"},{"name":"Value2","kind":"bytes"}]},{"name":"ThreeKeys","key_fields":[{"name":"Key1","kind":"string"},{"name":"Key2","kind":"int32"},{"name":"Key3","kind":"uint64"}],"value_fields":[{"name":"Value1","kind":"int32"}]},{"name":"TwoKeys","key_fields":[{"name":"Key1","kind":"string"},{"name":"Key2","kind":"int32"}]}],"enum_types":null}} StartBlock: {1 } OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"","Value":[4602,"NwsAtcME5moByAKKwXU="],"Delete":false},{"TypeName":"Simple","Key":"","Value":[-89,"fgY="],"Delete":false}]} OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Singleton","Key":null,"Value":["֑Ⱥ|@!`",""],"Delete":false}]} OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["a\u003c",-84],"Value":null,"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_integer","Key":"11598611","Value":["016807","-016339012"],"Delete":false},{"TypeName":"test_uint16","Key":9407,"Value":{"valNotNull":0,"valNullable":null},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_int16","Key":-4371,"Value":{"valNotNull":-3532,"valNullable":-15},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"\u000b𝜛࣢Ⱥ +\u001c","Value":{"Value1":-28,"Value2":"AAE5AAAAATgB"},"Delete":false},{"TypeName":"RetainDeletions","Key":".(","Value":[116120837,"/wwIyAAUciAC"],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bool","Key":false,"Value":[false,false],"Delete":false},{"TypeName":"test_float64","Key":0,"Value":[-0.819610595703125,0.08682777894820155],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"+!𐅫a⍦","Value":[36,"fi07",0.000005021243239880513,2],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ThreeKeys","Key":["˖|󺪆𝅲=鄖_.;ǀ⃣%; #~",16,512578],"Value":686,"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_int16","Key":-988,"Value":[6,null],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"?൙ဴ𑇑\".+AB","Value":{"Value1":-75,"Value2":"FdQcnKoeAAIB"},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_int8","Key":6,"Value":[6,null],"Delete":false},{"TypeName":"test_int32","Key":-7573,"Value":[-57,null],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ThreeKeys","Key":["\tA𐞙?\t",-5317218,1],"Value":6450,"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bytes","Key":"AwMbGS8=","Value":["AwQA3EBwHgCEABQBAw==",null],"Delete":false},{"TypeName":"test_bool","Key":true,"Value":{"valNotNull":true,"valNullable":null},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_time","Key":"1969-12-31T19:00:19.631216449-05:00","Value":{"valNotNull":"1969-12-31T18:59:59.999999998-05:00","valNullable":null},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"\u0026ắA","Value":[-507,"AFLIDwIESxgAgQEDAS8="],"Delete":false},{"TypeName":"ManyValues","Key":"῭𝚰ഃȺAᶊ?","Value":[-6,"GDU=",-11992.413883053847,57],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_int8","Key":98,"Value":[-4,-83],"Delete":false},{"TypeName":"test_string","Key":"ਃÙ࣢Ⱥ +\u001c","Value":{"valNotNull":"𐹹aa","valNullable":"aa"},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"_ _^.ෛ᧰;1A","Value":{"Value1":-29,"Value2":"9w=="},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"ᾏ","Value":{"Value1":773,"Value2":"9QEUBwEOAg=="},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bool","Key":true,"Value":{"valNotNull":false,"valNullable":null},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint64","Key":5388077,"Value":[1382203,null],"Delete":false},{"TypeName":"test_int16","Key":151,"Value":[-19691,3],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["|󺪆𝅲=鄖_.;ǀ⃣%; #~",16],"Value":null,"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"¨¹^Z_{/ a","Value":[-645,"ABQBAw==",0.33674474700582796,2023],"Delete":false},{"TypeName":"RetainDeletions","Key":"𝅲𝡇","Value":{"Value1":3666,"Value2":"PLgAFjwIEw=="},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_int32","Key":13,"Value":[1,639842],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["[",-5782],"Value":null,"Delete":false}]} Commit: {} StartBlock: {2 } OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"ᾢ","Value":[3,"AQQF3LYA"],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"_; ᾚ DzA{˭҄\nA ^$?ᾦ,:\u003c\"?_\u0014;|","Value":{"Value1":-15,"Value2":"PED/","Value3":7.997156312768529e-26,"Value4":33975920899014},"Delete":false},{"TypeName":"Simple","Key":"","Value":[-2,"FwY="],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_address","Key":"AgDYbdMBAZ31DGsBs7UGnAp/BgX/BkQFAQ3Si9sd6x8Hrw==","Value":{"valNotNull":"/2ADvYQC/wATggAAAwYBLjQCAv8=","valNullable":null},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_address","Key":"GJQSAs0BGAILARUXAwIrnf8pBgIrRQOrSQNOEgfvA8ATAAEMVw8s/w==","Value":["GwADWP8AMB6z0AZCDgEDMv8DfQEQ","DAHaBAOt3g16AQAfNQEBeQYBAlv/AfgKUi0YAgg="],"Delete":false},{"TypeName":"test_duration","Key":468,"Value":[-52600,null],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"_; ᾚ DzA{˭҄\nA ^$?ᾦ,:\u003c\"?_\u0014;|","Value":{"Value1":-15,"Value2":"PED/","Value3":7.997156312768529e-26,"Value4":33975920899014},"Delete":false},{"TypeName":"Simple","Key":"$#","Value":[2114984433,"M/80"],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_string","Key":"a]\u003e/a֍)!\"˂A","Value":["",null],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":" Ⅻ\t%a","Value":{"Value1":12733,"Value2":"hAL/"},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_address","Key":"AAEgvwGmbgFqAAGkMQAYlBICzQEYAgsBFRcDAiud/ykGAitFA6tJA04SB+8DwBMAAQxXDyz/","Value":["GwADWP8AMB6z0AZCDgEDMv8DfQEQ","DAHaBAOt3g16AQAfNQEBeQYBAlv/AfgKUi0YAgg="],"Delete":false},{"TypeName":"test_duration","Key":468,"Value":[-52600,null],"Delete":false}]} OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":": Ⱥ","Value":[-14,"fmoD3wY="],"Delete":false},{"TypeName":"TwoKeys","Key":["Ⱥ꙱Lj",12],"Value":null,"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"$","Value":[13,"Uf8VAgYltOwK"],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["",-4],"Value":null,"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bool","Key":true,"Value":{"valNotNull":false,"valNullable":null},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"\t;𞄱𑨁௺ⅦA×~ႂᛯaA","Value":{"Value1":2147483647,"Value2":"AAMBAgADGA4="},"Delete":false},{"TypeName":"RetainDeletions","Key":"\nȺ*|𑀾","Value":{"Value1":0,"Value2":"ChoCY0w="},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Singleton","Key":null,"Value":["\u000b!","OQ=="],"Delete":false},{"TypeName":"Singleton","Key":null,"Value":["a",""],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ThreeKeys","Key":["$",-1,774000],"Value":-11,"Delete":false},{"TypeName":"RetainDeletions","Key":"","Value":[-889,"AWoJAQI+4wEDAAD/A14DNwCH7O7QtACtCh4JCrwID+GQawo="],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bool","Key":false,"Value":[true,false],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"\"رऻ","Value":[-9237464,"BQ4CYQ=="],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"ᾎⅰ\u000bA*","Value":{"Value1":0,"Value2":"AA=="},"Delete":false}]} Commit: {} StartBlock: {3 } OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_int32","Key":-103,"Value":{"valNotNull":-1887959808,"valNullable":2096073436},"Delete":false}]} OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bool","Key":true,"Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"","Value":{"Value1":-4,"Value2":"","Value3":5.199354003997906e-290,"Value4":2703222758},"Delete":false},{"TypeName":"ThreeKeys","Key":["˖|󺪆𝅲=鄖_.;ǀ⃣%; #~",16,512578],"Value":11281,"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"","Value":{"Value1":-4,"Value2":"","Value3":5.199354003997906e-290,"Value4":2703222758},"Delete":false},{"TypeName":"ThreeKeys","Key":["$",-1,774000],"Value":11281,"Delete":false}]} OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint8","Key":7,"Value":{"valNotNull":1,"valNullable":150},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"?൙ဴ𑇑\".+AB","Value":[-1,"LP8="],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_integer","Key":"72961530924372552","Value":["080207094","-598415299"],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_float64","Key":-1.7392669057403718e+166,"Value":[1.556643269146063e-16,-1.1920928955078125e-7],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["ऻॉ~$𒐈+Xʱ:²-~?ʳ~$ₜ\\",-787],"Value":null,"Delete":false},{"TypeName":"Singleton","Key":null,"Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"\u000b𝜛࣢Ⱥ +\u001c","Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint8","Key":14,"Value":[4,1],"Delete":false},{"TypeName":"test_address","Key":"AgDYbdMBAZ31DGsBs7UGnAp/BgX/BkQFAQ3Si9sd6x8Hrw==","Value":["BQEBAemXEjNqrx2kATMdGuUCESLnES4KAfAC//v/A9gJIaQNAQH/kcYdDw==","lMhHJAXnpQG+wgIzzAoNWjoAGTIABQ=="],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["Ⱥ꙱Lj",12],"Value":null,"Delete":true}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"_ _^.ෛ᧰;1A","Value":[-1,"LP8="],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_integer","Key":"-7261530924372552","Value":["080207094","-598415299"],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_float64","Key":-368,"Value":{"valNotNull":1.142364501953125,"valNullable":4.509373305100153e-141},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"_; ᾚ DzA{˭҄\nA ^$?ᾦ,:\u003c\"?_\u0014;|","Value":{"Value1":-102862,"Value3":-0.4372412548364082,"Value4":3369109024730919},"Delete":false},{"TypeName":"Simple","Key":"$#","Value":[-15470,"sgAB"],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_decimal","Key":"2.78157850","Value":{"valNotNull":"-2.564","valNullable":null},"Delete":false},{"TypeName":"test_int64","Key":9223372036854775807,"Value":[-9223372036854775808,6033],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"↓ʰ/₱ {","Value":{"Value1":2147483647,"Value2":"","Value3":-4.236080089134453e-9,"Value4":3392046},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"~ᾈ\u0004󱜏a _〩ãᛮDž𑣠ʰA%a","Value":{"Value1":361,"Value2":"AVpAjeACFY7Tph5n"},"Delete":false}]} Commit: {} StartBlock: {4 } OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_duration","Key":-152,"Value":{"valNotNull":1476419818092,"valNullable":-163469},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"‮","Value":[-1,"GwE="],"Delete":false},{"TypeName":"ManyValues","Key":"","Value":[1,"",4.1017235364794545e-228,25],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":".(","Value":null,"Delete":true},{"TypeName":"Singleton","Key":null,"Value":{"Value":"ᾫ+=[฿́\u001b\u003cʰ+`𑱐@\u001b*Dž‮#₻\u0001῎ !a܏ῼ","Value2":"AgI="},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"?൙ဴ𑇑\".+AB","Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":" ","Value":[-1,""],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ThreeKeys","Key":["",11,107],"Value":{"Value1":-31402597},"Delete":false},{"TypeName":"Simple","Key":"\t;𞄱𑨁௺ⅦA×~ႂᛯaA","Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint16","Key":0,"Value":{"valNotNull":68,"valNullable":null},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_address","Key":"PQYReIgDAAG/6fs+AVcXxgEGDXLQ30f0/w==","Value":["b+QAdJmb/0hGGAMzEoat/wYeAQcB/wO7Ae0BlgQFAP+i7A0rGA8ESIv+Oi+eFwIDHAMAygDjBogABwADAAC5Aw==",null],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ThreeKeys","Key":["\tA𐞙?\t",-5317218,1],"Value":{"Value1":-220},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_integer","Key":"617","Value":{"valNotNull":"688647620","valNullable":null},"Delete":false},{"TypeName":"test_bool","Key":false,"Value":null,"Delete":true}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"‮","Value":[-1,"GwE="],"Delete":false},{"TypeName":"ManyValues","Key":"↓ʰ/₱ {","Value":[1,"",4.1017235364794545e-228,25],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"ᾎⅰ\u000bA*","Value":null,"Delete":true},{"TypeName":"Singleton","Key":null,"Value":{"Value2":""},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_enum","Key":"foo","Value":{"valNotNull":"baz","valNullable":"bar"},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_decimal","Key":"-618.7416010936009","Value":["4",null],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ThreeKeys","Key":["",11,107],"Value":{"Value1":-31402597},"Delete":false},{"TypeName":"Simple","Key":"\"رऻ","Value":null,"Delete":true}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint16","Key":24,"Value":[0,null],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint8","Key":61,"Value":[6,6],"Delete":false},{"TypeName":"test_int64","Key":9223372036854775807,"Value":null,"Delete":true}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"\u0026ắA","Value":null,"Delete":true},{"TypeName":"ManyValues","Key":"","Value":{"Value4":7},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"؁〩a_𞥟","Value":[-9890928,"5AB0mZv/SEYYAzMShq3/Bh4B"],"Delete":false}]} Commit: {} StartBlock: {5 } -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bool","Key":true,"Value":{"valNotNull":true,"valNullable":null},"Delete":false},{"TypeName":"test_uint64","Key":21,"Value":{"valNotNull":73,"valNullable":2},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_address","Key":"AgDYbdMBAZ31DGsBs7UGnAp/BgX/BkQFAQ3Si9sd6x8Hrw==","Value":["BQBsCf9MAgQAGfzKAAu1AYAClAADAhlDAP+oChQBYQA5AA0LT19MujQyf/8FbQMDawAM",null],"Delete":false},{"TypeName":"test_enum","Key":"foo","Value":{"valNotNull":"foo","valNullable":"foo"},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Singleton","Key":null,"Value":["𝔏؃\"ᵚ¡ $A\r",""],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ThreeKeys","Key":["𒑏𑿞=A?¯ \t~",-6,53],"Value":-2,"Delete":false},{"TypeName":"Simple","Key":"?","Value":{"Value1":12,"Value2":"HAIBmK0D"},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"⍦","Value":[-202,"EQTRAwAELg=="],"Delete":false},{"TypeName":"ManyValues","Key":"`ⅤaAះA~~⹗=\u000b","Value":[-17,"okMB1d0=",-3.643491752614398e+288,1382771530458],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_float64","Key":0,"Value":[-1014342049.3947449,null],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["a\u003c",-84],"Value":null,"Delete":true},{"TypeName":"Simple","Key":"d⹘:","Value":[3016,"AQ=="],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bytes","Key":"AwMbGS8=","Value":null,"Delete":true},{"TypeName":"test_decimal","Key":"-02","Value":["1219101",null],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_decimal","Key":"9.5E+8","Value":{"valNotNull":"13333140202.01031939e81","valNullable":"7210210.1e+1"},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint16","Key":11,"Value":[6,14912],"Delete":false},{"TypeName":"test_duration","Key":-152,"Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"`³Njॊ\u003c ?ᾩ‮₦~$","Value":{"Value1":2,"Value2":"lAAD4AAABQQbAwABAwHP"},"Delete":false},{"TypeName":"RetainDeletions","Key":"൴~𝔶ٞ蹯a_ ᛮ!؋aض©-?","Value":{"Value1":-6813,"Value2":"AhRPdlAC"},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_address","Key":"BkiVAAcAAJ6xA/dutlmcBe8DAA1UZAsB","Value":["AA57GQP/oifkJ8aYJENTAwLxPhPSAwEI1AA9xQMWAwEoBA==",null],"Delete":false},{"TypeName":"test_address","Key":"7QTt/24APN4FBA/TAG8B/wMBWOoCqP+HNg0FBQIdAw8F5AI=","Value":["BQNcFhh01gEBAm4BAfAlGwMKkCo=","aQQTfSUg2RkZARH/EP8IGAxENIBOGwbPFAA="],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_int8","Key":6,"Value":[-8,null],"Delete":false},{"TypeName":"test_address","Key":"AACHBAjyAgFHOQAABo+PGAK3Bj7TwwBb/wAB3gE=","Value":["ASwojxUABA8BAf/9AgUBIs4WAq9lqAEKAP8FAAgCGwEMDQKHZwEABA82AVZZAHO/ngS7AA==",null],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_address","Key":"AWvYAbSo5gQCAz8XAQYGjwCaRx0DSAUpAWQV","Value":["/z/eNBkL5QAgCwXergJOUCEC/+ICAp4BTgBsVw==","HhoELBAPigABQwIDAxsB7KEAGlIOEAAEYQL/GQA37QAJWg0A"],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":" ","Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_decimal","Key":"79","Value":["-7872","53"],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint32","Key":1322158439,"Value":{"valNotNull":2415,"valNullable":null},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"_; ᾚ DzA{˭҄\nA ^$?ᾦ,:\u003c\"?_\u0014;|","Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ThreeKeys","Key":["\tA𐞙?\t",-5317218,1],"Value":-2147483648,"Delete":false},{"TypeName":"ManyValues","Key":"‮۽𝅸\u003c#󠁋","Value":[-3,"",-5.385845077524242e-269,2468],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bool","Key":false,"Value":null,"Delete":true},{"TypeName":"test_int8","Key":-6,"Value":{"valNotNull":122,"valNullable":null},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"¨¹^Z_{/ a","Value":{"Value4":80},"Delete":false},{"TypeName":"RetainDeletions","Key":"@‮:","Value":[3016,"AQ=="],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bytes","Key":"AQ==","Value":{"valNotNull":"ogMIrOI=","valNullable":null},"Delete":false},{"TypeName":"test_float32","Key":-463,"Value":{"valNotNull":-58786,"valNullable":null},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"῭𝚰ഃȺAᶊ?","Value":[-1164946,"",1.176159974717759e+49,1691822],"Delete":false},{"TypeName":"RetainDeletions","Key":"#\\","Value":[1,"FQMCAG04AaQN"],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_decimal","Key":"2.78157850","Value":null,"Delete":true},{"TypeName":"test_uint64","Key":43469486790,"Value":{"valNotNull":49,"valNullable":null},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["\"A",-2147483648],"Value":null,"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_int32","Key":-103,"Value":[2147483647,null],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Singleton","Key":null,"Value":{"Value2":"BmoB"},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["#",0],"Value":null,"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_string","Key":"","Value":["₦~$",""],"Delete":false},{"TypeName":"test_int64","Key":-9943728846472,"Value":{"valNotNull":-3216,"valNullable":null},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"!\u0003ᾩ̴+a","Value":{"Value1":314182053,"Value2":"Gxc="},"Delete":false},{"TypeName":"TwoKeys","Key":["a\u003c",-84],"Value":null,"Delete":true}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"?","Value":{"Value1":-6813,"Value2":"AhRPdlAC","Value3":0.00182342529296875,"Value4":2},"Delete":false},{"TypeName":"ManyValues","Key":"յ","Value":[2147483647,"AA==",4.804339095791555e-248,395354],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"","Value":null,"Delete":true}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint8","Key":61,"Value":{"valNullable":255},"Delete":false},{"TypeName":"test_int64","Key":-3,"Value":[-6367,null],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["@",2],"Value":null,"Delete":false},{"TypeName":"TwoKeys","Key":["Ⱥ꙱Lj",12],"Value":null,"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["|󺪆𝅲=鄖_.;ǀ⃣%; #~",16],"Value":null,"Delete":true},{"TypeName":"ThreeKeys","Key":["$",-1,774000],"Value":{"Value1":-2147483648},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_enum","Key":"bar","Value":{"valNotNull":"bar","valNullable":"baz"},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint32","Key":1275013456,"Value":[0,null],"Delete":false},{"TypeName":"test_decimal","Key":"-924017190.947061628950076222998262213","Value":{"valNotNull":"5063","valNullable":null},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"\t","Value":{"Value1":17694,"Value2":"","Value3":-3.0734751418966004,"Value4":1505826045},"Delete":false}]} Commit: {} StartBlock: {6 } -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["A𞥟",981],"Value":null,"Delete":false},{"TypeName":"ManyValues","Key":"ᵕ؏­􏿽A","Value":{"Value1":-317,"Value2":"AA==","Value3":-37.62890625,"Value4":232},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_address","Key":"AACHBAjyAgFHOQAABo+PGAK3Bj7TwwBb/wAB3gE=","Value":{"valNotNull":"HBwBHAY6AAKO+UwDKRICAT0lgRRvCRvHFFoNAigBAUEDHoQUfB2qApRB/z41AAubARsBATQg3gCppQMAAQwHAQ=="},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_decimal","Key":"9.5E+8","Value":["-2","88111430.0122412446"],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint8","Key":7,"Value":null,"Delete":true},{"TypeName":"test_time","Key":"1969-12-31T18:59:59.999999999-05:00","Value":["1969-12-31T19:00:00.000000001-05:00",null],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"൴~𝔶ٞ蹯a_ ᛮ!؋aض©-?","Value":{"Value2":""},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint8","Key":14,"Value":{"valNotNull":116},"Delete":false},{"TypeName":"test_duration","Key":100403021838,"Value":[1547,null],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_int64","Key":-34196421,"Value":[56,224549431],"Delete":false},{"TypeName":"test_bool","Key":true,"Value":{"valNotNull":true,"valNullable":null},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ThreeKeys","Key":["ⅷ_ŕ,A",-467,98],"Value":{"Value1":145},"Delete":false},{"TypeName":"RetainDeletions","Key":"?aa₽A\u001b=⇂́ᯫ𖽦ᩣ","Value":{"Value1":0,"Value2":""},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["",-4],"Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"","Value":{"Value1":1174095848,"Value2":"AR//A0kBNVwGGGsHANYAAAAtJQ=="},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint64","Key":3,"Value":[14481555953,496],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"ǃ^@❽\u2028!𑿞a‮a`","Value":{"Value1":-33730,"Value2":"qKQ="},"Delete":false},{"TypeName":"Singleton","Key":null,"Value":["𞤎𞤡","BAconQGXHRuHXQN/GTUCSQACEg=="],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"ൌ{ ༿","Value":[1110340689,"AQ==",0.00018342199999210607,1],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bytes","Key":"AwcJA//C","Value":{"valNotNull":"DQ==","valNullable":null},"Delete":false},{"TypeName":"test_duration","Key":210213542904,"Value":[-207349773999415086,null],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_float64","Key":-3.0664227080502325e-103,"Value":[2.125936378595003e-239,null],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["A𞥟",981],"Value":null,"Delete":false},{"TypeName":"ManyValues","Key":"¨¹^Z_{/ a","Value":[-1060712359,"",14247.827343544246,589],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"̅Ⱥ‮","Value":[1,"AA=="],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_integer","Key":"-902404257","Value":["-34617","11684004"],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Singleton","Key":null,"Value":{"Value":"\u0011.-A©Aa"},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_decimal","Key":"-618.7416010936009","Value":["-2","88111430.0122412446"],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint8","Key":7,"Value":null,"Delete":true},{"TypeName":"test_time","Key":"1969-12-31T19:00:19.631216449-05:00","Value":null,"Delete":true}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint8","Key":3,"Value":[105,null],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_duration","Key":100403021838,"Value":[1547,null],"Delete":false},{"TypeName":"test_uint8","Key":61,"Value":[0,17],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":",a _ŕ,A","Value":{"Value1":-2956,"Value2":"b8ABC3UL"},"Delete":false},{"TypeName":"TwoKeys","Key":["#",0],"Value":null,"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"A","Value":[-1634,"xYV1wGkDTQQD5w=="],"Delete":false},{"TypeName":"TwoKeys","Key":["\"A",-2147483648],"Value":null,"Delete":true}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_address","Key":"AAEgvwGmbgFqAAGkMQAYlBICzQEYAgsBFRcDAiud/ykGAitFA6tJA04SB+8DwBMAAQxXDyz/","Value":["BFEKBowcIgQV/wCLEmwagiSjAANRA/EELQFeGDQtGv/5rdA1AAMeuQEoF8eoAQ==","HXoB/wT4E1QBVHuwBhkBAecMS5cABRkBIychAQhyHAdtbnvkAQcAUQEAAiIJAQczcAEDAAAA2uiNAQEAY4d1Aw=="],"Delete":false},{"TypeName":"test_string","Key":"a]\u003e/a֍)!\"˂A","Value":null,"Delete":true}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint16","Key":24,"Value":null,"Delete":true}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bool","Key":true,"Value":[true,null],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"~_̀\u000b","Value":[1,""],"Delete":false},{"TypeName":"RetainDeletions","Key":"𑇕|िaA\u003eA˖Aࢍ󾊥","Value":[-41836,"qUoBBFA="],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["Ⱥ꙱Lj",12],"Value":null,"Delete":false}]} Commit: {} StartBlock: {7 } -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bool","Key":true,"Value":{"valNotNull":true,"valNullable":true},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"d⹘:","Value":{"Value2":""},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["ऻॉ~$𒐈+Xʱ:²-~?ʳ~$ₜ\\",-787],"Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["ः𒑨Dz؅",-2],"Value":null,"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ThreeKeys","Key":["@(\u0001\u0001\tᛰᾚ𐺭a'ᵆᾭaa",16,817744173394],"Value":{"Value1":-2},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bytes","Key":"AwcJA//C","Value":{"valNotNull":"AWNXAw=="},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_decimal","Key":"-85","Value":["-2511998","-077.01427082957E-7"],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_int16","Key":-988,"Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_enum","Key":"foo","Value":null,"Delete":true},{"TypeName":"test_decimal","Key":"-02","Value":["-40892500970.58239","11e0"],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_string","Key":"","Value":{"valNotNull":"実.*𑁤!؋A\u000b.{;?󠀮_? ‍*🄑󠇯","valNullable":"(Ⱥ#/\u003c_"},"Delete":false},{"TypeName":"test_integer","Key":"-1391361","Value":{"valNotNull":"-0105","valNullable":null},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_address","Key":"AWvYAbSo5gQCAz8XAQYGjwCaRx0DSAUpAWQV","Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_int8","Key":98,"Value":[-40,null],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bool","Key":false,"Value":[true,null],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_integer","Key":"-7261530924372552","Value":null,"Delete":true}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Singleton","Key":null,"Value":null,"Delete":true}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bool","Key":true,"Value":[true,false],"Delete":false},{"TypeName":"test_int16","Key":3,"Value":[0,null],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ThreeKeys","Key":["A˜Ľ᠔",191623,168792497866039],"Value":{"Value1":87},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"🚞;aীDz","Value":{"Value1":294,"Value2":"BATeW2cC","Value3":5.9263472855091095,"Value4":23},"Delete":false},{"TypeName":"Simple","Key":"\taaaa𐅋́{󠁐 #\t\u001bץः𒐟𐅘᭢a","Value":[-23103798,"AwcGAg=="],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_int16","Key":453,"Value":{"valNotNull":15040,"valNullable":3},"Delete":false},{"TypeName":"test_enum","Key":"bar","Value":{"valNullable":"bar"},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"ᾢ","Value":[-4,"AtkOBQphAII3AQ=="],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ThreeKeys","Key":["±?󠀮_? ‍*🄑󠇯",-40,138699519114],"Value":{"Value1":-275850},"Delete":false},{"TypeName":"TwoKeys","Key":["#/\u003c_",-5],"Value":null,"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"","Value":null,"Delete":true},{"TypeName":"ThreeKeys","Key":["$",-1,774000],"Value":null,"Delete":true}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"_; ᾚ DzA{˭҄\nA ^$?ᾦ,:\u003c\"?_\u0014;|","Value":{"Value3":8.808423392052715e-20,"Value4":0},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"?","Value":null,"Delete":true},{"TypeName":"Simple","Key":";|⃝⤎?‮","Value":[8706,"AI8mhQ=="],"Delete":false}]} Commit: {} StartBlock: {8 } -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"$","Value":[0,""],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"‮","Value":[0,""],"Delete":false}]} OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_decimal","Key":"8E4","Value":{"valNotNull":"4043421E29","valNullable":null},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_address","Key":"AACHBAjyAgFHOQAABo+PGAK3Bj7TwwBb/wAB3gE=","Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["A𞥟",981],"Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["",55175],"Value":null,"Delete":false},{"TypeName":"RetainDeletions","Key":"`³Njॊ\u003c ?ᾩ‮₦~$","Value":{"Value1":3},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_duration","Key":468,"Value":[-4,-805402038367],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bool","Key":true,"Value":null,"Delete":true},{"TypeName":"test_int32","Key":-24,"Value":[1,null],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"҉߃ ","Value":[-526,""],"Delete":false},{"TypeName":"Simple","Key":": Ⱥ","Value":[59,"Kw=="],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_enum","Key":"bar","Value":{"valNotNull":"foo","valNullable":null},"Delete":false},{"TypeName":"test_int64","Key":2481611475,"Value":[136,6],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_float64","Key":-3.0664227080502325e-103,"Value":[-0.34326171875,-1.9202818317669984e-13],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Singleton","Key":null,"Value":null,"Delete":true},{"TypeName":"Singleton","Key":null,"Value":{"Value":"","Value2":"ClAs"},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"?b⁠\r##﹍/$ͥ","Value":[10,"",5.231528162956238,42],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"ݙaس\u003cй?{E","Value":{"Value1":-15,"Value2":"o+MQ"},"Delete":false},{"TypeName":"RetainDeletions","Key":"൴~𝔶ٞ蹯a_ ᛮ!؋aض©-?","Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bytes","Key":"AwcJA//C","Value":{"valNullable":""},"Delete":false},{"TypeName":"test_uint32","Key":1322158439,"Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["ꬵ[Ⰶ\u2029\u0026𒐗🕳c҉\u0026฿a\u0026",-79424],"Value":null,"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_int8","Key":-128,"Value":[7,null],"Delete":false},{"TypeName":"test_int32","Key":-103,"Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"ᾢ","Value":[-2356,"DA=="],"Delete":false},{"TypeName":"ManyValues","Key":"","Value":{"Value1":28,"Value2":"","Value3":-1.6098999622118156e+67,"Value4":14},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"?≚a'","Value":{"Value1":-611,"Value2":"AgqTAG4=","Value3":-2.0360732649240822e+100,"Value4":0},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_float64","Key":0,"Value":[2.5625,null],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint64","Key":3,"Value":{"valNotNull":59,"valNullable":null},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_address","Key":"AAEgvwGmbgFqAAGkMQAYlBICzQEYAgsBFRcDAiud/ykGAitFA6tJA04SB+8DwBMAAQxXDyz/","Value":{"valNullable":"BOYwACUAABLY7gECcQYUogBeNQE="},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"?+‌᭵̄$߃ ","Value":[-526,""],"Delete":false},{"TypeName":"Simple","Key":" Ⅻ\t%a","Value":{"Value1":-3584},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_time","Key":"1969-12-31T19:00:00.000000081-05:00","Value":{"valNotNull":"1969-12-31T18:59:59.999998159-05:00","valNullable":null},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint8","Key":1,"Value":[56,54],"Delete":false},{"TypeName":"test_uint32","Key":6,"Value":{"valNotNull":13,"valNullable":null},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bool","Key":true,"Value":null,"Delete":true},{"TypeName":"test_int8","Key":98,"Value":{"valNotNull":25,"valNullable":-49},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"A","Value":null,"Delete":true}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ThreeKeys","Key":["A˜Ľ᠔",191623,168792497866039],"Value":{"Value1":87072},"Delete":false},{"TypeName":"TwoKeys","Key":["aA\u003c‌ऻ⁠\r##﹍/$ͥ",-4],"Value":null,"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bytes","Key":"AQ==","Value":null,"Delete":true},{"TypeName":"test_uint64","Key":271328219,"Value":[9960,1],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint64","Key":43469486790,"Value":null,"Delete":true},{"TypeName":"test_float64","Key":-368,"Value":{"valNotNull":-3.9541311264038086,"valNullable":null},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Singleton","Key":null,"Value":["","DTQAB6ENAQ=="],"Delete":false},{"TypeName":"ManyValues","Key":"յ","Value":[248203,"",-29237.73048098229,108708571677],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_float64","Key":-2,"Value":[1.1408884758148922e-229,null],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint64","Key":5388077,"Value":{"valNotNull":4576150250879893,"valNullable":329},"Delete":false},{"TypeName":"test_duration","Key":-152,"Value":null,"Delete":true}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint8","Key":3,"Value":[1,null],"Delete":false},{"TypeName":"test_bool","Key":false,"Value":{"valNullable":true},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"\t","Value":{"Value2":"ABU=","Value3":-2.1604673743609532e-204},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"꙱؁\t­","Value":[-3,"",1.3442634946997238e+307,1561872634],"Delete":false},{"TypeName":"ManyValues","Key":"A⃟`?+₯~ী²a𞥃💵𐴸-/","Value":{"Value1":1647,"Value2":"aocGBA==","Value3":700057251012346200,"Value4":22},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_enum","Key":"baz","Value":["foo","foo"],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"ƻ̄n","Value":[-4385933,"9QARXRwUUPU=",3.130815935698223e+222,46],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"ऻ^₩́Ì'\u0017A:ĕ\u0026\\⁡\r$a","Value":[-27600,"LAYJAzkABc0A"],"Delete":false},{"TypeName":"TwoKeys","Key":[" ",2],"Value":null,"Delete":false}]} Commit: {} StartBlock: {9 } -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["ः𒑨Dz؅",-2],"Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"_�é","Value":{"Value1":9,"Value2":"Ywc="},"Delete":false},{"TypeName":"Singleton","Key":null,"Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"A%aa ¹­ ᾏaĵ¨","Value":[9,"A/faBuYCCecZ3ATQAQcC3gAsizI="],"Delete":false},{"TypeName":"ThreeKeys","Key":[" {a",2790155,310794],"Value":{"Value1":312},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_int32","Key":892,"Value":[-3,null],"Delete":false},{"TypeName":"test_duration","Key":210213542904,"Value":[-722503,113854019],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_duration","Key":468,"Value":[12,null],"Delete":false},{"TypeName":"test_int16","Key":0,"Value":[3089,null],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_decimal","Key":"79","Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ThreeKeys","Key":["",11,107],"Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bool","Key":false,"Value":[true,true],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":": Ⱥ","Value":{"Value1":-2147483648},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint8","Key":14,"Value":null,"Delete":true},{"TypeName":"test_integer","Key":"-1391361","Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"","Value":[-242379,"BngOEOsA"],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_int8","Key":6,"Value":null,"Delete":true},{"TypeName":"test_address","Key":"BkiVAAcAAJ6xA/dutlmcBe8DAA1UZAsB","Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":" 😖₱ ̄؀ा󠁿","Value":[7541152,""],"Delete":false},{"TypeName":"ThreeKeys","Key":["ⅷ_ŕ,A",-467,98],"Value":2,"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["#",0],"Value":null,"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ThreeKeys","Key":["�é",4,5],"Value":-21,"Delete":false},{"TypeName":"RetainDeletions","Key":"ǀȺA%aa ¹­ ᾏaĵ¨","Value":[9,"A/faBuYCCecZ3ATQAQcC3gAsizI="],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bool","Key":true,"Value":{"valNotNull":false,"valNullable":null},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"@d𒐽\u001b⃠","Value":[83523,"fgihAbYBRq4BAR4ATWUwAAADAUgDCZEI",5.463114807757741e-9,2],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint8","Key":146,"Value":[2,null],"Delete":false},{"TypeName":"test_uint16","Key":36451,"Value":[2,null],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ThreeKeys","Key":["±?󠀮_? ‍*🄑󠇯",-40,138699519114],"Value":null,"Delete":true}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_integer","Key":"-902404257","Value":null,"Delete":true},{"TypeName":"test_bool","Key":false,"Value":null,"Delete":true}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_int8","Key":98,"Value":[-45,16],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"V:\u0004","Value":{"Value1":-2,"Value2":""},"Delete":false},{"TypeName":"ManyValues","Key":"A⃟`?+₯~ী²a𞥃💵𐴸-/","Value":null,"Delete":true}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"~ᾈ\u0004󱜏a _〩ãᛮDž𑣠ʰA%a","Value":null,"Delete":true},{"TypeName":"Simple","Key":"$#","Value":null,"Delete":true}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"B;ᛮ\"𐅕\u0026؀ा󠁿","Value":[7541152,"",-3.2742207969630795e+66,1],"Delete":false},{"TypeName":"Simple","Key":"A{","Value":[4,"BQ34"],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint8","Key":1,"Value":[18,1],"Delete":false},{"TypeName":"test_bytes","Key":"xxV9kyMR","Value":["SwFUlRYWA7Q1C5MCMA==",null],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"~_̀\u000b","Value":[2147483647,"WgL/BAEBsg=="],"Delete":false}]} Commit: {} StartBlock: {10 } -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_duration","Key":87208838869,"Value":[-9725,4968373],"Delete":false},{"TypeName":"test_duration","Key":468,"Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"","Value":[-1,"FQIK"],"Delete":false},{"TypeName":"Singleton","Key":null,"Value":{"Value":"œLj$࿇ ᾙ☇؄ೲȺ","Value2":"ADei6AACZTMDDss="},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bool","Key":false,"Value":[true,null],"Delete":false},{"TypeName":"test_enum","Key":"bar","Value":{"valNotNull":"baz","valNullable":"baz"},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ThreeKeys","Key":["\tA𐞙?\t",-5317218,1],"Value":{"Value1":1},"Delete":false},{"TypeName":"RetainDeletions","Key":"\u0026 ٱȺ+҉@","Value":[63,"AAE="],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_float64","Key":-1.7392669057403718e+166,"Value":[-1.0781831287525041e+139,111.37014762980289],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_address","Key":"GJQSAs0BGAILARUXAwIrnf8pBgIrRQOrSQNOEgfvA8ATAAEMVw8s/w==","Value":{"valNotNull":"em2zQwR2O7EAAAYLk23QBADE/wA="},"Delete":false},{"TypeName":"test_address","Key":"PQYReIgDAAG/6fs+AVcXxgEGDXLQ30f0/w==","Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"","Value":[-188,"",-2632691.375,17],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ThreeKeys","Key":["A]$",-125,43],"Value":12654289,"Delete":false},{"TypeName":"RetainDeletions","Key":"?aa₽A\u001b=⇂́ᯫ𖽦ᩣ","Value":{"Value2":"ARM="},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint8","Key":0,"Value":{"valNotNull":0,"valNullable":null},"Delete":false},{"TypeName":"test_float32","Key":1.7852577e+32,"Value":[1.6582896,null],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"?b⁠\r##﹍/$ͥ","Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"TwoKeys","Key":["",55175],"Value":null,"Delete":true},{"TypeName":"ThreeKeys","Key":["˖|󺪆𝅲=鄖_.;ǀ⃣%; #~",16,512578],"Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"A%aa ¹­ ᾏaĵ¨","Value":null,"Delete":true}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"‮","Value":{"Value2":"DAcBeTgAFAED"},"Delete":false},{"TypeName":"RetainDeletions","Key":"ʵ² *ᾍA@҂b⭗@‮൞","Value":{"Value1":547,"Value2":""},"Delete":false}]} -OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_uint8","Key":4,"Value":[17,null],"Delete":false},{"TypeName":"test_uint8","Key":8,"Value":[2,12],"Delete":false}]} -OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"҉♰ᾜȺ൜堯Ⱥ៵\"","Value":{"Value1":-10,"Value2":"jg==","Value3":-0.11867497289509932,"Value4":24065},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_duration","Key":87208838869,"Value":[-9725,4968373],"Delete":false},{"TypeName":"test_duration","Key":100403021838,"Value":null,"Delete":true}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"","Value":[-1,"FQIK"],"Delete":false},{"TypeName":"Singleton","Key":null,"Value":["%؄ೲȺ","ADei6AACZTMDDss="],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_time","Key":"1969-12-31T18:59:59.999999999-05:00","Value":["1969-12-31T19:00:00.000000203-05:00","1969-12-31T18:59:59.988846518-05:00"],"Delete":false},{"TypeName":"test_bool","Key":true,"Value":{"valNotNull":false,"valNullable":true},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"ȺAª","Value":{"Value1":5,"Value2":"ByIBAAF0"},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"ʱ? -@","Value":[26,"BQ==",40371.625,136914],"Delete":false},{"TypeName":"RetainDeletions","Key":"?+‌᭵̄$߃ ","Value":[-4,"AWcfjgc="],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":"𝅲𝡇","Value":[3,"AQX4eAM="],"Delete":false},{"TypeName":"ManyValues","Key":"\t","Value":{"Value4":1956},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_int64","Key":-12,"Value":{"valNotNull":-121,"valNullable":-2},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ManyValues","Key":"","Value":[-23,"AQ==",-1.448908652612274e-70,579180],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"RetainDeletions","Key":",a _ŕ,A","Value":null,"Delete":true}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bytes","Key":"xxV9kyMR","Value":null,"Delete":true}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_float32","Key":-463,"Value":[-3.594342e-17,6.4607563e-37],"Delete":false},{"TypeName":"test_bytes","Key":"","Value":["IBEeAY8BAC1uKQU=",null],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ThreeKeys","Key":["",11,107],"Value":{"Value1":-80},"Delete":false},{"TypeName":"RetainDeletions","Key":"#\\","Value":[5521,"kwsBjw=="],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"Simple","Key":"˚~%!ˍ˃\"ᾜȺ൜堯Ⱥ៵\"","Value":{"Value1":-10,"Value2":"jg=="},"Delete":false}]} +OnObjectUpdate: {"ModuleName":"all_kinds","Updates":[{"TypeName":"test_bool","Key":false,"Value":[true,null],"Delete":false}]} +OnObjectUpdate: {"ModuleName":"test_cases","Updates":[{"TypeName":"ThreeKeys","Key":["A⒄a𲎯ڥ\u0026\u000b",1,0],"Value":{"Value1":154068889},"Delete":false},{"TypeName":"ManyValues","Key":"~ʳ{ {Ⱥ\t$࿐(#","Value":{"Value1":-26,"Value2":"","Value3":121.70742593632353,"Value4":1762146},"Delete":false}]} Commit: {} diff --git a/schema/testing/appdatasim/testdata/diff_example.txt b/schema/testing/appdatasim/testdata/diff_example.txt index fcdd45729de3..e70ae6c41b42 100644 --- a/schema/testing/appdatasim/testdata/diff_example.txt +++ b/schema/testing/appdatasim/testdata/diff_example.txt @@ -2,78 +2,69 @@ App State Diff: MODULE COUNT ERROR: expected 2, got 1 Module all_kinds Object Collection test_address - OBJECT COUNT ERROR: expected 16, got 14 - Object key=0x0c6ff6530300000704ff285714816e0d0b03010d0102010302ff7400d60103c2110e3700c30105679f0910570048aa48f6b4680128821c98011d00240c2c00ff - valNotNull: expected [43 29 85 255 6 1 176 1 241 222 0 0 14 116 190 1 11 30 2 8 1 144 12 2 12 1 16 15 1 1 27 8 0 255 57 2 6 195 255 60 0 201 255 1 1 13 9 112 1 2 0 121 12 172 254 22 11 1 5 37 54 212 121 0], got [220 0 1 2 13 4 24 1 12 24 58 0 1 224 0 148 104 51 116 27 56 39 14 32 35 84 126 2 18 1 5 6] - valNullable: expected [189 125 119 246 192 0 3 170 24 6 10 123 0 7 34 118 1 212 187 7 1 249 110 146 10 14 0 3 223 134 65 0 15 248 153], got [29 201 1 2 1 63 13 0 191 75 1 2 240 10 209 58 15 137 184 141 148] - Object key=0x18f0037d00012c006d9c72096b011e01f600035108fe0303000100031f1f020f08002203000502010120060f1b0201180203006a00e0: NOT FOUND - Object key=0xa10f005de9c1010692980d213250ef13020697430007000bdc01010305054f4001b7ba39003a01d2ae0e59007eef4e19e9020e006974016d00001c00037b7028: NOT FOUND - Object key=0xff2619001c04b3031aa10d9d167f1f0046d6760216009c: NOT FOUND - Object Collection test_bytes - OBJECT COUNT ERROR: expected 5, got 4 - Object key=0x000a4f0f6e9b67f6: NOT FOUND - Object key=0x0e0827 - valNotNull: expected [159 2], got [41 6 2 75] - valNullable: expected [0 11 54 47 28], got [6] - Object key=0xff661b1c00 - valNullable: expected [15 20 0 1 132 7 37 3 28 2], got [0 8 1 170 90 0 1 201 97 138 53 2] + OBJECT COUNT ERROR: expected 12, got 7 + Object key=0x00000306012e340202ff01a4310018941202cd0118020b01151703022b9dff2906022b4503ab49034e1207ef03c01300010c570f2cff: NOT FOUND + Object key=0x0000190f0405000a0501050288020000000100ff003b4d4b010700ff6f0e530a0e010104067a63b602055c000e0100: NOT FOUND + Object key=0x010901a813050300274200409f0200000b362f1c: NOT FOUND + Object key=0x01df2d00000627ff00fc0d9901003a93680000007501ff00010215290d000d0712: NOT FOUND + Object key=0x0200010d1a0100db010100ad8b1d0103180088bb0742258a66010303000c001200b200273e0d2051cc8656ff8304aa1d7e01: NOT FOUND + Object key=0x030201140105cc030101f5c9e4a7dafe1703f918000001cd01070309031901f007030a1371d4181bedf9c7340e82b8e655789f830106800c01a90701010d0f04: NOT FOUND + Object key=0x43063c0003f6218d29280001002e0e352f630100f70d073a01010e039a077a3d00379d0100b9018302fddb3000131939469d0172bc1614343802f916 + valNotNull: expected [6 3 149 0 1 1 95 3 5 115 6 61 5 80 15 105 31 231 0 13 222 115 183 0 193 1 0 126 181 21], got [0 8 30 7 6 2 80 6 234 1 20 2 44 227 23 5 71 7 218 161 66 107 225 254 0 11 52 57 193 126 42 62 67 0 0 43 0 212 75 255 22] + valNullable: expected [124 169 52 6 86 99 120 2 25 0 71 192 164 7 162 0 1 0 5 0 24 246 1 198 14 57 3 3 1 1 1], got [196 2 95 46 3 0 0 208 251 25 73 62 53 1 6 0 30 0 4 217 1 10 116 0 11 130 11 253 204 45 43 57 6 6 63 75 7 183 195 65 0 143 3 89 2 3 0 33 234 58 12 15 16 0 115 12 190 7 0 218] + Object key=0x810100146300390103010105021f8a2f1300000b07b7ff0207078e701700b8ee008d003709cfc800062bff00d3120010019a01ec0e058f03500039f8029601: NOT FOUND + Object Collection test_bool + Object key=true + valNotNull: expected true, got false + Object Collection test_bytes + OBJECT COUNT ERROR: expected 3, got 1 + Object key=0x: NOT FOUND + Object key=0xc2d7: NOT FOUND + Object key=0xff661b1c00 + valNotNull: expected [255 0 24 235 0 84 11], got [17] + valNullable: expected [1 18 6], got [0 8 1 170 90 0 1 201 97 138 53 2] Object Collection test_decimal - OBJECT COUNT ERROR: expected 5, got 3 - Object key=-04360.6e32: NOT FOUND - Object key=-21918e-3: NOT FOUND - Object key=-37.02e01: NOT FOUND - Object key=41090120E-3 - valNotNull: expected 04.13921382165470301184220430, got 0255559.705E-4 - valNullable: expected -2e5, got nil - Object Collection test_duration + OBJECT COUNT ERROR: expected 3, got 0 + Object key=0.00041: NOT FOUND + Object key=2236909734871917105: NOT FOUND + Object key=3.9672E+5: NOT FOUND + Object Collection test_duration OBJECT COUNT ERROR: expected 1, got 2 Object Collection test_enum - OBJECT COUNT ERROR: expected 1, got 2 + Object key=baz: NOT FOUND Object Collection test_float32 - OBJECT COUNT ERROR: expected 3, got 4 + OBJECT COUNT ERROR: expected 4, got 3 + Object key=-16: NOT FOUND + Object key=-5: NOT FOUND Object Collection test_int16 - OBJECT COUNT ERROR: expected 9, got 8 - Object key=-44: NOT FOUND + OBJECT COUNT ERROR: expected 5, got 4 + Object key=3518: NOT FOUND Object Collection test_int32 - OBJECT COUNT ERROR: expected 2, got 1 - Object key=-453: NOT FOUND - Object key=205: NOT FOUND + OBJECT COUNT ERROR: expected 3, got 4 Object Collection test_int64 - OBJECT COUNT ERROR: expected 3, got 5 - Object key=-41 - valNotNull: expected 244, got -5717 - valNullable: expected nil, got 0 - Object Collection test_int8 + Object key=-53052092: NOT FOUND + Object Collection test_int8 OBJECT COUNT ERROR: expected 4, got 3 - Object key=-2: NOT FOUND - Object key=53 - valNotNull: expected 27, got 58 - valNullable: expected nil, got -10 - Object Collection test_integer - OBJECT COUNT ERROR: expected 7, got 6 - Object key=-31083911818: NOT FOUND - Object key=191 - valNotNull: expected 62, got -47110784 - valNullable: expected 9297555, got nil - Object Collection test_string - OBJECT COUNT ERROR: expected 2, got 1 - Object key=š℠¼々¢~;-Ⱥ!˃a[ʰᾌ?{ᪧ৵%ᾯ¦〈: NOT FOUND - Object Collection test_time - OBJECT COUNT ERROR: expected 4, got 3 - Object key=1969-12-31 19:00:00.000000005 -0500 EST: NOT FOUND - Object key=1969-12-31 19:00:00.001598687 -0500 EST - valNotNull: expected 1969-12-31 19:00:00.007727197 -0500 EST, got 1969-12-31 19:00:00.034531678 -0500 EST - valNullable: expected 1969-12-31 19:00:00.000000484 -0500 EST, got 1969-12-31 19:00:00.000000033 -0500 EST - Object Collection test_uint16 - OBJECT COUNT ERROR: expected 4, got 3 - Object key=23712: NOT FOUND - Object Collection test_uint32 - OBJECT COUNT ERROR: expected 3, got 2 Object key=0: NOT FOUND + Object Collection test_string + OBJECT COUNT ERROR: expected 6, got 4 + Object key=;֏!A$⍈̈#a²𒑮{: NOT FOUND + Object key=a]>/a֍)!"˂A: NOT FOUND + Object key=҉೫ᾙ + + valNotNull: expected @۰a?, got ҉"🏿᷾꜌-?𒑮 + valNullable: expected nil, got + Object key=ਃÙ࣢Ⱥ + + valNotNull: expected \^𞻱⅗�, got 𐹹aa + valNullable: expected nil, got aa + Object Collection test_time + Object key=1969-12-31 18:59:59.99999818 -0500 EST: NOT FOUND + Object Collection test_uint32 + OBJECT COUNT ERROR: expected 2, got 3 Object Collection test_uint64 - OBJECT COUNT ERROR: expected 1, got 2 + OBJECT COUNT ERROR: expected 2, got 3 Object Collection test_uint8 - OBJECT COUNT ERROR: expected 3, got 2 - Object key=1: NOT FOUND + OBJECT COUNT ERROR: expected 2, got 1 + Object key=0: NOT FOUND Module test_cases: actual module NOT FOUND BlockNum: expected 2, got 1 diff --git a/schema/testing/diff.go b/schema/testing/diff.go index 413a9384eec3..9cf320f4cf28 100644 --- a/schema/testing/diff.go +++ b/schema/testing/diff.go @@ -3,6 +3,9 @@ package schematesting import ( "bytes" "fmt" + "math/big" + + "github.com/cockroachdb/apd/v3" "cosmossdk.io/schema" ) @@ -77,6 +80,8 @@ func DiffFieldValues(field schema.Field, expected, actual any) string { // CompareKindValues compares the expected and actual values for the provided kind and returns true if they are equal, // false if they are not, and an error if the types are not valid for the kind. +// For IntegerStringKind and DecimalStringKind values, comparisons are made based on equality of the underlying numeric +// values rather than their string encoding. func CompareKindValues(kind schema.Kind, expected, actual any) (bool, error) { if kind.ValidateValueType(expected) != nil { return false, fmt.Errorf("unexpected type %T for kind %s", expected, kind) @@ -91,6 +96,36 @@ func CompareKindValues(kind schema.Kind, expected, actual any) (bool, error) { if !bytes.Equal(expected.([]byte), actual.([]byte)) { return false, nil } + case schema.IntegerStringKind: + expectedInt := big.NewInt(0) + expectedInt, ok := expectedInt.SetString(expected.(string), 10) + if !ok { + return false, fmt.Errorf("could not convert %v to big.Int", expected) + } + + actualInt := big.NewInt(0) + actualInt, ok = actualInt.SetString(actual.(string), 10) + if !ok { + return false, fmt.Errorf("could not convert %v to big.Int", actual) + } + + if expectedInt.Cmp(actualInt) != 0 { + return false, nil + } + case schema.DecimalStringKind: + expectedDec, _, err := apd.NewFromString(expected.(string)) + if err != nil { + return false, fmt.Errorf("could not decode %v as a decimal: %w", expected, err) + } + + actualDec, _, err := apd.NewFromString(actual.(string)) + if err != nil { + return false, fmt.Errorf("could not decode %v as a decimal: %w", actual, err) + } + + if expectedDec.Cmp(actualDec) != 0 { + return false, nil + } default: if expected != actual { return false, nil diff --git a/schema/testing/diff_test.go b/schema/testing/diff_test.go new file mode 100644 index 000000000000..70bed0d1763e --- /dev/null +++ b/schema/testing/diff_test.go @@ -0,0 +1,111 @@ +package schematesting + +import ( + "testing" + + "cosmossdk.io/schema" +) + +func TestCompareKindValues(t *testing.T) { + tt := []struct { + kind schema.Kind + expected any + actual any + equal bool + expectError bool + }{ + { + kind: schema.BoolKind, + expected: "true", + actual: false, + expectError: true, + }, + { + kind: schema.BoolKind, + expected: true, + actual: "false", + expectError: true, + }, + { + kind: schema.BoolKind, + expected: true, + actual: false, + equal: false, + }, + { + kind: schema.BoolKind, + expected: true, + actual: true, + equal: true, + }, + { + kind: schema.BytesKind, + expected: []byte("hello"), + actual: []byte("world"), + equal: false, + }, + { + kind: schema.IntegerStringKind, + expected: "a123", + actual: "123", + expectError: true, + }, + { + kind: schema.IntegerStringKind, + expected: "123", + actual: "123b", + expectError: true, + }, + { + kind: schema.IntegerStringKind, + expected: "123", + actual: "1234", + equal: false, + }, + { + kind: schema.IntegerStringKind, + expected: "000123", + actual: "123", + equal: true, + }, + { + kind: schema.DecimalStringKind, + expected: "abc", + actual: "100.001", + expectError: true, + }, + { + kind: schema.DecimalStringKind, + expected: "1", + actual: "b", + expectError: true, + }, + { + kind: schema.DecimalStringKind, + expected: "1.00001", + actual: "100.001", + equal: false, + }, + { + kind: schema.DecimalStringKind, + expected: "1.00001e2", + actual: "100.001", + equal: true, + }, + { + kind: schema.DecimalStringKind, + expected: "00000100.00100000", + actual: "100.001", + equal: true, + }, + } + for _, tc := range tt { + eq, err := CompareKindValues(tc.kind, tc.expected, tc.actual) + if eq != tc.equal { + t.Errorf("expected %v, got %v", tc.equal, eq) + } + if (err != nil) != tc.expectError { + t.Errorf("expected error: %v, got %v", tc.expectError, err) + } + } +} diff --git a/schema/testing/enum.go b/schema/testing/enum.go index 40d3f6b35fbc..1c709260d840 100644 --- a/schema/testing/enum.go +++ b/schema/testing/enum.go @@ -6,14 +6,44 @@ import ( "cosmossdk.io/schema" ) -var enumValuesGen = rapid.SliceOfNDistinct(NameGen, 1, 10, func(x string) string { return x }) +var enumNumericKindGen = rapid.SampledFrom([]schema.Kind{ + schema.InvalidKind, + schema.Int8Kind, + schema.Int16Kind, + schema.Int32Kind, + schema.Uint8Kind, + schema.Uint16Kind, +}) + +var enumNumericValueGens = map[schema.Kind]*rapid.Generator[int32]{ + schema.Int8Kind: rapid.Map(rapid.Int8(), func(a int8) int32 { return int32(a) }), + schema.Int16Kind: rapid.Map(rapid.Int16(), func(a int16) int32 { return int32(a) }), + schema.Int32Kind: rapid.Map(rapid.Int32(), func(a int32) int32 { return a }), + schema.Uint8Kind: rapid.Map(rapid.Uint8(), func(a uint8) int32 { return int32(a) }), + schema.Uint16Kind: rapid.Map(rapid.Uint16(), func(a uint16) int32 { return int32(a) }), +} // EnumType generates random valid EnumTypes. -var EnumType = rapid.Custom(func(t *rapid.T) schema.EnumType { - enum := schema.EnumType{ - Name: NameGen.Draw(t, "name"), - Values: enumValuesGen.Draw(t, "values"), - } +func EnumType() *rapid.Generator[schema.EnumType] { + return rapid.Custom(func(t *rapid.T) schema.EnumType { + enum := schema.EnumType{ + Name: NameGen.Draw(t, "name"), + NumericKind: enumNumericKindGen.Draw(t, "numericKind"), + } - return enum -}) + numericValueGen := enumNumericValueGens[enum.GetNumericKind()] + numericValues := rapid.SliceOfNDistinct(numericValueGen, 1, 10, func(e int32) int32 { + return e + }).Draw(t, "values") + n := len(numericValues) + names := rapid.SliceOfNDistinct(NameGen, n, n, func(a string) string { return a }).Draw(t, "names") + values := make([]schema.EnumValueDefinition, n) + for i, v := range numericValues { + values[i] = schema.EnumValueDefinition{Name: names[i], Value: v} + } + + enum.Values = values + + return enum + }) +} diff --git a/schema/testing/enum_test.go b/schema/testing/enum_test.go index 4b84559cc520..c961d85764a1 100644 --- a/schema/testing/enum_test.go +++ b/schema/testing/enum_test.go @@ -5,11 +5,13 @@ import ( "github.com/stretchr/testify/require" "pgregory.net/rapid" + + "cosmossdk.io/schema" ) func TestEnumType(t *testing.T) { rapid.Check(t, func(t *rapid.T) { - enumType := EnumType.Draw(t, "enum") - require.NoError(t, enumType.Validate()) + enumType := EnumType().Draw(t, "enum") + require.NoError(t, enumType.Validate(schema.EmptyTypeSet())) }) } diff --git a/schema/testing/example_schema.go b/schema/testing/example_schema.go index 60ae8bba548e..81461b91b97f 100644 --- a/schema/testing/example_schema.go +++ b/schema/testing/example_schema.go @@ -10,8 +10,8 @@ import ( // that can be used in reproducible unit testing and property based testing. var ExampleAppSchema = map[string]schema.ModuleSchema{ "all_kinds": mkAllKindsModule(), - "test_cases": MustNewModuleSchema([]schema.ObjectType{ - { + "test_cases": schema.MustCompileModuleSchema( + schema.ObjectType{ Name: "Singleton", KeyFields: []schema.Field{}, ValueFields: []schema.Field{ @@ -25,7 +25,7 @@ var ExampleAppSchema = map[string]schema.ModuleSchema{ }, }, }, - { + schema.ObjectType{ Name: "Simple", KeyFields: []schema.Field{ { @@ -44,7 +44,7 @@ var ExampleAppSchema = map[string]schema.ModuleSchema{ }, }, }, - { + schema.ObjectType{ Name: "TwoKeys", KeyFields: []schema.Field{ { @@ -57,7 +57,7 @@ var ExampleAppSchema = map[string]schema.ModuleSchema{ }, }, }, - { + schema.ObjectType{ Name: "ThreeKeys", KeyFields: []schema.Field{ { @@ -80,7 +80,7 @@ var ExampleAppSchema = map[string]schema.ModuleSchema{ }, }, }, - { + schema.ObjectType{ Name: "ManyValues", KeyFields: []schema.Field{ { @@ -107,7 +107,7 @@ var ExampleAppSchema = map[string]schema.ModuleSchema{ }, }, }, - { + schema.ObjectType{ Name: "RetainDeletions", KeyFields: []schema.Field{ { @@ -127,18 +127,18 @@ var ExampleAppSchema = map[string]schema.ModuleSchema{ }, RetainDeletions: true, }, - }), + ), } func mkAllKindsModule() schema.ModuleSchema { - var objTypes []schema.ObjectType + types := []schema.Type{testEnum} for i := 1; i < int(schema.MAX_VALID_KIND); i++ { kind := schema.Kind(i) typ := mkTestObjectType(kind) - objTypes = append(objTypes, typ) + types = append(types, typ) } - return MustNewModuleSchema(objTypes) + return schema.MustCompileModuleSchema(types...) } func mkTestObjectType(kind schema.Kind) schema.ObjectType { @@ -147,11 +147,14 @@ func mkTestObjectType(kind schema.Kind) schema.ObjectType { } if kind == schema.EnumKind { - field.EnumType = testEnum + field.ReferencedType = testEnum.Name } keyField := field keyField.Name = "key" + if !kind.ValidKeyKind() { + keyField.Kind = schema.Int32Kind + } val1Field := field val1Field.Name = "valNotNull" val2Field := field @@ -167,5 +170,5 @@ func mkTestObjectType(kind schema.Kind) schema.ObjectType { var testEnum = schema.EnumType{ Name: "test_enum_type", - Values: []string{"foo", "bar", "baz"}, + Values: []schema.EnumValueDefinition{{Name: "foo", Value: 1}, {Name: "bar", Value: 2}, {Name: "baz", Value: 3}}, } diff --git a/schema/testing/field.go b/schema/testing/field.go index 670f9356a681..87154afec78e 100644 --- a/schema/testing/field.go +++ b/schema/testing/field.go @@ -2,6 +2,7 @@ package schematesting import ( "fmt" + "slices" "time" "pgregory.net/rapid" @@ -18,27 +19,47 @@ var ( ) // FieldGen generates random Field's based on the validity criteria of fields. -var FieldGen = rapid.Custom(func(t *rapid.T) schema.Field { - kind := kindGen.Draw(t, "kind") - field := schema.Field{ - Name: NameGen.Draw(t, "name"), - Kind: kind, - Nullable: boolGen.Draw(t, "nullable"), - } +func FieldGen(typeSet schema.TypeSet) *rapid.Generator[schema.Field] { + enumTypes := slices.DeleteFunc(slices.Collect(typeSet.AllTypes), func(t schema.Type) bool { + _, ok := t.(schema.EnumType) + return !ok + }) + enumTypeSelector := rapid.SampledFrom(enumTypes) + + return rapid.Custom(func(t *rapid.T) schema.Field { + kind := kindGen.Draw(t, "kind") + field := schema.Field{ + Name: NameGen.Draw(t, "name"), + Kind: kind, + Nullable: boolGen.Draw(t, "nullable"), + } - switch kind { - case schema.EnumKind: - field.EnumType = EnumType.Draw(t, "enumDefinition") - default: - } + switch kind { + case schema.EnumKind: + if len(enumTypes) == 0 { + // if we have no enum types, fall back to string + field.Kind = schema.StringKind + } else { + field.ReferencedType = enumTypeSelector.Draw(t, "enumType").TypeName() + } + default: + } - return field -}) + return field + }) +} + +// KeyFieldGen generates random key fields based on the validity criteria of key fields. +func KeyFieldGen(typeSet schema.TypeSet) *rapid.Generator[schema.Field] { + return FieldGen(typeSet).Filter(func(f schema.Field) bool { + return !f.Nullable && f.Kind.ValidKeyKind() + }) +} // FieldValueGen generates random valid values for the field, aiming to exercise the full range of possible // values for the field. -func FieldValueGen(field schema.Field) *rapid.Generator[any] { - gen := baseFieldValue(field) +func FieldValueGen(field schema.Field, typeSet schema.TypeSet) *rapid.Generator[any] { + gen := baseFieldValue(field, typeSet) if field.Nullable { return rapid.OneOf(gen, rapid.Just[any](nil)).AsAny() @@ -47,7 +68,7 @@ func FieldValueGen(field schema.Field) *rapid.Generator[any] { return gen } -func baseFieldValue(field schema.Field) *rapid.Generator[any] { +func baseFieldValue(field schema.Field, typeSet schema.TypeSet) *rapid.Generator[any] { switch field.Kind { case schema.StringKind: return rapid.StringOf(rapid.Rune().Filter(func(r rune) bool { @@ -92,25 +113,33 @@ func baseFieldValue(field schema.Field) *rapid.Generator[any] { case schema.AddressKind: return rapid.SliceOfN(rapid.Byte(), 20, 64).AsAny() case schema.EnumKind: - return rapid.SampledFrom(field.EnumType.Values).AsAny() + typ, found := typeSet.LookupType(field.ReferencedType) + enumTyp, ok := typ.(schema.EnumType) + if !found || !ok { + panic(fmt.Errorf("enum type %q not found", field.ReferencedType)) + } + + return rapid.Map(rapid.SampledFrom(enumTyp.Values), func(v schema.EnumValueDefinition) string { + return v.Name + }).AsAny() default: panic(fmt.Errorf("unexpected kind: %v", field.Kind)) } } // ObjectKeyGen generates a value that is valid for the provided object key fields. -func ObjectKeyGen(keyFields []schema.Field) *rapid.Generator[any] { +func ObjectKeyGen(keyFields []schema.Field, typeSet schema.TypeSet) *rapid.Generator[any] { if len(keyFields) == 0 { return rapid.Just[any](nil) } if len(keyFields) == 1 { - return FieldValueGen(keyFields[0]) + return FieldValueGen(keyFields[0], typeSet) } gens := make([]*rapid.Generator[any], len(keyFields)) for i, field := range keyFields { - gens[i] = FieldValueGen(field) + gens[i] = FieldValueGen(field, typeSet) } return rapid.Custom(func(t *rapid.T) any { @@ -127,16 +156,15 @@ func ObjectKeyGen(keyFields []schema.Field) *rapid.Generator[any] { // are valid for insertion (in the case forUpdate is false) or for update (in the case forUpdate is true). // Values that are for update may skip some fields in a ValueUpdates instance whereas values for insertion // will always contain all values. -func ObjectValueGen(valueFields []schema.Field, forUpdate bool) *rapid.Generator[any] { - // special case where there are no value fields - // we shouldn't end up here, but just in case +func ObjectValueGen(valueFields []schema.Field, forUpdate bool, typeSet schema.TypeSet) *rapid.Generator[any] { if len(valueFields) == 0 { + // if we have no value fields, always return nil return rapid.Just[any](nil) } gens := make([]*rapid.Generator[any], len(valueFields)) for i, field := range valueFields { - gens[i] = FieldValueGen(field) + gens[i] = FieldValueGen(field, typeSet) } return rapid.Custom(func(t *rapid.T) any { // return ValueUpdates 50% of the time diff --git a/schema/testing/field_test.go b/schema/testing/field_test.go index 7e264fcebcad..f83807ddfe85 100644 --- a/schema/testing/field_test.go +++ b/schema/testing/field_test.go @@ -5,12 +5,14 @@ import ( "github.com/stretchr/testify/require" "pgregory.net/rapid" + + "cosmossdk.io/schema" ) func TestField(t *testing.T) { rapid.Check(t, func(t *rapid.T) { - field := FieldGen.Draw(t, "field") - require.NoError(t, field.Validate()) + field := FieldGen(testEnumSchema).Draw(t, "field") + require.NoError(t, field.Validate(testEnumSchema)) }) } @@ -19,8 +21,13 @@ func TestFieldValue(t *testing.T) { } var checkFieldValue = func(t *rapid.T) { - field := FieldGen.Draw(t, "field") - require.NoError(t, field.Validate()) - fieldValue := FieldValueGen(field).Draw(t, "fieldValue") - require.NoError(t, field.ValidateValue(fieldValue)) + field := FieldGen(testEnumSchema).Draw(t, "field") + require.NoError(t, field.Validate(testEnumSchema)) + fieldValue := FieldValueGen(field, testEnumSchema).Draw(t, "fieldValue") + require.NoError(t, field.ValidateValue(fieldValue, testEnumSchema)) } + +var testEnumSchema = schema.MustCompileModuleSchema(schema.EnumType{ + Name: "test_enum", + Values: []schema.EnumValueDefinition{{Name: "a", Value: 1}, {Name: "b", Value: 2}}, +}) diff --git a/schema/testing/fmt.go b/schema/testing/fmt.go new file mode 100644 index 000000000000..e486adfeb8b7 --- /dev/null +++ b/schema/testing/fmt.go @@ -0,0 +1,53 @@ +package schematesting + +import ( + "fmt" + + "github.com/cockroachdb/apd/v3" + + "cosmossdk.io/schema" +) + +// ObjectKeyString formats the object key as a string deterministically for storage in a map. +// The key must be valid for the object type and the object type must be valid. +// No validation is performed here. +func ObjectKeyString(objectType schema.ObjectType, key any) string { + keyFields := objectType.KeyFields + n := len(keyFields) + switch n { + case 0: + return "" + case 1: + valStr := fmtValue(keyFields[0].Kind, key) + return fmt.Sprintf("%s=%v", keyFields[0].Name, valStr) + default: + ks := key.([]interface{}) + res := "" + for i := 0; i < n; i++ { + if i != 0 { + res += ", " + } + valStr := fmtValue(keyFields[i].Kind, ks[i]) + res += fmt.Sprintf("%s=%v", keyFields[i].Name, valStr) + } + return res + } +} + +func fmtValue(kind schema.Kind, value any) string { + switch kind { + case schema.BytesKind, schema.AddressKind: + return fmt.Sprintf("0x%x", value) + case schema.DecimalStringKind, schema.IntegerStringKind: + // we need to normalize decimal & integer strings to remove leading & trailing zeros + d, _, err := apd.NewFromString(value.(string)) + if err != nil { + panic(err) + } + r := &apd.Decimal{} + r, _ = r.Reduce(d) + return r.String() + default: + return fmt.Sprintf("%v", value) + } +} diff --git a/schema/testing/fmt_test.go b/schema/testing/fmt_test.go new file mode 100644 index 000000000000..02cef05d5f1b --- /dev/null +++ b/schema/testing/fmt_test.go @@ -0,0 +1,61 @@ +package schematesting + +import ( + "testing" + + "cosmossdk.io/schema" +) + +func TestObjectKeyString(t *testing.T) { + tt := []struct { + objectType schema.ObjectType + key any + expected string + }{ + { + objectType: schema.ObjectType{ + Name: "Singleton", + ValueFields: []schema.Field{ + {Name: "Value", Kind: schema.StringKind}, + }, + }, + key: nil, + expected: "", + }, + { + objectType: schema.ObjectType{ + Name: "Simple", + KeyFields: []schema.Field{{Name: "Key", Kind: schema.StringKind}}, + }, + key: "key", + expected: "Key=key", + }, + { + objectType: schema.ObjectType{ + Name: "BytesAddressDecInt", + KeyFields: []schema.Field{ + {Name: "Bz", Kind: schema.BytesKind}, + {Name: "Addr", Kind: schema.AddressKind}, + {Name: "Dec", Kind: schema.DecimalStringKind}, + {Name: "Int", Kind: schema.IntegerStringKind}, + }, + }, + key: []interface{}{ + []byte{0x01, 0x02}, + []byte{0x03, 0x04}, + "123.4560000", // trailing zeros should get removed + "0000012345678900000000000", // leading zeros should get removed and this should be in exponential form + }, + expected: "Bz=0x0102, Addr=0x0304, Dec=123.456, Int=1.23456789E+19", + }, + } + + for _, tc := range tt { + t.Run(tc.objectType.Name, func(t *testing.T) { + actual := ObjectKeyString(tc.objectType, tc.key) + if actual != tc.expected { + t.Errorf("expected %s, got %s", tc.expected, actual) + } + }) + } +} diff --git a/schema/testing/go.mod b/schema/testing/go.mod index e1cfc343bcdf..cc96f2267fc8 100644 --- a/schema/testing/go.mod +++ b/schema/testing/go.mod @@ -1,7 +1,10 @@ module cosmossdk.io/schema/testing +go 1.23 + require ( cosmossdk.io/schema v0.0.0 + github.com/cockroachdb/apd/v3 v3.2.1 github.com/stretchr/testify v1.9.0 github.com/tidwall/btree v1.7.0 gotest.tools/v3 v3.5.1 @@ -16,5 +19,3 @@ require ( ) replace cosmossdk.io/schema => ./.. - -go 1.22 diff --git a/schema/testing/go.sum b/schema/testing/go.sum index 393b537c2d4a..2ec1ed9ec0a3 100644 --- a/schema/testing/go.sum +++ b/schema/testing/go.sum @@ -1,7 +1,11 @@ +github.com/cockroachdb/apd/v3 v3.2.1 h1:U+8j7t0axsIgvQUqthuNm82HIrYXodOV2iWLWtEaIwg= +github.com/cockroachdb/apd/v3 v3.2.1/go.mod h1:klXJcjp+FffLTHlhIG69tezTDvdP065naDsHzKhYSqc= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= +github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= diff --git a/schema/testing/json_test.go b/schema/testing/json_test.go new file mode 100644 index 000000000000..7416924d69e9 --- /dev/null +++ b/schema/testing/json_test.go @@ -0,0 +1,23 @@ +package schematesting + +import ( + "encoding/json" + "testing" + + "github.com/stretchr/testify/require" + "pgregory.net/rapid" + + "cosmossdk.io/schema" +) + +func TestModuleSchemaJSON(t *testing.T) { + rapid.Check(t, func(t *rapid.T) { + modSchema := ModuleSchemaGen().Draw(t, "moduleSchema") + bz, err := json.Marshal(modSchema) + require.NoError(t, err) + var modSchema2 schema.ModuleSchema + err = json.Unmarshal(bz, &modSchema2) + require.NoError(t, err) + require.Equal(t, modSchema, modSchema2) + }) +} diff --git a/schema/testing/module_schema.go b/schema/testing/module_schema.go index 9f62bfd2d281..c874ac73a9f1 100644 --- a/schema/testing/module_schema.go +++ b/schema/testing/module_schema.go @@ -1,51 +1,36 @@ package schematesting import ( - "fmt" - "pgregory.net/rapid" "cosmossdk.io/schema" ) // ModuleSchemaGen generates random ModuleSchema's based on the validity criteria of module schemas. -var ModuleSchemaGen = rapid.Custom(func(t *rapid.T) schema.ModuleSchema { - objectTypes := objectTypesGen.Draw(t, "objectTypes") - modSchema, err := schema.NewModuleSchema(objectTypes) - if err != nil { - t.Fatal(err) - } - return modSchema -}) - -var objectTypesGen = rapid.Custom(func(t *rapid.T) []schema.ObjectType { - var objectTypes []schema.ObjectType - numObjectTypes := rapid.IntRange(1, 10).Draw(t, "numObjectTypes") - for i := 0; i < numObjectTypes; i++ { - objectType := ObjectTypeGen.Draw(t, fmt.Sprintf("objectType[%d]", i)) - objectTypes = append(objectTypes, objectType) - } - return objectTypes -}).Filter(func(objectTypes []schema.ObjectType) bool { - typeNames := map[string]bool{} - for _, objectType := range objectTypes { - if hasDuplicateNames(typeNames, objectType.KeyFields) || hasDuplicateNames(typeNames, objectType.ValueFields) { - return false +func ModuleSchemaGen() *rapid.Generator[schema.ModuleSchema] { + enumTypesGen := distinctTypes(EnumType()) + return rapid.Custom(func(t *rapid.T) schema.ModuleSchema { + enumTypes := enumTypesGen.Draw(t, "enumTypes") + tempSchema, err := schema.CompileModuleSchema(enumTypes...) + if err != nil { + t.Fatal(err) } - if typeNames[objectType.Name] { - return false + + objectTypes := distinctTypes(ObjectTypeGen(tempSchema)).Draw(t, "objectTypes") + allTypes := append(enumTypes, objectTypes...) + + modSchema, err := schema.CompileModuleSchema(allTypes...) + if err != nil { + t.Fatal(err) } - typeNames[objectType.Name] = true - } - return true -}) + return modSchema + }) +} -// MustNewModuleSchema calls NewModuleSchema and panics if there's an error. This should generally be used -// only in tests or initialization code. -func MustNewModuleSchema(objectTypes []schema.ObjectType) schema.ModuleSchema { - schema, err := schema.NewModuleSchema(objectTypes) - if err != nil { - panic(err) - } - return schema +func distinctTypes[T schema.Type](g *rapid.Generator[T]) *rapid.Generator[[]schema.Type] { + return rapid.SliceOfNDistinct(rapid.Map(g, func(t T) schema.Type { + return t + }), 1, 10, func(t schema.Type) string { + return t.TypeName() + }) } diff --git a/schema/testing/module_schema_test.go b/schema/testing/module_schema_test.go index 91196d59aa18..d42a8a9e30fc 100644 --- a/schema/testing/module_schema_test.go +++ b/schema/testing/module_schema_test.go @@ -9,7 +9,7 @@ import ( func TestModuleSchema(t *testing.T) { rapid.Check(t, func(t *rapid.T) { - schema := ModuleSchemaGen.Draw(t, "schema") + schema := ModuleSchemaGen().Draw(t, "schema") require.NoError(t, schema.Validate()) }) } diff --git a/schema/testing/object.go b/schema/testing/object.go index 8d7bd37a2a05..3e7665aa4bc5 100644 --- a/schema/testing/object.go +++ b/schema/testing/object.go @@ -7,121 +7,97 @@ import ( "cosmossdk.io/schema" ) -var fieldsGen = rapid.SliceOfNDistinct(FieldGen, 1, 12, func(f schema.Field) string { - return f.Name -}) - // ObjectTypeGen generates random ObjectType's based on the validity criteria of object types. -var ObjectTypeGen = rapid.Custom(func(t *rapid.T) schema.ObjectType { - typ := schema.ObjectType{ - Name: NameGen.Draw(t, "name"), - } - - fields := fieldsGen.Draw(t, "fields") - numKeyFields := rapid.IntRange(0, len(fields)).Draw(t, "numKeyFields") - - typ.KeyFields = fields[:numKeyFields] - - for i := range typ.KeyFields { - // key fields can't be nullable - typ.KeyFields[i].Nullable = false - } +func ObjectTypeGen(typeSet schema.TypeSet) *rapid.Generator[schema.ObjectType] { + keyFieldsGen := rapid.SliceOfNDistinct(KeyFieldGen(typeSet), 1, 6, func(f schema.Field) string { + return f.Name + }) + + valueFieldsGen := rapid.SliceOfNDistinct(FieldGen(typeSet), 1, 12, func(f schema.Field) string { + return f.Name + }) + + return rapid.Custom(func(t *rapid.T) schema.ObjectType { + typ := schema.ObjectType{ + Name: NameGen.Filter(func(s string) bool { + // filter out names that already exist in the schema + _, found := typeSet.LookupType(s) + return !found + }).Draw(t, "name"), + } - typ.ValueFields = fields[numKeyFields:] + typ.KeyFields = keyFieldsGen.Draw(t, "keyFields") + typ.ValueFields = valueFieldsGen.Draw(t, "valueFields") + typ.RetainDeletions = boolGen.Draw(t, "retainDeletions") - typ.RetainDeletions = boolGen.Draw(t, "retainDeletions") + return typ + }).Filter(func(typ schema.ObjectType) bool { + // filter out duplicate field names + fieldNames := map[string]bool{} + if hasDuplicateFieldNames(fieldNames, typ.KeyFields) { + return false + } + if hasDuplicateFieldNames(fieldNames, typ.ValueFields) { + return false + } - return typ -}).Filter(func(typ schema.ObjectType) bool { - // filter out duplicate enum names - typeNames := map[string]bool{typ.Name: true} - if hasDuplicateNames(typeNames, typ.KeyFields) { - return false - } - if hasDuplicateNames(typeNames, typ.ValueFields) { - return false - } - return true -}) + return true + }) +} -// hasDuplicateNames checks if there is type name in the fields -func hasDuplicateNames(typeNames map[string]bool, fields []schema.Field) bool { +func hasDuplicateFieldNames(typeNames map[string]bool, fields []schema.Field) bool { for _, field := range fields { - if field.Kind != schema.EnumKind { - continue - } - - if _, ok := typeNames[field.EnumType.Name]; ok { + if _, ok := typeNames[field.Name]; ok { return true } - - typeNames[field.EnumType.Name] = true + typeNames[field.Name] = true } return false } // ObjectInsertGen generates object updates that are valid for insertion. -func ObjectInsertGen(objectType schema.ObjectType) *rapid.Generator[schema.ObjectUpdate] { - return ObjectUpdateGen(objectType, nil) +func ObjectInsertGen(objectType schema.ObjectType, typeSet schema.TypeSet) *rapid.Generator[schema.ObjectUpdate] { + return ObjectUpdateGen(objectType, nil, typeSet) } // ObjectUpdateGen generates object updates that are valid for updates using the provided state map as a source // of valid existing keys. -func ObjectUpdateGen(objectType schema.ObjectType, state *btree.Map[string, schema.ObjectUpdate]) *rapid.Generator[schema.ObjectUpdate] { - keyGen := ObjectKeyGen(objectType.KeyFields) +func ObjectUpdateGen(objectType schema.ObjectType, state *btree.Map[string, schema.ObjectUpdate], sch schema.TypeSet) *rapid.Generator[schema.ObjectUpdate] { + keyGen := ObjectKeyGen(objectType.KeyFields, sch).Filter(func(key interface{}) bool { + // filter out keys that exist in the state + if state != nil { + _, exists := state.Get(ObjectKeyString(objectType, key)) + return !exists + } + return true + }) + insertValueGen := ObjectValueGen(objectType.ValueFields, false, sch) + updateValueGen := ObjectValueGen(objectType.ValueFields, true, sch) + return rapid.Custom(func(t *rapid.T) schema.ObjectUpdate { + update := schema.ObjectUpdate{ + TypeName: objectType.Name, + } - if len(objectType.ValueFields) == 0 { - // special case where there are no value fields, - // so we just insert or delete, no updates - return rapid.Custom(func(t *rapid.T) schema.ObjectUpdate { - update := schema.ObjectUpdate{ - TypeName: objectType.Name, - } + // 50% of the time use existing key (when there are keys) + n := 0 + if state != nil { + n = state.Len() + } + if n > 0 && boolGen.Draw(t, "existingKey") { + i := rapid.IntRange(0, n-1).Draw(t, "index") + update.Key = state.Values()[i].Key - // 50% of the time delete existing key (when there are keys) - n := 0 - if state != nil { - n = state.Len() - } - if n > 0 && boolGen.Draw(t, "delete") { - i := rapid.IntRange(0, n-1).Draw(t, "index") - update.Key = state.Values()[i].Key + // delete 50% of the time + if boolGen.Draw(t, "delete") { update.Delete = true } else { - update.Key = keyGen.Draw(t, "key") - } - - return update - }) - } else { - insertValueGen := ObjectValueGen(objectType.ValueFields, false) - updateValueGen := ObjectValueGen(objectType.ValueFields, true) - return rapid.Custom(func(t *rapid.T) schema.ObjectUpdate { - update := schema.ObjectUpdate{ - TypeName: objectType.Name, - } - - // 50% of the time use existing key (when there are keys) - n := 0 - if state != nil { - n = state.Len() - } - if n > 0 && boolGen.Draw(t, "existingKey") { - i := rapid.IntRange(0, n-1).Draw(t, "index") - update.Key = state.Values()[i].Key - - // delete 50% of the time - if boolGen.Draw(t, "delete") { - update.Delete = true - } else { - update.Value = updateValueGen.Draw(t, "value") - } - } else { - update.Key = keyGen.Draw(t, "key") - update.Value = insertValueGen.Draw(t, "value") + update.Value = updateValueGen.Draw(t, "value") } + } else { + update.Key = keyGen.Draw(t, "key") + update.Value = insertValueGen.Draw(t, "value") + } - return update - }) - } + return update + }) } diff --git a/schema/testing/object_test.go b/schema/testing/object_test.go index 9106878a7fed..b28ca8b2d6cf 100644 --- a/schema/testing/object_test.go +++ b/schema/testing/object_test.go @@ -9,16 +9,16 @@ import ( func TestObject(t *testing.T) { rapid.Check(t, func(t *rapid.T) { - objectType := ObjectTypeGen.Draw(t, "object") - require.NoError(t, objectType.Validate()) + objectType := ObjectTypeGen(testEnumSchema).Draw(t, "object") + require.NoError(t, objectType.Validate(testEnumSchema)) }) } func TestObjectUpdate(t *testing.T) { rapid.Check(t, func(t *rapid.T) { - objectType := ObjectTypeGen.Draw(t, "object") - require.NoError(t, objectType.Validate()) - update := ObjectInsertGen(objectType).Draw(t, "update") - require.NoError(t, objectType.ValidateObjectUpdate(update)) + objectType := ObjectTypeGen(testEnumSchema).Draw(t, "object") + require.NoError(t, objectType.Validate(testEnumSchema)) + update := ObjectInsertGen(objectType, testEnumSchema).Draw(t, "update") + require.NoError(t, objectType.ValidateObjectUpdate(update, testEnumSchema)) }) } diff --git a/schema/testing/statesim/app_diff.go b/schema/testing/statesim/app_diff.go index 93735093a7db..82628e550293 100644 --- a/schema/testing/statesim/app_diff.go +++ b/schema/testing/statesim/app_diff.go @@ -27,21 +27,21 @@ func DiffAppStates(expected, actual view.AppState) string { res += fmt.Sprintf("MODULE COUNT ERROR: expected %d, got %d\n", expectNumModules, actualNumModules) } - expected.Modules(func(expectedMod view.ModuleState, err error) bool { + for expectedMod, err := range expected.Modules { if err != nil { res += fmt.Sprintf("ERROR getting expected module: %s\n", err) - return true + continue } moduleName := expectedMod.ModuleName() actualMod, err := actual.GetModule(moduleName) if err != nil { res += fmt.Sprintf("ERROR getting actual module: %s\n", err) - return true + continue } if actualMod == nil { res += fmt.Sprintf("Module %s: actual module NOT FOUND\n", moduleName) - return true + continue } diff := DiffModuleStates(expectedMod, actualMod) @@ -49,9 +49,7 @@ func DiffAppStates(expected, actual view.AppState) string { res += "Module " + moduleName + "\n" res += indentAllLines(diff) } - - return true - }) + } return res } diff --git a/schema/testing/statesim/module.go b/schema/testing/statesim/module.go index fd3f70b0fc61..4aa33a063506 100644 --- a/schema/testing/statesim/module.go +++ b/schema/testing/statesim/module.go @@ -25,7 +25,7 @@ func NewModule(name string, moduleSchema schema.ModuleSchema, options Options) * var objectTypeNames []string moduleSchema.ObjectTypes(func(objectType schema.ObjectType) bool { - objectCollection := NewObjectCollection(objectType, options) + objectCollection := NewObjectCollection(objectType, options, moduleSchema) objectCollections.Set(objectType.Name, objectCollection) objectTypeNames = append(objectTypeNames, objectType.Name) return true diff --git a/schema/testing/statesim/module_diff.go b/schema/testing/statesim/module_diff.go index 29ee19fb01a9..6570b900be29 100644 --- a/schema/testing/statesim/module_diff.go +++ b/schema/testing/statesim/module_diff.go @@ -27,21 +27,21 @@ func DiffModuleStates(expected, actual view.ModuleState) string { res += fmt.Sprintf("OBJECT COLLECTION COUNT ERROR: expected %d, got %d\n", expectedNumObjectCollections, actualNumObjectCollections) } - expected.ObjectCollections(func(expectedColl view.ObjectCollection, err error) bool { + for expectedColl, err := range expected.ObjectCollections { if err != nil { res += fmt.Sprintf("ERROR getting expected object collection: %s\n", err) - return true + continue } objTypeName := expectedColl.ObjectType().Name actualColl, err := actual.GetObjectCollection(objTypeName) if err != nil { res += fmt.Sprintf("ERROR getting actual object collection: %s\n", err) - return true + continue } if actualColl == nil { res += fmt.Sprintf("Object Collection %s: actuall collection NOT FOUND\n", objTypeName) - return true + continue } diff := DiffObjectCollections(expectedColl, actualColl) @@ -49,9 +49,7 @@ func DiffModuleStates(expected, actual view.ModuleState) string { res += "Object Collection " + objTypeName + "\n" res += indentAllLines(diff) } - - return true - }) + } return res } diff --git a/schema/testing/statesim/object_coll.go b/schema/testing/statesim/object_coll.go index 8531811de3c3..e2c026a898a2 100644 --- a/schema/testing/statesim/object_coll.go +++ b/schema/testing/statesim/object_coll.go @@ -14,15 +14,16 @@ import ( type ObjectCollection struct { options Options objectType schema.ObjectType + typeSet schema.TypeSet objects *btree.Map[string, schema.ObjectUpdate] updateGen *rapid.Generator[schema.ObjectUpdate] valueFieldIndices map[string]int } // NewObjectCollection creates a new ObjectCollection for the given object type. -func NewObjectCollection(objectType schema.ObjectType, options Options) *ObjectCollection { +func NewObjectCollection(objectType schema.ObjectType, options Options, typeSet schema.TypeSet) *ObjectCollection { objects := &btree.Map[string, schema.ObjectUpdate]{} - updateGen := schematesting.ObjectUpdateGen(objectType, objects) + updateGen := schematesting.ObjectUpdateGen(objectType, objects, typeSet) valueFieldIndices := make(map[string]int, len(objectType.ValueFields)) for i, field := range objectType.ValueFields { valueFieldIndices[field.Name] = i @@ -31,6 +32,7 @@ func NewObjectCollection(objectType schema.ObjectType, options Options) *ObjectC return &ObjectCollection{ options: options, objectType: objectType, + typeSet: typeSet, objects: objects, updateGen: updateGen, valueFieldIndices: valueFieldIndices, @@ -43,12 +45,12 @@ func (o *ObjectCollection) ApplyUpdate(update schema.ObjectUpdate) error { return fmt.Errorf("update type name %q does not match object type name %q", update.TypeName, o.objectType.Name) } - err := o.objectType.ValidateObjectUpdate(update) + err := o.objectType.ValidateObjectUpdate(update, o.typeSet) if err != nil { return err } - keyStr := fmtObjectKey(o.objectType, update.Key) + keyStr := schematesting.ObjectKeyString(o.objectType, update.Key) cur, exists := o.objects.Get(keyStr) if update.Delete { if o.objectType.RetainDeletions && o.options.CanRetainDeletions { @@ -119,7 +121,7 @@ func (o *ObjectCollection) AllState(f func(schema.ObjectUpdate, error) bool) { // GetObject returns the object with the given key from the collection represented as an ObjectUpdate // itself. Deletions that are retained are returned as ObjectUpdate's with delete set to true. func (o *ObjectCollection) GetObject(key interface{}) (update schema.ObjectUpdate, found bool, err error) { - update, ok := o.objects.Get(fmtObjectKey(o.objectType, key)) + update, ok := o.objects.Get(schematesting.ObjectKeyString(o.objectType, key)) return update, ok, nil } @@ -132,37 +134,3 @@ func (o *ObjectCollection) ObjectType() schema.ObjectType { func (o *ObjectCollection) Len() (int, error) { return o.objects.Len(), nil } - -func fmtObjectKey(objectType schema.ObjectType, key any) string { - keyFields := objectType.KeyFields - n := len(keyFields) - switch n { - case 0: - return "" - case 1: - valStr := fmtValue(keyFields[0].Kind, key) - return fmt.Sprintf("%s=%v", keyFields[0].Name, valStr) - default: - ks := key.([]interface{}) - res := "" - for i := 0; i < n; i++ { - if i != 0 { - res += ", " - } - valStr := fmtValue(keyFields[i].Kind, ks[i]) - res += fmt.Sprintf("%s=%v", keyFields[i].Name, valStr) - } - return res - } -} - -func fmtValue(kind schema.Kind, value any) string { - switch kind { - case schema.BytesKind, schema.AddressKind: - return fmt.Sprintf("0x%x", value) - case schema.JSONKind: - return fmt.Sprintf("%s", value) - default: - return fmt.Sprintf("%v", value) - } -} diff --git a/schema/testing/statesim/object_coll_diff.go b/schema/testing/statesim/object_coll_diff.go index cfd33b0b2a40..b38b577aec97 100644 --- a/schema/testing/statesim/object_coll_diff.go +++ b/schema/testing/statesim/object_coll_diff.go @@ -4,7 +4,6 @@ import ( "fmt" "strings" - "cosmossdk.io/schema" schematesting "cosmossdk.io/schema/testing" "cosmossdk.io/schema/view" ) @@ -30,21 +29,21 @@ func DiffObjectCollections(expected, actual view.ObjectCollection) string { res += fmt.Sprintf("OBJECT COUNT ERROR: expected %d, got %d\n", expectedNumObjects, actualNumObjects) } - expected.AllState(func(expectedUpdate schema.ObjectUpdate, err error) bool { + for expectedUpdate, err := range expected.AllState { if err != nil { res += fmt.Sprintf("ERROR getting expected object: %s\n", err) - return true + continue } - keyStr := fmtObjectKey(expected.ObjectType(), expectedUpdate.Key) + keyStr := schematesting.ObjectKeyString(expected.ObjectType(), expectedUpdate.Key) actualUpdate, found, err := actual.GetObject(expectedUpdate.Key) if err != nil { res += fmt.Sprintf("Object %s: ERROR: %v\n", keyStr, err) - return true + continue } if !found { res += fmt.Sprintf("Object %s: NOT FOUND\n", keyStr) - return true + continue } if expectedUpdate.Delete != actualUpdate.Delete { @@ -52,7 +51,7 @@ func DiffObjectCollections(expected, actual view.ObjectCollection) string { } if expectedUpdate.Delete { - return true + continue } valueDiff := schematesting.DiffObjectValues(expected.ObjectType().ValueFields, expectedUpdate.Value, actualUpdate.Value) @@ -62,9 +61,7 @@ func DiffObjectCollections(expected, actual view.ObjectCollection) string { res += "\n" res += indentAllLines(valueDiff) } - - return true - }) + } return res } diff --git a/schema/type.go b/schema/type.go index 75155de8688f..f525e84b817b 100644 --- a/schema/type.go +++ b/schema/type.go @@ -1,10 +1,51 @@ package schema // Type is an interface that all types in the schema implement. -// Currently these are ObjectType and EnumType. +// Currently, these are ObjectType and EnumType. type Type interface { // TypeName returns the type's name. TypeName() string + // Validate validates the type. + Validate(TypeSet) error + + // isType is a private method that ensures that only types in this package can be marked as types. isType() } + +// TypeSet represents something that has types and allows them to be looked up by name. +// Currently, the only implementation is ModuleSchema. +type TypeSet interface { + // LookupType looks up a type by name. + LookupType(name string) (Type, bool) + + // AllTypes calls the given function for each type in the type set. + // This function is compatible with go 1.23 iterators and can be used like this: + // for t := range types.AllTypes { + // // do something with t + // } + AllTypes(f func(Type) bool) + + // isTypeSet is a private method that ensures that only types in this package can be marked as type sets. + isTypeSet() +} + +// EmptyTypeSet is a schema that contains no types. +// It can be used in Validate methods when there is no schema needed or available. +func EmptyTypeSet() TypeSet { + return emptyTypeSetInst +} + +var emptyTypeSetInst = emptyTypeSet{} + +type emptyTypeSet struct{} + +// LookupType always returns false because there are no types in an EmptyTypeSet. +func (emptyTypeSet) LookupType(string) (Type, bool) { + return nil, false +} + +// Types does nothing because there are no types in an EmptyTypeSet. +func (emptyTypeSet) AllTypes(func(Type) bool) {} + +func (emptyTypeSet) isTypeSet() {} diff --git a/scripts/build/linting.mk b/scripts/build/linting.mk index eeeecc484c0a..58d481a235fb 100644 --- a/scripts/build/linting.mk +++ b/scripts/build/linting.mk @@ -1,4 +1,4 @@ -golangci_version=v1.59.0 +golangci_version=v1.60.1 #? setup-pre-commit: Set pre-commit git hook setup-pre-commit: diff --git a/scripts/build/protobuf.mk b/scripts/build/protobuf.mk index 54182e2432f5..a0f42f52f50a 100644 --- a/scripts/build/protobuf.mk +++ b/scripts/build/protobuf.mk @@ -1,4 +1,4 @@ -protoVer=0.14.1 +protoVer=0.15.0 protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer) protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) diff --git a/scripts/build/simulations.mk b/scripts/build/simulations.mk index ea7510db4cb8..4020d468a920 100644 --- a/scripts/build/simulations.mk +++ b/scripts/build/simulations.mk @@ -44,7 +44,7 @@ test-sim-custom-genesis-multi-seed: test-sim-multi-seed-long: @echo "Running long multi-seed application simulation. This may take awhile!" - @cd ${CURRENT_DIR}/simapp && go test -mod=readonly -timeout=1h -tags='sims' -run TestFullAppSimulation \ + @cd ${CURRENT_DIR}/simapp && go test -mod=readonly -timeout=2h -tags='sims' -run TestFullAppSimulation \ -NumBlocks=150 -Period=50 test-sim-multi-seed-short: diff --git a/scripts/dep-assert.sh b/scripts/dep-assert.sh index 2f4dfd0dbf64..2599115a19cd 100755 --- a/scripts/dep-assert.sh +++ b/scripts/dep-assert.sh @@ -22,6 +22,7 @@ done # no runtime/v2 or server/v2 imports in x/ modules RUNTIMEV2_REGEX="cosmossdk.io/runtime/v2" SEVERV2_REGEX="cosmossdk.io/server/v2" +XEXP_REGEX="golang.org/x/exp" find ./x/ -type f -name 'go.mod' -print0 | while IFS= read -r -d '' file do d=$(dirname "$file") @@ -34,4 +35,9 @@ do echo "${d} has a dependency on server/v2!" exit 1 fi + + if cd "$CWD/$d" && go list -test -f '{{ .Imports }}' ./... | grep -q -E "${XEXP_REGEX}"; then + echo "${d} has a dependency on golang.org/x/exp" + exit 1 + fi done \ No newline at end of file diff --git a/scripts/init-simapp-v2.sh b/scripts/init-simapp-v2.sh index a4788dfee838..ca25b4f706c0 100755 --- a/scripts/init-simapp-v2.sh +++ b/scripts/init-simapp-v2.sh @@ -19,5 +19,5 @@ jq '.app_state.gov.params.expedited_voting_period = "300s"' $SIMD_HOME/config/ge jq '.app_state.mint.minter.inflation = "0.300000000000000000"' $SIMD_HOME/config/genesis.json > temp.json && mv temp.json $SIMD_HOME/config/genesis.json # to change the inflation $SIMD_BIN genesis add-genesis-account alice 5000000000stake --keyring-backend test $SIMD_BIN genesis add-genesis-account bob 5000000000stake --keyring-backend test -$SIMD_BIN genesis gentx alice 1000000stake --chain-id demo +$SIMD_BIN genesis gentx alice 1000000stake --chain-id simapp-v2-chain $SIMD_BIN genesis collect-gentxs \ No newline at end of file diff --git a/scripts/mockgen.sh b/scripts/mockgen.sh index eef0730c881a..80869055797c 100755 --- a/scripts/mockgen.sh +++ b/scripts/mockgen.sh @@ -13,7 +13,7 @@ $mockgen_cmd -source=x/nft/expected_keepers.go -package testutil -destination x/ $mockgen_cmd -source=x/feegrant/expected_keepers.go -package testutil -destination x/feegrant/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/mint/types/expected_keepers.go -package testutil -destination x/mint/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/auth/tx/config/expected_keepers.go -package testutil -destination x/auth/tx/testutil/expected_keepers_mocks.go -$mockgen_cmd -source=x/auth/types/expected_keepers.go -package testutil -destination x/auth/testutil/expected_keepers_mocks.go +# $mockgen_cmd -source=x/auth/types/expected_keepers.go -package testutil -destination x/auth/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/auth/ante/expected_keepers.go -package testutil -destination x/auth/ante/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/authz/expected_keepers.go -package testutil -destination x/authz/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/bank/types/expected_keepers.go -package testutil -destination x/bank/testutil/expected_keepers_mocks.go @@ -24,5 +24,6 @@ $mockgen_cmd -source=x/slashing/types/expected_keepers.go -package testutil -des $mockgen_cmd -source=x/genutil/types/expected_keepers.go -package testutil -destination x/genutil/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/gov/testutil/expected_keepers.go -package testutil -destination x/gov/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/staking/types/expected_keepers.go -package testutil -destination x/staking/testutil/expected_keepers_mocks.go -$mockgen_cmd -source=x/auth/vesting/types/expected_keepers.go -package testutil -destination x/auth/vesting/testutil/expected_keepers_mocks.go +# $mockgen_cmd -source=x/auth/vesting/types/expected_keepers.go -package testutil -destination x/auth/vesting/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/protocolpool/types/expected_keepers.go -package testutil -destination x/protocolpool/testutil/expected_keepers_mocks.go +$mockgen_cmd -source=core/gas/service.go -package gas -destination core/testing/gas/service_mocks.go diff --git a/scripts/protocgen.sh b/scripts/protocgen.sh index 34f993bba5ce..c731c75e4fa7 100755 --- a/scripts/protocgen.sh +++ b/scripts/protocgen.sh @@ -29,7 +29,7 @@ for dir in $proto_dirs; do # check if buf.gen.gogo.yaml exists in the proto directory if [ -f "buf.gen.gogo.yaml" ]; then - for file in $(find . -maxdepth 5 -name '*.proto'); do + for file in $(find . -maxdepth 8 -name '*.proto'); do # this regex checks if a proto file has its go_package set to cosmossdk.io/api/... # gogo proto files SHOULD ONLY be generated if this is false # we don't want gogo proto to run for proto files which are natively built for google.golang.org/protobuf diff --git a/scripts/validate-gentxs.sh b/scripts/validate-gentxs.sh index 7ab14f47561e..42640199973a 100755 --- a/scripts/validate-gentxs.sh +++ b/scripts/validate-gentxs.sh @@ -107,7 +107,6 @@ if [ "$(ls -A $GENTXS_DIR)" ]; then GENACC=$(cat $GENTX_FILE | sed -n 's|.*"delegator_address":"\([^"]*\)".*|\1|p') denomquery=$(jq -r '.body.messages[0].value.denom' $GENTX_FILE) - amountquery=$(jq -r '.body.messages[0].value.amount' $GENTX_FILE) # only allow $DENOM tokens to be bonded if [ $denomquery != $DENOM ]; then diff --git a/server/README.md b/server/README.md index 6ecbb5b2955e..5ce89c026ef8 100644 --- a/server/README.md +++ b/server/README.md @@ -74,7 +74,7 @@ the viper literal and passed to the application construction. Example: ```go -func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts servertypes.AppOptions) servertypes.Application { +func newApp(logger log.Logger, db corestore.KVStoreWithBatch, traceStore io.Writer, appOpts servertypes.AppOptions) servertypes.Application { baseappOptions := server.DefaultBaseappOptions(appOpts) return simapp.NewSimApp( logger, db, traceStore, true, diff --git a/server/cmt_cmds.go b/server/cmt_cmds.go index 6e13230e5260..5d3bf3fab589 100644 --- a/server/cmt_cmds.go +++ b/server/cmt_cmds.go @@ -18,7 +18,6 @@ import ( "sigs.k8s.io/yaml" "cosmossdk.io/log" - auth "cosmossdk.io/x/auth/client/cli" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" @@ -29,6 +28,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" "github.com/cosmos/cosmos-sdk/version" + auth "github.com/cosmos/cosmos-sdk/x/auth/client/cli" ) // StatusCommand returns the command to return the status of the network. @@ -218,7 +218,7 @@ for. Each module documents its respective events under 'xx_events.md'. // QueryBlockCmd implements the default command for a Block query. func QueryBlockCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "block --type=[height|hash] [height|hash]", + Use: "block --type={height|hash} [height|hash]", Short: "Query for a committed block by height, hash, or event(s)", Long: "Query for a specific committed block using the CometBFT RPC `block` and `block_by_hash` method", Example: strings.TrimSpace(fmt.Sprintf(` @@ -363,9 +363,10 @@ func QueryBlockResultsCmd() *cobra.Command { func BootstrapStateCmd[T types.Application](appCreator types.AppCreator[T]) *cobra.Command { cmd := &cobra.Command{ - Use: "bootstrap-state", - Short: "Bootstrap CometBFT state at an arbitrary block height using a light client", - Args: cobra.NoArgs, + Use: "bootstrap-state", + Short: "Bootstrap CometBFT state at an arbitrary block height using a light client", + Args: cobra.NoArgs, + Example: fmt.Sprintf("%s bootstrap-state --height 1000000", version.AppName), RunE: func(cmd *cobra.Command, args []string) error { serverCtx := GetServerContextFromCmd(cmd) logger := log.NewLogger(cmd.OutOrStdout()) diff --git a/server/config/config_test.go b/server/config/config_test.go index 308858d95502..6d827ec27dc7 100644 --- a/server/config/config_test.go +++ b/server/config/config_test.go @@ -10,6 +10,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + pruningtypes "cosmossdk.io/store/pruning/types" + sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -21,15 +23,29 @@ func TestDefaultConfig(t *testing.T) { func TestGetAndSetMinimumGas(t *testing.T) { cfg := DefaultConfig() + // Test case 1: Single coin input := sdk.DecCoins{sdk.NewInt64DecCoin("foo", 5)} cfg.SetMinGasPrices(input) require.Equal(t, "5.000000000000000000foo", cfg.MinGasPrices) require.EqualValues(t, cfg.GetMinGasPrices(), input) + // Test case 2: Multiple coins input = sdk.DecCoins{sdk.NewInt64DecCoin("bar", 1), sdk.NewInt64DecCoin("foo", 5)} cfg.SetMinGasPrices(input) require.Equal(t, "1.000000000000000000bar,5.000000000000000000foo", cfg.MinGasPrices) require.EqualValues(t, cfg.GetMinGasPrices(), input) + + // Test case 4: Empty DecCoins + input = sdk.DecCoins{} + cfg.SetMinGasPrices(input) + require.Equal(t, "", cfg.MinGasPrices) + require.EqualValues(t, cfg.GetMinGasPrices(), input) + + // Test case 5: Invalid string (should panic) + cfg.MinGasPrices = "invalid,gas,prices" + require.Panics(t, func() { + cfg.GetMinGasPrices() + }, "GetMinGasPrices should panic with invalid input") } func TestIndexEventsMarshalling(t *testing.T) { @@ -238,3 +254,40 @@ func TestAppConfig(t *testing.T) { require.NoError(t, v.Unmarshal(appCfg)) require.EqualValues(t, appCfg, defAppConfig) } + +func TestValidateBasic(t *testing.T) { + cfg := DefaultConfig() + + // Test case 1: Valid MinGasPrices + cfg.MinGasPrices = "0.01stake" + err := cfg.ValidateBasic() + require.NoError(t, err) + + // Test case 2: Default configuration (MinGasPrices is empty) + cfg.MinGasPrices = "" + err = cfg.ValidateBasic() + require.Error(t, err) + require.Contains(t, err.Error(), "set min gas price in app.toml or flag or env variable") + + // Test case 3: Invalid pruning and state sync combination + cfg = DefaultConfig() + cfg.MinGasPrices = "0.01stake" + cfg.Pruning = pruningtypes.PruningOptionEverything + cfg.StateSync.SnapshotInterval = 1000 + err = cfg.ValidateBasic() + require.Error(t, err) + require.Contains(t, err.Error(), "cannot enable state sync snapshots with 'everything' pruning setting") +} + +func TestGetConfig(t *testing.T) { + v := viper.New() + v.Set("minimum-gas-prices", "0.01stake") + v.Set("api.enable", true) + v.Set("grpc.max-recv-msg-size", 5*1024*1024) + + cfg, err := GetConfig(v) + require.NoError(t, err) + require.Equal(t, "0.01stake", cfg.MinGasPrices) + require.True(t, cfg.API.Enable) + require.Equal(t, 5*1024*1024, cfg.GRPC.MaxRecvMsgSize) +} diff --git a/server/mock/store.go b/server/mock/store.go index 4dee9024b17f..18bb4f2d7d40 100644 --- a/server/mock/store.go +++ b/server/mock/store.go @@ -3,9 +3,9 @@ package mock import ( "io" - dbm "github.com/cosmos/cosmos-db" protoio "github.com/cosmos/gogoproto/io" + corestore "cosmossdk.io/core/store" "cosmossdk.io/store/metrics" pruningtypes "cosmossdk.io/store/pruning/types" snapshottypes "cosmossdk.io/store/snapshots/types" @@ -90,7 +90,7 @@ func (ms multiStore) GetCommitStore(key storetypes.StoreKey) storetypes.CommitSt panic("not implemented") } -func (ms multiStore) MountStoreWithDB(key storetypes.StoreKey, typ storetypes.StoreType, db dbm.DB) { +func (ms multiStore) MountStoreWithDB(key storetypes.StoreKey, typ storetypes.StoreType, db corestore.KVStoreWithBatch) { ms.kv[key] = kvStore{store: make(map[string][]byte)} } diff --git a/server/mock/tx.go b/server/mock/tx.go index f11ddd12a987..22a709452b0a 100644 --- a/server/mock/tx.go +++ b/server/mock/tx.go @@ -9,12 +9,12 @@ import ( bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" "cosmossdk.io/core/transaction" errorsmod "cosmossdk.io/errors" - "cosmossdk.io/x/auth/signing" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" txsigning "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/signing" ) // KVStoreTx is an sdk.Tx which is its own sdk.Msg. diff --git a/server/module_hash.go b/server/module_hash.go index 966a29139038..4b18355a85e3 100644 --- a/server/module_hash.go +++ b/server/module_hash.go @@ -21,7 +21,7 @@ import ( // ModuleHashByHeightQuery retrieves the module hashes at a given height. func ModuleHashByHeightQuery[T servertypes.Application](appCreator servertypes.AppCreator[T]) *cobra.Command { cmd := &cobra.Command{ - Use: "module-hash-by-height [height]", + Use: "module-hash-by-height ", Short: "Get module hashes at a given height", Long: "Get module hashes at a given height. This command is useful for debugging and verifying the state of the application at a given height. Daemon should not be running when calling this command.", Example: fmt.Sprintf("%s module-hash-by-height 16841115", version.AppName), diff --git a/server/start.go b/server/start.go index 37089246b8b5..77a08645d45f 100644 --- a/server/start.go +++ b/server/start.go @@ -36,6 +36,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" + corestore "cosmossdk.io/core/store" "cosmossdk.io/log" pruningtypes "cosmossdk.io/store/pruning/types" @@ -117,7 +118,7 @@ const ( type StartCmdOptions[T types.Application] struct { // DBOpener can be used to customize db opening, for example customize db options or support different db backends, // default to the builtin db opener. - DBOpener func(rootDir string, backendType dbm.BackendType) (dbm.DB, error) + DBOpener func(rootDir string, backendType dbm.BackendType) (corestore.KVStoreWithBatch, error) // PostSetup can be used to setup extra services under the same cancellable context, // it's not called in stand-alone mode, only for in-process mode. PostSetup func(app T, svrCtx *Context, clientCtx client.Context, ctx context.Context, g *errgroup.Group) error @@ -126,7 +127,7 @@ type StartCmdOptions[T types.Application] struct { // AddFlags add custom flags to start cmd AddFlags func(cmd *cobra.Command) // StartCommandHandler can be used to customize the start command handler - StartCommandHandler func(svrCtx *Context, clientCtx client.Context, appCreator types.AppCreator[T], inProcessConsensus bool, opts StartCmdOptions[T]) error + StartCommandHandler func(svrCtx *Context, clientCtx client.Context, appCreator types.AppCreator[T], withCMT bool, opts StartCmdOptions[T]) error } // StartCmd runs the service passed in, either stand-alone or in-process with @@ -415,31 +416,28 @@ func getAndValidateConfig(svrCtx *Context) (serverconfig.Config, error) { // getGenDocProvider returns a function which returns the genesis doc from the genesis file. func getGenDocProvider(cfg *cmtcfg.Config) func() (node.ChecksummedGenesisDoc, error) { return func() (node.ChecksummedGenesisDoc, error) { + defaultGenesisDoc := node.ChecksummedGenesisDoc{ + Sha256Checksum: []byte{}, + } + appGenesis, err := genutiltypes.AppGenesisFromFile(cfg.GenesisFile()) if err != nil { - return node.ChecksummedGenesisDoc{ - Sha256Checksum: []byte{}, - }, err + return defaultGenesisDoc, err } gen, err := appGenesis.ToGenesisDoc() if err != nil { - return node.ChecksummedGenesisDoc{ - Sha256Checksum: []byte{}, - }, err + return defaultGenesisDoc, err } + genbz, err := gen.AppState.MarshalJSON() if err != nil { - return node.ChecksummedGenesisDoc{ - Sha256Checksum: []byte{}, - }, err + return defaultGenesisDoc, err } bz, err := json.Marshal(genbz) if err != nil { - return node.ChecksummedGenesisDoc{ - Sha256Checksum: []byte{}, - }, err + return defaultGenesisDoc, err } sum := sha256.Sum256(bz) @@ -667,7 +665,7 @@ func InPlaceTestnetCreator[T types.Application](testnetAppCreator types.AppCreat } cmd := &cobra.Command{ - Use: "in-place-testnet [newChainID] [newOperatorAddress]", + Use: "in-place-testnet ", Short: "Create and start a testnet from current local state", Long: `Create and start a testnet from current local state. After utilizing this command the network will start. If the network is stopped, @@ -753,7 +751,7 @@ you want to test the upgrade handler itself. // testnetify modifies both state and blockStore, allowing the provided operator address and local validator key to control the network // that the state in the data folder represents. The chainID of the local genesis file is modified to match the provided chainID. -func testnetify[T types.Application](ctx *Context, testnetAppCreator types.AppCreator[T], db dbm.DB, traceWriter io.WriteCloser) (*T, error) { +func testnetify[T types.Application](ctx *Context, testnetAppCreator types.AppCreator[T], db corestore.KVStoreWithBatch, traceWriter io.WriteCloser) (*T, error) { config := ctx.Config newChainID, ok := ctx.Viper.Get(KeyNewChainID).(string) diff --git a/server/types/app.go b/server/types/app.go index 74f4798612ab..798a4475dbbe 100644 --- a/server/types/app.go +++ b/server/types/app.go @@ -6,9 +6,9 @@ import ( cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" cmttypes "github.com/cometbft/cometbft/types" - dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/gogoproto/grpc" + corestore "cosmossdk.io/core/store" "cosmossdk.io/log" "cosmossdk.io/store/snapshots" storetypes "cosmossdk.io/store/types" @@ -65,7 +65,7 @@ type ( // AppCreator is a function that allows us to lazily initialize an // application using various configurations. - AppCreator[T Application] func(log.Logger, dbm.DB, io.Writer, AppOptions) T + AppCreator[T Application] func(log.Logger, corestore.KVStoreWithBatch, io.Writer, AppOptions) T // ExportedApp represents an exported app state, along with // validators, consensus params and latest app height. @@ -84,7 +84,7 @@ type ( // JSON-serializable structure and returns the current validator set. AppExporter func( logger log.Logger, - db dbm.DB, + db corestore.KVStoreWithBatch, traceWriter io.Writer, height int64, forZeroHeight bool, diff --git a/server/util.go b/server/util.go index 5e77127b5a04..bb54bdd1dc00 100644 --- a/server/util.go +++ b/server/util.go @@ -25,6 +25,7 @@ import ( "golang.org/x/sync/errgroup" corectx "cosmossdk.io/core/context" + corestore "cosmossdk.io/core/store" "cosmossdk.io/log" "cosmossdk.io/store" "cosmossdk.io/store/snapshots" @@ -45,8 +46,9 @@ import ( // a command's Context. const ServerContextKey = sdk.ContextKey("server.context") -// Context server context -// Deprecated: Do not use since we use viper to track all config +// Context is the server context. +// Prefer using we use viper a it tracks track all config. +// See core/context/server_context.go. type Context struct { Viper *viper.Viper Config *cmtcfg.Config @@ -472,7 +474,7 @@ func addrToIP(addr net.Addr) net.IP { } // OpenDB opens the application database using the appropriate driver. -func OpenDB(rootDir string, backendType dbm.BackendType) (dbm.DB, error) { +func OpenDB(rootDir string, backendType dbm.BackendType) (corestore.KVStoreWithBatch, error) { dataDir := filepath.Join(rootDir, "data") return dbm.NewDB("application", backendType, dataDir) } diff --git a/server/v2/api/grpc/codec.go b/server/v2/api/grpc/codec.go index d0d885c041ad..39feda403a40 100644 --- a/server/v2/api/grpc/codec.go +++ b/server/v2/api/grpc/codec.go @@ -9,15 +9,23 @@ import ( "google.golang.org/protobuf/proto" _ "cosmossdk.io/api/amino" // Import amino.proto file for reflection - appmanager "cosmossdk.io/core/app" + "cosmossdk.io/core/server" + "cosmossdk.io/core/transaction" ) +// protocdc defines the interface for marshaling and unmarshaling messages in server/v2 +type protocdc interface { + Marshal(v transaction.Msg) ([]byte, error) + Unmarshal(data []byte, v transaction.Msg) error + Name() string +} + type protoCodec struct { - interfaceRegistry appmanager.InterfaceRegistry + interfaceRegistry server.InterfaceRegistry } // newProtoCodec returns a reference to a new ProtoCodec -func newProtoCodec(interfaceRegistry appmanager.InterfaceRegistry) *protoCodec { +func newProtoCodec(interfaceRegistry server.InterfaceRegistry) *protoCodec { return &protoCodec{ interfaceRegistry: interfaceRegistry, } @@ -62,7 +70,7 @@ func (pc *protoCodec) GRPCCodec() encoding.Codec { // grpcProtoCodec is the implementation of the gRPC proto codec. type grpcProtoCodec struct { - cdc appmanager.ProtoCodec + cdc protocdc } var errUnknownProtoType = errors.New("codec: unknown proto type") // sentinel error diff --git a/server/v2/api/grpc/server.go b/server/v2/api/grpc/server.go index 006a970e09b9..b66be16da602 100644 --- a/server/v2/api/grpc/server.go +++ b/server/v2/api/grpc/server.go @@ -5,13 +5,14 @@ import ( "errors" "fmt" "io" + "maps" "net" + "slices" "strconv" "github.com/cosmos/gogoproto/proto" "github.com/spf13/pflag" "github.com/spf13/viper" - "golang.org/x/exp/maps" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" @@ -65,7 +66,7 @@ func (s *Server[T]) Init(appI serverv2.AppI[T], v *viper.Viper, logger log.Logge ) // Reflection allows external clients to see what services and methods the gRPC server exposes. - gogoreflection.Register(grpcSrv, maps.Keys(methodsMap), logger.With("sub-module", "grpc-reflection")) + gogoreflection.Register(grpcSrv, slices.Collect(maps.Keys(methodsMap)), logger.With("sub-module", "grpc-reflection")) s.grpcSrv = grpcSrv s.config = cfg diff --git a/server/v2/appmanager/appmanager.go b/server/v2/appmanager/appmanager.go index 21997be09ea8..e367c7d8fbfe 100644 --- a/server/v2/appmanager/appmanager.go +++ b/server/v2/appmanager/appmanager.go @@ -7,7 +7,7 @@ import ( "errors" "fmt" - appmanager "cosmossdk.io/core/app" + "cosmossdk.io/core/server" corestore "cosmossdk.io/core/store" "cosmossdk.io/core/transaction" ) @@ -39,10 +39,10 @@ type AppManager[T transaction.Tx] struct { // InitGenesis initializes the genesis state of the application. func (a AppManager[T]) InitGenesis( ctx context.Context, - blockRequest *appmanager.BlockRequest[T], + blockRequest *server.BlockRequest[T], initGenesisJSON []byte, txDecoder transaction.Codec[T], -) (*appmanager.BlockResponse, corestore.WriterMap, error) { +) (*server.BlockResponse, corestore.WriterMap, error) { v, zeroState, err := a.db.StateLatest() if err != nil { return nil, nil, fmt.Errorf("unable to get latest state: %w", err) @@ -89,7 +89,24 @@ func (a AppManager[T]) InitGenesis( // ExportGenesis exports the genesis state of the application. func (a AppManager[T]) ExportGenesis(ctx context.Context, version uint64) ([]byte, error) { - bz, err := a.exportGenesis(ctx, version) + zeroState, err := a.db.StateAt(version) + if err != nil { + return nil, fmt.Errorf("unable to get latest state: %w", err) + } + + bz := make([]byte, 0) + _, err = a.stf.RunWithCtx(ctx, zeroState, func(ctx context.Context) error { + if a.exportGenesis == nil { + return errors.New("export genesis function not set") + } + + bz, err = a.exportGenesis(ctx, version) + if err != nil { + return fmt.Errorf("failed to export genesis state: %w", err) + } + + return nil + }) if err != nil { return nil, fmt.Errorf("failed to export genesis state: %w", err) } @@ -99,8 +116,8 @@ func (a AppManager[T]) ExportGenesis(ctx context.Context, version uint64) ([]byt func (a AppManager[T]) DeliverBlock( ctx context.Context, - block *appmanager.BlockRequest[T], -) (*appmanager.BlockResponse, corestore.WriterMap, error) { + block *server.BlockRequest[T], +) (*server.BlockResponse, corestore.WriterMap, error) { latestVersion, currentState, err := a.db.StateLatest() if err != nil { return nil, nil, fmt.Errorf("unable to create new state for height %d: %w", block.Height, err) @@ -121,20 +138,20 @@ func (a AppManager[T]) DeliverBlock( // ValidateTx will validate the tx against the latest storage state. This means that // only the stateful validation will be run, not the execution portion of the tx. // If full execution is needed, Simulate must be used. -func (a AppManager[T]) ValidateTx(ctx context.Context, tx T) (appmanager.TxResult, error) { +func (a AppManager[T]) ValidateTx(ctx context.Context, tx T) (server.TxResult, error) { _, latestState, err := a.db.StateLatest() if err != nil { - return appmanager.TxResult{}, err + return server.TxResult{}, err } res := a.stf.ValidateTx(ctx, latestState, a.config.ValidateTxGasLimit, tx) return res, res.Error } // Simulate runs validation and execution flow of a Tx. -func (a AppManager[T]) Simulate(ctx context.Context, tx T) (appmanager.TxResult, corestore.WriterMap, error) { +func (a AppManager[T]) Simulate(ctx context.Context, tx T) (server.TxResult, corestore.WriterMap, error) { _, state, err := a.db.StateLatest() if err != nil { - return appmanager.TxResult{}, nil, err + return server.TxResult{}, nil, err } result, cs := a.stf.Simulate(ctx, state, a.config.SimulationGasLimit, tx) // TODO: check if this is done in the antehandler return result, cs, nil diff --git a/server/v2/appmanager/go.mod b/server/v2/appmanager/go.mod index d7ff0bb8ca67..53c6e1c150a5 100644 --- a/server/v2/appmanager/go.mod +++ b/server/v2/appmanager/go.mod @@ -1,7 +1,7 @@ module cosmossdk.io/server/v2/appmanager -go 1.21 +go 1.23 replace cosmossdk.io/core => ../../../core -require cosmossdk.io/core v0.12.0 +require cosmossdk.io/core v1.0.0 diff --git a/server/v2/appmanager/types.go b/server/v2/appmanager/types.go index 760637dbcdf3..149f190f353e 100644 --- a/server/v2/appmanager/types.go +++ b/server/v2/appmanager/types.go @@ -3,7 +3,7 @@ package appmanager import ( "context" - appmanager "cosmossdk.io/core/app" + "cosmossdk.io/core/server" "cosmossdk.io/core/store" "cosmossdk.io/core/transaction" ) @@ -13,9 +13,9 @@ type StateTransitionFunction[T transaction.Tx] interface { // DeliverBlock executes a block of transactions. DeliverBlock( ctx context.Context, - block *appmanager.BlockRequest[T], + block *server.BlockRequest[T], state store.ReaderMap, - ) (blockResult *appmanager.BlockResponse, newState store.WriterMap, err error) + ) (blockResult *server.BlockResponse, newState store.WriterMap, err error) // ValidateTx validates a transaction. ValidateTx( @@ -23,7 +23,7 @@ type StateTransitionFunction[T transaction.Tx] interface { state store.ReaderMap, gasLimit uint64, tx T, - ) appmanager.TxResult + ) server.TxResult // Simulate executes a transaction in simulation mode. Simulate( @@ -31,7 +31,7 @@ type StateTransitionFunction[T transaction.Tx] interface { state store.ReaderMap, gasLimit uint64, tx T, - ) (appmanager.TxResult, store.WriterMap) + ) (server.TxResult, store.WriterMap) // Query executes a query on the application. Query( diff --git a/server/v2/cometbft/abci.go b/server/v2/cometbft/abci.go index bcc3ec6cd775..c30a38ada250 100644 --- a/server/v2/cometbft/abci.go +++ b/server/v2/cometbft/abci.go @@ -11,10 +11,10 @@ import ( abciproto "github.com/cometbft/cometbft/api/cometbft/abci/v1" gogoproto "github.com/cosmos/gogoproto/proto" - coreappmgr "cosmossdk.io/core/app" "cosmossdk.io/core/comet" corecontext "cosmossdk.io/core/context" "cosmossdk.io/core/event" + "cosmossdk.io/core/server" "cosmossdk.io/core/store" "cosmossdk.io/core/transaction" errorsmod "cosmossdk.io/errors" @@ -134,10 +134,6 @@ func (c *Consensus[T]) CheckTx(ctx context.Context, req *abciproto.CheckTxReques GasWanted: uint64ToInt64(resp.GasWanted), GasUsed: uint64ToInt64(resp.GasUsed), Events: intoABCIEvents(resp.Events, c.indexedEvents), - Info: resp.Info, - Data: resp.Data, - Log: resp.Log, - Codespace: resp.Codespace, } if resp.Error != nil { cometResp.Code = 1 @@ -249,7 +245,7 @@ func (c *Consensus[T]) InitChain(ctx context.Context, req *abciproto.InitChainRe } if req.ConsensusParams != nil { - ctx = context.WithValue(ctx, corecontext.InitInfoKey, &consensustypes.MsgUpdateParams{ + ctx = context.WithValue(ctx, corecontext.CometParamsInitInfoKey, &consensustypes.MsgUpdateParams{ Authority: c.consensusAuthority, Block: req.ConsensusParams.Block, Evidence: req.ConsensusParams.Evidence, @@ -268,7 +264,7 @@ func (c *Consensus[T]) InitChain(ctx context.Context, req *abciproto.InitChainRe // populate hash with empty byte slice instead of nil bz := sha256.Sum256([]byte{}) - br := &coreappmgr.BlockRequest[T]{ + br := &server.BlockRequest[T]{ Height: uint64(req.InitialHeight - 1), Time: req.Time, Hash: bz[:], @@ -289,7 +285,7 @@ func (c *Consensus[T]) InitChain(ctx context.Context, req *abciproto.InitChainRe // TODO necessary? where should this WARN live if it all. helpful for testing for _, txRes := range blockresponse.TxResults { if txRes.Error != nil { - c.logger.Warn("genesis tx failed", "code", txRes.Code, "log", txRes.Log, "error", txRes.Error) + c.logger.Warn("genesis tx failed", "code", txRes.Code, "error", txRes.Error) } } @@ -428,7 +424,7 @@ func (c *Consensus[T]) FinalizeBlock( return nil, err } - blockReq := &coreappmgr.BlockRequest[T]{ + blockReq := &server.BlockRequest[T]{ Height: uint64(req.Height), Time: req.Time, Hash: req.Hash, diff --git a/server/v2/cometbft/client/grpc/cmtservice/autocli.go b/server/v2/cometbft/client/grpc/cmtservice/autocli.go index ea314c6f8c08..6d8be1f22994 100644 --- a/server/v2/cometbft/client/grpc/cmtservice/autocli.go +++ b/server/v2/cometbft/client/grpc/cmtservice/autocli.go @@ -25,7 +25,7 @@ var CometBFTAutoCLIDescriptor = &autocliv1.ServiceCommandDescriptor{ }, { RpcMethod: "GetBlockByHeight", - Use: "block-by-height [height]", + Use: "block-by-height ", Short: "Query for a committed block by height", Long: "Query for a specific committed block using the CometBFT RPC `block_by_height` method", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "height"}}, @@ -38,7 +38,7 @@ var CometBFTAutoCLIDescriptor = &autocliv1.ServiceCommandDescriptor{ }, { RpcMethod: "GetValidatorSetByHeight", - Use: "validator-set-by-height [height]", + Use: "validator-set-by-height ", Short: "Query for a validator set by height", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "height"}}, }, diff --git a/server/v2/cometbft/commands.go b/server/v2/cometbft/commands.go index dac4fa63f8d1..49be1c969adc 100644 --- a/server/v2/cometbft/commands.go +++ b/server/v2/cometbft/commands.go @@ -13,7 +13,6 @@ import ( "github.com/cometbft/cometbft/p2p" pvm "github.com/cometbft/cometbft/privval" rpchttp "github.com/cometbft/cometbft/rpc/client/http" - "github.com/cometbft/cometbft/rpc/client/local" cmtversion "github.com/cometbft/cometbft/version" "github.com/spf13/cobra" "google.golang.org/protobuf/encoding/protojson" @@ -28,35 +27,25 @@ import ( "github.com/cosmos/cosmos-sdk/version" ) -func (s *CometBFTServer[T]) rpcClient(cmd *cobra.Command) (rpc.CometRPC, error) { - if s.config.AppTomlConfig.Standalone { - client, err := rpchttp.New(client.GetConfigFromCmd(cmd).RPC.ListenAddress) - if err != nil { - return nil, err - } - return client, nil +func rpcClient(cmd *cobra.Command) (rpc.CometRPC, error) { + rpcURI, err := cmd.Flags().GetString(FlagNode) + if err != nil { + return nil, err } - - if s.Node == nil || cmd.Flags().Changed(FlagNode) { - rpcURI, err := cmd.Flags().GetString(FlagNode) - if err != nil { - return nil, err - } - if rpcURI != "" { - return rpchttp.New(rpcURI) - } + if rpcURI == "" { + return nil, fmt.Errorf("rpc URI is empty") } - return local.New(s.Node), nil + return rpchttp.New(rpcURI) } // StatusCommand returns the command to return the status of the network. -func (s *CometBFTServer[T]) StatusCommand() *cobra.Command { +func StatusCommand() *cobra.Command { cmd := &cobra.Command{ Use: "status", Short: "Query remote node for status", RunE: func(cmd *cobra.Command, _ []string) error { - rpcclient, err := s.rpcClient(cmd) + rpcclient, err := rpcClient(cmd) if err != nil { return err } @@ -82,7 +71,7 @@ func (s *CometBFTServer[T]) StatusCommand() *cobra.Command { } // ShowNodeIDCmd - ported from CometBFT, dump node ID to stdout -func (s *CometBFTServer[T]) ShowNodeIDCmd() *cobra.Command { +func ShowNodeIDCmd() *cobra.Command { return &cobra.Command{ Use: "show-node-id", Short: "Show this node's ID", @@ -100,7 +89,7 @@ func (s *CometBFTServer[T]) ShowNodeIDCmd() *cobra.Command { } // ShowValidatorCmd - ported from CometBFT, show this node's validator info -func (s *CometBFTServer[T]) ShowValidatorCmd() *cobra.Command { +func ShowValidatorCmd() *cobra.Command { cmd := cobra.Command{ Use: "show-validator", Short: "Show this node's CometBFT validator info", @@ -134,7 +123,7 @@ func (s *CometBFTServer[T]) ShowValidatorCmd() *cobra.Command { } // ShowAddressCmd - show this node's validator address -func (s *CometBFTServer[T]) ShowAddressCmd() *cobra.Command { +func ShowAddressCmd() *cobra.Command { cmd := &cobra.Command{ Use: "show-address", Short: "Shows this node's CometBFT validator consensus address", @@ -153,7 +142,7 @@ func (s *CometBFTServer[T]) ShowAddressCmd() *cobra.Command { } // VersionCmd prints CometBFT and ABCI version numbers. -func (s *CometBFTServer[T]) VersionCmd() *cobra.Command { +func VersionCmd() *cobra.Command { return &cobra.Command{ Use: "version", Short: "Print CometBFT libraries' version", @@ -181,7 +170,7 @@ func (s *CometBFTServer[T]) VersionCmd() *cobra.Command { } // QueryBlocksCmd returns a command to search through blocks by events. -func (s *CometBFTServer[T]) QueryBlocksCmd() *cobra.Command { +func QueryBlocksCmd() *cobra.Command { cmd := &cobra.Command{ Use: "blocks", Short: "Query for paginated blocks that match a set of events", @@ -196,7 +185,7 @@ for. Each module documents its respective events under 'xx_events.md'. version.AppName, ), RunE: func(cmd *cobra.Command, args []string) error { - rpcclient, err := s.rpcClient(cmd) + rpcclient, err := rpcClient(cmd) if err != nil { return err } @@ -231,9 +220,9 @@ for. Each module documents its respective events under 'xx_events.md'. } // QueryBlockCmd implements the default command for a Block query. -func (s *CometBFTServer[T]) QueryBlockCmd() *cobra.Command { +func QueryBlockCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "block --type=[height|hash] [height|hash]", + Use: "block --type={height|hash} ", Short: "Query for a committed block by height, hash, or event(s)", Long: "Query for a specific committed block using the CometBFT RPC `block` and `block_by_hash` method", Example: strings.TrimSpace(fmt.Sprintf(` @@ -246,7 +235,8 @@ $ %s query block --%s=%s RunE: func(cmd *cobra.Command, args []string) error { typ, _ := cmd.Flags().GetString(FlagType) - rpcclient, err := s.rpcClient(cmd) + rpcclient, err := rpcClient(cmd) + fmt.Println("rpcclient", rpcclient, err) if err != nil { return err } @@ -318,14 +308,14 @@ $ %s query block --%s=%s } // QueryBlockResultsCmd implements the default command for a BlockResults query. -func (s *CometBFTServer[T]) QueryBlockResultsCmd() *cobra.Command { +func QueryBlockResultsCmd() *cobra.Command { cmd := &cobra.Command{ Use: "block-results [height]", Short: "Query for a committed block's results by height", Long: "Query for a specific committed block's results using the CometBFT RPC `block_results` method", Args: cobra.RangeArgs(0, 1), RunE: func(cmd *cobra.Command, args []string) error { - node, err := s.rpcClient(cmd) + node, err := rpcClient(cmd) if err != nil { return err } diff --git a/server/v2/cometbft/go.mod b/server/v2/cometbft/go.mod index 40eea02efaa9..f5bee435d483 100644 --- a/server/v2/cometbft/go.mod +++ b/server/v2/cometbft/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/server/v2/cometbft -go 1.22.2 +go 1.23 replace ( cosmossdk.io/api => ../../../api @@ -10,8 +10,6 @@ replace ( cosmossdk.io/server/v2/appmanager => ../appmanager cosmossdk.io/store => ../../../store cosmossdk.io/store/v2 => ../../../store/v2 - cosmossdk.io/x/accounts => ../../../x/accounts - cosmossdk.io/x/auth => ../../../x/auth cosmossdk.io/x/bank => ../../../x/bank cosmossdk.io/x/consensus => ../../../x/consensus cosmossdk.io/x/staking => ../../../x/staking @@ -22,11 +20,11 @@ replace ( require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 cosmossdk.io/api v0.7.5 - cosmossdk.io/core v0.12.1-0.20240725072823-6a2d039e1212 + cosmossdk.io/core v1.0.0 cosmossdk.io/errors v1.0.1 - cosmossdk.io/log v1.4.0 + cosmossdk.io/log v1.4.1 cosmossdk.io/server/v2 v2.0.0-00010101000000-000000000000 - cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000 + cosmossdk.io/server/v2/appmanager v0.0.0-20240802110823-cffeedff643d cosmossdk.io/store/v2 v2.0.0-00010101000000-000000000000 cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 github.com/cometbft/cometbft v1.0.0-rc1 @@ -39,8 +37,8 @@ require ( github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.19.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 - google.golang.org/grpc v1.65.0 + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 + google.golang.org/grpc v1.66.0 google.golang.org/protobuf v1.34.2 sigs.k8s.io/yaml v1.4.0 ) @@ -52,7 +50,6 @@ require ( cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 // indirect cosmossdk.io/math v1.3.0 // indirect cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc // indirect - cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/tx v0.13.3 // indirect @@ -71,11 +68,11 @@ require ( github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/cometbft/cometbft-db v0.12.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-db v1.0.2 // indirect + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 // indirect github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/iavl v1.2.1-0.20240731145221-594b181f427e // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -115,7 +112,7 @@ require ( github.com/iancoleman/strcase v0.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect @@ -131,13 +128,13 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -170,9 +167,11 @@ require ( golang.org/x/term v0.23.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect pgregory.net/rapid v1.1.0 // indirect ) + +replace github.com/cosmos/iavl => github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e diff --git a/server/v2/cometbft/go.sum b/server/v2/cometbft/go.sum index b0e53aebebb7..d5c73f9fd59f 100644 --- a/server/v2/cometbft/go.sum +++ b/server/v2/cometbft/go.sum @@ -12,12 +12,12 @@ cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 h1:IQNdY2kB+k+1OM2DvqFG1+UgeU1JzZrWtwuWzI3ZfwA= cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5/go.mod h1:0CuYKkFHxc1vw2JC+t21THBCALJVROrWVR/3PQ1urpc= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= -cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= +cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk= +cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= @@ -95,8 +95,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/crypto v0.1.2 h1:Yn500sPY+9sKVdhiPUSDtt8JOpBGMB515dOmla4zfls= @@ -107,10 +107,10 @@ github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiK github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/cosmos/iavl v1.2.1-0.20240731145221-594b181f427e h1:5bxw1E0peLMrr8ZO9mYT0d9sxy0WgR1ZEWb92yjKnnk= -github.com/cosmos/iavl v1.2.1-0.20240731145221-594b181f427e/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e h1:LEii0v/FxtXa/F7mRn+tijZ0zaXBPn2ZkKwb6Qm4rqE= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e/go.mod h1:3ywr0wDnWeD7MUH6qu50wZ5bxuKH3LBrGG4/lZX8lVY= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -292,8 +292,8 @@ github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -303,6 +303,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -369,8 +371,8 @@ github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4 github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba h1:3jPgmsFGBID1wFfU2AbYocNcN4wqU68UaHSdMjiw/7U= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= @@ -387,8 +389,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -397,8 +399,8 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -453,7 +455,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -481,6 +482,8 @@ go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 h1:qxen9oVGzDdIRP6 go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5/go.mod h1:eW0HG9/oHQhvRCvb1/pIXW4cOvtDqeQK+XSi3TnwaXY= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -599,18 +602,18 @@ google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/server/v2/cometbft/handlers/defaults.go b/server/v2/cometbft/handlers/defaults.go index 3fd46da6fe94..18ad38669c9c 100644 --- a/server/v2/cometbft/handlers/defaults.go +++ b/server/v2/cometbft/handlers/defaults.go @@ -7,7 +7,7 @@ import ( abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" - appmanager "cosmossdk.io/core/app" + "cosmossdk.io/core/server" "cosmossdk.io/core/store" "cosmossdk.io/core/transaction" "cosmossdk.io/server/v2/cometbft/mempool" @@ -15,7 +15,7 @@ import ( ) type AppManager[T transaction.Tx] interface { - ValidateTx(ctx context.Context, tx T) (appmanager.TxResult, error) + ValidateTx(ctx context.Context, tx T) (server.TxResult, error) Query(ctx context.Context, version uint64, request transaction.Msg) (response transaction.Msg, err error) } diff --git a/server/v2/cometbft/server.go b/server/v2/cometbft/server.go index c06c56c9be9e..c1b547928c8c 100644 --- a/server/v2/cometbft/server.go +++ b/server/v2/cometbft/server.go @@ -233,18 +233,19 @@ func (s *CometBFTServer[T]) StartCmdFlags() *pflag.FlagSet { func (s *CometBFTServer[T]) CLICommands() serverv2.CLIConfig { return serverv2.CLIConfig{ Commands: []*cobra.Command{ - s.StatusCommand(), - s.ShowNodeIDCmd(), - s.ShowValidatorCmd(), - s.ShowAddressCmd(), - s.VersionCmd(), + StatusCommand(), + ShowNodeIDCmd(), + ShowValidatorCmd(), + ShowAddressCmd(), + VersionCmd(), + s.BootstrapStateCmd(), cmtcmd.ResetAllCmd, cmtcmd.ResetStateCmd, }, Queries: []*cobra.Command{ - s.QueryBlockCmd(), - s.QueryBlocksCmd(), - s.QueryBlockResultsCmd(), + QueryBlockCmd(), + QueryBlocksCmd(), + QueryBlockResultsCmd(), }, } } diff --git a/server/v2/cometbft/streaming.go b/server/v2/cometbft/streaming.go index 1ac9991b9ffa..0c8af07aa547 100644 --- a/server/v2/cometbft/streaming.go +++ b/server/v2/cometbft/streaming.go @@ -3,8 +3,8 @@ package cometbft import ( "context" - coreappmgr "cosmossdk.io/core/app" "cosmossdk.io/core/event" + "cosmossdk.io/core/server" "cosmossdk.io/core/store" "cosmossdk.io/server/v2/streaming" ) @@ -14,7 +14,7 @@ func (c *Consensus[T]) streamDeliverBlockChanges( ctx context.Context, height int64, txs [][]byte, - txResults []coreappmgr.TxResult, + txResults []server.TxResult, events []event.Event, stateChanges []store.StateChanges, ) error { @@ -23,13 +23,9 @@ func (c *Consensus[T]) streamDeliverBlockChanges( for i, txResult := range txResults { streamingTxResults[i] = &streaming.ExecTxResult{ Code: txResult.Code, - Data: txResult.Data, - Log: txResult.Log, - Info: txResult.Info, GasWanted: uint64ToInt64(txResult.GasWanted), GasUsed: uint64ToInt64(txResult.GasUsed), Events: streaming.IntoStreamingEvents(txResult.Events), - Codespace: txResult.Codespace, } } diff --git a/server/v2/cometbft/utils.go b/server/v2/cometbft/utils.go index 594e046ad173..b8470c79e76a 100644 --- a/server/v2/cometbft/utils.go +++ b/server/v2/cometbft/utils.go @@ -17,10 +17,10 @@ import ( "google.golang.org/protobuf/types/known/anypb" v1beta1 "cosmossdk.io/api/cosmos/base/abci/v1beta1" - appmanager "cosmossdk.io/core/app" appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/comet" "cosmossdk.io/core/event" + "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" errorsmod "cosmossdk.io/errors" consensus "cosmossdk.io/x/consensus/types" @@ -68,7 +68,7 @@ func splitABCIQueryPath(requestPath string) (path []string) { } func finalizeBlockResponse( - in *appmanager.BlockResponse, + in *server.BlockResponse, cp *cmtproto.ConsensusParams, appHash []byte, indexSet map[string]struct{}, @@ -99,7 +99,7 @@ func intoABCIValidatorUpdates(updates []appmodulev2.ValidatorUpdate) []abci.Vali return valsetUpdates } -func intoABCITxResults(results []appmanager.TxResult, indexSet map[string]struct{}) []*abci.ExecTxResult { +func intoABCITxResults(results []server.TxResult, indexSet map[string]struct{}) []*abci.ExecTxResult { res := make([]*abci.ExecTxResult, len(results)) for i := range results { if results[i].Error != nil { @@ -146,7 +146,7 @@ func intoABCIEvents(events []event.Event, indexSet map[string]struct{}) []abci.E return abciEvents } -func intoABCISimulationResponse(txRes appmanager.TxResult, indexSet map[string]struct{}) ([]byte, error) { +func intoABCISimulationResponse(txRes server.TxResult, indexSet map[string]struct{}) ([]byte, error) { indexAll := len(indexSet) == 0 abciEvents := make([]*abciv1.Event, len(txRes.Events)) for i, e := range txRes.Events { diff --git a/server/v2/commands.go b/server/v2/commands.go index a0b2b05ae902..101a23d3983e 100644 --- a/server/v2/commands.go +++ b/server/v2/commands.go @@ -38,13 +38,14 @@ func AddCommands[T transaction.Tx]( rootCmd *cobra.Command, newApp AppCreator[T], logger log.Logger, + serverCfg ServerConfig, components ...ServerComponent[T], ) error { if len(components) == 0 { return errors.New("no components provided") } - server := NewServer(logger, components...) + server := NewServer(logger, serverCfg, components...) originalPersistentPreRunE := rootCmd.PersistentPreRunE rootCmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error { // set the default command outputs diff --git a/server/v2/config.go b/server/v2/config.go index 7ce73fe88a9a..b5c525fdf682 100644 --- a/server/v2/config.go +++ b/server/v2/config.go @@ -7,6 +7,18 @@ import ( "github.com/spf13/viper" ) +// ServerConfig defines configuration for the server component. +type ServerConfig struct { + MinGasPrices string `mapstructure:"minimum-gas-prices" toml:"minimum-gas-prices" comment:"minimum-gas-prices defines the price which a validator is willing to accept for processing a transaction. A transaction's fees must meet the minimum of any denomination specified in this config (e.g. 0.25token1;0.0001token2)."` +} + +// DefaultServerConfig returns the default config of server component +func DefaultServerConfig() ServerConfig { + return ServerConfig{ + MinGasPrices: "0stake", + } +} + // ReadConfig returns a viper instance of the config file func ReadConfig(configPath string) (*viper.Viper, error) { v := viper.New() diff --git a/server/v2/flags.go b/server/v2/flags.go index a86154eb769c..fc36cdcf2b4c 100644 --- a/server/v2/flags.go +++ b/server/v2/flags.go @@ -1,6 +1,16 @@ // Package serverv2 defines constants for server configuration flags and output formats. package serverv2 +import "fmt" + +// start flags are prefixed with the server name +// this allows viper to properly bind the flags +func prefix(f string) string { + return fmt.Sprintf("%s.%s", serverName, f) +} + +var FlagMinGasPrices = prefix("minimum-gas-prices") + const ( // FlagHome specifies the home directory flag. FlagHome = "home" diff --git a/server/v2/go.mod b/server/v2/go.mod index dc36c6b533a8..7a4b026686cb 100644 --- a/server/v2/go.mod +++ b/server/v2/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/server/v2 -go 1.21 +go 1.23 replace ( cosmossdk.io/api => ../../api @@ -15,9 +15,9 @@ replace ( require ( cosmossdk.io/api v0.7.5 - cosmossdk.io/core v0.12.1-0.20240725072823-6a2d039e1212 + cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 - cosmossdk.io/log v1.4.0 + cosmossdk.io/log v1.4.1 cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000 cosmossdk.io/store/v2 v2.0.0-00010101000000-000000000000 github.com/cosmos/cosmos-proto v1.0.0-beta.5 @@ -31,16 +31,15 @@ require ( github.com/hashicorp/go-plugin v1.6.1 github.com/mitchellh/mapstructure v1.5.0 github.com/pelletier/go-toml/v2 v2.2.2 - github.com/prometheus/client_golang v1.19.1 - github.com/prometheus/common v0.55.0 + github.com/prometheus/client_golang v1.20.2 + github.com/prometheus/common v0.57.0 github.com/rs/zerolog v1.33.0 github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 - golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc golang.org/x/sync v0.8.0 - google.golang.org/grpc v1.65.0 + google.golang.org/grpc v1.66.0 google.golang.org/protobuf v1.34.2 ) @@ -56,9 +55,8 @@ require ( github.com/cockroachdb/pebble v1.1.0 // indirect github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect - github.com/cosmos/cosmos-db v1.0.2 // indirect github.com/cosmos/iavl v1.2.1-0.20240731145221-594b181f427e // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/emicklei/dot v1.6.2 // indirect github.com/fatih/color v1.17.0 // indirect @@ -75,7 +73,7 @@ require ( github.com/hashicorp/yamux v0.1.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jhump/protoreflect v1.15.3 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/linxGnu/grocksdb v1.8.14 // indirect @@ -102,14 +100,17 @@ require ( github.com/tidwall/btree v1.7.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.26.0 // indirect + golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +replace github.com/cosmos/iavl => github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e diff --git a/server/v2/go.sum b/server/v2/go.sum index aef9a43e08ad..8fd608907e25 100644 --- a/server/v2/go.sum +++ b/server/v2/go.sum @@ -2,8 +2,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 h1:IQNdY2kB+k+1OM2DvqFG1+UgeU1JzZrWtwuWzI3ZfwA= cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5/go.mod h1:0CuYKkFHxc1vw2JC+t21THBCALJVROrWVR/3PQ1urpc= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= @@ -53,8 +53,6 @@ github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= @@ -62,10 +60,10 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/cosmos/iavl v1.2.1-0.20240731145221-594b181f427e h1:5bxw1E0peLMrr8ZO9mYT0d9sxy0WgR1ZEWb92yjKnnk= -github.com/cosmos/iavl v1.2.1-0.20240731145221-594b181f427e/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e h1:LEii0v/FxtXa/F7mRn+tijZ0zaXBPn2ZkKwb6Qm4rqE= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e/go.mod h1:3ywr0wDnWeD7MUH6qu50wZ5bxuKH3LBrGG4/lZX8lVY= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -112,8 +110,6 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -183,8 +179,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -256,8 +252,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -266,8 +262,8 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -446,10 +442,10 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEY google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -458,8 +454,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/server/v2/server.go b/server/v2/server.go index 6e1a4e7114db..08ae9a6a06fa 100644 --- a/server/v2/server.go +++ b/server/v2/server.go @@ -56,25 +56,32 @@ type CLIConfig struct { Txs []*cobra.Command } +const ( + serverName = "server" +) + var _ ServerComponent[transaction.Tx] = (*Server[transaction.Tx])(nil) type Server[T transaction.Tx] struct { logger log.Logger components []ServerComponent[T] + config ServerConfig } func NewServer[T transaction.Tx]( logger log.Logger, + config ServerConfig, components ...ServerComponent[T], ) *Server[T] { return &Server[T]{ logger: logger, + config: config, components: components, } } func (s *Server[T]) Name() string { - return "server" + return serverName } // Start starts all components concurrently. @@ -151,9 +158,19 @@ func (s *Server[T]) CLICommands() CLIConfig { return commands } +// Config returns config of the server component +func (s *Server[T]) Config() ServerConfig { + return s.config +} + // Configs returns all configs of all server components. func (s *Server[T]) Configs() map[string]any { cfgs := make(map[string]any) + + // add server component config + cfgs[s.Name()] = s.config + + // add other components' config for _, mod := range s.components { if configmod, ok := mod.(HasConfig); ok { cfg := configmod.Config() @@ -164,9 +181,22 @@ func (s *Server[T]) Configs() map[string]any { return cfgs } +func (s *Server[T]) StartCmdFlags() *pflag.FlagSet { + flags := pflag.NewFlagSet(s.Name(), pflag.ExitOnError) + flags.String(FlagMinGasPrices, "", "Minimum gas prices to accept for transactions; Any fee in a tx must meet this minimum (e.g. 0.01photino;0.0001stake)") + return flags +} + // Init initializes all server components with the provided application, configuration, and logger. // It returns an error if any component fails to initialize. func (s *Server[T]) Init(appI AppI[T], v *viper.Viper, logger log.Logger) error { + cfg := s.config + if v != nil { + if err := UnmarshalSubConfig(v, s.Name(), &cfg); err != nil { + return fmt.Errorf("failed to unmarshal config: %w", err) + } + } + var components []ServerComponent[T] for _, mod := range s.components { mod := mod @@ -177,6 +207,7 @@ func (s *Server[T]) Init(appI AppI[T], v *viper.Viper, logger log.Logger) error components = append(components, mod) } + s.config = cfg s.components = components return nil } @@ -217,6 +248,11 @@ func (s *Server[T]) WriteConfig(configPath string) error { // StartFlags returns all flags of all server components. func (s *Server[T]) StartFlags() []*pflag.FlagSet { flags := []*pflag.FlagSet{} + + // add server component flags + flags = append(flags, s.StartCmdFlags()) + + // add other components' start cmd flags for _, mod := range s.components { if startmod, ok := mod.(HasStartFlags); ok { flags = append(flags, startmod.StartCmdFlags()) diff --git a/server/v2/server_test.go b/server/v2/server_test.go index e757e7ecd5ca..572d91272062 100644 --- a/server/v2/server_test.go +++ b/server/v2/server_test.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/viper" "github.com/stretchr/testify/require" - coreapp "cosmossdk.io/core/app" + coreserver "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" serverv2 "cosmossdk.io/server/v2" @@ -42,7 +42,7 @@ func (*mockApp[T]) GetAppManager() *appmanager.AppManager[T] { return nil } -func (*mockApp[T]) InterfaceRegistry() coreapp.InterfaceRegistry { +func (*mockApp[T]) InterfaceRegistry() coreserver.InterfaceRegistry { return &mockInterfaceRegistry{} } @@ -65,6 +65,7 @@ func TestServer(t *testing.T) { server := serverv2.NewServer( logger, + serverv2.DefaultServerConfig(), grpcServer, mockServer, ) diff --git a/server/v2/stf/branch/branch_test.go b/server/v2/stf/branch/branch_test.go index e306a2cadfdc..9ce7f7364394 100644 --- a/server/v2/stf/branch/branch_test.go +++ b/server/v2/stf/branch/branch_test.go @@ -3,7 +3,6 @@ package branch import ( "testing" - "github.com/stretchr/testify/require" "github.com/tidwall/btree" "cosmossdk.io/core/store" @@ -11,21 +10,32 @@ import ( func TestBranch(t *testing.T) { set := func(s interface{ Set([]byte, []byte) error }, key, value string) { - require.NoError(t, s.Set([]byte(key), []byte(value))) + err := s.Set([]byte(key), []byte(value)) + if err != nil { + t.Errorf("Error setting value: %v", err) + } } get := func(s interface{ Get([]byte) ([]byte, error) }, key, wantValue string) { value, err := s.Get([]byte(key)) - require.NoError(t, err) + if err != nil { + t.Errorf("Error getting value: %v", err) + } if wantValue == "" { - require.Nil(t, value) + if value != nil { + t.Errorf("Expected nil value, got: %v", value) + } } else { - require.Equal(t, wantValue, string(value)) + if string(value) != wantValue { + t.Errorf("Expected value: %s, got: %s", wantValue, value) + } } } remove := func(s interface{ Delete([]byte) error }, key string) { err := s.Delete([]byte(key)) - require.NoError(t, err) + if err != nil { + t.Errorf("Error deleting value: %v", err) + } } iter := func(s interface { @@ -41,15 +51,23 @@ func TestBranch(t *testing.T) { endKey = nil } iter, err := s.Iterator(startKey, endKey) - require.NoError(t, err) + if err != nil { + t.Errorf("Error creating iterator: %v", err) + } defer iter.Close() numPairs := len(wantPairs) for i := 0; i < numPairs; i++ { - require.True(t, iter.Valid(), "expected iterator to be valid") + if !iter.Valid() { + t.Errorf("Expected iterator to be valid") + } gotKey, gotValue := string(iter.Key()), string(iter.Value()) wantKey, wantValue := wantPairs[i][0], wantPairs[i][1] - require.Equal(t, wantKey, gotKey) - require.Equal(t, wantValue, gotValue) + if wantKey != gotKey { + t.Errorf("Expected key: %s, got: %s", wantKey, gotKey) + } + if wantValue != gotValue { + t.Errorf("Expected value: %s, got: %s", wantValue, gotValue) + } iter.Next() } } @@ -107,8 +125,6 @@ func newMemState() memStore { return memStore{btree.NewBTreeGOptions(byKeys, btree.Options{Degree: bTreeDegree, NoLocks: true})} } -var _ store.Writer = memStore{} - type memStore struct { t *btree.BTreeG[item] } diff --git a/server/v2/stf/core_branch_service.go b/server/v2/stf/core_branch_service.go index 365d73d532b4..431730b2334a 100644 --- a/server/v2/stf/core_branch_service.go +++ b/server/v2/stf/core_branch_service.go @@ -14,7 +14,12 @@ var _ branch.Service = (*BranchService)(nil) type BranchService struct{} func (bs BranchService) Execute(ctx context.Context, f func(ctx context.Context) error) error { - return bs.execute(ctx.(*executionContext), f) + exCtx, err := getExecutionCtxFromContext(ctx) + if err != nil { + return err + } + + return bs.execute(exCtx, f) } func (bs BranchService) ExecuteWithGasLimit( @@ -22,18 +27,21 @@ func (bs BranchService) ExecuteWithGasLimit( gasLimit uint64, f func(ctx context.Context) error, ) (gasUsed uint64, err error) { - stfCtx := ctx.(*executionContext) + exCtx, err := getExecutionCtxFromContext(ctx) + if err != nil { + return 0, err + } - originalGasMeter := stfCtx.meter + originalGasMeter := exCtx.meter - stfCtx.setGasLimit(gasLimit) + exCtx.setGasLimit(gasLimit) // execute branched, with predefined gas limit. - err = bs.execute(stfCtx, f) + err = bs.execute(exCtx, f) // restore original context - gasUsed = stfCtx.meter.Limit() - stfCtx.meter.Remaining() + gasUsed = exCtx.meter.Limit() - exCtx.meter.Remaining() _ = originalGasMeter.Consume(gasUsed, "execute-with-gas-limit") - stfCtx.setGasLimit(originalGasMeter.Limit() - originalGasMeter.Remaining()) + exCtx.setGasLimit(originalGasMeter.Limit() - originalGasMeter.Remaining()) return gasUsed, err } diff --git a/server/v2/stf/core_branch_service_test.go b/server/v2/stf/core_branch_service_test.go index 21854001ba56..a54783b605e7 100644 --- a/server/v2/stf/core_branch_service_test.go +++ b/server/v2/stf/core_branch_service_test.go @@ -6,7 +6,6 @@ import ( "testing" gogotypes "github.com/cosmos/gogoproto/types" - "github.com/stretchr/testify/require" appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/server/v2/stf/branch" @@ -61,8 +60,12 @@ func TestBranchService(t *testing.T) { kvSet(t, ctx, "cookies") return nil }) - require.NoError(t, err) - require.NotZero(t, gasUsed) + if err != nil { + t.Errorf("unexpected error: %v", err) + } + if gasUsed == 0 { + t.Error("expected non-zero gasUsed") + } stateHas(t, stfCtx.state, "cookies") }) @@ -72,8 +75,12 @@ func TestBranchService(t *testing.T) { kvSet(t, ctx, "cookies") return errors.New("fail") }) - require.Error(t, err) - require.NotZero(t, gasUsed) + if err == nil { + t.Error("expected error") + } + if gasUsed == 0 { + t.Error("expected non-zero gasUsed") + } stateNotHas(t, stfCtx.state, "cookies") }) @@ -85,9 +92,15 @@ func TestBranchService(t *testing.T) { _ = state.Set([]byte("not out of gas"), []byte{}) return state.Set([]byte("out of gas"), []byte{}) }) - require.Error(t, err) - require.NotZero(t, gasUsed) + if err == nil { + t.Error("expected error") + } + if gasUsed == 0 { + t.Error("expected non-zero gasUsed") + } stateNotHas(t, stfCtx.state, "cookies") - require.Equal(t, uint64(1000), stfCtx.meter.Limit()-stfCtx.meter.Remaining()) + if stfCtx.meter.Limit()-stfCtx.meter.Remaining() != 1000 { + t.Error("expected gas limit precision to be 1000") + } }) } diff --git a/server/v2/stf/core_event_service.go b/server/v2/stf/core_event_service.go index a27eddd35cd5..7a294fc77960 100644 --- a/server/v2/stf/core_event_service.go +++ b/server/v2/stf/core_event_service.go @@ -4,14 +4,14 @@ import ( "bytes" "context" "encoding/json" + "maps" "slices" "github.com/cosmos/gogoproto/jsonpb" gogoproto "github.com/cosmos/gogoproto/proto" - "golang.org/x/exp/maps" "cosmossdk.io/core/event" - transaction "cosmossdk.io/core/transaction" + "cosmossdk.io/core/transaction" ) func NewEventService() event.Service { @@ -22,7 +22,12 @@ type eventService struct{} // EventManager implements event.Service. func (eventService) EventManager(ctx context.Context) event.Manager { - return &eventManager{ctx.(*executionContext)} + exCtx, err := getExecutionCtxFromContext(ctx) + if err != nil { + panic(err) + } + + return &eventManager{exCtx} } var _ event.Manager = (*eventManager)(nil) @@ -49,12 +54,6 @@ func (em *eventManager) EmitKV(eventType string, attrs ...event.Attribute) error return nil } -// EmitNonConsensus emits an typed event that is defined in the protobuf file. -// These events will not be added to consensus. -func (em *eventManager) EmitNonConsensus(event transaction.Msg) error { - return em.Emit(event) -} - // TypedEventToEvent takes typed event and converts to Event object func TypedEventToEvent(tev transaction.Msg) (event.Event, error) { evtType := gogoproto.MessageName(tev) @@ -70,9 +69,7 @@ func TypedEventToEvent(tev transaction.Msg) (event.Event, error) { } // sort the keys to ensure the order is always the same - keys := maps.Keys(attrMap) - slices.Sort(keys) - + keys := slices.Sorted(maps.Keys(attrMap)) attrs := make([]event.Attribute, 0, len(attrMap)) for _, k := range keys { v := attrMap[k] diff --git a/server/v2/stf/core_gas_service.go b/server/v2/stf/core_gas_service.go index d61859791772..1253420eb246 100644 --- a/server/v2/stf/core_gas_service.go +++ b/server/v2/stf/core_gas_service.go @@ -30,5 +30,10 @@ func (g gasService) GasConfig(ctx context.Context) gas.GasConfig { } func (g gasService) GasMeter(ctx context.Context) gas.Meter { - return ctx.(*executionContext).meter + exCtx, err := getExecutionCtxFromContext(ctx) + if err != nil { + panic(err) + } + + return exCtx.meter } diff --git a/server/v2/stf/core_header_service.go b/server/v2/stf/core_header_service.go index 4448627828ca..8b7f6c412be9 100644 --- a/server/v2/stf/core_header_service.go +++ b/server/v2/stf/core_header_service.go @@ -12,7 +12,12 @@ var _ header.Service = (*HeaderService)(nil) type HeaderService struct{} func (h HeaderService) HeaderInfo(ctx context.Context) header.Info { - return ctx.(*executionContext).headerInfo + exCtx, err := getExecutionCtxFromContext(ctx) + if err != nil { + panic(err) + } + + return exCtx.headerInfo } const headerInfoPrefix = 0x37 diff --git a/server/v2/stf/core_router_service.go b/server/v2/stf/core_router_service.go index 8410b0d5f779..e3a3f95940a6 100644 --- a/server/v2/stf/core_router_service.go +++ b/server/v2/stf/core_router_service.go @@ -23,19 +23,22 @@ type msgRouterService struct { // CanInvoke returns an error if the given message cannot be invoked. func (m msgRouterService) CanInvoke(ctx context.Context, typeURL string) error { - return ctx.(*executionContext).msgRouter.CanInvoke(ctx, typeURL) -} + exCtx, err := getExecutionCtxFromContext(ctx) + if err != nil { + return err + } -// InvokeTyped execute a message and fill-in a response. -// The response must be known and passed as a parameter. -// Use InvokeUntyped if the response type is not known. -func (m msgRouterService) InvokeTyped(ctx context.Context, msg, resp transaction.Msg) error { - return ctx.(*executionContext).msgRouter.InvokeTyped(ctx, msg, resp) + return exCtx.msgRouter.CanInvoke(ctx, typeURL) } -// InvokeUntyped execute a message and returns a response. -func (m msgRouterService) InvokeUntyped(ctx context.Context, msg transaction.Msg) (transaction.Msg, error) { - return ctx.(*executionContext).msgRouter.InvokeUntyped(ctx, msg) +// Invoke execute a message and returns a response. +func (m msgRouterService) Invoke(ctx context.Context, msg transaction.Msg) (transaction.Msg, error) { + exCtx, err := getExecutionCtxFromContext(ctx) + if err != nil { + return nil, err + } + + return exCtx.msgRouter.Invoke(ctx, msg) } // NewQueryRouterService implements router.Service. @@ -49,23 +52,23 @@ type queryRouterService struct{} // CanInvoke returns an error if the given request cannot be invoked. func (m queryRouterService) CanInvoke(ctx context.Context, typeURL string) error { - return ctx.(*executionContext).queryRouter.CanInvoke(ctx, typeURL) -} + exCtx, err := getExecutionCtxFromContext(ctx) + if err != nil { + return err + } -// InvokeTyped execute a message and fill-in a response. -// The response must be known and passed as a parameter. -// Use InvokeUntyped if the response type is not known. -func (m queryRouterService) InvokeTyped( - ctx context.Context, - req, resp transaction.Msg, -) error { - return ctx.(*executionContext).queryRouter.InvokeTyped(ctx, req, resp) + return exCtx.queryRouter.CanInvoke(ctx, typeURL) } // InvokeUntyped execute a message and returns a response. -func (m queryRouterService) InvokeUntyped( +func (m queryRouterService) Invoke( ctx context.Context, req transaction.Msg, ) (transaction.Msg, error) { - return ctx.(*executionContext).queryRouter.InvokeUntyped(ctx, req) + exCtx, err := getExecutionCtxFromContext(ctx) + if err != nil { + return nil, err + } + + return exCtx.queryRouter.Invoke(ctx, req) } diff --git a/server/v2/stf/core_store_service.go b/server/v2/stf/core_store_service.go index d912f9277157..9ee67ca367af 100644 --- a/server/v2/stf/core_store_service.go +++ b/server/v2/stf/core_store_service.go @@ -21,7 +21,12 @@ type storeService struct { } func (s storeService) OpenKVStore(ctx context.Context) store.KVStore { - state, err := ctx.(*executionContext).state.GetWriter(s.actor) + exCtx, err := getExecutionCtxFromContext(ctx) + if err != nil { + panic(err) + } + + state, err := exCtx.state.GetWriter(s.actor) if err != nil { panic(err) } diff --git a/server/v2/stf/export_test.go b/server/v2/stf/export_test.go deleted file mode 100644 index b84148abdd9c..000000000000 --- a/server/v2/stf/export_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package stf - -import ( - "context" -) - -func GetExecutionContext(ctx context.Context) *executionContext { - executionCtx, ok := ctx.(*executionContext) - if !ok { - return nil - } - return executionCtx -} diff --git a/server/v2/stf/go.mod b/server/v2/stf/go.mod index 9d99659c3110..69d9dd853a73 100644 --- a/server/v2/stf/go.mod +++ b/server/v2/stf/go.mod @@ -1,23 +1,16 @@ module cosmossdk.io/server/v2/stf -go 1.21 +go 1.23 replace cosmossdk.io/core => ../../../core require ( cosmossdk.io/core v0.11.0 github.com/cosmos/gogoproto v1.7.0 - github.com/stretchr/testify v1.9.0 github.com/tidwall/btree v1.7.0 - golang.org/x/exp v0.0.0-20231006140011-7918f672742d ) require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect google.golang.org/protobuf v1.34.2 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) - -replace github.com/cosmos/gogoproto => github.com/cosmos/gogoproto v1.6.1-0.20240809124342-d6a57064ada0 diff --git a/server/v2/stf/go.sum b/server/v2/stf/go.sum index 64ea66b6dd2b..201794168336 100644 --- a/server/v2/stf/go.sum +++ b/server/v2/stf/go.sum @@ -1,22 +1,10 @@ -github.com/cosmos/gogoproto v1.6.1-0.20240809124342-d6a57064ada0 h1:qZdcY4sKyAnaUwFRtSKkk9YdeMuQixWxLagI/8jhJo4= -github.com/cosmos/gogoproto v1.6.1-0.20240809124342-d6a57064ada0/go.mod h1:Y+g956rcUf2vr4uwtCcK/1Xx9BWVluCtcI9vsh0GHmk= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= +github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/server/v2/stf/identity.go b/server/v2/stf/identity.go new file mode 100644 index 000000000000..715c51cd977d --- /dev/null +++ b/server/v2/stf/identity.go @@ -0,0 +1,10 @@ +package stf + +var ( + // Identity defines STF's bytes identity and it's used by STF to store things in its own state. + Identity = []byte("stf") + // RuntimeIdentity defines the bytes identity of the runtime. + RuntimeIdentity = []byte("runtime") + // ConsensusIdentity defines the bytes identity of the consensus. + ConsensusIdentity = []byte("consensus") +) diff --git a/server/v2/stf/stf.go b/server/v2/stf/stf.go index d3cd2405b23b..e32a8f33293e 100644 --- a/server/v2/stf/stf.go +++ b/server/v2/stf/stf.go @@ -5,7 +5,6 @@ import ( "errors" "fmt" - appmanager "cosmossdk.io/core/app" appmodulev2 "cosmossdk.io/core/appmodule/v2" corecontext "cosmossdk.io/core/context" "cosmossdk.io/core/event" @@ -13,14 +12,16 @@ import ( "cosmossdk.io/core/header" "cosmossdk.io/core/log" "cosmossdk.io/core/router" + "cosmossdk.io/core/server" "cosmossdk.io/core/store" "cosmossdk.io/core/transaction" stfgas "cosmossdk.io/server/v2/stf/gas" "cosmossdk.io/server/v2/stf/internal" ) -// Identity defines STF's bytes identity and it's used by STF to store things in its own state. -var Identity = []byte("stf") +type eContextKey struct{} + +var executionContextKey = eContextKey{} // STF is a struct that manages the state transition component of the app. type STF[T transaction.Tx] struct { @@ -85,9 +86,9 @@ func NewSTF[T transaction.Tx]( // executes the block and returns the block results and the new state. func (s STF[T]) DeliverBlock( ctx context.Context, - block *appmanager.BlockRequest[T], + block *server.BlockRequest[T], state store.ReaderMap, -) (blockResult *appmanager.BlockResponse, newState store.WriterMap, err error) { +) (blockResult *server.BlockResponse, newState store.WriterMap, err error) { // creates a new branchFn state, from the readonly view of the state // that can be written to. newState = s.branchFn(state) @@ -104,7 +105,7 @@ func (s STF[T]) DeliverBlock( return nil, nil, fmt.Errorf("unable to set initial header info, %w", err) } - exCtx := s.makeContext(ctx, appmanager.ConsensusIdentity, newState, internal.ExecModeFinalize) + exCtx := s.makeContext(ctx, ConsensusIdentity, newState, internal.ExecModeFinalize) exCtx.setHeaderInfo(hi) // reset events @@ -138,7 +139,7 @@ func (s STF[T]) DeliverBlock( } // execute txs - txResults := make([]appmanager.TxResult, len(block.Txs)) + txResults := make([]server.TxResult, len(block.Txs)) // TODO: skip first tx if vote extensions are enabled (marko) for i, txBytes := range block.Txs { // check if we need to return early or continue delivering txs @@ -155,8 +156,7 @@ func (s STF[T]) DeliverBlock( return nil, nil, err } - return &appmanager.BlockResponse{ - Apphash: nil, + return &server.BlockResponse{ ValidatorUpdates: valset, PreBlockEvents: preBlockEvents, BeginBlockEvents: beginBlockEvents, @@ -172,7 +172,7 @@ func (s STF[T]) deliverTx( tx T, execMode transaction.ExecMode, hi header.Info, -) appmanager.TxResult { +) server.TxResult { // recover in the case of a panic var recoveryError error defer func() { @@ -184,26 +184,26 @@ func (s STF[T]) deliverTx( // handle error from GetGasLimit gasLimit, gasLimitErr := tx.GetGasLimit() if gasLimitErr != nil { - return appmanager.TxResult{ + return server.TxResult{ Error: gasLimitErr, } } if recoveryError != nil { - return appmanager.TxResult{ + return server.TxResult{ Error: recoveryError, } } validateGas, validationEvents, err := s.validateTx(ctx, state, gasLimit, tx, execMode) if err != nil { - return appmanager.TxResult{ + return server.TxResult{ Error: err, } } execResp, execGas, execEvents, err := s.execTx(ctx, state, gasLimit-validateGas, tx, execMode, hi) - return appmanager.TxResult{ + return server.TxResult{ Events: append(validationEvents, execEvents...), GasUsed: execGas + validateGas, GasWanted: gasLimit, @@ -226,7 +226,7 @@ func (s STF[T]) validateTx( if err != nil { return 0, nil, err } - validateCtx := s.makeContext(ctx, appmanager.RuntimeIdentity, validateState, execMode) + validateCtx := s.makeContext(ctx, RuntimeIdentity, validateState, execMode) validateCtx.setHeaderInfo(hi) validateCtx.setGasLimit(gasLimit) err = s.doTxValidation(validateCtx, tx) @@ -255,7 +255,7 @@ func (s STF[T]) execTx( // in case of error during message execution, we do not apply the exec state. // instead we run the post exec handler in a new branchFn from the initial state. postTxState := s.branchFn(state) - postTxCtx := s.makeContext(ctx, appmanager.RuntimeIdentity, postTxState, execMode) + postTxCtx := s.makeContext(ctx, RuntimeIdentity, postTxState, execMode) postTxCtx.setHeaderInfo(hi) postTxErr := s.postTxExec(postTxCtx, tx, false) @@ -275,7 +275,7 @@ func (s STF[T]) execTx( // tx execution went fine, now we use the same state to run the post tx exec handler, // in case the execution of the post tx fails, then no state change is applied and the // whole execution step is rolled back. - postTxCtx := s.makeContext(ctx, appmanager.RuntimeIdentity, execState, execMode) // NO gas limit. + postTxCtx := s.makeContext(ctx, RuntimeIdentity, execState, execMode) // NO gas limit. postTxCtx.setHeaderInfo(hi) postTxErr := s.postTxExec(postTxCtx, tx, true) if postTxErr != nil { @@ -312,12 +312,12 @@ func (s STF[T]) runTxMsgs( } msgResps := make([]transaction.Msg, len(msgs)) - execCtx := s.makeContext(ctx, nil, state, execMode) + execCtx := s.makeContext(ctx, RuntimeIdentity, state, execMode) execCtx.setHeaderInfo(hi) execCtx.setGasLimit(gasLimit) for i, msg := range msgs { execCtx.sender = txSenders[i] - resp, err := s.msgRouter.InvokeUntyped(execCtx, msg) + resp, err := s.msgRouter.Invoke(execCtx, msg) if err != nil { return nil, 0, nil, fmt.Errorf("message execution at index %d failed: %w", i, err) } @@ -410,11 +410,11 @@ func (s STF[T]) Simulate( state store.ReaderMap, gasLimit uint64, tx T, -) (appmanager.TxResult, store.WriterMap) { +) (server.TxResult, store.WriterMap) { simulationState := s.branchFn(state) hi, err := s.getHeaderInfo(simulationState) if err != nil { - return appmanager.TxResult{}, nil + return server.TxResult{}, nil } txr := s.deliverTx(ctx, simulationState, tx, internal.ExecModeSimulate, hi) @@ -428,10 +428,10 @@ func (s STF[T]) ValidateTx( state store.ReaderMap, gasLimit uint64, tx T, -) appmanager.TxResult { +) server.TxResult { validationState := s.branchFn(state) gasUsed, events, err := s.validateTx(ctx, validationState, gasLimit, tx, transaction.ExecModeCheck) - return appmanager.TxResult{ + return server.TxResult{ Events: events, GasUsed: gasUsed, Error: err, @@ -453,7 +453,7 @@ func (s STF[T]) Query( queryCtx := s.makeContext(ctx, nil, queryState, internal.ExecModeSimulate) queryCtx.setHeaderInfo(hi) queryCtx.setGasLimit(gasLimit) - return s.queryRouter.InvokeUntyped(queryCtx, req) + return s.queryRouter.Invoke(queryCtx, req) } // RunWithCtx is made to support genesis, if genesis was just the execution of messages instead @@ -529,6 +529,14 @@ func (e *executionContext) setGasLimit(limit uint64) { e.state = meteredState } +func (e *executionContext) Value(key any) any { + if key == executionContextKey { + return e + } + + return e.Context.Value(key) +} + // TODO: too many calls to makeContext can be expensive // makeContext creates and returns a new execution context for the STF[T] type. // It takes in the following parameters: @@ -579,9 +587,9 @@ func newExecutionContext( state: meteredState, meter: meter, events: make([]event.Event, 0), - sender: sender, headerInfo: header.Info{}, execMode: execMode, + sender: sender, branchFn: branchFn, makeGasMeter: makeGasMeterFn, makeGasMeteredStore: makeGasMeteredStoreFn, diff --git a/server/v2/stf/stf_router.go b/server/v2/stf/stf_router.go index 41d5b805c612..0593dddf71b4 100644 --- a/server/v2/stf/stf_router.go +++ b/server/v2/stf/stf_router.go @@ -4,14 +4,13 @@ import ( "context" "errors" "fmt" - "reflect" "strings" gogoproto "github.com/cosmos/gogoproto/proto" appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/router" - transaction "cosmossdk.io/core/transaction" + "cosmossdk.io/core/transaction" ) var ErrNoHandler = errors.New("no handler") @@ -160,54 +159,12 @@ func (r coreRouterImpl) CanInvoke(_ context.Context, typeURL string) error { return nil } -func (r coreRouterImpl) InvokeTyped(ctx context.Context, req, resp transaction.Msg) error { - handlerResp, err := r.InvokeUntyped(ctx, req) - if err != nil { - return err - } - return merge(handlerResp, resp) -} - -func (r coreRouterImpl) InvokeUntyped(ctx context.Context, req transaction.Msg) (res transaction.Msg, err error) { +func (r coreRouterImpl) Invoke(ctx context.Context, req transaction.Msg) (res transaction.Msg, err error) { typeName := msgTypeURL(req) handler, exists := r.handlers[typeName] if !exists { return nil, fmt.Errorf("%w: %s", ErrNoHandler, typeName) } - return handler(ctx, req) -} - -// merge merges together two protobuf messages by setting the pointer -// to src in dst. Used internally. -func merge(src, dst gogoproto.Message) error { - if src == nil { - return fmt.Errorf("source message is nil") - } - if dst == nil { - return fmt.Errorf("destination message is nil") - } - srcVal := reflect.ValueOf(src) - dstVal := reflect.ValueOf(dst) - - if srcVal.Kind() == reflect.Interface { - srcVal = srcVal.Elem() - } - if dstVal.Kind() == reflect.Interface { - dstVal = dstVal.Elem() - } - - if srcVal.Kind() != reflect.Ptr || dstVal.Kind() != reflect.Ptr { - return fmt.Errorf("both source and destination must be pointers") - } - - srcElem := srcVal.Elem() - dstElem := dstVal.Elem() - - if !srcElem.Type().AssignableTo(dstElem.Type()) { - return fmt.Errorf("incompatible types: cannot merge %v into %v", srcElem.Type(), dstElem.Type()) - } - - dstElem.Set(srcElem) - return nil + return handler(ctx, req) } diff --git a/server/v2/stf/stf_router_test.go b/server/v2/stf/stf_router_test.go index b5ea7dab5b9d..0a63ae4b79d4 100644 --- a/server/v2/stf/stf_router_test.go +++ b/server/v2/stf/stf_router_test.go @@ -2,15 +2,14 @@ package stf import ( "context" + "reflect" "testing" gogoproto "github.com/cosmos/gogoproto/proto" gogotypes "github.com/cosmos/gogoproto/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "cosmossdk.io/core/appmodule/v2" - transaction "cosmossdk.io/core/transaction" + appmodulev2 "cosmossdk.io/core/appmodule/v2" + "cosmossdk.io/core/transaction" ) func TestRouter(t *testing.T) { @@ -19,90 +18,43 @@ func TestRouter(t *testing.T) { expectedResp := &gogotypes.StringValue{Value: "test"} - router := coreRouterImpl{handlers: map[string]appmodule.Handler{ + router := coreRouterImpl{handlers: map[string]appmodulev2.Handler{ gogoproto.MessageName(expectedMsg): func(ctx context.Context, gotMsg transaction.Msg) (msgResp transaction.Msg, err error) { - require.Equal(t, expectedMsg, gotMsg) + if !reflect.DeepEqual(expectedMsg, gotMsg) { + t.Errorf("expected message: %v, got: %v", expectedMsg, gotMsg) + } return expectedResp, nil }, }} t.Run("can invoke message by name", func(t *testing.T) { err := router.CanInvoke(context.Background(), expectedMsgName) - require.NoError(t, err, "must be invocable") + if err != nil { + t.Errorf("unexpected error: %v", err) + } }) t.Run("can invoke message by type URL", func(t *testing.T) { err := router.CanInvoke(context.Background(), "/"+expectedMsgName) - require.NoError(t, err) + if err != nil { + t.Errorf("unexpected error: %v", err) + } }) t.Run("cannot invoke unknown message", func(t *testing.T) { err := router.CanInvoke(context.Background(), "not exist") - require.Error(t, err) - }) - - t.Run("invoke untyped", func(t *testing.T) { - gotResp, err := router.InvokeUntyped(context.Background(), expectedMsg) - require.NoError(t, err) - require.Equal(t, expectedResp, gotResp) + if err == nil { + t.Error("expected error, got nil") + } }) - t.Run("invoked typed", func(t *testing.T) { - gotResp := new(gogotypes.StringValue) - err := router.InvokeTyped(context.Background(), expectedMsg, gotResp) - require.NoError(t, err) - require.Equal(t, expectedResp, gotResp) + t.Run("invoke", func(t *testing.T) { + gotResp, err := router.Invoke(context.Background(), expectedMsg) + if err != nil { + t.Errorf("unexpected error: %v", err) + } + if !reflect.DeepEqual(expectedResp, gotResp) { + t.Errorf("expected response: %v, got: %v", expectedResp, gotResp) + } }) } - -func TestMerge(t *testing.T) { - tests := []struct { - name string - src transaction.Msg - dst transaction.Msg - expected transaction.Msg - wantErr bool - }{ - { - name: "success", - src: &gogotypes.BoolValue{Value: true}, - dst: &gogotypes.BoolValue{}, - expected: &gogotypes.BoolValue{Value: true}, - wantErr: false, - }, - { - name: "nil src", - src: nil, - dst: &gogotypes.StringValue{}, - expected: &gogotypes.StringValue{}, - wantErr: true, - }, - { - name: "nil dst", - src: &gogotypes.StringValue{Value: "hello"}, - dst: nil, - expected: nil, - wantErr: true, - }, - { - name: "incompatible types", - src: &gogotypes.StringValue{Value: "hello"}, - dst: &gogotypes.BoolValue{}, - expected: &gogotypes.BoolValue{}, - wantErr: true, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := merge(tt.src, tt.dst) - - if tt.wantErr { - assert.Error(t, err) - } else { - assert.NoError(t, err) - assert.Equal(t, tt.expected, tt.dst) - } - }) - } -} diff --git a/server/v2/stf/stf_test.go b/server/v2/stf/stf_test.go index 040882d363f1..5fa4fce15b40 100644 --- a/server/v2/stf/stf_test.go +++ b/server/v2/stf/stf_test.go @@ -4,15 +4,15 @@ import ( "context" "crypto/sha256" "errors" + "strings" "testing" "time" gogotypes "github.com/cosmos/gogoproto/types" - "github.com/stretchr/testify/require" - appmanager "cosmossdk.io/core/app" appmodulev2 "cosmossdk.io/core/appmodule/v2" coregas "cosmossdk.io/core/gas" + "cosmossdk.io/core/server" "cosmossdk.io/core/store" "cosmossdk.io/core/transaction" "cosmossdk.io/server/v2/stf/branch" @@ -46,10 +46,14 @@ func addMsgHandlerToSTF[T any, PT interface { return typedResp, nil }, ) - require.NoError(t, err) + if err != nil { + t.Errorf("Failed to register handler: %v", err) + } msgRouter, err := msgRouterBuilder.Build() - require.NoError(t, err) + if err != nil { + t.Errorf("Failed to build message router: %v", err) + } stf.msgRouter = msgRouter } @@ -93,34 +97,44 @@ func TestSTF(t *testing.T) { }) t.Run("begin and end block", func(t *testing.T) { - _, newState, err := s.DeliverBlock(context.Background(), &appmanager.BlockRequest[mock.Tx]{ + _, newState, err := s.DeliverBlock(context.Background(), &server.BlockRequest[mock.Tx]{ Height: uint64(1), Time: time.Date(2024, 2, 3, 18, 23, 0, 0, time.UTC), AppHash: sum[:], Hash: sum[:], }, state) - require.NoError(t, err) + if err != nil { + t.Errorf("DeliverBlock error: %v", err) + } stateHas(t, newState, "begin-block") stateHas(t, newState, "end-block") }) t.Run("basic tx", func(t *testing.T) { - result, newState, err := s.DeliverBlock(context.Background(), &appmanager.BlockRequest[mock.Tx]{ + result, newState, err := s.DeliverBlock(context.Background(), &server.BlockRequest[mock.Tx]{ Height: uint64(1), Time: time.Date(2024, 2, 3, 18, 23, 0, 0, time.UTC), AppHash: sum[:], Hash: sum[:], Txs: []mock.Tx{mockTx}, }, state) - require.NoError(t, err) + if err != nil { + t.Errorf("DeliverBlock error: %v", err) + } stateHas(t, newState, "validate") stateHas(t, newState, "exec") stateHas(t, newState, "post-tx-exec") - require.Len(t, result.TxResults, 1) + if len(result.TxResults) != 1 { + t.Errorf("Expected 1 TxResult, got %d", len(result.TxResults)) + } txResult := result.TxResults[0] - require.NotZero(t, txResult.GasUsed) - require.Equal(t, mockTx.GasLimit, txResult.GasWanted) + if txResult.GasUsed == 0 { + t.Errorf("GasUsed should not be zero") + } + if txResult.GasWanted != mockTx.GasLimit { + t.Errorf("Expected GasWanted to be %d, got %d", mockTx.GasLimit, txResult.GasWanted) + } }) t.Run("exec tx out of gas", func(t *testing.T) { @@ -136,22 +150,30 @@ func TestSTF(t *testing.T) { // out of gas immediately at tx validation level. s.doTxValidation = func(ctx context.Context, tx mock.Tx) error { w, err := ctx.(*executionContext).state.GetWriter(actorName) - require.NoError(t, err) + if err != nil { + t.Errorf("GetWriter error: %v", err) + } err = w.Set([]byte("gas_failure"), []byte{}) - require.Error(t, err) + if err == nil { + t.Error("Expected error, got nil") + } return err } - result, newState, err := s.DeliverBlock(context.Background(), &appmanager.BlockRequest[mock.Tx]{ + result, newState, err := s.DeliverBlock(context.Background(), &server.BlockRequest[mock.Tx]{ Height: uint64(1), Time: time.Date(2024, 2, 3, 18, 23, 0, 0, time.UTC), AppHash: sum[:], Hash: sum[:], Txs: []mock.Tx{mockTx}, }, state) - require.NoError(t, err) + if err != nil { + t.Errorf("DeliverBlock error: %v", err) + } stateNotHas(t, newState, "gas_failure") // assert during out of gas no state changes leaked. - require.ErrorIs(t, result.TxResults[0].Error, coregas.ErrOutOfGas, result.TxResults[0].Error) + if !errors.Is(result.TxResults[0].Error, coregas.ErrOutOfGas) { + t.Errorf("Expected ErrOutOfGas, got %v", result.TxResults[0].Error) + } }) t.Run("fail exec tx", func(t *testing.T) { @@ -161,15 +183,19 @@ func TestSTF(t *testing.T) { return nil, errors.New("failure") }) - blockResult, newState, err := s.DeliverBlock(context.Background(), &appmanager.BlockRequest[mock.Tx]{ + blockResult, newState, err := s.DeliverBlock(context.Background(), &server.BlockRequest[mock.Tx]{ Height: uint64(1), Time: time.Date(2024, 2, 3, 18, 23, 0, 0, time.UTC), AppHash: sum[:], Hash: sum[:], Txs: []mock.Tx{mockTx}, }, state) - require.NoError(t, err) - require.ErrorContains(t, blockResult.TxResults[0].Error, "failure") + if err != nil { + t.Errorf("DeliverBlock error: %v", err) + } + if !strings.Contains(blockResult.TxResults[0].Error.Error(), "failure") { + t.Errorf("Expected error to contain 'failure', got %v", blockResult.TxResults[0].Error) + } stateHas(t, newState, "begin-block") stateHas(t, newState, "end-block") stateHas(t, newState, "validate") @@ -182,15 +208,19 @@ func TestSTF(t *testing.T) { s.postTxExec = func(ctx context.Context, tx mock.Tx, success bool) error { return errors.New("post tx failure") } - blockResult, newState, err := s.DeliverBlock(context.Background(), &appmanager.BlockRequest[mock.Tx]{ + blockResult, newState, err := s.DeliverBlock(context.Background(), &server.BlockRequest[mock.Tx]{ Height: uint64(1), Time: time.Date(2024, 2, 3, 18, 23, 0, 0, time.UTC), AppHash: sum[:], Hash: sum[:], Txs: []mock.Tx{mockTx}, }, state) - require.NoError(t, err) - require.ErrorContains(t, blockResult.TxResults[0].Error, "post tx failure") + if err != nil { + t.Errorf("DeliverBlock error: %v", err) + } + if !strings.Contains(blockResult.TxResults[0].Error.Error(), "post tx failure") { + t.Errorf("Expected error to contain 'post tx failure', got %v", blockResult.TxResults[0].Error) + } stateHas(t, newState, "begin-block") stateHas(t, newState, "end-block") stateHas(t, newState, "validate") @@ -204,15 +234,19 @@ func TestSTF(t *testing.T) { return nil, errors.New("exec failure") }) s.postTxExec = func(ctx context.Context, tx mock.Tx, success bool) error { return errors.New("post tx failure") } - blockResult, newState, err := s.DeliverBlock(context.Background(), &appmanager.BlockRequest[mock.Tx]{ + blockResult, newState, err := s.DeliverBlock(context.Background(), &server.BlockRequest[mock.Tx]{ Height: uint64(1), Time: time.Date(2024, 2, 3, 18, 23, 0, 0, time.UTC), AppHash: sum[:], Hash: sum[:], Txs: []mock.Tx{mockTx}, }, state) - require.NoError(t, err) - require.ErrorContains(t, blockResult.TxResults[0].Error, "exec failure\npost tx failure") + if err != nil { + t.Errorf("DeliverBlock error: %v", err) + } + if !strings.Contains(blockResult.TxResults[0].Error.Error(), "exec failure\npost tx failure") { + t.Errorf("Expected error to contain 'exec failure\npost tx failure', got %v", blockResult.TxResults[0].Error) + } stateHas(t, newState, "begin-block") stateHas(t, newState, "end-block") stateHas(t, newState, "validate") @@ -224,15 +258,19 @@ func TestSTF(t *testing.T) { // update stf to fail on the validation step s := s.clone() s.doTxValidation = func(ctx context.Context, tx mock.Tx) error { return errors.New("failure") } - blockResult, newState, err := s.DeliverBlock(context.Background(), &appmanager.BlockRequest[mock.Tx]{ + blockResult, newState, err := s.DeliverBlock(context.Background(), &server.BlockRequest[mock.Tx]{ Height: uint64(1), Time: time.Date(2024, 2, 3, 18, 23, 0, 0, time.UTC), AppHash: sum[:], Hash: sum[:], Txs: []mock.Tx{mockTx}, }, state) - require.NoError(t, err) - require.ErrorContains(t, blockResult.TxResults[0].Error, "failure") + if err != nil { + t.Errorf("DeliverBlock error: %v", err) + } + if !strings.Contains(blockResult.TxResults[0].Error.Error(), "failure") { + t.Errorf("Expected error to contain 'failure', got %v", blockResult.TxResults[0].Error) + } stateHas(t, newState, "begin-block") stateHas(t, newState, "end-block") stateNotHas(t, newState, "validate") @@ -250,12 +288,16 @@ func TestSTF(t *testing.T) { } // test ValidateTx as it validates with check execMode res := s.ValidateTx(context.Background(), state, mockTx.GasLimit, mockTx) - require.Error(t, res.Error) + if res.Error == nil { + t.Error("Expected error, got nil") + } // test validate tx with exec mode as finalize _, _, err := s.validateTx(context.Background(), s.branchFn(state), mockTx.GasLimit, mockTx, transaction.ExecModeFinalize) - require.NoError(t, err) + if err != nil { + t.Errorf("validateTx error: %v", err) + } }) } @@ -264,24 +306,42 @@ var actorName = []byte("cookies") func kvSet(t *testing.T, ctx context.Context, v string) { t.Helper() state, err := ctx.(*executionContext).state.GetWriter(actorName) - require.NoError(t, err) - require.NoError(t, state.Set([]byte(v), []byte(v))) + if err != nil { + t.Errorf("Set error: %v", err) + } else { + err = state.Set([]byte(v), []byte(v)) + if err != nil { + t.Errorf("Set error: %v", err) + } + } } func stateHas(t *testing.T, accountState store.ReaderMap, key string) { t.Helper() state, err := accountState.GetReader(actorName) - require.NoError(t, err) + if err != nil { + t.Errorf("GetReader error: %v", err) + } has, err := state.Has([]byte(key)) - require.NoError(t, err) - require.Truef(t, has, "state did not have key: %s", key) + if err != nil { + t.Errorf("Has error: %v", err) + } + if !has { + t.Errorf("State did not have key: %s", key) + } } func stateNotHas(t *testing.T, accountState store.ReaderMap, key string) { t.Helper() state, err := accountState.GetReader(actorName) - require.NoError(t, err) + if err != nil { + t.Errorf("GetReader error: %v", err) + } has, err := state.Has([]byte(key)) - require.NoError(t, err) - require.Falsef(t, has, "state was not supposed to have key: %s", key) + if err != nil { + t.Errorf("Has error: %v", err) + } + if has { + t.Errorf("State was not supposed to have key: %s", key) + } } diff --git a/server/v2/stf/util.go b/server/v2/stf/util.go new file mode 100644 index 000000000000..cd2cab2f70e4 --- /dev/null +++ b/server/v2/stf/util.go @@ -0,0 +1,20 @@ +package stf + +import ( + "context" + "errors" +) + +// getExecutionCtxFromContext tries to get the execution context from the given go context. +func getExecutionCtxFromContext(ctx context.Context) (*executionContext, error) { + if ec, ok := ctx.(*executionContext); ok { + return ec, nil + } + + value, ok := ctx.Value(executionContextKey).(*executionContext) + if ok { + return value, nil + } + + return nil, errors.New("failed to get executionContext from context") +} diff --git a/server/v2/stf/util_test.go b/server/v2/stf/util_test.go new file mode 100644 index 000000000000..8f9631782052 --- /dev/null +++ b/server/v2/stf/util_test.go @@ -0,0 +1,43 @@ +package stf + +import ( + "context" + "testing" +) + +func TestGetExecutionCtxFromContext(t *testing.T) { + t.Run("direct type *executionContext", func(t *testing.T) { + ec := &executionContext{} + result, err := getExecutionCtxFromContext(ec) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if result != ec { + t.Fatalf("expected %v, got %v", ec, result) + } + }) + + t.Run("context value of type *executionContext", func(t *testing.T) { + ec := &executionContext{} + ctx := context.WithValue(context.Background(), executionContextKey, ec) + result, err := getExecutionCtxFromContext(ctx) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if result != ec { + t.Fatalf("expected %v, got %v", ec, result) + } + }) + + t.Run("invalid context type or value", func(t *testing.T) { + ctx := context.Background() + _, err := getExecutionCtxFromContext(ctx) + if err == nil { + t.Fatalf("expected error, got nil") + } + expectedErr := "failed to get executionContext from context" + if err.Error() != expectedErr { + t.Fatalf("expected error message %v, got %v", expectedErr, err.Error()) + } + }) +} diff --git a/server/v2/store/snapshot.go b/server/v2/store/snapshot.go index 3289d94f5e7d..2c106f85fe69 100644 --- a/server/v2/store/snapshot.go +++ b/server/v2/store/snapshot.go @@ -337,12 +337,12 @@ func (s *StoreComponent[T]) LoadArchiveCmd() *cobra.Command { savedSnapshot := <-quitChan if savedSnapshot == nil { - return fmt.Errorf("failed to save snapshot") + return errors.New("failed to save snapshot") } if !reflect.DeepEqual(&snapshot, savedSnapshot) { _ = snapshotStore.Delete(snapshot.Height, snapshot.Format) - return fmt.Errorf("invalid archive, the saved snapshot is not equal to the original one") + return errors.New("invalid archive, the saved snapshot is not equal to the original one") } return nil diff --git a/server/v2/testdata/app.toml b/server/v2/testdata/app.toml index 5b0112dd8b37..192dc8d67865 100644 --- a/server/v2/testdata/app.toml +++ b/server/v2/testdata/app.toml @@ -10,6 +10,10 @@ max-recv-msg-size = 10485760 # The default value is math.MaxInt32. max-send-msg-size = 2147483647 +[server] +# minimum-gas-prices defines the price which a validator is willing to accept for processing a transaction. A transaction's fees must meet the minimum of any denomination specified in this config (e.g. 0.25token1;0.0001token2). +minimum-gas-prices = '0stake' + [store] # The type of database for application and snapshots databases. app-db-backend = 'goleveldb' diff --git a/server/v2/types.go b/server/v2/types.go index 978b46b78810..3979f99f48db 100644 --- a/server/v2/types.go +++ b/server/v2/types.go @@ -4,7 +4,7 @@ import ( gogoproto "github.com/cosmos/gogoproto/proto" "github.com/spf13/viper" - coreapp "cosmossdk.io/core/app" + "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" "cosmossdk.io/server/v2/appmanager" @@ -14,7 +14,7 @@ type AppCreator[T transaction.Tx] func(log.Logger, *viper.Viper) AppI[T] type AppI[T transaction.Tx] interface { Name() string - InterfaceRegistry() coreapp.InterfaceRegistry + InterfaceRegistry() server.InterfaceRegistry GetAppManager() *appmanager.AppManager[T] GetConsensusAuthority() string GetGPRCMethodsToMessageMap() map[string]func() gogoproto.Message diff --git a/simapp/CHANGELOG.md b/simapp/CHANGELOG.md index 2daff48a15f2..5e6dae65ec2b 100644 --- a/simapp/CHANGELOG.md +++ b/simapp/CHANGELOG.md @@ -24,7 +24,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ # Changelog `SimApp` is an application built using the Cosmos SDK for testing and educational purposes. -It won't be tagged or intented to be imported in an application. +It won't be tagged or intended to be imported in an application. This changelog is aimed to help developers understand the wiring changes between SDK versions. It is an exautive list of changes that completes the SimApp section in the [UPGRADING.md](https://github.com/cosmos/cosmos-sdk/blob/main/UPGRADING.md#simapp) @@ -32,11 +32,20 @@ It is an exautive list of changes that completes the SimApp section in the [UPGR Always refer to the [UPGRADING.md](https://github.com/cosmos/cosmos-sdk/blob/main/UPGRADING.md) to understand the changes. +* Update module path to new vanity url. +* Wire new SDK modules (`epochs`, `accounts`, `protocolpool`). +* Remove the crisis module from simapp. +* Update `export` function to make use of the new module collections API. +* Add example of how to define a custom mint function in `simapp/mint_fn.go`. +* Add address codec in client context and signing context. +* Update testnet command to match new module APIs. * [#20409](https://github.com/cosmos/cosmos-sdk/pull/20409) Add `tx` as `SkipStoreKeys` in `app_config.go`. * [#20485](https://github.com/cosmos/cosmos-sdk/pull/20485) The signature of `x/upgrade/types.UpgradeHandler` has changed to accept `appmodule.VersionMap` from `module.VersionMap`. These types are interchangeable, but usages of `UpradeKeeper.SetUpgradeHandler` may need to adjust their usages to match the new signature. * [#20740](https://github.com/cosmos/cosmos-sdk/pull/20740) Update `genutilcli.Commands` to use the genutil modules from the module manager. * [#20771](https://github.com/cosmos/cosmos-sdk/pull/20771) Use client/v2 `GetNodeHomeDirectory` helper in `app.go` and use the `DefaultNodeHome` constant everywhere in the app. - +* [#20490](https://github.com/cosmos/cosmos-sdk/pull/20490) Refactor simulations to make use of `testutil/sims` instead of `runsims`. +* [#19726](https://github.com/cosmos/cosmos-sdk/pull/19726) Update APIs to match CometBFT v1. +* [#21466](https://github.com/cosmos/cosmos-sdk/pull/21466) Allow chains to plug in their own public key types in `base.Account` ## v0.47 to v0.50 diff --git a/simapp/README.md b/simapp/README.md index 08d476708e6a..d4fc9dc029d2 100644 --- a/simapp/README.md +++ b/simapp/README.md @@ -4,50 +4,119 @@ sidebar_position: 1 # `SimApp` -`SimApp` is an application built using the Cosmos SDK for testing and educational purposes. +`SimApp` is a CLI application built using the Cosmos SDK for testing and educational purposes. ## Running testnets with `simd` -If you want to spin up a quick testnet with your friends, you can follow these steps. -Unless otherwise noted, every step must be done by everyone who wants to participate -in this testnet. - -1. From the root directory of the Cosmos SDK repository, run `$ make build`. This will build the - `simd` binary inside a new `build` directory. The following instructions are run from inside - the `build` directory. -2. If you've run `simd` before, you may need to reset your database before starting a new - testnet. You can reset your database with the following command: `$ ./simd comet unsafe-reset-all`. -3. `$ ./simd init [moniker] --chain-id [chain-id]`. This will initialize a new working directory - at the default location `~/.simapp`. You need to provide a "moniker" and a "chain id". These - two names can be anything, but you will need to use the same "chain id" in the following steps. -4. `$ ./simd keys add [key_name]`. This will create a new key, with a name of your choosing. - Save the output of this command somewhere; you'll need the address generated here later. -5. `$ ./simd genesis add-genesis-account [key_name] [amount]`, where `key_name` is the same key name as - before; and `amount` is something like `10000000000000000000000000stake`. -6. `$ ./simd genesis gentx [key_name] [amount] --chain-id [chain-id]`. This will create the genesis - transaction for your new chain. Here `amount` should be at least `1000000000stake`. If you - provide too much or too little, you will encounter an error when starting your node. -7. Now, one person needs to create the genesis file `genesis.json` using the genesis transactions - from every participant, by gathering all the genesis transactions under `config/gentx` and then - calling `$ ./simd genesis collect-gentxs`. This will create a new `genesis.json` file that includes data - from all the validators (we sometimes call it the "super genesis file" to distinguish it from - single-validator genesis files). -8. Once you've received the super genesis file, overwrite your original `genesis.json` file with - the new super `genesis.json`. -9. Modify your `config/config.toml` (in the simapp working directory) to include the other participants as - persistent peers: - - ```text - # Comma separated list of nodes to keep persistent connections to - persistent_peers = "[validator_address]@[ip_address]:[port],[validator_address]@[ip_address]:[port]" - ``` - - You can find `validator_address` by running `$ ./simd comet show-node-id`. The output will - be the hex-encoded `validator_address`. The default `port` is 26656. -10. Now you can start your nodes: `$ ./simd start`. +Except stated otherwise, all participants in the testnet must follow through with each step. + +### 1. Download and Setup + +Download the Cosmos SDK and unzip it. You can do this manually (via the GitHub UI) or with the git clone command. + +```sh +git clone github.com/cosmos/cosmos-sdk.git +``` + +Next, run this command to build the `simd` binary in the `build` directory. + +```sh +make build +``` + +Use the following command and skip all the next steps to configure your SimApp node: + +```sh +make init-simapp +``` + +If you’ve run `simd` in the past, you may need to reset your database before starting up a new testnet. You can do that with this command: + +```sh +# you need to provide the moniker and chain ID +$ ./simd init [moniker] --chain-id [chain-id] +``` + +The command should initialize a new working directory at the `~simapp` location. + +The `moniker` and `chain-id` can be anything but you need to use the same `chain-id` subsequently. + + +### 2. Create a New Key + +Execute this command to create a new key. + +```sh + ./simd keys add [key_name] +``` + +The command will create a new key with your chosen name. + +⚠️ Save the output somewhere safe; you’ll need the address later. + +### 3. Add Genesis Account + +Add a genesis account to your testnet blockchain. + +```sh +$ ./simd genesis add-genesis-account [key_name] [amount] +``` + +Where `key_name` is the same key name as before, and the `amount` is something like `10000000000000000000000000stake`. + +### 4. Add the Genesis Transaction + +This creates the genesis transaction for your testnet chain. + +```sh +$ ./simd genesis gentx [key_name] [amount] --chain-id [chain-id] +``` + +The amount should be at least `1000000000stake`. When you start your node, providing too much or too little may result in errors. + +### 5. Create the Genesis File + +A participant must create the genesis file `genesis.json` with every participant's transaction. + +You can do this by gathering all the Genesis transactions under `config/gentx` and then executing this command. + +```sh +$ ./simd genesis collect-gentxs +``` + +The command will create a new `genesis.json` file that includes data from all the validators. The command will create a new `genesis.json` file, including data from all the validators + +Once you've received the super genesis file, overwrite your original `genesis.json` file with +the new super `genesis.json`. + +Modify your `config/config.toml` (in the simapp working directory) to include the other participants as +persistent peers: + +``` +# Comma-separated list of nodes to keep persistent connections to +persistent_peers = "[validator_address]@[ip_address]:[port],[validator_address]@[ip_address]:[port]" +``` + +You can find `validator_address` by executing: + +```sh +$ ./simd comet show-node-id +``` + +The output will be the hex-encoded `validator_address`. The default `port` is 26656. + +### 6. Start the Nodes + +Finally, execute this command to start your nodes. + +```sh +$ ./simd start +``` Now you have a small testnet that you can use to try out changes to the Cosmos SDK or CometBFT! -NOTE: Sometimes creating the network through the `collect-gentxs` will fail, and validators will start -in a funny state (and then panic). If this happens, you can try to create and start the network first +> ⚠️ NOTE: Sometimes, creating the network through the `collect-gents` will fail, and validators will start in a funny state (and then panic). +> + +If this happens, you can try to create and start the network first with a single validator and then add additional validators using a `create-validator` transaction. diff --git a/simapp/ante.go b/simapp/ante.go index 6a12eabecfd5..54bc40331ee3 100644 --- a/simapp/ante.go +++ b/simapp/ante.go @@ -3,18 +3,17 @@ package simapp import ( "errors" - "cosmossdk.io/x/auth/ante" - "cosmossdk.io/x/auth/ante/unorderedtx" circuitante "cosmossdk.io/x/circuit/ante" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + "github.com/cosmos/cosmos-sdk/x/auth/ante/unorderedtx" ) // HandlerOptions are the options required for constructing a default SDK AnteHandler. type HandlerOptions struct { ante.HandlerOptions CircuitKeeper circuitante.CircuitBreaker - TxManager *unorderedtx.Manager } // NewAnteHandler returns an AnteHandler that checks and increments sequence @@ -39,7 +38,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker), ante.NewValidateBasicDecorator(options.Environment), ante.NewTxTimeoutHeightDecorator(options.Environment), - ante.NewUnorderedTxDecorator(unorderedtx.DefaultMaxTimeoutDuration, options.TxManager, options.Environment, ante.DefaultSha256Cost), + ante.NewUnorderedTxDecorator(unorderedtx.DefaultMaxTimeoutDuration, options.UnorderedTxManager, options.Environment, ante.DefaultSha256Cost), ante.NewValidateMemoDecorator(options.AccountKeeper), ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper), ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker), diff --git a/simapp/app.go b/simapp/app.go index a03a9e69f518..e15c14c0d9e5 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -11,7 +11,6 @@ import ( "path/filepath" abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" - dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/gogoproto/proto" "github.com/spf13/cast" @@ -19,6 +18,8 @@ import ( reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" "cosmossdk.io/client/v2/autocli" clienthelpers "cosmossdk.io/client/v2/helpers" + coreaddress "cosmossdk.io/core/address" + corestore "cosmossdk.io/core/store" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/accounts" @@ -27,18 +28,6 @@ import ( lockup "cosmossdk.io/x/accounts/defaults/lockup" "cosmossdk.io/x/accounts/testing/account_abstraction" "cosmossdk.io/x/accounts/testing/counter" - "cosmossdk.io/x/auth" - "cosmossdk.io/x/auth/ante" - "cosmossdk.io/x/auth/ante/unorderedtx" - authcodec "cosmossdk.io/x/auth/codec" - authkeeper "cosmossdk.io/x/auth/keeper" - "cosmossdk.io/x/auth/posthandler" - authsims "cosmossdk.io/x/auth/simulation" - authtx "cosmossdk.io/x/auth/tx" - txmodule "cosmossdk.io/x/auth/tx/config" - authtypes "cosmossdk.io/x/auth/types" - "cosmossdk.io/x/auth/vesting" - vestingtypes "cosmossdk.io/x/auth/vesting/types" "cosmossdk.io/x/authz" authzkeeper "cosmossdk.io/x/authz/keeper" authzmodule "cosmossdk.io/x/authz/module" @@ -50,7 +39,6 @@ import ( circuittypes "cosmossdk.io/x/circuit/types" "cosmossdk.io/x/consensus" consensusparamkeeper "cosmossdk.io/x/consensus/keeper" - consensusparamtypes "cosmossdk.io/x/consensus/types" consensustypes "cosmossdk.io/x/consensus/types" distr "cosmossdk.io/x/distribution" distrkeeper "cosmossdk.io/x/distribution/keeper" @@ -113,6 +101,18 @@ import ( "github.com/cosmos/cosmos-sdk/types/msgservice" sigtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" "github.com/cosmos/cosmos-sdk/version" + "github.com/cosmos/cosmos-sdk/x/auth" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + "github.com/cosmos/cosmos-sdk/x/auth/ante/unorderedtx" + authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + "github.com/cosmos/cosmos-sdk/x/auth/posthandler" + authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" + txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/auth/vesting" + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" ) @@ -197,7 +197,7 @@ func init() { // NewSimApp returns a reference to an initialized SimApp. func NewSimApp( logger log.Logger, - db dbm.DB, + db corestore.KVStoreWithBatch, traceStore io.Writer, loadLatest bool, appOpts servertypes.AppOptions, @@ -215,6 +215,11 @@ func NewSimApp( signingCtx := interfaceRegistry.SigningContext() txConfig := authtx.NewTxConfig(appCodec, signingCtx.AddressCodec(), signingCtx.ValidatorAddressCodec(), authtx.DefaultSignModes) + govModuleAddr, err := signingCtx.AddressCodec().BytesToString(authtypes.NewModuleAddress(govtypes.ModuleName)) + if err != nil { + panic(err) + } + if err := signingCtx.Validate(); err != nil { panic(err) } @@ -265,7 +270,7 @@ func NewSimApp( keys := storetypes.NewKVStoreKeys( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, - govtypes.StoreKey, consensusparamtypes.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, + govtypes.StoreKey, consensustypes.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, evidencetypes.StoreKey, circuittypes.StoreKey, authzkeeper.StoreKey, nftkeeper.StoreKey, group.StoreKey, pooltypes.StoreKey, accounts.StoreKey, epochstypes.StoreKey, @@ -288,7 +293,7 @@ func NewSimApp( cometService := runtime.NewContextAwareCometInfoService() // set the BaseApp's parameter store - app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), logger.With(log.ModuleKey, "x/consensus")), authtypes.NewModuleAddress(govtypes.ModuleName).String()) + app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[consensustypes.StoreKey]), logger.With(log.ModuleKey, "x/consensus")), govModuleAddr) bApp.SetParamStore(app.ConsensusParamsKeeper.ParamsStore) // add keepers @@ -306,21 +311,25 @@ func NewSimApp( accountstd.AddAccount(lockup.DELAYED_LOCKING_ACCOUNT, lockup.NewDelayedLockingAccount), accountstd.AddAccount(lockup.PERMANENT_LOCKING_ACCOUNT, lockup.NewPermanentLockingAccount), // PRODUCTION: add - baseaccount.NewAccount("base", txConfig.SignModeHandler()), + baseaccount.NewAccount("base", txConfig.SignModeHandler(), baseaccount.WithSecp256K1PubKey()), ) if err != nil { panic(err) } app.AccountsKeeper = accountsKeeper - app.AuthKeeper = authkeeper.NewAccountKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), logger.With(log.ModuleKey, "x/auth")), appCodec, authtypes.ProtoBaseAccount, accountsKeeper, maccPerms, signingCtx.AddressCodec(), sdk.Bech32MainPrefix, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + app.AuthKeeper = authkeeper.NewAccountKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), logger.With(log.ModuleKey, "x/auth")), appCodec, authtypes.ProtoBaseAccount, accountsKeeper, maccPerms, signingCtx.AddressCodec(), sdk.Bech32MainPrefix, govModuleAddr) + blockedAddrs, err := BlockedAddresses(signingCtx.AddressCodec()) + if err != nil { + panic(err) + } app.BankKeeper = bankkeeper.NewBaseKeeper( runtime.NewEnvironment(runtime.NewKVStoreService(keys[banktypes.StoreKey]), logger.With(log.ModuleKey, "x/bank")), appCodec, app.AuthKeeper, - BlockedAddresses(), - authtypes.NewModuleAddress(govtypes.ModuleName).String(), + blockedAddrs, + govModuleAddr, ) // optional: enable sign mode textual by overwriting the default tx config (after setting the bank keeper) @@ -351,20 +360,20 @@ func NewSimApp( runtime.EnvWithQueryRouterService(app.GRPCQueryRouter())), app.AuthKeeper, app.BankKeeper, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), + govModuleAddr, signingCtx.ValidatorAddressCodec(), authcodec.NewBech32Codec(sdk.Bech32PrefixConsAddr), cometService, ) - app.MintKeeper = mintkeeper.NewKeeper(appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[minttypes.StoreKey]), logger.With(log.ModuleKey, "x/mint")), app.StakingKeeper, app.AuthKeeper, app.BankKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + app.MintKeeper = mintkeeper.NewKeeper(appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[minttypes.StoreKey]), logger.With(log.ModuleKey, "x/mint")), app.StakingKeeper, app.AuthKeeper, app.BankKeeper, authtypes.FeeCollectorName, govModuleAddr) - app.PoolKeeper = poolkeeper.NewKeeper(appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[pooltypes.StoreKey]), logger.With(log.ModuleKey, "x/protocolpool")), app.AuthKeeper, app.BankKeeper, app.StakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + app.PoolKeeper = poolkeeper.NewKeeper(appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[pooltypes.StoreKey]), logger.With(log.ModuleKey, "x/protocolpool")), app.AuthKeeper, app.BankKeeper, app.StakingKeeper, govModuleAddr) - app.DistrKeeper = distrkeeper.NewKeeper(appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[distrtypes.StoreKey]), logger.With(log.ModuleKey, "x/distribution")), app.AuthKeeper, app.BankKeeper, app.StakingKeeper, cometService, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + app.DistrKeeper = distrkeeper.NewKeeper(appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[distrtypes.StoreKey]), logger.With(log.ModuleKey, "x/distribution")), app.AuthKeeper, app.BankKeeper, app.StakingKeeper, cometService, authtypes.FeeCollectorName, govModuleAddr) app.SlashingKeeper = slashingkeeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[slashingtypes.StoreKey]), logger.With(log.ModuleKey, "x/slashing")), - appCodec, legacyAmino, app.StakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + appCodec, legacyAmino, app.StakingKeeper, govModuleAddr, ) app.FeeGrantKeeper = feegrantkeeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[feegrant.StoreKey]), logger.With(log.ModuleKey, "x/feegrant")), appCodec, app.AuthKeeper) @@ -375,7 +384,7 @@ func NewSimApp( stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks()), ) - app.CircuitKeeper = circuitkeeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[circuittypes.StoreKey]), logger.With(log.ModuleKey, "x/circuit")), appCodec, authtypes.NewModuleAddress(govtypes.ModuleName).String(), app.AuthKeeper.AddressCodec()) + app.CircuitKeeper = circuitkeeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[circuittypes.StoreKey]), logger.With(log.ModuleKey, "x/circuit")), appCodec, govModuleAddr, app.AuthKeeper.AddressCodec()) app.BaseApp.SetCircuitBreaker(&app.CircuitKeeper) app.AuthzKeeper = authzkeeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[authzkeeper.StoreKey]), logger.With(log.ModuleKey, "x/authz"), runtime.EnvWithMsgRouterService(app.MsgServiceRouter()), runtime.EnvWithQueryRouterService(app.GRPCQueryRouter())), appCodec, app.AuthKeeper) @@ -397,7 +406,7 @@ func NewSimApp( } homePath := cast.ToString(appOpts.Get(flags.FlagHome)) // set the governance module account as the authority for conducting upgrades - app.UpgradeKeeper = upgradekeeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), logger.With(log.ModuleKey, "x/upgrade"), runtime.EnvWithMsgRouterService(app.MsgServiceRouter()), runtime.EnvWithQueryRouterService(app.GRPCQueryRouter())), skipUpgradeHeights, appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + app.UpgradeKeeper = upgradekeeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), logger.With(log.ModuleKey, "x/upgrade"), runtime.EnvWithMsgRouterService(app.MsgServiceRouter()), runtime.EnvWithQueryRouterService(app.GRPCQueryRouter())), skipUpgradeHeights, appCodec, homePath, app.BaseApp, govModuleAddr) // Register the proposal types // Deprecated: Avoid adding new handlers, instead use the new proposal flow @@ -409,7 +418,7 @@ func NewSimApp( Example of setting gov params: govConfig.MaxMetadataLen = 10000 */ - govKeeper := govkeeper.NewKeeper(appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[govtypes.StoreKey]), logger.With(log.ModuleKey, "x/gov"), runtime.EnvWithMsgRouterService(app.MsgServiceRouter()), runtime.EnvWithQueryRouterService(app.GRPCQueryRouter())), app.AuthKeeper, app.BankKeeper, app.StakingKeeper, app.PoolKeeper, govConfig, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + govKeeper := govkeeper.NewKeeper(appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[govtypes.StoreKey]), logger.With(log.ModuleKey, "x/gov"), runtime.EnvWithMsgRouterService(app.MsgServiceRouter()), runtime.EnvWithQueryRouterService(app.GRPCQueryRouter())), app.AuthKeeper, app.BankKeeper, app.StakingKeeper, app.PoolKeeper, govConfig, govModuleAddr) // Set legacy router for backwards compatibility with gov v1beta1 govKeeper.SetLegacyRouter(govRouter) @@ -447,7 +456,7 @@ func NewSimApp( app.ModuleManager = module.NewManager( genutil.NewAppModule(appCodec, app.AuthKeeper, app.StakingKeeper, app, txConfig, genutiltypes.DefaultMessageValidator), accounts.NewAppModule(appCodec, app.AccountsKeeper), - auth.NewAppModule(appCodec, app.AuthKeeper, app.AccountsKeeper, authsims.RandomGenesisAccounts), + auth.NewAppModule(appCodec, app.AuthKeeper, app.AccountsKeeper, authsims.RandomGenesisAccounts, nil), vesting.NewAppModule(app.AuthKeeper, app.BankKeeper), bank.NewAppModule(appCodec, app.BankKeeper, app.AuthKeeper), feegrantmodule.NewAppModule(appCodec, app.AuthKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), @@ -519,7 +528,6 @@ func NewSimApp( group.ModuleName, upgradetypes.ModuleName, vestingtypes.ModuleName, - consensusparamtypes.ModuleName, circuittypes.ModuleName, pooltypes.ModuleName, epochstypes.ModuleName, @@ -556,7 +564,7 @@ func NewSimApp( // NOTE: this is not required apps that don't use the simulator for fuzz testing // transactions overrideModules := map[string]module.AppModuleSimulation{ - authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AuthKeeper, app.AccountsKeeper, authsims.RandomGenesisAccounts), + authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AuthKeeper, app.AccountsKeeper, authsims.RandomGenesisAccounts, nil), } app.sm = module.NewSimulationManagerFromAppModules(app.ModuleManager.Modules, overrideModules) @@ -639,9 +647,9 @@ func (app *SimApp) setAnteHandler(txConfig client.TxConfig) { SignModeHandler: txConfig.SignModeHandler(), FeegrantKeeper: app.FeeGrantKeeper, SigGasConsumer: ante.DefaultSigVerificationGasConsumer, + UnorderedTxManager: app.UnorderedTxManager, }, &app.CircuitKeeper, - app.UnorderedTxManager, }, ) if err != nil { @@ -663,9 +671,13 @@ func (app *SimApp) setPostHandler() { app.SetPostHandler(postHandler) } -// Close implements the Application interface and closes all necessary application -// resources. +// Close closes all necessary application resources. +// It implements servertypes.Application. func (app *SimApp) Close() error { + if err := app.BaseApp.Close(); err != nil { + return err + } + return app.UnorderedTxManager.Close() } @@ -821,14 +833,22 @@ func GetMaccPerms() map[string][]string { } // BlockedAddresses returns all the app's blocked account addresses. -func BlockedAddresses() map[string]bool { +func BlockedAddresses(ac coreaddress.Codec) (map[string]bool, error) { modAccAddrs := make(map[string]bool) for acc := range GetMaccPerms() { - modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true + addr, err := ac.BytesToString(authtypes.NewModuleAddress(acc)) + if err != nil { + return nil, err + } + modAccAddrs[addr] = true } // allow the following addresses to receive funds - delete(modAccAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + addr, err := ac.BytesToString(authtypes.NewModuleAddress(govtypes.ModuleName)) + if err != nil { + return nil, err + } + delete(modAccAddrs, addr) - return modAccAddrs + return modAccAddrs, nil } diff --git a/simapp/app_config.go b/simapp/app_config.go index 8918475184e1..d4c21d453c29 100644 --- a/simapp/app_config.go +++ b/simapp/app_config.go @@ -1,4 +1,4 @@ -//nolint:unused,nolintlint // ignore unused code linting and directive `//nolint:unused // ignore unused code linting` is unused for linter "unused" +//nolint:unused,nolintlint // ignore unused code linting package simapp import ( @@ -31,10 +31,6 @@ import ( vestingmodulev1 "cosmossdk.io/api/cosmos/vesting/module/v1" "cosmossdk.io/depinject/appconfig" "cosmossdk.io/x/accounts" - _ "cosmossdk.io/x/auth/tx/config" // import for side-effects - authtypes "cosmossdk.io/x/auth/types" - _ "cosmossdk.io/x/auth/vesting" // import for side-effects - vestingtypes "cosmossdk.io/x/auth/vesting/types" "cosmossdk.io/x/authz" _ "cosmossdk.io/x/authz/module" // import for side-effects _ "cosmossdk.io/x/bank" // import for side-effects @@ -71,6 +67,10 @@ import ( "github.com/cosmos/cosmos-sdk/runtime" _ "github.com/cosmos/cosmos-sdk/testutil/x/counter" // import for side-effects countertypes "github.com/cosmos/cosmos-sdk/testutil/x/counter/types" + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import for side-effects + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + _ "github.com/cosmos/cosmos-sdk/x/auth/vesting" // import for side-effects + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" ) @@ -284,7 +284,7 @@ var ( Name: epochstypes.ModuleName, Config: appconfig.WrapAny(&epochsmodulev1.Module{}), }, - // This module is used for testing the depinject gogo x pulsar module registration. + // This module is only used for testing the depinject gogo x pulsar module registration. { Name: countertypes.ModuleName, Config: appconfig.WrapAny(&countertypes.Module{}), diff --git a/simapp/app_di.go b/simapp/app_di.go index 63beee09ab7e..94764c72eeb3 100644 --- a/simapp/app_di.go +++ b/simapp/app_di.go @@ -6,24 +6,15 @@ import ( _ "embed" "fmt" "io" - "path/filepath" - - dbm "github.com/cosmos/cosmos-db" - "github.com/spf13/cast" clienthelpers "cosmossdk.io/client/v2/helpers" + "cosmossdk.io/core/address" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/legacy" + corestore "cosmossdk.io/core/store" "cosmossdk.io/depinject" "cosmossdk.io/log" - storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/accounts" - "cosmossdk.io/x/auth" - "cosmossdk.io/x/auth/ante" - "cosmossdk.io/x/auth/ante/unorderedtx" - authkeeper "cosmossdk.io/x/auth/keeper" - authsims "cosmossdk.io/x/auth/simulation" - authtypes "cosmossdk.io/x/auth/types" authzkeeper "cosmossdk.io/x/authz/keeper" bankkeeper "cosmossdk.io/x/bank/keeper" circuitkeeper "cosmossdk.io/x/circuit/keeper" @@ -44,7 +35,6 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/runtime" @@ -54,6 +44,12 @@ import ( servertypes "github.com/cosmos/cosmos-sdk/server/types" testdata_pulsar "github.com/cosmos/cosmos-sdk/testutil/testdata/testpb" "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/x/auth" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + "github.com/cosmos/cosmos-sdk/x/auth/ante/unorderedtx" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) // DefaultNodeHome default home directories for the application daemon @@ -74,8 +70,6 @@ type SimApp struct { txConfig client.TxConfig interfaceRegistry codectypes.InterfaceRegistry - UnorderedTxManager *unorderedtx.Manager - // keepers AccountsKeeper accounts.Keeper AuthKeeper authkeeper.AccountKeeper @@ -119,7 +113,7 @@ func AppConfig() depinject.Config { // NewSimApp returns a reference to an initialized SimApp. func NewSimApp( logger log.Logger, - db dbm.DB, + db corestore.KVStoreWithBatch, traceStore io.Writer, loadLatest bool, appOpts servertypes.AppOptions, @@ -244,23 +238,6 @@ func NewSimApp( app.App = appBuilder.Build(db, traceStore, baseAppOptions...) - if indexerOpts := appOpts.Get("indexer"); indexerOpts != nil { - // if we have indexer options in app.toml, then enable the built-in indexer framework - moduleSet := map[string]any{} - for modName, mod := range appModules { - moduleSet[modName] = mod - } - err := app.EnableIndexer(indexerOpts, app.kvStoreKeys(), moduleSet) - if err != nil { - panic(err) - } - } else { - // register legacy streaming services if we don't have the built-in indexer enabled - if err := app.RegisterStreamingServices(appOpts, app.kvStoreKeys()); err != nil { - panic(err) - } - } - /**** Module Options ****/ // RegisterUpgradeHandlers is used for registering any on-chain upgrades. @@ -274,7 +251,7 @@ func NewSimApp( // NOTE: this is not required apps that don't use the simulator for fuzz testing // transactions overrideModules := map[string]module.AppModuleSimulation{ - authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AuthKeeper, &app.AccountsKeeper, authsims.RandomGenesisAccounts), + authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AuthKeeper, &app.AccountsKeeper, authsims.RandomGenesisAccounts, nil), } app.sm = module.NewSimulationManagerFromAppModules(app.ModuleManager.Modules, overrideModules) @@ -286,26 +263,16 @@ func NewSimApp( // However, when registering a module manually (i.e. that does not support app wiring), the module version map // must be set manually as follow. The upgrade module will de-duplicate the module version map. // - // app.SetInitChainer(func(ctx sdk.Context, req *abci.RequestInitChain) (*abci.InitChainResponse, error) { + // app.SetInitChainer(func(ctx sdk.Context, req *abci.InitChainRequest) (*abci.InitChainResponse, error) { // app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()) // return app.App.InitChainer(ctx, req) // }) - // create, start, and load the unordered tx manager - utxDataDir := filepath.Join(cast.ToString(appOpts.Get(flags.FlagHome)), "data") - app.UnorderedTxManager = unorderedtx.NewManager(utxDataDir) - app.UnorderedTxManager.Start() - - if err := app.UnorderedTxManager.OnInit(); err != nil { - panic(fmt.Errorf("failed to initialize unordered tx manager: %w", err)) - } - // register custom snapshot extensions (if any) if manager := app.SnapshotManager(); manager != nil { - err := manager.RegisterExtensions( + if err := manager.RegisterExtensions( unorderedtx.NewSnapshotter(app.UnorderedTxManager), - ) - if err != nil { + ); err != nil { panic(fmt.Errorf("failed to register snapshot extension: %w", err)) } } @@ -320,21 +287,21 @@ func NewSimApp( return app } -// overwrite default ante handlers with custom ante handlers +// setCustomAnteHandler overwrites default ante handlers with custom ante handlers // set SkipAnteHandler to true in app config and set custom ante handler on baseapp func (app *SimApp) setCustomAnteHandler() { anteHandler, err := NewAnteHandler( HandlerOptions{ ante.HandlerOptions{ - AccountKeeper: app.AuthKeeper, - BankKeeper: app.BankKeeper, - SignModeHandler: app.txConfig.SignModeHandler(), - FeegrantKeeper: app.FeeGrantKeeper, - SigGasConsumer: ante.DefaultSigVerificationGasConsumer, - Environment: app.AuthKeeper.Environment, + AccountKeeper: app.AuthKeeper, + BankKeeper: app.BankKeeper, + SignModeHandler: app.txConfig.SignModeHandler(), + FeegrantKeeper: app.FeeGrantKeeper, + SigGasConsumer: ante.DefaultSigVerificationGasConsumer, + UnorderedTxManager: app.UnorderedTxManager, + Environment: app.AuthKeeper.Environment, }, &app.CircuitBreakerKeeper, - app.UnorderedTxManager, }, ) if err != nil { @@ -345,12 +312,6 @@ func (app *SimApp) setCustomAnteHandler() { app.SetAnteHandler(anteHandler) } -// Close implements the Application interface and closes all necessary application -// resources. -func (app *SimApp) Close() error { - return app.UnorderedTxManager.Close() -} - // LegacyAmino returns SimApp's amino codec. // // NOTE: This is solely to be used for testing purposes as it may be desirable @@ -382,29 +343,6 @@ func (app *SimApp) TxConfig() client.TxConfig { return app.txConfig } -// GetKey returns the KVStoreKey for the provided store key. -// -// NOTE: This is solely to be used for testing purposes. -func (app *SimApp) GetKey(storeKey string) *storetypes.KVStoreKey { - sk := app.UnsafeFindStoreKey(storeKey) - kvStoreKey, ok := sk.(*storetypes.KVStoreKey) - if !ok { - return nil - } - return kvStoreKey -} - -func (app *SimApp) kvStoreKeys() map[string]*storetypes.KVStoreKey { - keys := make(map[string]*storetypes.KVStoreKey) - for _, k := range app.GetStoreKeys() { - if kv, ok := k.(*storetypes.KVStoreKey); ok { - keys[kv.Name()] = kv - } - } - - return keys -} - // SimulationManager implements the SimulationApp interface func (app *SimApp) SimulationManager() *module.SimulationManager { return app.sm @@ -433,7 +371,9 @@ func GetMaccPerms() map[string][]string { } // BlockedAddresses returns all the app's blocked account addresses. -func BlockedAddresses() map[string]bool { +// This function takes an address.Codec parameter to maintain compatibility +// with the signature of the same function in appV1. +func BlockedAddresses(_ address.Codec) (map[string]bool, error) { result := make(map[string]bool) if len(blockAccAddrs) > 0 { @@ -446,5 +386,5 @@ func BlockedAddresses() map[string]bool { } } - return result + return result, nil } diff --git a/simapp/app_test.go b/simapp/app_test.go index 56adf2c04721..46fde529e136 100644 --- a/simapp/app_test.go +++ b/simapp/app_test.go @@ -16,8 +16,6 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/log" "cosmossdk.io/x/accounts" - "cosmossdk.io/x/auth" - "cosmossdk.io/x/auth/vesting" authzmodule "cosmossdk.io/x/authz/module" "cosmossdk.io/x/bank" banktypes "cosmossdk.io/x/bank/types" @@ -39,6 +37,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/types/msgservice" + "github.com/cosmos/cosmos-sdk/x/auth" + "github.com/cosmos/cosmos-sdk/x/auth/vesting" "github.com/cosmos/cosmos-sdk/x/genutil" ) @@ -51,10 +51,12 @@ func TestSimAppExportAndBlockedAddrs(t *testing.T) { AppOpts: simtestutil.NewAppOptionsWithFlagHome(t.TempDir()), }) - // BlockedAddresses returns a map of addresses in app v1 and a map of modules name in app v2. - for acc := range BlockedAddresses() { + // BlockedAddresses returns a map of addresses in app v1 and a map of modules names in app di. + blockedAddrs, err := BlockedAddresses(app.interfaceRegistry.SigningContext().AddressCodec()) + require.NoError(t, err) + for acc := range blockedAddrs { var addr sdk.AccAddress - if modAddr, err := sdk.AccAddressFromBech32(acc); err == nil { + if modAddr, err := app.InterfaceRegistry().SigningContext().AddressCodec().StringToBytes(acc); err == nil { addr = modAddr } else { addr = app.AuthKeeper.GetModuleAddress(acc) @@ -68,7 +70,7 @@ func TestSimAppExportAndBlockedAddrs(t *testing.T) { } // finalize block so we have CheckTx state set - _, err := app.FinalizeBlock(&abci.FinalizeBlockRequest{ + _, err = app.FinalizeBlock(&abci.FinalizeBlockRequest{ Height: 1, }) require.NoError(t, err) diff --git a/simapp/export.go b/simapp/export.go index 2c1d401ba580..fcd6bafe78f6 100644 --- a/simapp/export.go +++ b/simapp/export.go @@ -3,7 +3,6 @@ package simapp import ( "encoding/json" "fmt" - "log" cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" @@ -50,7 +49,7 @@ func (app *SimApp) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAd }, err } -// prepare for fresh start at zero height +// prepForZeroHeightGenesis prepares for fresh start at zero height // NOTE zero height genesis is a temporary feature which will be deprecated // // in favor of export at a block height @@ -65,9 +64,9 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [] allowedAddrsMap := make(map[string]bool) for _, addr := range jailAllowedAddrs { - _, err := sdk.ValAddressFromBech32(addr) + _, err := app.InterfaceRegistry().SigningContext().ValidatorAddressCodec().StringToBytes(addr) if err != nil { - log.Fatal(err) + panic(err) } allowedAddrsMap[addr] = true } @@ -94,12 +93,15 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [] } for _, delegation := range dels { - valAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) + valAddr, err := app.InterfaceRegistry().SigningContext().ValidatorAddressCodec().StringToBytes(delegation.ValidatorAddress) if err != nil { panic(err) } - delAddr := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress) + delAddr, err := app.InterfaceRegistry().SigningContext().AddressCodec().StringToBytes(delegation.DelegatorAddress) + if err != nil { + panic(err) + } _, _ = app.DistrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr) } @@ -151,11 +153,14 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [] // reinitialize all delegations for _, del := range dels { - valAddr, err := sdk.ValAddressFromBech32(del.ValidatorAddress) + valAddr, err := app.InterfaceRegistry().SigningContext().ValidatorAddressCodec().StringToBytes(del.ValidatorAddress) + if err != nil { + panic(err) + } + delAddr, err := app.InterfaceRegistry().SigningContext().AddressCodec().StringToBytes(del.DelegatorAddress) if err != nil { panic(err) } - delAddr := sdk.MustAccAddressFromBech32(del.DelegatorAddress) if err := app.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr); err != nil { // never called as BeforeDelegationCreated always returns nil @@ -192,7 +197,7 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [] err = app.StakingKeeper.UnbondingDelegations.Walk( ctx, nil, - func(key collections.Pair[[]byte, []byte], ubd stakingtypes.UnbondingDelegation) (stop bool, err error) { + func(_ collections.Pair[[]byte, []byte], ubd stakingtypes.UnbondingDelegation) (stop bool, err error) { for i := range ubd.Entries { ubd.Entries[i].CreationHeight = 0 } @@ -219,8 +224,13 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [] panic("expected validator, not found") } + valAddr, err := app.StakingKeeper.ValidatorAddressCodec().BytesToString(addr) + if err != nil { + panic(err) + } + validator.UnbondingHeight = 0 - if applyAllowedAddrs && !allowedAddrsMap[addr.String()] { + if applyAllowedAddrs && !allowedAddrsMap[valAddr] { validator.Jailed = true } @@ -237,7 +247,7 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [] _, err = app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) if err != nil { - log.Fatal(err) + panic(err) } /* Handle slashing state. */ diff --git a/simapp/genesis_account.go b/simapp/genesis_account.go index d242ba57060c..0ebb67d0393a 100644 --- a/simapp/genesis_account.go +++ b/simapp/genesis_account.go @@ -3,9 +3,8 @@ package simapp import ( "errors" - authtypes "cosmossdk.io/x/auth/types" - sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var _ authtypes.GenesisAccount = (*SimGenesisAccount)(nil) @@ -31,7 +30,7 @@ type SimGenesisAccount struct { func (sga SimGenesisAccount) Validate() error { if !sga.OriginalVesting.IsZero() { if sga.StartTime >= sga.EndTime { - return errors.New("vesting start-time cannot be before end-time") + return errors.New("vesting start-time cannot be after end-time") } } diff --git a/simapp/genesis_account_test.go b/simapp/genesis_account_test.go index 0fe897c10749..d813e9ec7e31 100644 --- a/simapp/genesis_account_test.go +++ b/simapp/genesis_account_test.go @@ -8,10 +8,10 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/simapp" - authtypes "cosmossdk.io/x/auth/types" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestSimGenesisAccountValidate(t *testing.T) { diff --git a/simapp/go.mod b/simapp/go.mod index a306eccbb917..b6b7e6cbd322 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -1,21 +1,20 @@ module cosmossdk.io/simapp -go 1.22.2 +go 1.23 require ( cosmossdk.io/api v0.7.5 cosmossdk.io/client/v2 v2.0.0-20230630094428-02b760776860 cosmossdk.io/collections v0.4.0 - cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 + cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/depinject v1.0.0 - cosmossdk.io/log v1.4.0 + cosmossdk.io/log v1.4.1 cosmossdk.io/math v1.3.0 cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc cosmossdk.io/tools/confix v0.0.0-20230613133644-0a778132a60f cosmossdk.io/x/accounts v0.0.0-20240226161501-23359a0b6d91 cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5 - cosmossdk.io/x/auth v0.0.0-20240226161501-23359a0b6d91 cosmossdk.io/x/authz v0.0.0-00010101000000-000000000000 cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 cosmossdk.io/x/circuit v0.0.0-20230613133644-0a778132a60f @@ -35,7 +34,7 @@ require ( cosmossdk.io/x/upgrade v0.0.0-20230613133644-0a778132a60f github.com/cometbft/cometbft v1.0.0-rc1 github.com/cometbft/cometbft/api v1.0.0-rc.1 - github.com/cosmos/cosmos-db v1.0.2 + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 // this version is not used as it is always replaced by the latest Cosmos SDK version github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 @@ -48,19 +47,19 @@ require ( google.golang.org/protobuf v1.34.2 ) -require google.golang.org/grpc v1.65.0 +require google.golang.org/grpc v1.66.0 require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect - cloud.google.com/go v0.115.0 // indirect - cloud.google.com/go/auth v0.5.1 // indirect - cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect - cloud.google.com/go/compute/metadata v0.3.0 // indirect - cloud.google.com/go/iam v1.1.8 // indirect - cloud.google.com/go/storage v1.42.0 // indirect + cloud.google.com/go v0.115.1 // indirect + cloud.google.com/go/auth v0.8.1 // indirect + cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect + cloud.google.com/go/compute/metadata v0.5.0 // indirect + cloud.google.com/go/iam v1.1.13 // indirect + cloud.google.com/go/storage v1.43.0 // indirect cosmossdk.io/errors v1.0.1 // indirect - cosmossdk.io/schema v0.1.1 // indirect + cosmossdk.io/schema v0.2.0 // indirect cosmossdk.io/x/accounts/defaults/multisig v0.0.0-00010101000000-000000000000 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect @@ -68,7 +67,7 @@ require ( github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/aws/aws-sdk-go v1.54.6 // indirect + github.com/aws/aws-sdk-go v1.55.5 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect @@ -90,9 +89,9 @@ require ( github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect - github.com/creachadair/atomicfile v0.3.4 // indirect + github.com/creachadair/atomicfile v0.3.5 // indirect github.com/creachadair/tomledit v0.0.26 // indirect github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -123,10 +122,10 @@ require ( github.com/google/flatbuffers v2.0.8+incompatible // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/orderedcode v0.0.1 // indirect - github.com/google/s2a-go v0.1.7 // indirect + github.com/google/s2a-go v0.1.8 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect - github.com/googleapis/gax-go/v2 v2.12.5 // indirect + github.com/googleapis/gax-go/v2 v2.13.0 // indirect github.com/gorilla/handlers v1.5.2 // indirect github.com/gorilla/mux v1.8.1 // indirect github.com/gorilla/websocket v1.5.3 // indirect @@ -134,7 +133,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-getter v1.7.5 // indirect + github.com/hashicorp/go-getter v1.7.6 // indirect github.com/hashicorp/go-hclog v1.6.3 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-metrics v0.5.3 // indirect @@ -173,13 +172,13 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rivo/uniseg v0.2.0 // indirect @@ -203,27 +202,27 @@ require ( gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 // indirect - go.opentelemetry.io/otel v1.27.0 // indirect - go.opentelemetry.io/otel/metric v1.27.0 // indirect - go.opentelemetry.io/otel/trace v1.27.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect + go.opentelemetry.io/otel v1.28.0 // indirect + go.opentelemetry.io/otel/metric v1.28.0 // indirect + go.opentelemetry.io/otel/trace v1.28.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.26.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/oauth2 v0.21.0 // indirect + golang.org/x/oauth2 v0.22.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.24.0 // indirect golang.org/x/term v0.23.0 // indirect golang.org/x/text v0.17.0 // indirect - golang.org/x/time v0.5.0 // indirect + golang.org/x/time v0.6.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect - google.golang.org/api v0.185.0 // indirect - google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect + google.golang.org/api v0.192.0 // indirect + google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect @@ -250,7 +249,6 @@ replace ( cosmossdk.io/x/accounts => ../x/accounts cosmossdk.io/x/accounts/defaults/lockup => ../x/accounts/defaults/lockup cosmossdk.io/x/accounts/defaults/multisig => ../x/accounts/defaults/multisig - cosmossdk.io/x/auth => ../x/auth cosmossdk.io/x/authz => ../x/authz cosmossdk.io/x/bank => ../x/bank cosmossdk.io/x/circuit => ../x/circuit @@ -277,6 +275,7 @@ replace ( github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 // Simapp always use the latest version of the cosmos-sdk github.com/cosmos/cosmos-sdk => ../. + github.com/cosmos/iavl => github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e // Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities. // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1 diff --git a/simapp/go.sum b/simapp/go.sum index a75190e24f16..0e0465a4a489 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -34,8 +34,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.115.0 h1:CnFSK6Xo3lDYRoBKEcAtia6VSC837/ZkJuRduSFnr14= -cloud.google.com/go v0.115.0/go.mod h1:8jIM5vVgoAEoiVxQ/O4BFTfHqulPZgs/ufEzMcFMdWU= +cloud.google.com/go v0.115.1 h1:Jo0SM9cQnSkYfp44+v+NQXHpcHqlnRJk2qxh6yvxxxQ= +cloud.google.com/go v0.115.1/go.mod h1:DuujITeaufu3gL68/lOFIirVNJwQeyf5UXyi+Wbgknc= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= @@ -50,10 +50,10 @@ cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjby cloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY= cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw= cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI= -cloud.google.com/go/auth v0.5.1 h1:0QNO7VThG54LUzKiQxv8C6x1YX7lUrzlAa1nVLF8CIw= -cloud.google.com/go/auth v0.5.1/go.mod h1:vbZT8GjzDf3AVqCcQmqeeM32U9HBFc32vVVAbwDsa6s= -cloud.google.com/go/auth/oauth2adapt v0.2.2 h1:+TTV8aXpjeChS9M+aTtN/TjdQnzJvmzKFt//oWu7HX4= -cloud.google.com/go/auth/oauth2adapt v0.2.2/go.mod h1:wcYjgpZI9+Yu7LyYBg4pqSiaRkfEK3GQcpb7C/uyF1Q= +cloud.google.com/go/auth v0.8.1 h1:QZW9FjC5lZzN864p13YxvAtGUlQ+KgRL+8Sg45Z6vxo= +cloud.google.com/go/auth v0.8.1/go.mod h1:qGVp/Y3kDRSDZ5gFD/XPUfYQ9xW1iI7q8RIRoCyBbJc= +cloud.google.com/go/auth/oauth2adapt v0.2.4 h1:0GWE/FUsXhf6C+jAkWgYm7X9tK8cuEIfy19DBn6B6bY= +cloud.google.com/go/auth/oauth2adapt v0.2.4/go.mod h1:jC/jOpwFP6JBxhB3P5Rr0a9HLMC/Pe3eaL4NmdvqPtc= cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0= cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= @@ -76,8 +76,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc= -cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= +cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY= +cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= @@ -115,14 +115,14 @@ cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y97 cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= -cloud.google.com/go/iam v1.1.8 h1:r7umDwhj+BQyz0ScZMp4QrGXjSTI3ZINnpgU2nlB/K0= -cloud.google.com/go/iam v1.1.8/go.mod h1:GvE6lyMmfxXauzNq8NbgJbeVQNspG+tcdL/W8QO1+zE= +cloud.google.com/go/iam v1.1.13 h1:7zWBXG9ERbMLrzQBRhFliAV+kjcRToDTgQT3CTwYyv4= +cloud.google.com/go/iam v1.1.13/go.mod h1:K8mY0uSXwEXS30KrnVb+j54LB/ntfZu1dr+4zFMNbus= cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= cloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08= -cloud.google.com/go/longrunning v0.5.7 h1:WLbHekDbjK1fVFD3ibpFFVoyizlLRl73I7YKuAKilhU= -cloud.google.com/go/longrunning v0.5.7/go.mod h1:8GClkudohy1Fxm3owmBGid8W0pSgodEMwEAztp38Xng= +cloud.google.com/go/longrunning v0.5.11 h1:Havn1kGjz3whCfoD8dxMLP73Ph5w+ODyZB9RUsDxtGk= +cloud.google.com/go/longrunning v0.5.11/go.mod h1:rDn7//lmlfWV1Dx6IB4RatCPenTwwmqXuiP0/RgoEO4= cloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4= cloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w= cloud.google.com/go/memcache v1.4.0/go.mod h1:rTOfiGZtJX1AaFUrOgsMHX5kAzaTQ8azHiuDoTPzNsE= @@ -179,8 +179,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= -cloud.google.com/go/storage v1.42.0 h1:4QtGpplCVt1wz6g5o1ifXd656P5z+yNgzdw1tVfp0cU= -cloud.google.com/go/storage v1.42.0/go.mod h1:HjMXRFq65pGKFn6hxj6x3HCyR41uSB72Z0SO/Vn6JFQ= +cloud.google.com/go/storage v1.43.0 h1:CcxnSohZwizt4LCzQHWvBf1/kvtHUn7gk9QERXPyXFs= +cloud.google.com/go/storage v1.43.0/go.mod h1:ajvxEa7WmZS1PxvKRq4bq0tFT3vMd502JwstCcYv0Q0= cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= @@ -196,12 +196,12 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= -cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= +cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk= +cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -231,8 +231,8 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= -github.com/aws/aws-sdk-go v1.54.6 h1:HEYUib3yTt8E6vxjMWM3yAq5b+qjj/6aKA62mkgux9g= -github.com/aws/aws-sdk-go v1.54.6/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= +github.com/aws/aws-sdk-go v1.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU= +github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -308,8 +308,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/crypto v0.1.2 h1:Yn500sPY+9sKVdhiPUSDtt8JOpBGMB515dOmla4zfls= @@ -321,19 +321,19 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e h1:LEii0v/FxtXa/F7mRn+tijZ0zaXBPn2ZkKwb6Qm4rqE= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e/go.mod h1:3ywr0wDnWeD7MUH6qu50wZ5bxuKH3LBrGG4/lZX8lVY= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creachadair/atomicfile v0.3.4 h1:AjNK7To+S1p+nk7uJXJMZFpcV9XHOyAaULyDeU6LEqM= -github.com/creachadair/atomicfile v0.3.4/go.mod h1:ByEUbfQyms+tRtE7Wk7WdS6PZeyMzfSFlNX1VoKEh6E= -github.com/creachadair/mds v0.13.3 h1:OqXNRorXKsuvfjor+0ixtrpA4IINApH8zgm23XLlngk= -github.com/creachadair/mds v0.13.3/go.mod h1:4vrFYUzTXMJpMBU+OA292I6IUxKWCCfZkgXg+/kBZMo= +github.com/creachadair/atomicfile v0.3.5 h1:i93bxeaH/rQR6XfJslola3XkOM1nEP3eIexuk9SWcSc= +github.com/creachadair/atomicfile v0.3.5/go.mod h1:m7kIY2OUMygtETnMYe141rubsG4b+EusFLinlxxdHYM= +github.com/creachadair/mds v0.16.0 h1:v6DlvKXClowXFg4hkjLCR1FEFiREMf0qgX+Lm5GsEKk= +github.com/creachadair/mds v0.16.0/go.mod h1:4vrFYUzTXMJpMBU+OA292I6IUxKWCCfZkgXg+/kBZMo= github.com/creachadair/tomledit v0.0.26 h1:MoDdgHIHZ5PctBVsAZDjxdxreWUEa9ObPKTRkk5PPwA= github.com/creachadair/tomledit v0.0.26/go.mod h1:SJi1OxKpMyR141tq1lzsbPtIg3j8TeVPM/ZftfieD7o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -519,8 +519,8 @@ github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= -github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= +github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM= +github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -539,8 +539,8 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99 github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= -github.com/googleapis/gax-go/v2 v2.12.5 h1:8gw9KZK8TiVKB6q3zHY3SBzLnrGp6HQjyfYBYGmXdxA= -github.com/googleapis/gax-go/v2 v2.12.5/go.mod h1:BUDKcWo+RaKq5SC9vVYL0wLADa3VcfswbOMMRmB9H3E= +github.com/googleapis/gax-go/v2 v2.13.0 h1:yitjD5f7jQHhyDsnhKEBU52NdvvdSeGzlAnDPT0hH1s= +github.com/googleapis/gax-go/v2 v2.13.0/go.mod h1:Z/fvTZXF8/uw7Xu5GuslPw+bplx6SS338j1Is2S+B7A= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= @@ -557,8 +557,8 @@ github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NM github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-getter v1.7.5 h1:dT58k9hQ/vbxNMwoI5+xFYAJuv6152UNvdHokfI5wE4= -github.com/hashicorp/go-getter v1.7.5/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-getter v1.7.6 h1:5jHuM+aH373XNtXl9TNTUH5Qd69Trve11tHIrB+6yj4= +github.com/hashicorp/go-getter v1.7.6/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= @@ -628,6 +628,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -704,8 +706,8 @@ github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4 github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba h1:3jPgmsFGBID1wFfU2AbYocNcN4wqU68UaHSdMjiw/7U= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= @@ -722,8 +724,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -732,8 +734,8 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -793,7 +795,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -835,21 +836,23 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0 h1:vS1Ao/R55RNV4O7TA2Qopok8yN+X0LIP6RVWLFkprck= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0/go.mod h1:BMsdeOxN04K0L5FNUBfjFdvwWGNe/rkmSwH4Aelu/X0= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 h1:9l89oX4ba9kHbBol3Xin3leYJ+252h0zszDtBwyKe2A= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0/go.mod h1:XLZfZboOJWHNKUv7eH0inh0E9VV6eWDFB/9yJyTLPp0= -go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= -go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= -go.opentelemetry.io/otel/metric v1.27.0 h1:hvj3vdEKyeCi4YaYfNjv2NUje8FqKqUY8IlF0FxV/ik= -go.opentelemetry.io/otel/metric v1.27.0/go.mod h1:mVFgmRlhljgBiuk/MP/oKylr4hs85GZAylncepAX/ak= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 h1:9G6E0TXzGFVfTnawRzrPl83iHOAV7L8NJiR8RSGYV1g= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0/go.mod h1:azvtTADFQJA8mX80jIH/akaE7h+dbm/sVuaHqN13w74= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= +go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= +go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= +go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= +go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= -go.opentelemetry.io/otel/trace v1.27.0 h1:IqYb813p7cmbHk0a5y6pD5JPakbVfftRXABGt5/Rscw= -go.opentelemetry.io/otel/trace v1.27.0/go.mod h1:6RiD1hkAprV4/q+yd2ln1HG9GoPx39SuvvstaLBl+l4= +go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= +go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= @@ -983,8 +986,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= -golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= +golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1106,8 +1109,8 @@ golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= +golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1174,8 +1177,6 @@ golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= -golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -1224,8 +1225,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.185.0 h1:ENEKk1k4jW8SmmaT6RE+ZasxmxezCrD5Vw4npvr+pAU= -google.golang.org/api v0.185.0/go.mod h1:HNfvIkJGlgrIlrbYkAm9W9IdkmKZjOTVh33YltygGbg= +google.golang.org/api v0.192.0 h1:PljqpNAfZaaSpS+TnANfnNAXKdzHM/B9bKhwRlo7JP0= +google.golang.org/api v0.192.0/go.mod h1:9VcphjvAxPKLmSxVSzPlSRXy/5ARMEw5bf58WoVXafQ= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1337,12 +1338,12 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4 h1:CUiCqkPw1nNrNQzCCG4WA65m0nAmQiwXHpub3dNyruU= -google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4/go.mod h1:EvuUDCulqGgV80RvP1BHuom+smhX4qtlhnNatHuroGQ= -google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 h1:MuYw1wJzT+ZkybKfaOXKp5hJiZDn2iHaXRw0mRYdHSc= -google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4/go.mod h1:px9SlOOZBg1wM1zdnr8jEL4CNGUBZ+ZKYtNPApNQc4c= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142 h1:oLiyxGgE+rt22duwci1+TG7bg2/L1LQsXwfjPlmuJA0= +google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142/go.mod h1:G11eXq53iI5Q+kyNOmCvnzBaxEA2Q/Ik5Tj7nqBE8j4= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -1378,8 +1379,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= diff --git a/simapp/gomod2nix.toml b/simapp/gomod2nix.toml index 8c571d3ee020..59f091559212 100644 --- a/simapp/gomod2nix.toml +++ b/simapp/gomod2nix.toml @@ -2,35 +2,44 @@ schema = 3 [mod] [mod."buf.build/gen/go/cometbft/cometbft/protocolbuffers/go"] - version = "v1.34.1-20240312114316-c0d3497e35d6.1" - hash = "sha256-0zQ7x05+UOSAexuSQMFmt8kcY3023CBEOaulmRklnPA=" + version = "v1.34.2-20240701160653-fedbb9acfd2f.2" + hash = "sha256-0s06GxIx/S/l7P8lkNEHwxnHbAIchuWrIo+6FLNu8ew=" [mod."buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go"] - version = "v1.34.1-20240130113600-88ef6483f90f.1" - hash = "sha256-xCjFaSPtlyMmDhzBDAdgUStU8TYFOril/goGfGOGAWo=" + version = "v1.34.2-20240130113600-88ef6483f90f.2" + hash = "sha256-BNi/Ef44xNRmEtkhF+/hqEq041Fell0+ygGiUWeOqo8=" [mod."cloud.google.com/go"] - version = "v0.112.2" - hash = "sha256-Bk5MD40eefJlyUk96arLU/X1+EHItM7MjRPJtV0CU58=" + version = "v0.115.1" + hash = "sha256-i/KvDIs1/6HoX8DbH0qI2vJ0kiuZOV3o2ep9FxUQn/M=" [mod."cloud.google.com/go/auth"] - version = "v0.2.2" - hash = "sha256-xlhXKBwHDAGalOYhl6/ZSu+1LInr4xOdo4n0LfEEbuY=" + version = "v0.8.1" + hash = "sha256-EPYkxpJB/ybPR0UwJiEM1/lMVq9T0p3ltn5IfttUw1M=" [mod."cloud.google.com/go/auth/oauth2adapt"] - version = "v0.2.1" - hash = "sha256-meY0Sms2PtUe6kGYmVUbqCTkGJJmA05v0eN+OuZvKXs=" + version = "v0.2.4" + hash = "sha256-GRXPQMHEEgeKhdCOBjoDL7+UW3yBdSei5ULuZGBE4tw=" [mod."cloud.google.com/go/compute/metadata"] - version = "v0.3.0" - hash = "sha256-hj2Xjlz3vj7KYONZO/ItclWGGJEUgo5EvMEkGPfQi1Q=" + version = "v0.5.0" + hash = "sha256-IyVEEElHNPLTRFUMF8ymV3FfQEJQfEdTSeU5PodfOzA=" [mod."cloud.google.com/go/iam"] - version = "v1.1.7" - hash = "sha256-+HdgBZbhH9ZdifQ2s1IZGnCOA8xwdnsB4AZTaV5m2IU=" + version = "v1.1.13" + hash = "sha256-iYfsUNu8BDnIaP57W6xwiJa34IOj/MQw5aKZRT+3yI4=" [mod."cloud.google.com/go/storage"] - version = "v1.40.0" - hash = "sha256-/G0VKU/MZ2zBF+05UOsCOdzIf7LurwV9RtozVtiKkm0=" + version = "v1.43.0" + hash = "sha256-4ilF4rvcOsdVQ/Ga4XtsPAoGg+tu7lCn0QmnEfHCO8s=" + [mod."cosmossdk.io/depinject"] + version = "v1.0.0" + hash = "sha256-dtsNfj5zUlX6e4YslzyegrebztmlLiBFvqDb2IHV+Zc=" [mod."cosmossdk.io/errors"] version = "v1.0.1" hash = "sha256-MgTocXkBzri9FKkNtkARJXPmxRrRO/diQJS5ZzvYrJY=" + [mod."cosmossdk.io/log"] + version = "v1.4.1" + hash = "sha256-pgI770MdI/OfZcK6UFmQ9iyPBgapz/ErrUe8WVO3iBg=" [mod."cosmossdk.io/math"] version = "v1.3.0" hash = "sha256-EEFK43Cr0g0ndhQhkIKher0FqV3mvkmE9z0sP7uVSHg=" + [mod."cosmossdk.io/schema"] + version = "v0.2.0" + hash = "sha256-E3oyUZ+apCNf699V2o7cUCjDQ6HCX2/0qE64cr77WA8=" [mod."filippo.io/edwards25519"] version = "v1.1.0" hash = "sha256-9ACANrgWZSd5HYPfDZHY8DVbPSC9LOMgy8deq3rDOoc=" @@ -51,8 +60,8 @@ schema = 3 version = "v0.6.1" hash = "sha256-BL0BVaHtmPKQts/711W59AbHXjGKqFS4ZTal0RYnR9I=" [mod."github.com/aws/aws-sdk-go"] - version = "v1.51.25" - hash = "sha256-eYGEnqYOVeTfwPuLiCYVgh5Bj2crnO6QUtNoLJBNPH0=" + version = "v1.55.5" + hash = "sha256-Duod/yk0bGmbcqgaZg+4XoWwY7Ysq4RA/cFBV8nFX6E=" [mod."github.com/aymanbagabas/go-osc52/v2"] version = "v2.0.1" hash = "sha256-6Bp0jBZ6npvsYcKZGHHIUSVSTAMEyieweAX2YAKDjjg=" @@ -63,7 +72,7 @@ schema = 3 version = "v0.0.0-20140422174119-9fd32a8b3d3d" hash = "sha256-NDxQzO5C5M/aDz5/pjUHfZUh4VwIXovbb3irtxWCwjY=" [mod."github.com/bgentry/speakeasy"] - version = "v0.1.1-0.20220910012023-760eaf8b6816" + version = "v0.2.0" hash = "sha256-Tx3sPuhsoVwrCfJdIwf4ipn7pD92OQNYvpCxl1Z9Wt0=" [mod."github.com/bits-and-blooms/bitset"] version = "v1.10.0" @@ -96,8 +105,8 @@ schema = 3 version = "v0.0.0-20230807174530-cc333fc44b06" hash = "sha256-yZdBXkTVzPxRYntI9I2Gu4gkI11m52Nwl8RNNdlXSrA=" [mod."github.com/cometbft/cometbft"] - version = "v1.0.0-alpha.2.0.20240530055211-ae27f7eb3c08" - hash = "sha256-lTWdghXhWiEPyRmOCdNHhMJRHjLuztutkYXuIxBn6Iw=" + version = "v1.0.0-rc1" + hash = "sha256-Z143m7sKQPuhkqXQtrmzVJv4jMjcjgcrmUbkwVv7aYw=" [mod."github.com/cometbft/cometbft-db"] version = "v0.12.0" hash = "sha256-mfeUD8+V+xUzEhSOLgQQP0GFDWt7ch/TeBw9gnTJuHk=" @@ -108,14 +117,14 @@ schema = 3 version = "v1.0.5" hash = "sha256-t572Sr5iiHcuMKLMWa2i+LBAt192oa+G1oA371tG/eI=" [mod."github.com/cosmos/cosmos-db"] - version = "v1.0.2" - hash = "sha256-WjDoB2AGoIyEW30LlGcQX5JVACJbs0jWSY58IuJHz0M=" + version = "v1.0.3-0.20240829004618-717cba019b33" + hash = "sha256-SVwEhu5bBq1i7DuTZuZid9Rc4LYvBrdmBqhn/c+EPL8=" [mod."github.com/cosmos/cosmos-proto"] version = "v1.0.0-beta.5" hash = "sha256-Fy/PbsOsd6iq0Njy3DVWK6HqWsogI+MkE8QslHGWyVg=" [mod."github.com/cosmos/crypto"] - version = "v0.0.0-20240309083813-82ed2537802e" - hash = "sha256-QZMLx8zhaaD1XReCSwwlx2ay2ubQ/KYv7M/+znkK2LA=" + version = "v0.1.2" + hash = "sha256-BcUwnEdS8aXIg171hXoNdn5xdNVvEzgHR01jLi+1tx4=" [mod."github.com/cosmos/go-bip39"] version = "v1.0.0" hash = "sha256-Qm2aC2vaS8tjtMUbHmlBSagOSqbduEEDwc51qvQaBmA=" @@ -123,20 +132,21 @@ schema = 3 version = "v1.2.0" hash = "sha256-Hd19V0RCiMoCL67NsqvWIsvWF8KM3LnuJTbYjWtQkEo=" [mod."github.com/cosmos/gogoproto"] - version = "v1.5.0" - hash = "sha256-xfMjGMPy5+Nw4EhmiveFSSRNQXnocyUB7QGTN/ET1m0=" + version = "v1.7.0" + hash = "sha256-ZkEUImxBBo8Q/6c7tVR0rybpLbtlplzvgfLl5xvtV00=" [mod."github.com/cosmos/iavl"] - version = "v1.2.0" - hash = "sha256-NYSt6LOGyspP6eZXo9e5+2MFwyrWxD/rp2dRTtlWg2E=" + version = "v1.0.0-beta.1.0.20240813194616-eb5078efcf9e" + hash = "sha256-stj1mt8ucRWTe+qfmo9JdAzm8jdHfzlNX3cnGYtrl2I=" + replaced = "github.com/cosmos/iavl" [mod."github.com/cosmos/ics23/go"] - version = "v0.10.0" - hash = "sha256-KYEv727BO/ht63JO02xiKFGFAddg41Ve9l2vSSZZBq0=" + version = "v0.11.0" + hash = "sha256-mgU/pqp4kASmW/bP0z6PzssfjRp7GU9ioyvNlDdGC+E=" [mod."github.com/cosmos/ledger-cosmos-go"] version = "v0.13.3" hash = "sha256-4f73odipfgWku0/gK2UtXbrBXvj8kT9sg4IhnfAP/S0=" [mod."github.com/creachadair/atomicfile"] - version = "v0.3.4" - hash = "sha256-iV1Q8QAp3Y28bUa198jXnvV5wpITvuqUkU4aRIytVDI=" + version = "v0.3.5" + hash = "sha256-OTd/sQLFQ+V4H118Eclz7x0DqdZiidtd9pR9tko0+n8=" [mod."github.com/creachadair/tomledit"] version = "v0.0.26" hash = "sha256-kpn/KpzYdlYMV9vq+AYEJq80S2tbT3xdU1gp6H4WoA8=" @@ -186,8 +196,8 @@ schema = 3 version = "v0.6.0" hash = "sha256-RtIG2qARd5sT10WQ7F3LR8YJhS8exs+KiuUiVf75bWg=" [mod."github.com/go-logr/logr"] - version = "v1.4.1" - hash = "sha256-WM4badoqxXlBmqCRrnmtNce63dLlr/FJav3BJSYHvaY=" + version = "v1.4.2" + hash = "sha256-/W6qGilFlZNTb9Uq48xGZ4IbsVeSwJiAMLw4wiNYHLI=" [mod."github.com/go-logr/stdr"] version = "v1.2.2" hash = "sha256-rRweAP7XIb4egtT1f2gkz4sYOu7LDHmcJ5iNsJUd0sE=" @@ -204,8 +214,8 @@ schema = 3 version = "v1.3.2" hash = "sha256-pogILFrrk+cAtb0ulqn9+gRZJ7sGnnLLdtqITvxvG6c=" [mod."github.com/golang/glog"] - version = "v1.2.0" - hash = "sha256-eCWkUlsWbHSjsuTw8HcNpj3KxT+QPvW5SSIv88hAsxA=" + version = "v1.2.1" + hash = "sha256-H9gR4sQRFOb4ZlSwvxU0MGR6iKnYWv4NSY3genjN/V4=" [mod."github.com/golang/groupcache"] version = "v0.0.0-20210331224755-41bb18bfe9da" hash = "sha256-7Gs7CS9gEYZkbu5P4hqPGBpeGZWC64VDwraSKFF+VR0=" @@ -231,8 +241,8 @@ schema = 3 version = "v0.0.1" hash = "sha256-KrExYovtUQrHGI1mPQf57jGw8soz7eWOC2xqEaV0uGk=" [mod."github.com/google/s2a-go"] - version = "v0.1.7" - hash = "sha256-E+SX/3VmRI5qN7SbnRP4Tt+gQTq93pScpY9U2tTmIU0=" + version = "v0.1.8" + hash = "sha256-H4jy3iElh82CTujW3UpaSvsdfN7fZHBLJ4Z4M7kiMSk=" [mod."github.com/google/uuid"] version = "v1.6.0" hash = "sha256-VWl9sqUzdOuhW0KzQlv0gwwUQClYkmZwSydHG2sALYw=" @@ -240,8 +250,8 @@ schema = 3 version = "v0.3.2" hash = "sha256-wVuR3QC0mYFl5LNeKdRXdKdod7BGP5sv2h6VVib85v8=" [mod."github.com/googleapis/gax-go/v2"] - version = "v2.12.3" - hash = "sha256-FSlL1GXLe/e7gol/D9GOp3iC04s58UtDXcwiKSalUwE=" + version = "v2.13.0" + hash = "sha256-p1SEjRjI/SkWSBWjeptQ5M/Tgrcj8IiH/beXBYqRVko=" [mod."github.com/gorilla/handlers"] version = "v1.5.2" hash = "sha256-2WQeVCe7vQg+8MpNLMhOGsRdbrcWLpbtUhUX8mbiQrs=" @@ -249,8 +259,8 @@ schema = 3 version = "v1.8.1" hash = "sha256-nDABvAhlYgxUW2N/brrep7NkQXoSGcHhA+XI4+tK0F0=" [mod."github.com/gorilla/websocket"] - version = "v1.5.1" - hash = "sha256-eHZ/U+eeE5tSgWc1jEDuBwtTRbXKP9fqP9zfW4Zw8T0=" + version = "v1.5.3" + hash = "sha256-vTIGEFMEi+30ZdO6ffMNJ/kId6pZs5bbyqov8xe9BM0=" [mod."github.com/grpc-ecosystem/go-grpc-middleware"] version = "v1.4.0" hash = "sha256-0UymBjkg41C9MPqkBLz/ZY9WbimZrabpJk+8C/X63h8=" @@ -264,8 +274,8 @@ schema = 3 version = "v0.5.2" hash = "sha256-N9GOKYo7tK6XQUFhvhImtL7PZW/mr4C4Manx/yPVvcQ=" [mod."github.com/hashicorp/go-getter"] - version = "v1.7.4" - hash = "sha256-GtJSwcS1WXLn9lFAuTRCseIQBXJOElAywEhTtYrsfbE=" + version = "v1.7.6" + hash = "sha256-T0XGw1SqIdEO44QemqcFQcdUpBI910xMo631zQA6znQ=" [mod."github.com/hashicorp/go-hclog"] version = "v1.6.3" hash = "sha256-BK2s+SH1tQyUaXCH4kC0/jgqiSu638UFbwamfKjFOYg=" @@ -282,8 +292,8 @@ schema = 3 version = "v1.0.0" hash = "sha256-g5i9m7FSRInQzZ4iRpIsoUu685AY7fppUwjhuZCezT8=" [mod."github.com/hashicorp/go-version"] - version = "v1.6.0" - hash = "sha256-UV0equpmW6BiJnp4W3TZlSJ+PTHuTA+CdOs2JTeHhjs=" + version = "v1.7.0" + hash = "sha256-Umc/Q2mxRrPF4aEcDuDJq4lFBT+PSsnyANfyFwUIaxI=" [mod."github.com/hashicorp/golang-lru"] version = "v1.0.2" hash = "sha256-yy+5botc6T5wXgOe2mfNXJP3wr+MkVlUZ2JBkmmrA48=" @@ -315,8 +325,8 @@ schema = 3 version = "v1.0.0" hash = "sha256-xEd0mDBeq3eR/GYeXjoTVb2sPs8sTCosn5ayWkcgENI=" [mod."github.com/klauspost/compress"] - version = "v1.17.8" - hash = "sha256-8rgCCfHX29le8m6fyVn6gwFde5TPUHjwQqZqv9JIubs=" + version = "v1.17.9" + hash = "sha256-FxHk4OuwsbiH1OLI+Q0oA4KpcOB786sEfik0G+GNoow=" [mod."github.com/kr/pretty"] version = "v0.3.1" hash = "sha256-DlER7XM+xiaLjvebcIPiB12oVNjyZHuJHoRGITzzpKU=" @@ -371,6 +381,9 @@ schema = 3 [mod."github.com/muesli/termenv"] version = "v0.15.2" hash = "sha256-Eum/SpyytcNIchANPkG4bYGBgcezLgej7j/+6IhqoMU=" + [mod."github.com/munnerz/goautoneg"] + version = "v0.0.0-20191010083416-a7dc8b61c822" + hash = "sha256-79URDDFenmGc9JZu+5AXHToMrtTREHb3BC84b/gym9Q=" [mod."github.com/oasisprotocol/curve25519-voi"] version = "v0.0.0-20230904125328-1f23a7beb09a" hash = "sha256-N5MMNn4rytO3ObXVXoY34Sf7AGPkw2dTPkXjigjozls=" @@ -378,8 +391,8 @@ schema = 3 version = "v1.1.0" hash = "sha256-U4IS0keJa4BSBSeEBqtIV1Zg6N4b0zFiKfzN9ua4pWQ=" [mod."github.com/pelletier/go-toml/v2"] - version = "v2.2.2" - hash = "sha256-ukxk1Cfm6cQW18g/aa19tLcUu5BnF7VmfAvrDHAOl6A=" + version = "v2.2.3" + hash = "sha256-fE++SVgnCGdnFZoROHWuYjIR7ENl7k9KKxQrRTquv/o=" [mod."github.com/petermattis/goid"] version = "v0.0.0-20240327183114-c42a807a84ba" hash = "sha256-f2enuVnb6nrQX0uBc3WYEK68TiLUp4Y1qisx84ElaFA=" @@ -390,17 +403,17 @@ schema = 3 version = "v1.0.1-0.20181226105442-5d4384ee4fb2" hash = "sha256-XA4Oj1gdmdV/F/+8kMI+DBxKPthZ768hbKsO3d9Gx90=" [mod."github.com/prometheus/client_golang"] - version = "v1.19.1" - hash = "sha256-MSLsMDi89uQc7Pa2fhqeamyfPJpenGj3r+eB/UotK7w=" + version = "v1.20.2" + hash = "sha256-IDz23JBmIasHQzqfik5gogDZH5xSN2aorgnC+IIJZv4=" [mod."github.com/prometheus/client_model"] version = "v0.6.1" hash = "sha256-rIDyUzNfxRA934PIoySR0EhuBbZVRK/25Jlc/r8WODw=" [mod."github.com/prometheus/common"] - version = "v0.54.0" - hash = "sha256-joypdri5BKFVOZM3EYTOryJLX0eNHjB5cdlewypwU0c=" + version = "v0.57.0" + hash = "sha256-Lh9qK+5EfNHvT9u9QNvCTZFHJDB7CiFiHB+XqGENXNY=" [mod."github.com/prometheus/procfs"] - version = "v0.14.0" - hash = "sha256-NZfiTx9g098TFnsA1Q/niXxTqybkbNG1BItaXSiRsnQ=" + version = "v0.15.1" + hash = "sha256-H+WXJemFFwdoglmD6p7JRjrJJZmIVAmJwYmLbZ8Q9sw=" [mod."github.com/rcrowley/go-metrics"] version = "v0.0.0-20201227073835-cf1acfcdf475" hash = "sha256-10ytHQ1SpMKYTiKuOPdEMuOVa8HVvv9ryYSIF9BHEBI=" @@ -432,8 +445,8 @@ schema = 3 version = "v1.11.0" hash = "sha256-+rV3cDZr13N8E0rJ7iHmwsKYKH+EhV+IXBut+JbBiIE=" [mod."github.com/spf13/cast"] - version = "v1.6.0" - hash = "sha256-hxioqRZfXE0AE5099wmn3YG0AZF8Wda2EB4c7zHF6zI=" + version = "v1.7.0" + hash = "sha256-xO2kSmNmMHaJ1i3T0ou0pcaBCusuO6Ep3xtF1P7ZadA=" [mod."github.com/spf13/cobra"] version = "v1.8.1" hash = "sha256-yDF6yAHycV1IZOrt3/hofR+QINe+B2yqkcIaVov3Ky8=" @@ -450,8 +463,8 @@ schema = 3 version = "v1.6.0" hash = "sha256-LspbjTniiq2xAICSXmgqP7carwlNaLqnCTQfw2pa80A=" [mod."github.com/supranational/blst"] - version = "v0.3.11" - hash = "sha256-r0zdZzVvPYaTOPzLF742uYYQ5tzSiv0xxB52etEkGAk=" + version = "v0.3.12" + hash = "sha256-2Mj9yzEMawkqowVwJDwNEvLhwN1uXydFbca1/JF5/kw=" [mod."github.com/syndtr/goleveldb"] version = "v1.0.1-0.20210819022825-2ae1ddf74ef7" hash = "sha256-36a4hgVQfwtS2zhylKpQuFhrjdc/Y8pF0dxc26jcZIU=" @@ -484,26 +497,26 @@ schema = 3 version = "v0.24.0" hash = "sha256-4H+mGZgG2c9I1y0m8avF4qmt8LUKxxVsTqR8mKgP4yo=" [mod."go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"] - version = "v0.50.0" - hash = "sha256-ucFsEVD4lTfUkBjIpJRJrjaX2lRb9lLKJSadPrcCz3I=" + version = "v0.53.0" + hash = "sha256-Y7GHreVzxTBSxLnITRIP8fHxSK/ozs+nme8e0MuiujA=" [mod."go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"] - version = "v0.50.0" - hash = "sha256-2ZZp2ADv9q6+3CCS2KLBWr+UBhNAd/x8ixov/CA3LJw=" + version = "v0.53.0" + hash = "sha256-B7LSUQARnc4mpFjHj4jvJJh/rBAHGtKm1p+qFib+Pqk=" [mod."go.opentelemetry.io/otel"] - version = "v1.25.0" - hash = "sha256-HMruryzhsHkfVwEt1TE2Wj2r1z0U6xFAsVTPFihpn/k=" + version = "v1.28.0" + hash = "sha256-bilBBr2cuADs9bQ7swnGLTuC7h0DooU6BQtrQqMqIjs=" [mod."go.opentelemetry.io/otel/metric"] - version = "v1.25.0" - hash = "sha256-s4hqgIhkIDA8oN0e8aWMFkgkm68RDZUzT0lUxEdanaw=" + version = "v1.28.0" + hash = "sha256-k3p1lYcvrODwIkZo/j2jvCoDFUelz4yVJEEVdUKUmGU=" [mod."go.opentelemetry.io/otel/trace"] - version = "v1.25.0" - hash = "sha256-sz8Pv8Yy0gGM82Tfo0X+48mUU/wiD7t9riaBrmgeb8E=" + version = "v1.28.0" + hash = "sha256-8uxmlm0/5VGoWegxwy0q8NgeY+pyicSoV08RkvD9Q98=" [mod."go.uber.org/multierr"] version = "v1.11.0" hash = "sha256-Lb6rHHfR62Ozg2j2JZy3MKOMKdsfzd1IYTR57r3Mhp0=" [mod."golang.org/x/crypto"] - version = "v0.24.0" - hash = "sha256-wpxJApwSmmn9meVdpFdOU0gzeJbIXcKuFfYUUVogSss=" + version = "v0.26.0" + hash = "sha256-Iicrsb65fCmjfPILKoSLyBZMwe2VUcoTF5SpYTCQEuk=" [mod."golang.org/x/exp"] version = "v0.0.0-20240531132922-fd00a4e0eefc" hash = "sha256-5JI14bkKxDtVGWpUmAFUPtqEcjMa8EHjt5obV8/FQew=" @@ -511,44 +524,44 @@ schema = 3 version = "v0.17.0" hash = "sha256-CLaPeF6uTFuRDv4oHwOQE6MCMvrzkUjWN3NuyywZjKU=" [mod."golang.org/x/net"] - version = "v0.25.0" - hash = "sha256-IjFfXLYNj27WLF7vpkZ6mfFXBnp+7QER3OQ0RgjxN54=" + version = "v0.28.0" + hash = "sha256-WdH/mgsX/CB+CiYtXEwJAXHN8FgtW2YhFcWwrrHNBLo=" [mod."golang.org/x/oauth2"] - version = "v0.19.0" - hash = "sha256-IYdkq8R8BXnwoBt/ZLAMJr0DkLZDMVkjeBJNQ/Z9Bes=" + version = "v0.22.0" + hash = "sha256-3gmmXfCcxYBMaXmKRzGBpX01h4lMenFPkqWT9TwqIBE=" [mod."golang.org/x/sync"] - version = "v0.7.0" - hash = "sha256-2ETllEu2GDWoOd/yMkOkLC2hWBpKzbVZ8LhjLu0d2A8=" + version = "v0.8.0" + hash = "sha256-usvF0z7gq1vsX58p4orX+8WHlv52pdXgaueXlwj2Wss=" [mod."golang.org/x/sys"] - version = "v0.21.0" - hash = "sha256-gapzPWuEqY36V6W2YhIDYR49sEvjJRd7bSuf9K1f4JY=" + version = "v0.24.0" + hash = "sha256-P0fsA+qy9taYHWPTtCs5XmrJ1i8tWfvkno+PNuc2elw=" [mod."golang.org/x/term"] - version = "v0.21.0" - hash = "sha256-zRm7uPBM1+TJkODYHkk/BtN3la5QAaSgslE2hSTm27Y=" + version = "v0.23.0" + hash = "sha256-ECmmK3Wc0g/zUy5wAokj7ItRsUi6eoqSe9s9Uhcwu90=" [mod."golang.org/x/text"] - version = "v0.16.0" - hash = "sha256-hMTO45upjEuA4sJzGplJT+La2n3oAfHccfYWZuHcH+8=" + version = "v0.17.0" + hash = "sha256-R8JbsP7KX+KFTHH7SjRnUGCdvtagylVOfngWEnVSqBc=" [mod."golang.org/x/time"] - version = "v0.5.0" - hash = "sha256-W6RgwgdYTO3byIPOFxrP2IpAZdgaGowAaVfYby7AULU=" + version = "v0.6.0" + hash = "sha256-gW9TVK9HjLk52lzfo5rBzSunc01gS0+SG2nk0X1w55M=" [mod."golang.org/x/tools"] version = "v0.21.1-0.20240508182429-e35e4ccd0d2d" hash = "sha256-KfnS+3fREPAWQUBoUedPupQp9yLrugxMmmEoHvyzKNE=" [mod."google.golang.org/api"] - version = "v0.175.0" - hash = "sha256-0NVK3UxAm8Sp8mux2GHeD4rA97u37U7yuE9vDd+wJlg=" + version = "v0.192.0" + hash = "sha256-1mva7l/lH0RlrvCnDcvrOWr1vnNHX632mMj3FTkeZIU=" [mod."google.golang.org/genproto"] - version = "v0.0.0-20240415180920-8c6c420018be" - hash = "sha256-IkbfNXhXtoemc7KWZQncKR/ykLpmfW7yb/P6ULMWEek=" + version = "v0.0.0-20240814211410-ddb44dafa142" + hash = "sha256-wLdAf7c2bjaS+X/4eE1KkKa08kthBoAHmP9kYrOGXQ0=" [mod."google.golang.org/genproto/googleapis/api"] - version = "v0.0.0-20240415180920-8c6c420018be" - hash = "sha256-0Bc66Utj1rydwYngQxTQoTyg1Td2D+nIxukc0zz7XFc=" + version = "v0.0.0-20240814211410-ddb44dafa142" + hash = "sha256-NosKwVYZLpvtvRq7oD4ldoNcodSur62X1bpujarh9t8=" [mod."google.golang.org/genproto/googleapis/rpc"] - version = "v0.0.0-20240515191416-fc5f0ca64291" - hash = "sha256-hQjIHJdIBBAthdXMB19Xr3A2Wy6GV6Gjv4w4MZl7qy4=" + version = "v0.0.0-20240827150818-7e3bb234dfed" + hash = "sha256-4T4DTrmFbqT4tD7PSL7Ie7u8ZN2iwGkhK02nWugssxk=" [mod."google.golang.org/grpc"] - version = "v1.64.0" - hash = "sha256-04Noi8lrzr+4ac2BA7KNXUXN/xZL/A2SsEpC2Hern84=" + version = "v1.66.0" + hash = "sha256-uFX1JsW1lx+CFLmj0B8wA8iE7ijaWMTNufBvMPMa0P0=" [mod."google.golang.org/protobuf"] version = "v1.34.2" hash = "sha256-nMTlrDEE2dbpWz50eQMPBQXCyQh4IdjrTIccaU0F3m0=" diff --git a/simapp/mint_fn.go b/simapp/mint_fn.go index dcb9f96c7ff6..f4542f7fb7c0 100644 --- a/simapp/mint_fn.go +++ b/simapp/mint_fn.go @@ -3,16 +3,17 @@ package simapp import ( "context" "encoding/binary" + "fmt" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/event" "cosmossdk.io/math" - authtypes "cosmossdk.io/x/auth/types" banktypes "cosmossdk.io/x/bank/types" minttypes "cosmossdk.io/x/mint/types" stakingtypes "cosmossdk.io/x/staking/types" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) type MintBankKeeper interface { @@ -29,31 +30,45 @@ func ProvideExampleMintFn(bankKeeper MintBankKeeper) minttypes.MintFn { return nil } - var stakingParams stakingtypes.QueryParamsResponse - err := env.QueryRouterService.InvokeTyped(ctx, &stakingtypes.QueryParamsRequest{}, &stakingParams) + resp, err := env.QueryRouterService.Invoke(ctx, &stakingtypes.QueryParamsRequest{}) if err != nil { return err } + stakingParams, ok := resp.(*stakingtypes.QueryParamsResponse) + if !ok { + return fmt.Errorf("unexpected response type: %T", resp) + } - var bankSupply banktypes.QuerySupplyOfResponse - err = env.QueryRouterService.InvokeTyped(ctx, &banktypes.QuerySupplyOfRequest{Denom: stakingParams.Params.BondDenom}, &bankSupply) + resp, err = env.QueryRouterService.Invoke(ctx, &banktypes.QuerySupplyOfRequest{Denom: stakingParams.Params.BondDenom}) if err != nil { return err } + bankSupply, ok := resp.(*banktypes.QuerySupplyOfResponse) + if !ok { + return fmt.Errorf("unexpected response type: %T", resp) + } + stakingTokenSupply := bankSupply.Amount - var mintParams minttypes.QueryParamsResponse - err = env.QueryRouterService.InvokeTyped(ctx, &minttypes.QueryParamsRequest{}, &mintParams) + resp, err = env.QueryRouterService.Invoke(ctx, &minttypes.QueryParamsRequest{}) if err != nil { return err } + mintParams, ok := resp.(*minttypes.QueryParamsResponse) + if !ok { + return fmt.Errorf("unexpected response type: %T", resp) + } - var stakingPool stakingtypes.QueryPoolResponse - err = env.QueryRouterService.InvokeTyped(ctx, &stakingtypes.QueryPoolRequest{}, &stakingPool) + resp, err = env.QueryRouterService.Invoke(ctx, &stakingtypes.QueryPoolRequest{}) if err != nil { return err } + stakingPool, ok := resp.(*stakingtypes.QueryPoolResponse) + if !ok { + return fmt.Errorf("unexpected response type: %T", resp) + } + // bondedRatio bondedRatio := math.LegacyNewDecFromInt(stakingPool.Pool.BondedTokens).QuoInt(stakingTokenSupply.Amount) minter.Inflation = minter.NextInflationRate(mintParams.Params, bondedRatio) diff --git a/simapp/sim_bench_test.go b/simapp/sim_bench_test.go index 4a7832c8ec14..be78cae4f8ab 100644 --- a/simapp/sim_bench_test.go +++ b/simapp/sim_bench_test.go @@ -6,17 +6,18 @@ import ( "os" "testing" - "cosmossdk.io/log" - "github.com/cosmos/cosmos-sdk/testutils/sims" - + dbm "github.com/cosmos/cosmos-db" flag "github.com/spf13/pflag" "github.com/spf13/viper" "github.com/stretchr/testify/require" + "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/server" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + "github.com/cosmos/cosmos-sdk/testutils/sims" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" @@ -57,6 +58,9 @@ func BenchmarkFullAppSimulation(b *testing.B) { app := NewSimApp(logger, db, nil, true, appOptions, interBlockCacheOpt(), baseapp.SetChainID(sims.SimAppChainID)) + blockedAddrs, err := BlockedAddresses(app.InterfaceRegistry().SigningContext().AddressCodec()) + require.NoError(b, err) + // run randomized simulation simParams, simErr := simulation.SimulateFromSeedX( b, @@ -66,7 +70,7 @@ func BenchmarkFullAppSimulation(b *testing.B) { simtestutil.AppStateFn(app.AppCodec(), app.AuthKeeper.AddressCodec(), app.StakingKeeper.ValidatorAddressCodec(), app.SimulationManager(), app.DefaultGenesis()), simtypes.RandomAccounts, simtestutil.SimulationOperations(app, app.AppCodec(), config, app.txConfig), - BlockedAddresses(), + blockedAddrs, config, app.AppCodec(), app.txConfig.SigningContext().AddressCodec(), @@ -83,6 +87,6 @@ func BenchmarkFullAppSimulation(b *testing.B) { } if config.Commit { - simtestutil.PrintStats(db) + simtestutil.PrintStats(db.(*dbm.GoLevelDB)) } } diff --git a/simapp/sim_test.go b/simapp/sim_test.go index 7a02d6a46cd6..9cb61c051adf 100644 --- a/simapp/sim_test.go +++ b/simapp/sim_test.go @@ -12,6 +12,7 @@ import ( "sync" "testing" + corestore "cosmossdk.io/core/store" "cosmossdk.io/log" "cosmossdk.io/store" storetypes "cosmossdk.io/store/types" @@ -21,7 +22,6 @@ import ( stakingtypes "cosmossdk.io/x/staking/types" abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" - dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/baseapp" servertypes "github.com/cosmos/cosmos-sdk/server/types" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" @@ -55,10 +55,11 @@ func TestFullAppSimulation(t *testing.T) { } func setupStateFactory(app *SimApp) sims.SimStateFactory { + blockedAddre, _ := BlockedAddresses(app.interfaceRegistry.SigningContext().AddressCodec()) return sims.SimStateFactory{ Codec: app.AppCodec(), AppStateFn: simtestutil.AppStateFn(app.AppCodec(), app.AuthKeeper.AddressCodec(), app.StakingKeeper.ValidatorAddressCodec(), app.SimulationManager(), app.DefaultGenesis()), - BlockedAddr: BlockedAddresses(), + BlockedAddr: blockedAddre, } } @@ -169,7 +170,7 @@ func TestAppStateDeterminism(t *testing.T) { } } // overwrite default app config - interBlockCachingAppFactory := func(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp)) *SimApp { + interBlockCachingAppFactory := func(logger log.Logger, db corestore.KVStoreWithBatch, traceStore io.Writer, loadLatest bool, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp)) *SimApp { if FlagEnableStreamingValue { m := map[string]any{ "streaming.abci.keys": []string{"*"}, diff --git a/simapp/simd/cmd/commands.go b/simapp/simd/cmd/commands.go index 67175d3ee31d..2b6e1a9032af 100644 --- a/simapp/simd/cmd/commands.go +++ b/simapp/simd/cmd/commands.go @@ -4,15 +4,14 @@ import ( "errors" "io" - dbm "github.com/cosmos/cosmos-db" "github.com/spf13/cobra" "github.com/spf13/viper" "cosmossdk.io/client/v2/offchain" + corestore "cosmossdk.io/core/store" "cosmossdk.io/log" "cosmossdk.io/simapp" confixcmd "cosmossdk.io/tools/confix/cmd" - authcmd "cosmossdk.io/x/auth/client/cli" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/debug" @@ -24,6 +23,7 @@ import ( servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" "github.com/cosmos/cosmos-sdk/x/genutil" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" @@ -116,7 +116,7 @@ func txCommand() *cobra.Command { // newApp creates the application func newApp( logger log.Logger, - db dbm.DB, + db corestore.KVStoreWithBatch, traceStore io.Writer, appOpts servertypes.AppOptions, ) servertypes.Application { @@ -131,7 +131,7 @@ func newApp( // appExport creates a new simapp (optionally at a given height) and exports state. func appExport( logger log.Logger, - db dbm.DB, + db corestore.KVStoreWithBatch, traceStore io.Writer, height int64, forZeroHeight bool, @@ -146,17 +146,16 @@ func appExport( // overwrite the FlagInvCheckPeriod viperAppOpts.Set(server.FlagInvCheckPeriod, 1) - appOpts = viperAppOpts var simApp *simapp.SimApp if height != -1 { - simApp = simapp.NewSimApp(logger, db, traceStore, false, appOpts) + simApp = simapp.NewSimApp(logger, db, traceStore, false, viperAppOpts) if err := simApp.LoadHeight(height); err != nil { return servertypes.ExportedApp{}, err } } else { - simApp = simapp.NewSimApp(logger, db, traceStore, true, appOpts) + simApp = simapp.NewSimApp(logger, db, traceStore, true, viperAppOpts) } return simApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) diff --git a/simapp/simd/cmd/config.go b/simapp/simd/cmd/config.go index ce6698e255b1..a87875836fd9 100644 --- a/simapp/simd/cmd/config.go +++ b/simapp/simd/cmd/config.go @@ -15,7 +15,7 @@ import ( func initCometBFTConfig() *cmtcfg.Config { cfg := cmtcfg.DefaultConfig() - // only display only error logs by default except for p2p and state + // display only error logs by default except for p2p and state cfg.LogLevel = "*:error,p2p:info,state:info" // these values put a higher strain on node memory @@ -103,7 +103,6 @@ func initAppConfig() (string, interface{}) { // // In simapp, we set the min gas prices to 0. srvCfg.MinGasPrices = "0stake" - // srvCfg.BaseConfig.IAVLDisableFastNode = true // disable fastnode by default // Now we set the custom config default values. customAppConfig := CustomAppConfig{ diff --git a/simapp/simd/cmd/root.go b/simapp/simd/cmd/root.go index 5734452f0bd0..2f2e8000e139 100644 --- a/simapp/simd/cmd/root.go +++ b/simapp/simd/cmd/root.go @@ -11,18 +11,19 @@ import ( "cosmossdk.io/log" "cosmossdk.io/simapp" "cosmossdk.io/simapp/params" - "cosmossdk.io/x/auth/tx" - authtxconfig "cosmossdk.io/x/auth/tx/config" - "cosmossdk.io/x/auth/types" txsigning "cosmossdk.io/x/tx/signing" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" + nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" addresscodec "github.com/cosmos/cosmos-sdk/codec/address" "github.com/cosmos/cosmos-sdk/server" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/tx" + authtxconfig "github.com/cosmos/cosmos-sdk/x/auth/tx/config" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) // NewRootCmd creates a new root command for simd. It is called once in the @@ -122,6 +123,9 @@ func NewRootCmd() *cobra.Command { autoCliOpts := tempApp.AutoCliOpts() autoCliOpts.ClientCtx = initClientCtx + nodeCmds := nodeservice.NewNodeCommands() + autoCliOpts.ModuleOptions[nodeCmds.Name()] = nodeCmds.AutoCLIOptions() + if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil { panic(err) } diff --git a/simapp/simd/cmd/root_di.go b/simapp/simd/cmd/root_di.go index 08fc997af43d..24373b0c9595 100644 --- a/simapp/simd/cmd/root_di.go +++ b/simapp/simd/cmd/root_di.go @@ -8,6 +8,7 @@ import ( "github.com/spf13/cobra" authv1 "cosmossdk.io/api/cosmos/auth/module/v1" + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" stakingv1 "cosmossdk.io/api/cosmos/staking/module/v1" "cosmossdk.io/client/v2/autocli" "cosmossdk.io/core/address" @@ -15,16 +16,17 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/log" "cosmossdk.io/simapp" - "cosmossdk.io/x/auth/tx" - authtxconfig "cosmossdk.io/x/auth/tx/config" - "cosmossdk.io/x/auth/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" + nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/x/auth/tx" + authtxconfig "github.com/cosmos/cosmos-sdk/x/auth/tx/config" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) // NewRootCmd creates a new root command for simd. It is called once in the main function. @@ -83,6 +85,10 @@ func NewRootCmd() *cobra.Command { initRootCmd(rootCmd, moduleManager) + nodeCmds := nodeservice.NewNodeCommands() + autoCliOpts.ModuleOptions = make(map[string]*autocliv1.ModuleOptions) + autoCliOpts.ModuleOptions[nodeCmds.Name()] = nodeCmds.AutoCLIOptions() + if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil { panic(err) } diff --git a/simapp/simd/cmd/testnet.go b/simapp/simd/cmd/testnet.go index 822fc5fe453e..116307f63bf2 100644 --- a/simapp/simd/cmd/testnet.go +++ b/simapp/simd/cmd/testnet.go @@ -17,7 +17,6 @@ import ( "cosmossdk.io/math" "cosmossdk.io/math/unsafe" "cosmossdk.io/simapp" - authtypes "cosmossdk.io/x/auth/types" banktypes "cosmossdk.io/x/bank/types" stakingtypes "cosmossdk.io/x/staking/types" @@ -34,6 +33,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/version" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" ) @@ -336,7 +336,12 @@ func initTestnetFiles( sdk.NewCoin(args.bondTokenDenom, accStakingTokens), } - genBalances = append(genBalances, banktypes.Balance{Address: addr.String(), Coins: coins.Sort()}) + addrStr, err := clientCtx.AddressCodec.BytesToString(addr) + if err != nil { + return err + } + + genBalances = append(genBalances, banktypes.Balance{Address: addrStr, Coins: coins.Sort()}) genAccounts = append(genAccounts, authtypes.NewBaseAccount(addr, nil, 0, 0)) valStr, err := clientCtx.ValidatorAddressCodec.BytesToString(addr) @@ -370,7 +375,7 @@ func initTestnetFiles( WithKeybase(kb). WithTxConfig(clientCtx.TxConfig) - if err := tx.Sign(cmd.Context(), txFactory, nodeDirName, txBuilder, true); err != nil { + if err := tx.Sign(clientCtx, txFactory, nodeDirName, txBuilder, true); err != nil { return err } @@ -544,11 +549,7 @@ func writeFile(name, dir string, contents []byte) error { return fmt.Errorf("could not create directory %q: %w", dir, err) } - if err := os.WriteFile(file, contents, 0o600); err != nil { - return err - } - - return nil + return os.WriteFile(file, contents, 0o600) } // startTestnet starts an in-process testnet diff --git a/simapp/simd/cmd/testnet_test.go b/simapp/simd/cmd/testnet_test.go index e15a0b5db2b7..2e2653c20e4b 100644 --- a/simapp/simd/cmd/testnet_test.go +++ b/simapp/simd/cmd/testnet_test.go @@ -11,7 +11,6 @@ import ( corectx "cosmossdk.io/core/context" "cosmossdk.io/depinject" "cosmossdk.io/log" - "cosmossdk.io/x/auth" banktypes "cosmossdk.io/x/bank/types" "cosmossdk.io/x/staking" @@ -21,6 +20,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/configurator" "github.com/cosmos/cosmos-sdk/types/module" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/auth" genutiltest "github.com/cosmos/cosmos-sdk/x/genutil/client/testutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" ) @@ -45,7 +45,7 @@ func Test_TestnetCmd(t *testing.T) { ) require.NoError(t, err) require.NotNil(t, moduleManager) - require.Len(t, moduleManager.Modules, 8) + require.Len(t, moduleManager.Modules, 9) // the registered above + runtime home := t.TempDir() cdcOpts := codectestutil.CodecOptions{} diff --git a/simapp/test_helpers.go b/simapp/test_helpers.go index dc74a4e47e16..8835e185e8b7 100644 --- a/simapp/test_helpers.go +++ b/simapp/test_helpers.go @@ -15,7 +15,6 @@ import ( "cosmossdk.io/log" sdkmath "cosmossdk.io/math" pruningtypes "cosmossdk.io/store/pruning/types" - authtypes "cosmossdk.io/x/auth/types" banktypes "cosmossdk.io/x/bank/types" minttypes "cosmossdk.io/x/mint/types" @@ -30,6 +29,7 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) // SetupOptions defines arguments that are passed into `Simapp` constructor. @@ -64,15 +64,19 @@ func NewSimappWithCustomOptions(t *testing.T, isCheckTx bool, options SetupOptio validator := cmttypes.NewValidator(pubKey, 1) valSet := cmttypes.NewValidatorSet([]*cmttypes.Validator{validator}) + app := NewSimApp(options.Logger, options.DB, nil, true, options.AppOpts) + // generate genesis account senderPrivKey := secp256k1.GenPrivKey() acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0) + accAddr, err := app.InterfaceRegistry().SigningContext().AddressCodec().BytesToString(acc.GetAddress()) + require.NoError(t, err) + balance := banktypes.Balance{ - Address: acc.GetAddress().String(), + Address: accAddr, Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100000000000000))), } - app := NewSimApp(options.Logger, options.DB, nil, true, options.AppOpts) genesisState := app.DefaultGenesis() genesisState, err = simtestutil.GenesisStateWithValSet(app.AppCodec(), genesisState, valSet, []authtypes.GenesisAccount{acc}, balance) require.NoError(t, err) @@ -106,11 +110,14 @@ func Setup(t *testing.T, isCheckTx bool) *SimApp { validator := cmttypes.NewValidator(pubKey, 1) valSet := cmttypes.NewValidatorSet([]*cmttypes.Validator{validator}) + sApp, _ := setup(true, 0) // generate genesis account senderPrivKey := secp256k1.GenPrivKey() acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0) + accAddr, err := sApp.interfaceRegistry.SigningContext().AddressCodec().BytesToString(acc.GetAddress()) + require.NoError(t, err) balance := banktypes.Balance{ - Address: acc.GetAddress().String(), + Address: accAddr, Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100000000000000))), } @@ -169,9 +176,11 @@ func GenesisStateWithSingleValidator(t *testing.T, app *SimApp) GenesisState { // generate genesis account senderPrivKey := secp256k1.GenPrivKey() acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0) + accAddr, err := app.interfaceRegistry.SigningContext().AddressCodec().BytesToString(acc.GetAddress()) + require.NoError(t, err) balances := []banktypes.Balance{ { - Address: acc.GetAddress().String(), + Address: accAddr, Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100000000000000))), }, } diff --git a/simapp/upgrades.go b/simapp/upgrades.go index 6262ee35ee37..36079956cc64 100644 --- a/simapp/upgrades.go +++ b/simapp/upgrades.go @@ -6,12 +6,12 @@ import ( "cosmossdk.io/core/appmodule" corestore "cosmossdk.io/core/store" "cosmossdk.io/x/accounts" - authkeeper "cosmossdk.io/x/auth/keeper" epochstypes "cosmossdk.io/x/epochs/types" protocolpooltypes "cosmossdk.io/x/protocolpool/types" upgradetypes "cosmossdk.io/x/upgrade/types" countertypes "github.com/cosmos/cosmos-sdk/testutil/x/counter/types" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" ) // UpgradeName defines the on-chain upgrade name for the sample SimApp upgrade diff --git a/simapp/upgrades_test.go b/simapp/upgrades_test.go index b70ee15c7863..4ea93b6430cb 100644 --- a/simapp/upgrades_test.go +++ b/simapp/upgrades_test.go @@ -7,8 +7,9 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/collections" - authkeeper "cosmossdk.io/x/auth/keeper" - authtypes "cosmossdk.io/x/auth/types" + + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) // TestSyncAccountNumber tests if accounts module account number is set correctly with the value get from auth. diff --git a/simapp/v2/app_config.go b/simapp/v2/app_config.go index ab54100a3f09..0cd6cac6b879 100644 --- a/simapp/v2/app_config.go +++ b/simapp/v2/app_config.go @@ -1,4 +1,4 @@ -//nolint:unused,nolintlint // ignore unused code linting and directive `//nolint:unused // ignore unused code linting` is unused for linter "unused" +//nolint:unused,nolintlint // ignore unused code linting package simapp import ( @@ -15,6 +15,7 @@ import ( circuitmodulev1 "cosmossdk.io/api/cosmos/circuit/module/v1" consensusmodulev1 "cosmossdk.io/api/cosmos/consensus/module/v1" distrmodulev1 "cosmossdk.io/api/cosmos/distribution/module/v1" + epochsmodulev1 "cosmossdk.io/api/cosmos/epochs/module/v1" evidencemodulev1 "cosmossdk.io/api/cosmos/evidence/module/v1" feegrantmodulev1 "cosmossdk.io/api/cosmos/feegrant/module/v1" genutilmodulev1 "cosmossdk.io/api/cosmos/genutil/module/v1" @@ -30,11 +31,6 @@ import ( vestingmodulev1 "cosmossdk.io/api/cosmos/vesting/module/v1" "cosmossdk.io/depinject/appconfig" "cosmossdk.io/x/accounts" - _ "cosmossdk.io/x/auth" // import for side-effects - _ "cosmossdk.io/x/auth/tx/config" // import for side-effects - authtypes "cosmossdk.io/x/auth/types" - _ "cosmossdk.io/x/auth/vesting" // import for side-effects - vestingtypes "cosmossdk.io/x/auth/vesting/types" "cosmossdk.io/x/authz" _ "cosmossdk.io/x/authz/module" // import for side-effects _ "cosmossdk.io/x/bank" // import for side-effects @@ -45,6 +41,8 @@ import ( consensustypes "cosmossdk.io/x/consensus/types" _ "cosmossdk.io/x/distribution" // import for side-effects distrtypes "cosmossdk.io/x/distribution/types" + _ "cosmossdk.io/x/epochs" // import for side-effects + epochstypes "cosmossdk.io/x/epochs/types" _ "cosmossdk.io/x/evidence" // import for side-effects evidencetypes "cosmossdk.io/x/evidence/types" "cosmossdk.io/x/feegrant" @@ -67,6 +65,11 @@ import ( upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/runtime" + _ "github.com/cosmos/cosmos-sdk/x/auth" // import for side-effects + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import for side-effects + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + _ "github.com/cosmos/cosmos-sdk/x/auth/vesting" // import for side-effects + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" ) @@ -121,6 +124,7 @@ var ( evidencetypes.ModuleName, stakingtypes.ModuleName, authz.ModuleName, + epochstypes.ModuleName, }, EndBlockers: []string{ govtypes.ModuleName, @@ -158,6 +162,7 @@ var ( vestingtypes.ModuleName, circuittypes.ModuleName, pooltypes.ModuleName, + epochstypes.ModuleName, }, // When ExportGenesis is not specified, the export genesis module order // is equal to the init genesis order @@ -270,6 +275,10 @@ var ( Name: pooltypes.ModuleName, Config: appconfig.WrapAny(&poolmodulev1.Module{}), }, + { + Name: epochstypes.ModuleName, + Config: appconfig.WrapAny(&epochsmodulev1.Module{}), + }, }, }) ) diff --git a/simapp/v2/app_di.go b/simapp/v2/app_di.go index 7cde4042f3c8..116c96446700 100644 --- a/simapp/v2/app_di.go +++ b/simapp/v2/app_di.go @@ -6,20 +6,19 @@ import ( "github.com/spf13/viper" clienthelpers "cosmossdk.io/client/v2/helpers" - coreapp "cosmossdk.io/core/app" "cosmossdk.io/core/legacy" + "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/depinject" "cosmossdk.io/log" "cosmossdk.io/runtime/v2" - serverv2 "cosmossdk.io/server/v2" "cosmossdk.io/x/accounts" - authkeeper "cosmossdk.io/x/auth/keeper" authzkeeper "cosmossdk.io/x/authz/keeper" bankkeeper "cosmossdk.io/x/bank/keeper" circuitkeeper "cosmossdk.io/x/circuit/keeper" consensuskeeper "cosmossdk.io/x/consensus/keeper" distrkeeper "cosmossdk.io/x/distribution/keeper" + epochskeeper "cosmossdk.io/x/epochs/keeper" evidencekeeper "cosmossdk.io/x/evidence/keeper" feegrantkeeper "cosmossdk.io/x/feegrant/keeper" govkeeper "cosmossdk.io/x/gov/keeper" @@ -36,6 +35,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/std" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" _ "github.com/cosmos/cosmos-sdk/x/genutil" ) @@ -70,6 +70,7 @@ type SimApp[T transaction.Tx] struct { ConsensusParamsKeeper consensuskeeper.Keeper CircuitBreakerKeeper circuitkeeper.Keeper PoolKeeper poolkeeper.Keeper + EpochsKeeper *epochskeeper.Keeper } func init() { @@ -92,7 +93,6 @@ func NewSimApp[T transaction.Tx]( logger log.Logger, viper *viper.Viper, ) *SimApp[T] { - viper.Set(serverv2.FlagHome, DefaultNodeHome) // TODO possibly set earlier when viper is created var ( app = &SimApp[T]{} appBuilder *runtime.AppBuilder[T] @@ -179,6 +179,7 @@ func NewSimApp[T transaction.Tx]( &app.ConsensusParamsKeeper, &app.CircuitBreakerKeeper, &app.PoolKeeper, + &app.EpochsKeeper, ); err != nil { panic(err) } @@ -196,7 +197,6 @@ func NewSimApp[T transaction.Tx]( // TODO (here or in runtime/v2) // wire simulation manager - // wire snapshot manager // wire unordered tx manager if err := app.LoadLatest(); err != nil { @@ -214,7 +214,7 @@ func (app *SimApp[T]) AppCodec() codec.Codec { } // InterfaceRegistry returns SimApp's InterfaceRegistry. -func (app *SimApp[T]) InterfaceRegistry() coreapp.InterfaceRegistry { +func (app *SimApp[T]) InterfaceRegistry() server.InterfaceRegistry { return app.interfaceRegistry } diff --git a/simapp/v2/app_test.go b/simapp/v2/app_test.go new file mode 100644 index 000000000000..a51354e4b3b6 --- /dev/null +++ b/simapp/v2/app_test.go @@ -0,0 +1,157 @@ +package simapp + +import ( + "context" + "crypto/sha256" + "encoding/json" + "testing" + "time" + + "github.com/cometbft/cometbft/types" + "github.com/spf13/viper" + "github.com/stretchr/testify/require" + + "cosmossdk.io/core/comet" + context2 "cosmossdk.io/core/context" + "cosmossdk.io/core/server" + "cosmossdk.io/core/store" + "cosmossdk.io/core/transaction" + "cosmossdk.io/log" + sdkmath "cosmossdk.io/math" + serverv2 "cosmossdk.io/server/v2" + comettypes "cosmossdk.io/server/v2/cometbft/types" + "cosmossdk.io/store/v2/db" + banktypes "cosmossdk.io/x/bank/types" + + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + "github.com/cosmos/cosmos-sdk/testutil/mock" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" +) + +func NewTestApp(t *testing.T) (*SimApp[transaction.Tx], context.Context) { + t.Helper() + + logger := log.NewTestLogger(t) + + vp := viper.New() + vp.Set("store.app-db-backend", string(db.DBTypeGoLevelDB)) + vp.Set(serverv2.FlagHome, t.TempDir()) + + app := NewSimApp[transaction.Tx](logger, vp) + genesis := app.ModuleManager().DefaultGenesis() + + privVal := mock.NewPV() + pubKey, err := privVal.GetPubKey() + require.NoError(t, err) + + // create validator set with single validator + validator := types.NewValidator(pubKey, 1) + valSet := types.NewValidatorSet([]*types.Validator{validator}) + + // generate genesis account + senderPrivKey := secp256k1.GenPrivKey() + acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0) + accAddr, err := app.txConfig.SigningContext().AddressCodec().BytesToString(acc.GetAddress()) + require.NoError(t, err) + balance := banktypes.Balance{ + Address: accAddr, + Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100000000000000))), + } + + genesis, err = simtestutil.GenesisStateWithValSet( + app.AppCodec(), + genesis, + valSet, + []authtypes.GenesisAccount{acc}, + balance, + ) + require.NoError(t, err) + + genesisBytes, err := json.Marshal(genesis) + require.NoError(t, err) + + st := app.GetStore().(comettypes.Store) + ci, err := st.LastCommitID() + require.NoError(t, err) + + bz := sha256.Sum256([]byte{}) + + ctx := context.Background() + + _, newState, err := app.InitGenesis( + ctx, + &server.BlockRequest[transaction.Tx]{ + Time: time.Now(), + Hash: bz[:], + ChainId: "theChain", + AppHash: ci.Hash, + IsGenesis: true, + }, + genesisBytes, + nil, + ) + require.NoError(t, err) + + changes, err := newState.GetStateChanges() + require.NoError(t, err) + + _, err = st.Commit(&store.Changeset{Changes: changes}) + require.NoError(t, err) + + return app, ctx +} + +func MoveNextBlock(t *testing.T, app *SimApp[transaction.Tx], ctx context.Context) { + t.Helper() + + bz := sha256.Sum256([]byte{}) + + st := app.GetStore().(comettypes.Store) + ci, err := st.LastCommitID() + require.NoError(t, err) + + height, err := app.LoadLatestHeight() + require.NoError(t, err) + + // TODO: this is a hack to set the comet info in the context for distribution module dependency. + ctx = context.WithValue(ctx, context2.CometInfoKey, comet.Info{ + Evidence: nil, + ValidatorsHash: nil, + ProposerAddress: nil, + LastCommit: comet.CommitInfo{}, + }) + + _, newState, err := app.DeliverBlock( + ctx, + &server.BlockRequest[transaction.Tx]{ + Height: height + 1, + Time: time.Now(), + Hash: bz[:], + AppHash: ci.Hash, + }) + require.NoError(t, err) + + changes, err := newState.GetStateChanges() + require.NoError(t, err) + + _, err = st.Commit(&store.Changeset{Changes: changes}) + require.NoError(t, err) +} + +func TestSimAppExportAndBlockedAddrs_WithOneBlockProduced(t *testing.T) { + app, ctx := NewTestApp(t) + + MoveNextBlock(t, app, ctx) + + _, err := app.ExportAppStateAndValidators(nil) + require.NoError(t, err) +} + +func TestSimAppExportAndBlockedAddrs_NoBlocksProduced(t *testing.T) { + app, _ := NewTestApp(t) + + _, err := app.ExportAppStateAndValidators(nil) + require.NoError(t, err) +} diff --git a/simapp/v2/export.go b/simapp/v2/export.go index 41b8d94e9e7a..5a1757b16535 100644 --- a/simapp/v2/export.go +++ b/simapp/v2/export.go @@ -1,10 +1,29 @@ package simapp import ( - servertypes "github.com/cosmos/cosmos-sdk/server/types" + "context" + + v2 "github.com/cosmos/cosmos-sdk/x/genutil/v2" ) -// ExportAppStateAndValidators exports the state of the application for a genesis file. -func (app *SimApp[T]) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs, modulesToExport []string) (servertypes.ExportedApp, error) { - panic("not implemented") +// ExportAppStateAndValidators exports the state of the application for a genesis +// file. +func (app *SimApp[T]) ExportAppStateAndValidators(jailAllowedAddrs []string) (v2.ExportedApp, error) { + // as if they could withdraw from the start of the next block + ctx := context.Background() + + latestHeight, err := app.LoadLatestHeight() + if err != nil { + return v2.ExportedApp{}, err + } + + genesis, err := app.ExportGenesis(ctx, latestHeight) + if err != nil { + return v2.ExportedApp{}, err + } + + return v2.ExportedApp{ + AppState: genesis, + Height: int64(latestHeight), + }, nil } diff --git a/simapp/v2/genesis_account.go b/simapp/v2/genesis_account.go index d242ba57060c..0ebb67d0393a 100644 --- a/simapp/v2/genesis_account.go +++ b/simapp/v2/genesis_account.go @@ -3,9 +3,8 @@ package simapp import ( "errors" - authtypes "cosmossdk.io/x/auth/types" - sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var _ authtypes.GenesisAccount = (*SimGenesisAccount)(nil) @@ -31,7 +30,7 @@ type SimGenesisAccount struct { func (sga SimGenesisAccount) Validate() error { if !sga.OriginalVesting.IsZero() { if sga.StartTime >= sga.EndTime { - return errors.New("vesting start-time cannot be before end-time") + return errors.New("vesting start-time cannot be after end-time") } } diff --git a/simapp/v2/genesis_account_test.go b/simapp/v2/genesis_account_test.go new file mode 100644 index 000000000000..5b8339b29c0b --- /dev/null +++ b/simapp/v2/genesis_account_test.go @@ -0,0 +1,89 @@ +package simapp_test + +import ( + "testing" + "time" + + "github.com/cometbft/cometbft/crypto" + "github.com/stretchr/testify/require" + + "cosmossdk.io/simapp/v2" + + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" +) + +func TestSimGenesisAccountValidate(t *testing.T) { + pubkey := secp256k1.GenPrivKey().PubKey() + addr := sdk.AccAddress(pubkey.Address()) + + vestingStart := time.Now().UTC() + + coins := sdk.NewCoins(sdk.NewInt64Coin("test", 1000)) + baseAcc := authtypes.NewBaseAccount(addr, pubkey, 0, 0) + + testCases := []struct { + name string + sga simapp.SimGenesisAccount + wantErr bool + }{ + { + "valid basic account", + simapp.SimGenesisAccount{ + BaseAccount: baseAcc, + }, + false, + }, + { + "invalid basic account with mismatching address/pubkey", + simapp.SimGenesisAccount{ + BaseAccount: authtypes.NewBaseAccount(addr, secp256k1.GenPrivKey().PubKey(), 0, 0), + }, + true, + }, + { + "valid basic account with module name", + simapp.SimGenesisAccount{ + BaseAccount: authtypes.NewBaseAccount(sdk.AccAddress(crypto.AddressHash([]byte("testmod"))), nil, 0, 0), + ModuleName: "testmod", + }, + false, + }, + { + "valid basic account with invalid module name/pubkey pair", + simapp.SimGenesisAccount{ + BaseAccount: baseAcc, + ModuleName: "testmod", + }, + true, + }, + { + "valid basic account with valid vesting attributes", + simapp.SimGenesisAccount{ + BaseAccount: baseAcc, + OriginalVesting: coins, + StartTime: vestingStart.Unix(), + EndTime: vestingStart.Add(1 * time.Hour).Unix(), + }, + false, + }, + { + "valid basic account with invalid vesting end time", + simapp.SimGenesisAccount{ + BaseAccount: baseAcc, + OriginalVesting: coins, + StartTime: vestingStart.Add(2 * time.Hour).Unix(), + EndTime: vestingStart.Add(1 * time.Hour).Unix(), + }, + true, + }, + } + + for _, tc := range testCases { + tc := tc + t.Run(tc.name, func(t *testing.T) { + require.Equal(t, tc.wantErr, tc.sga.Validate() != nil) + }) + } +} diff --git a/simapp/v2/go.mod b/simapp/v2/go.mod index a04d0705c076..2a104a56139f 100644 --- a/simapp/v2/go.mod +++ b/simapp/v2/go.mod @@ -1,26 +1,26 @@ module cosmossdk.io/simapp/v2 -go 1.22.2 +go 1.23 require ( cosmossdk.io/api v0.7.5 cosmossdk.io/client/v2 v2.0.0-00010101000000-000000000000 - cosmossdk.io/core v0.12.1-0.20240725072823-6a2d039e1212 + cosmossdk.io/core v1.0.0 cosmossdk.io/depinject v1.0.0 - cosmossdk.io/log v1.4.0 + cosmossdk.io/log v1.4.1 cosmossdk.io/math v1.3.0 cosmossdk.io/runtime/v2 v2.0.0-00010101000000-000000000000 cosmossdk.io/server/v2 v2.0.0-20240718121635-a877e3e8048a cosmossdk.io/server/v2/cometbft v0.0.0-00010101000000-000000000000 - cosmossdk.io/store/v2 v2.0.0 // indirect + cosmossdk.io/store/v2 v2.0.0 cosmossdk.io/tools/confix v0.0.0-00010101000000-000000000000 cosmossdk.io/x/accounts v0.0.0-20240226161501-23359a0b6d91 - cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 cosmossdk.io/x/authz v0.0.0-00010101000000-000000000000 cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 cosmossdk.io/x/circuit v0.0.0-20230613133644-0a778132a60f cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 cosmossdk.io/x/distribution v0.0.0-20230925135524-a1bc045b3190 + cosmossdk.io/x/epochs v0.0.0-20240522060652-a1ae4c3e0337 cosmossdk.io/x/evidence v0.0.0-20230613133644-0a778132a60f cosmossdk.io/x/feegrant v0.0.0-20230613133644-0a778132a60f cosmossdk.io/x/gov v0.0.0-20231113122742-912390d5fc4a @@ -32,7 +32,7 @@ require ( cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 cosmossdk.io/x/upgrade v0.0.0-20230613133644-0a778132a60f github.com/cometbft/cometbft v1.0.0-rc1 - github.com/cosmos/cosmos-db v1.0.2 + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 // indirect // this version is not used as it is always replaced by the latest Cosmos SDK version github.com/cosmos/cosmos-sdk v0.53.0 github.com/spf13/cobra v1.8.1 @@ -42,27 +42,25 @@ require ( google.golang.org/protobuf v1.34.2 ) -require cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 // indirect - require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect - cloud.google.com/go v0.115.0 // indirect - cloud.google.com/go/auth v0.5.1 // indirect - cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect - cloud.google.com/go/compute/metadata v0.3.0 // indirect - cloud.google.com/go/iam v1.1.8 // indirect - cloud.google.com/go/storage v1.42.0 // indirect + cloud.google.com/go v0.115.1 // indirect + cloud.google.com/go/auth v0.8.1 // indirect + cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect + cloud.google.com/go/compute/metadata v0.5.0 // indirect + cloud.google.com/go/iam v1.1.13 // indirect + cloud.google.com/go/storage v1.43.0 // indirect cosmossdk.io/collections v0.4.0 // indirect + cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/errors v1.0.1 // indirect cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 // indirect - cosmossdk.io/schema v0.1.1 // indirect - cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000 // indirect + cosmossdk.io/schema v0.2.0 // indirect + cosmossdk.io/server/v2/appmanager v0.0.0-20240802110823-cffeedff643d // indirect cosmossdk.io/server/v2/stf v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc // indirect cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5 // indirect cosmossdk.io/x/accounts/defaults/multisig v0.0.0-00010101000000-000000000000 // indirect - cosmossdk.io/x/epochs v0.0.0-20240522060652-a1ae4c3e0337 // indirect cosmossdk.io/x/tx v0.13.4 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect @@ -70,7 +68,7 @@ require ( github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/aws/aws-sdk-go v1.54.6 // indirect + github.com/aws/aws-sdk-go v1.55.5 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect @@ -94,9 +92,9 @@ require ( github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/gogoproto v1.7.0 // indirect github.com/cosmos/iavl v1.2.1-0.20240731145221-594b181f427e // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect - github.com/creachadair/atomicfile v0.3.4 // indirect + github.com/creachadair/atomicfile v0.3.5 // indirect github.com/creachadair/tomledit v0.0.26 // indirect github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -128,10 +126,10 @@ require ( github.com/google/flatbuffers v2.0.8+incompatible // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/orderedcode v0.0.1 // indirect - github.com/google/s2a-go v0.1.7 // indirect + github.com/google/s2a-go v0.1.8 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect - github.com/googleapis/gax-go/v2 v2.12.5 // indirect + github.com/googleapis/gax-go/v2 v2.13.0 // indirect github.com/gorilla/handlers v1.5.2 // indirect github.com/gorilla/mux v1.8.1 // indirect github.com/gorilla/websocket v1.5.3 // indirect @@ -139,7 +137,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-getter v1.7.5 // indirect + github.com/hashicorp/go-getter v1.7.6 // indirect github.com/hashicorp/go-hclog v1.6.3 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-metrics v0.5.3 // indirect @@ -179,13 +177,13 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rivo/uniseg v0.2.0 // indirect @@ -210,28 +208,28 @@ require ( gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 // indirect - go.opentelemetry.io/otel v1.27.0 // indirect - go.opentelemetry.io/otel/metric v1.27.0 // indirect - go.opentelemetry.io/otel/trace v1.27.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect + go.opentelemetry.io/otel v1.28.0 // indirect + go.opentelemetry.io/otel/metric v1.28.0 // indirect + go.opentelemetry.io/otel/trace v1.28.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.26.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/oauth2 v0.21.0 // indirect + golang.org/x/oauth2 v0.22.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.24.0 // indirect golang.org/x/term v0.23.0 // indirect golang.org/x/text v0.17.0 // indirect - golang.org/x/time v0.5.0 // indirect + golang.org/x/time v0.6.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect - google.golang.org/api v0.185.0 // indirect - google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect - google.golang.org/grpc v1.65.0 // indirect + google.golang.org/api v0.192.0 // indirect + google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect + google.golang.org/grpc v1.66.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect @@ -255,12 +253,12 @@ replace ( cosmossdk.io/x/accounts => ../../x/accounts cosmossdk.io/x/accounts/defaults/lockup => ../../x/accounts/defaults/lockup cosmossdk.io/x/accounts/defaults/multisig => ../../x/accounts/defaults/multisig - cosmossdk.io/x/auth => ../../x/auth cosmossdk.io/x/authz => ../../x/authz cosmossdk.io/x/bank => ../../x/bank cosmossdk.io/x/circuit => ../../x/circuit cosmossdk.io/x/consensus => ../../x/consensus cosmossdk.io/x/distribution => ../../x/distribution + cosmossdk.io/x/epochs => ../../x/epochs cosmossdk.io/x/evidence => ../../x/evidence cosmossdk.io/x/feegrant => ../../x/feegrant cosmossdk.io/x/gov => ../../x/gov @@ -281,6 +279,7 @@ replace ( github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 // Simapp always use the latest version of the cosmos-sdk github.com/cosmos/cosmos-sdk => ../../. + github.com/cosmos/iavl => github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e // Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities. // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1 diff --git a/simapp/v2/go.sum b/simapp/v2/go.sum index 62bba6528fd7..10ea94d79b45 100644 --- a/simapp/v2/go.sum +++ b/simapp/v2/go.sum @@ -34,8 +34,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.115.0 h1:CnFSK6Xo3lDYRoBKEcAtia6VSC837/ZkJuRduSFnr14= -cloud.google.com/go v0.115.0/go.mod h1:8jIM5vVgoAEoiVxQ/O4BFTfHqulPZgs/ufEzMcFMdWU= +cloud.google.com/go v0.115.1 h1:Jo0SM9cQnSkYfp44+v+NQXHpcHqlnRJk2qxh6yvxxxQ= +cloud.google.com/go v0.115.1/go.mod h1:DuujITeaufu3gL68/lOFIirVNJwQeyf5UXyi+Wbgknc= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= @@ -50,10 +50,10 @@ cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjby cloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY= cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw= cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI= -cloud.google.com/go/auth v0.5.1 h1:0QNO7VThG54LUzKiQxv8C6x1YX7lUrzlAa1nVLF8CIw= -cloud.google.com/go/auth v0.5.1/go.mod h1:vbZT8GjzDf3AVqCcQmqeeM32U9HBFc32vVVAbwDsa6s= -cloud.google.com/go/auth/oauth2adapt v0.2.2 h1:+TTV8aXpjeChS9M+aTtN/TjdQnzJvmzKFt//oWu7HX4= -cloud.google.com/go/auth/oauth2adapt v0.2.2/go.mod h1:wcYjgpZI9+Yu7LyYBg4pqSiaRkfEK3GQcpb7C/uyF1Q= +cloud.google.com/go/auth v0.8.1 h1:QZW9FjC5lZzN864p13YxvAtGUlQ+KgRL+8Sg45Z6vxo= +cloud.google.com/go/auth v0.8.1/go.mod h1:qGVp/Y3kDRSDZ5gFD/XPUfYQ9xW1iI7q8RIRoCyBbJc= +cloud.google.com/go/auth/oauth2adapt v0.2.4 h1:0GWE/FUsXhf6C+jAkWgYm7X9tK8cuEIfy19DBn6B6bY= +cloud.google.com/go/auth/oauth2adapt v0.2.4/go.mod h1:jC/jOpwFP6JBxhB3P5Rr0a9HLMC/Pe3eaL4NmdvqPtc= cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0= cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= @@ -76,8 +76,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc= -cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= +cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY= +cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= @@ -115,14 +115,14 @@ cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y97 cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= -cloud.google.com/go/iam v1.1.8 h1:r7umDwhj+BQyz0ScZMp4QrGXjSTI3ZINnpgU2nlB/K0= -cloud.google.com/go/iam v1.1.8/go.mod h1:GvE6lyMmfxXauzNq8NbgJbeVQNspG+tcdL/W8QO1+zE= +cloud.google.com/go/iam v1.1.13 h1:7zWBXG9ERbMLrzQBRhFliAV+kjcRToDTgQT3CTwYyv4= +cloud.google.com/go/iam v1.1.13/go.mod h1:K8mY0uSXwEXS30KrnVb+j54LB/ntfZu1dr+4zFMNbus= cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= cloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08= -cloud.google.com/go/longrunning v0.5.7 h1:WLbHekDbjK1fVFD3ibpFFVoyizlLRl73I7YKuAKilhU= -cloud.google.com/go/longrunning v0.5.7/go.mod h1:8GClkudohy1Fxm3owmBGid8W0pSgodEMwEAztp38Xng= +cloud.google.com/go/longrunning v0.5.11 h1:Havn1kGjz3whCfoD8dxMLP73Ph5w+ODyZB9RUsDxtGk= +cloud.google.com/go/longrunning v0.5.11/go.mod h1:rDn7//lmlfWV1Dx6IB4RatCPenTwwmqXuiP0/RgoEO4= cloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4= cloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w= cloud.google.com/go/memcache v1.4.0/go.mod h1:rTOfiGZtJX1AaFUrOgsMHX5kAzaTQ8azHiuDoTPzNsE= @@ -179,8 +179,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= -cloud.google.com/go/storage v1.42.0 h1:4QtGpplCVt1wz6g5o1ifXd656P5z+yNgzdw1tVfp0cU= -cloud.google.com/go/storage v1.42.0/go.mod h1:HjMXRFq65pGKFn6hxj6x3HCyR41uSB72Z0SO/Vn6JFQ= +cloud.google.com/go/storage v1.43.0 h1:CcxnSohZwizt4LCzQHWvBf1/kvtHUn7gk9QERXPyXFs= +cloud.google.com/go/storage v1.43.0/go.mod h1:ajvxEa7WmZS1PxvKRq4bq0tFT3vMd502JwstCcYv0Q0= cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= @@ -198,14 +198,12 @@ cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 h1:IQNdY2kB+k+1OM2DvqFG1+UgeU1JzZrWtwuWzI3ZfwA= cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5/go.mod h1:0CuYKkFHxc1vw2JC+t21THBCALJVROrWVR/3PQ1urpc= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= -cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= -cosmossdk.io/x/epochs v0.0.0-20240522060652-a1ae4c3e0337 h1:GuBrfHsK3RD5vlD4DuBz3DXslR6VlnzrYmHOC3L679Q= -cosmossdk.io/x/epochs v0.0.0-20240522060652-a1ae4c3e0337/go.mod h1:PhLn1pMBilyRC4GfRkoYhm+XVAYhF4adVrzut8AdpJI= +cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk= +cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -235,8 +233,8 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= -github.com/aws/aws-sdk-go v1.54.6 h1:HEYUib3yTt8E6vxjMWM3yAq5b+qjj/6aKA62mkgux9g= -github.com/aws/aws-sdk-go v1.54.6/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= +github.com/aws/aws-sdk-go v1.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU= +github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -312,8 +310,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/crypto v0.1.2 h1:Yn500sPY+9sKVdhiPUSDtt8JOpBGMB515dOmla4zfls= @@ -325,19 +323,19 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/cosmos/iavl v1.2.1-0.20240731145221-594b181f427e h1:5bxw1E0peLMrr8ZO9mYT0d9sxy0WgR1ZEWb92yjKnnk= -github.com/cosmos/iavl v1.2.1-0.20240731145221-594b181f427e/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e h1:LEii0v/FxtXa/F7mRn+tijZ0zaXBPn2ZkKwb6Qm4rqE= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e/go.mod h1:3ywr0wDnWeD7MUH6qu50wZ5bxuKH3LBrGG4/lZX8lVY= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creachadair/atomicfile v0.3.4 h1:AjNK7To+S1p+nk7uJXJMZFpcV9XHOyAaULyDeU6LEqM= -github.com/creachadair/atomicfile v0.3.4/go.mod h1:ByEUbfQyms+tRtE7Wk7WdS6PZeyMzfSFlNX1VoKEh6E= -github.com/creachadair/mds v0.13.3 h1:OqXNRorXKsuvfjor+0ixtrpA4IINApH8zgm23XLlngk= -github.com/creachadair/mds v0.13.3/go.mod h1:4vrFYUzTXMJpMBU+OA292I6IUxKWCCfZkgXg+/kBZMo= +github.com/creachadair/atomicfile v0.3.5 h1:i93bxeaH/rQR6XfJslola3XkOM1nEP3eIexuk9SWcSc= +github.com/creachadair/atomicfile v0.3.5/go.mod h1:m7kIY2OUMygtETnMYe141rubsG4b+EusFLinlxxdHYM= +github.com/creachadair/mds v0.16.0 h1:v6DlvKXClowXFg4hkjLCR1FEFiREMf0qgX+Lm5GsEKk= +github.com/creachadair/mds v0.16.0/go.mod h1:4vrFYUzTXMJpMBU+OA292I6IUxKWCCfZkgXg+/kBZMo= github.com/creachadair/tomledit v0.0.26 h1:MoDdgHIHZ5PctBVsAZDjxdxreWUEa9ObPKTRkk5PPwA= github.com/creachadair/tomledit v0.0.26/go.mod h1:SJi1OxKpMyR141tq1lzsbPtIg3j8TeVPM/ZftfieD7o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -523,8 +521,8 @@ github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= -github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= +github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM= +github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -543,8 +541,8 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99 github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= -github.com/googleapis/gax-go/v2 v2.12.5 h1:8gw9KZK8TiVKB6q3zHY3SBzLnrGp6HQjyfYBYGmXdxA= -github.com/googleapis/gax-go/v2 v2.12.5/go.mod h1:BUDKcWo+RaKq5SC9vVYL0wLADa3VcfswbOMMRmB9H3E= +github.com/googleapis/gax-go/v2 v2.13.0 h1:yitjD5f7jQHhyDsnhKEBU52NdvvdSeGzlAnDPT0hH1s= +github.com/googleapis/gax-go/v2 v2.13.0/go.mod h1:Z/fvTZXF8/uw7Xu5GuslPw+bplx6SS338j1Is2S+B7A= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= @@ -561,8 +559,8 @@ github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NM github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-getter v1.7.5 h1:dT58k9hQ/vbxNMwoI5+xFYAJuv6152UNvdHokfI5wE4= -github.com/hashicorp/go-getter v1.7.5/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-getter v1.7.6 h1:5jHuM+aH373XNtXl9TNTUH5Qd69Trve11tHIrB+6yj4= +github.com/hashicorp/go-getter v1.7.6/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= @@ -632,6 +630,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -710,8 +710,8 @@ github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4 github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba h1:3jPgmsFGBID1wFfU2AbYocNcN4wqU68UaHSdMjiw/7U= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= @@ -728,8 +728,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -738,8 +738,8 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -799,7 +799,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -841,18 +840,18 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0 h1:vS1Ao/R55RNV4O7TA2Qopok8yN+X0LIP6RVWLFkprck= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0/go.mod h1:BMsdeOxN04K0L5FNUBfjFdvwWGNe/rkmSwH4Aelu/X0= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 h1:9l89oX4ba9kHbBol3Xin3leYJ+252h0zszDtBwyKe2A= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0/go.mod h1:XLZfZboOJWHNKUv7eH0inh0E9VV6eWDFB/9yJyTLPp0= -go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= -go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= -go.opentelemetry.io/otel/metric v1.27.0 h1:hvj3vdEKyeCi4YaYfNjv2NUje8FqKqUY8IlF0FxV/ik= -go.opentelemetry.io/otel/metric v1.27.0/go.mod h1:mVFgmRlhljgBiuk/MP/oKylr4hs85GZAylncepAX/ak= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 h1:9G6E0TXzGFVfTnawRzrPl83iHOAV7L8NJiR8RSGYV1g= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0/go.mod h1:azvtTADFQJA8mX80jIH/akaE7h+dbm/sVuaHqN13w74= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= +go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= +go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= +go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= +go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= -go.opentelemetry.io/otel/trace v1.27.0 h1:IqYb813p7cmbHk0a5y6pD5JPakbVfftRXABGt5/Rscw= -go.opentelemetry.io/otel/trace v1.27.0/go.mod h1:6RiD1hkAprV4/q+yd2ln1HG9GoPx39SuvvstaLBl+l4= +go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= +go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= @@ -991,8 +990,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= -golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= +golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1114,8 +1113,8 @@ golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= +golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1182,8 +1181,6 @@ golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= -golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -1232,8 +1229,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.185.0 h1:ENEKk1k4jW8SmmaT6RE+ZasxmxezCrD5Vw4npvr+pAU= -google.golang.org/api v0.185.0/go.mod h1:HNfvIkJGlgrIlrbYkAm9W9IdkmKZjOTVh33YltygGbg= +google.golang.org/api v0.192.0 h1:PljqpNAfZaaSpS+TnANfnNAXKdzHM/B9bKhwRlo7JP0= +google.golang.org/api v0.192.0/go.mod h1:9VcphjvAxPKLmSxVSzPlSRXy/5ARMEw5bf58WoVXafQ= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1345,12 +1342,12 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4 h1:CUiCqkPw1nNrNQzCCG4WA65m0nAmQiwXHpub3dNyruU= -google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4/go.mod h1:EvuUDCulqGgV80RvP1BHuom+smhX4qtlhnNatHuroGQ= -google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 h1:MuYw1wJzT+ZkybKfaOXKp5hJiZDn2iHaXRw0mRYdHSc= -google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4/go.mod h1:px9SlOOZBg1wM1zdnr8jEL4CNGUBZ+ZKYtNPApNQc4c= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142 h1:oLiyxGgE+rt22duwci1+TG7bg2/L1LQsXwfjPlmuJA0= +google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142/go.mod h1:G11eXq53iI5Q+kyNOmCvnzBaxEA2Q/Ik5Tj7nqBE8j4= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -1386,8 +1383,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= diff --git a/simapp/v2/simdv2/cmd/commands.go b/simapp/v2/simdv2/cmd/commands.go index ec9998f5c8f2..eaa3483d4ea1 100644 --- a/simapp/v2/simdv2/cmd/commands.go +++ b/simapp/v2/simdv2/cmd/commands.go @@ -3,9 +3,7 @@ package cmd import ( "errors" "fmt" - "io" - dbm "github.com/cosmos/cosmos-db" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -19,24 +17,28 @@ import ( "cosmossdk.io/server/v2/store" "cosmossdk.io/simapp/v2" confixcmd "cosmossdk.io/tools/confix/cmd" - authcmd "cosmossdk.io/x/auth/client/cli" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/debug" "github.com/cosmos/cosmos-sdk/client/keys" "github.com/cosmos/cosmos-sdk/client/rpc" "github.com/cosmos/cosmos-sdk/server" - servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" + authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" "github.com/cosmos/cosmos-sdk/x/genutil" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + genutilv2 "github.com/cosmos/cosmos-sdk/x/genutil/v2" + v2 "github.com/cosmos/cosmos-sdk/x/genutil/v2/cli" ) func newApp[T transaction.Tx]( logger log.Logger, viper *viper.Viper, ) serverv2.AppI[T] { - return serverv2.AppI[T](simapp.NewSimApp[T](logger, viper)) + viper.Set(serverv2.FlagHome, simapp.DefaultNodeHome) + + return serverv2.AppI[T]( + simapp.NewSimApp[T](logger, viper)) } func initRootCmd[T transaction.Tx]( @@ -73,6 +75,7 @@ func initRootCmd[T transaction.Tx]( rootCmd, newApp, logger, + initServerConfig(), cometbft.New(&genericTxDecoder[T]{txConfig}, cometbft.DefaultServerOptions[T]()), grpc.New[T](), store.New[T](newApp), @@ -84,25 +87,11 @@ func initRootCmd[T transaction.Tx]( // genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter func genesisCommand[T transaction.Tx]( moduleManager *runtimev2.MM[T], - appExport func(logger log.Logger, - height int64, - forZeroHeight bool, - jailAllowedAddrs []string, - viper *viper.Viper, - modulesToExport []string, - ) (servertypes.ExportedApp, error), + appExport genutilv2.AppExporter, cmds ...*cobra.Command, ) *cobra.Command { - compatAppExporter := func(logger log.Logger, db dbm.DB, traceWriter io.Writer, height int64, forZeroHeight bool, jailAllowedAddrs []string, appOpts servertypes.AppOptions, modulesToExport []string) (servertypes.ExportedApp, error) { - viperAppOpts, ok := appOpts.(*viper.Viper) - if !ok { - return servertypes.ExportedApp{}, errors.New("appOpts is not viper.Viper") - } - - return appExport(logger, height, forZeroHeight, jailAllowedAddrs, viperAppOpts, modulesToExport) - } + cmd := v2.Commands(moduleManager.Modules()[genutiltypes.ModuleName].(genutil.AppModule), moduleManager, appExport) - cmd := genutilcli.Commands(moduleManager.Modules()[genutiltypes.ModuleName].(genutil.AppModule), moduleManager, compatAppExporter) for _, subCmd := range cmds { cmd.AddCommand(subCmd) } @@ -121,11 +110,8 @@ func queryCommand() *cobra.Command { cmd.AddCommand( rpc.QueryEventForTxCmd(), - server.QueryBlockCmd(), authcmd.QueryTxsByEventsCmd(), - server.QueryBlocksCmd(), authcmd.QueryTxCmd(), - server.QueryBlockResultsCmd(), ) return cmd @@ -159,26 +145,25 @@ func txCommand() *cobra.Command { func appExport[T transaction.Tx]( logger log.Logger, height int64, - forZeroHeight bool, jailAllowedAddrs []string, viper *viper.Viper, - modulesToExport []string, -) (servertypes.ExportedApp, error) { +) (genutilv2.ExportedApp, error) { // overwrite the FlagInvCheckPeriod viper.Set(server.FlagInvCheckPeriod, 1) + viper.Set(serverv2.FlagHome, simapp.DefaultNodeHome) var simApp *simapp.SimApp[T] if height != -1 { simApp = simapp.NewSimApp[T](logger, viper) if err := simApp.LoadHeight(uint64(height)); err != nil { - return servertypes.ExportedApp{}, err + return genutilv2.ExportedApp{}, err } } else { simApp = simapp.NewSimApp[T](logger, viper) } - return simApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) + return simApp.ExportAppStateAndValidators(jailAllowedAddrs) } var _ transaction.Codec[transaction.Tx] = &genericTxDecoder[transaction.Tx]{} diff --git a/simapp/v2/simdv2/cmd/config.go b/simapp/v2/simdv2/cmd/config.go index 0794a8a42a79..c7f6b707c89c 100644 --- a/simapp/v2/simdv2/cmd/config.go +++ b/simapp/v2/simdv2/cmd/config.go @@ -3,6 +3,8 @@ package cmd import ( "strings" + serverv2 "cosmossdk.io/server/v2" + clientconfig "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/crypto/keyring" ) @@ -49,3 +51,20 @@ gas-adjustment = {{ .GasConfig.GasAdjustment }} return customClientConfigTemplate, customClientConfig } + +// Allow the chain developer to overwrite the server default app toml config. +func initServerConfig() serverv2.ServerConfig { + serverCfg := serverv2.DefaultServerConfig() + // The server's default minimum gas price is set to "0stake" inside + // app.toml. However, the chain developer can set a default app.toml value for their + // validators here. Please update value based on chain denom. + // + // In summary: + // - if you set serverCfg.MinGasPrices value, validators CAN tweak their + // own app.toml to override, or use this default value. + // + // In simapp, we set the min gas prices to 0. + serverCfg.MinGasPrices = "0stake" + + return serverCfg +} diff --git a/simapp/v2/simdv2/cmd/root_di.go b/simapp/v2/simdv2/cmd/root_di.go index 6051bede8e9c..a4646a705e5c 100644 --- a/simapp/v2/simdv2/cmd/root_di.go +++ b/simapp/v2/simdv2/cmd/root_di.go @@ -5,6 +5,7 @@ import ( "github.com/spf13/cobra" + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" "cosmossdk.io/client/v2/autocli" "cosmossdk.io/core/address" "cosmossdk.io/core/legacy" @@ -13,15 +14,16 @@ import ( "cosmossdk.io/log" "cosmossdk.io/runtime/v2" "cosmossdk.io/simapp/v2" - "cosmossdk.io/x/auth/tx" - authtxconfig "cosmossdk.io/x/auth/tx/config" - "cosmossdk.io/x/auth/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" + nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/std" + "github.com/cosmos/cosmos-sdk/x/auth/tx" + authtxconfig "github.com/cosmos/cosmos-sdk/x/auth/tx/config" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) // NewRootCmd creates a new root command for simd. It is called once in the main function. @@ -81,6 +83,11 @@ func NewRootCmd[T transaction.Tx]() *cobra.Command { } initRootCmd[T](rootCmd, clientCtx.TxConfig, moduleManager) + + nodeCmds := nodeservice.NewNodeCommands() + autoCliOpts.ModuleOptions = make(map[string]*autocliv1.ModuleOptions) + autoCliOpts.ModuleOptions[nodeCmds.Name()] = nodeCmds.AutoCLIOptions() + if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil { panic(err) } diff --git a/simapp/v2/simdv2/cmd/testnet.go b/simapp/v2/simdv2/cmd/testnet.go index ea56e3a8fe2f..99dfb9459a13 100644 --- a/simapp/v2/simdv2/cmd/testnet.go +++ b/simapp/v2/simdv2/cmd/testnet.go @@ -23,7 +23,6 @@ import ( "cosmossdk.io/server/v2/api/grpc" "cosmossdk.io/server/v2/cometbft" "cosmossdk.io/server/v2/store" - authtypes "cosmossdk.io/x/auth/types" banktypes "cosmossdk.io/x/bank/types" stakingtypes "cosmossdk.io/x/staking/types" @@ -36,12 +35,12 @@ import ( "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" ) var ( - flagMinGasPrices = "minimum-gas-prices" flagNodeDirPrefix = "node-dir-prefix" flagNumValidators = "validator-count" flagOutputDir = "output-dir" @@ -72,7 +71,7 @@ func addTestnetFlagsToCmd(cmd *cobra.Command) { cmd.Flags().IntP(flagNumValidators, "n", 4, "Number of validators to initialize the testnet with") cmd.Flags().StringP(flagOutputDir, "o", "./.testnets", "Directory to store initialization data for the testnet") cmd.Flags().String(flags.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created") - cmd.Flags().String(flagMinGasPrices, fmt.Sprintf("0.000006%s", sdk.DefaultBondDenom), "Minimum gas prices to accept for transactions; All fees in a tx must meet this minimum (e.g. 0.01photino,0.001stake)") + cmd.Flags().String(serverv2.FlagMinGasPrices, fmt.Sprintf("0.000006%s", sdk.DefaultBondDenom), "Minimum gas prices to accept for transactions; All fees in a tx must meet this minimum (e.g. 0.01photino,0.001stake)") cmd.Flags().String(flags.FlagKeyType, string(hd.Secp256k1Type), "Key signing algorithm to generate keys for") // support old flags name for backwards compatibility @@ -129,7 +128,7 @@ Example: args.outputDir, _ = cmd.Flags().GetString(flagOutputDir) args.keyringBackend, _ = cmd.Flags().GetString(flags.FlagKeyringBackend) args.chainID, _ = cmd.Flags().GetString(flags.FlagChainID) - args.minGasPrices, _ = cmd.Flags().GetString(flagMinGasPrices) + args.minGasPrices, _ = cmd.Flags().GetString(serverv2.FlagMinGasPrices) args.nodeDirPrefix, _ = cmd.Flags().GetString(flagNodeDirPrefix) args.nodeDaemonHome, _ = cmd.Flags().GetString(flagNodeDaemonHome) args.startingIPAddress, _ = cmd.Flags().GetString(flagStartingIPAddress) @@ -176,14 +175,6 @@ func initTestnetFiles[T transaction.Tx]( nodeIDs := make([]string, args.numValidators) valPubKeys := make([]cryptotypes.PubKey, args.numValidators) - // appConfig := srvconfig.DefaultConfig() - // appConfig.MinGasPrices = args.minGasPrices - // appConfig.API.Enable = true - // appConfig.Telemetry.Enabled = true - // appConfig.Telemetry.PrometheusRetentionTime = 60 - // appConfig.Telemetry.EnableHostnameLabel = false - // appConfig.Telemetry.GlobalLabels = [][]string{{"chain_id", args.chainID}} - var ( genAccounts []authtypes.GenesisAccount genBalances []banktypes.Balance @@ -288,7 +279,11 @@ func initTestnetFiles[T transaction.Tx]( sdk.NewCoin(args.bondTokenDenom, accStakingTokens), } - genBalances = append(genBalances, banktypes.Balance{Address: addr.String(), Coins: coins.Sort()}) + addrStr, err := clientCtx.AddressCodec.BytesToString(addr) + if err != nil { + return err + } + genBalances = append(genBalances, banktypes.Balance{Address: addrStr, Coins: coins.Sort()}) genAccounts = append(genAccounts, authtypes.NewBaseAccount(addr, nil, 0, 0)) valStr, err := clientCtx.ValidatorAddressCodec.BytesToString(addr) @@ -324,7 +319,7 @@ func initTestnetFiles[T transaction.Tx]( WithKeybase(kb). WithTxConfig(clientCtx.TxConfig) - if err := tx.Sign(cmd.Context(), txFactory, nodeDirName, txBuilder, true); err != nil { + if err := tx.Sign(clientCtx, txFactory, nodeDirName, txBuilder, true); err != nil { return err } @@ -337,6 +332,9 @@ func initTestnetFiles[T transaction.Tx]( return err } + serverCfg := serverv2.DefaultServerConfig() + serverCfg.MinGasPrices = args.minGasPrices + // Write server config cometServer := cometbft.New[T]( &genericTxDecoder[T]{clientCtx.TxConfig}, @@ -345,7 +343,7 @@ func initTestnetFiles[T transaction.Tx]( ) storeServer := store.New[T](newApp) grpcServer := grpc.New[T](grpc.OverwriteDefaultConfig(grpcConfig)) - server := serverv2.NewServer(log.NewNopLogger(), cometServer, grpcServer, storeServer) + server := serverv2.NewServer(log.NewNopLogger(), serverCfg, cometServer, grpcServer, storeServer) err = server.WriteConfig(filepath.Join(nodeDir, "config")) if err != nil { return err @@ -504,9 +502,5 @@ func writeFile(name, dir string, contents []byte) error { return fmt.Errorf("could not create directory %q: %w", dir, err) } - if err := os.WriteFile(file, contents, 0o600); err != nil { - return err - } - - return nil + return os.WriteFile(file, contents, 0o600) } diff --git a/store/cache/cache_test.go b/store/cache/cache_test.go index efbf22c8e18e..0340f7ecbd8d 100644 --- a/store/cache/cache_test.go +++ b/store/cache/cache_test.go @@ -13,11 +13,10 @@ import ( "cosmossdk.io/store/cachekv" iavlstore "cosmossdk.io/store/iavl" "cosmossdk.io/store/types" - "cosmossdk.io/store/wrapper" ) func TestGetOrSetStoreCache(t *testing.T) { - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() mngr := cache.NewCommitKVStoreCacheManager(cache.DefaultCommitKVStoreCacheSize) sKey := types.NewKVStoreKey("test") @@ -30,7 +29,7 @@ func TestGetOrSetStoreCache(t *testing.T) { } func TestUnwrap(t *testing.T) { - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() mngr := cache.NewCommitKVStoreCacheManager(cache.DefaultCommitKVStoreCacheSize) sKey := types.NewKVStoreKey("test") @@ -43,7 +42,7 @@ func TestUnwrap(t *testing.T) { } func TestStoreCache(t *testing.T) { - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() mngr := cache.NewCommitKVStoreCacheManager(cache.DefaultCommitKVStoreCacheSize) sKey := types.NewKVStoreKey("test") @@ -69,7 +68,7 @@ func TestStoreCache(t *testing.T) { } func TestReset(t *testing.T) { - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() mngr := cache.NewCommitKVStoreCacheManager(cache.DefaultCommitKVStoreCacheSize) sKey := types.NewKVStoreKey("test") @@ -89,7 +88,7 @@ func TestReset(t *testing.T) { } func TestCacheWrap(t *testing.T) { - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() mngr := cache.NewCommitKVStoreCacheManager(cache.DefaultCommitKVStoreCacheSize) sKey := types.NewKVStoreKey("test") diff --git a/store/cachekv/store_test.go b/store/cachekv/store_test.go index 220d25dd83bd..9824708f6410 100644 --- a/store/cachekv/store_test.go +++ b/store/cachekv/store_test.go @@ -7,6 +7,7 @@ import ( dbm "github.com/cosmos/cosmos-db" "github.com/stretchr/testify/require" + corestore "cosmossdk.io/core/store" "cosmossdk.io/math/unsafe" "cosmossdk.io/store/cachekv" "cosmossdk.io/store/dbadapter" @@ -465,7 +466,7 @@ func randInt(n int) int { } // useful for replaying a error case if we find one -func doOp(t *testing.T, st types.CacheKVStore, truth dbm.DB, op int, args ...int) { +func doOp(t *testing.T, st types.CacheKVStore, truth corestore.KVStoreWithBatch, op int, args ...int) { t.Helper() switch op { case opSet: @@ -491,7 +492,7 @@ func doOp(t *testing.T, st types.CacheKVStore, truth dbm.DB, op int, args ...int } } -func doRandomOp(t *testing.T, st types.CacheKVStore, truth dbm.DB, maxKey int) { +func doRandomOp(t *testing.T, st types.CacheKVStore, truth corestore.KVStoreWithBatch, maxKey int) { t.Helper() r := randInt(totalOps) switch r { @@ -535,7 +536,7 @@ func assertIterateDomain(t *testing.T, st types.KVStore, expectedN int) { require.NoError(t, itr.Close()) } -func assertIterateDomainCheck(t *testing.T, st types.KVStore, mem dbm.DB, r []keyRange) { +func assertIterateDomainCheck(t *testing.T, st types.KVStore, mem corestore.KVStoreWithBatch, r []keyRange) { t.Helper() // iterate over each and check they match the other itr := st.Iterator(nil, nil) @@ -569,7 +570,7 @@ func assertIterateDomainCheck(t *testing.T, st types.KVStore, mem dbm.DB, r []ke require.NoError(t, itr2.Close()) } -func assertIterateDomainCompare(t *testing.T, st types.KVStore, mem dbm.DB) { +func assertIterateDomainCompare(t *testing.T, st types.KVStore, mem corestore.KVStoreWithBatch) { t.Helper() // iterate over each and check they match the other itr := st.Iterator(nil, nil) @@ -597,7 +598,7 @@ func checkIterators(t *testing.T, itr, itr2 types.Iterator) { //-------------------------------------------------------- -func setRange(t *testing.T, st types.KVStore, mem dbm.DB, start, end int) { +func setRange(t *testing.T, st types.KVStore, mem corestore.KVStoreWithBatch, start, end int) { t.Helper() for i := start; i < end; i++ { st.Set(keyFmt(i), valFmt(i)) @@ -606,7 +607,7 @@ func setRange(t *testing.T, st types.KVStore, mem dbm.DB, start, end int) { } } -func deleteRange(t *testing.T, st types.KVStore, mem dbm.DB, start, end int) { +func deleteRange(t *testing.T, st types.KVStore, mem corestore.KVStoreWithBatch, start, end int) { t.Helper() for i := start; i < end; i++ { st.Delete(keyFmt(i)) diff --git a/store/cachemulti/store.go b/store/cachemulti/store.go index 696911370c5d..42742f566ed9 100644 --- a/store/cachemulti/store.go +++ b/store/cachemulti/store.go @@ -4,8 +4,7 @@ import ( "fmt" "io" - dbm "github.com/cosmos/cosmos-db" - + corestore "cosmossdk.io/core/store" "cosmossdk.io/store/cachekv" "cosmossdk.io/store/dbadapter" "cosmossdk.io/store/tracekv" @@ -66,7 +65,7 @@ func NewFromKVStore( // NewStore creates a new Store object from a mapping of store keys to // CacheWrapper objects. Each CacheWrapper store is a branched store. func NewStore( - db dbm.DB, stores map[types.StoreKey]types.CacheWrapper, keys map[string]types.StoreKey, + db corestore.KVStoreWithBatch, stores map[types.StoreKey]types.CacheWrapper, keys map[string]types.StoreKey, traceWriter io.Writer, traceContext types.TraceContext, ) Store { return NewFromKVStore(dbadapter.Store{DB: db}, stores, keys, traceWriter, traceContext) diff --git a/store/dbadapter/store.go b/store/dbadapter/store.go index d69e4ebf1357..ba673b98333d 100644 --- a/store/dbadapter/store.go +++ b/store/dbadapter/store.go @@ -3,16 +3,15 @@ package dbadapter import ( "io" - dbm "github.com/cosmos/cosmos-db" - + corestore "cosmossdk.io/core/store" "cosmossdk.io/store/cachekv" "cosmossdk.io/store/tracekv" "cosmossdk.io/store/types" ) -// Store is wrapper type for dbm.Db with implementation of KVStore +// Store is wrapper type for corestore.KVStoreWithBatch with implementation of KVStore type Store struct { - dbm.DB + DB corestore.KVStoreWithBatch } // Get wraps the underlying DB's Get method panicking on error. @@ -86,5 +85,5 @@ func (dsa Store) CacheWrapWithTrace(w io.Writer, tc types.TraceContext) types.Ca return cachekv.NewStore(tracekv.NewStore(dsa, w, tc)) } -// dbm.DB implements KVStore so we can CacheKVStore it. +// corestore.KVStoreWithBatch implements KVStore so we can CacheKVStore it. var _ types.KVStore = Store{} diff --git a/store/go.mod b/store/go.mod index fe35fabc1d8b..6ad8ec6ecae4 100644 --- a/store/go.mod +++ b/store/go.mod @@ -3,16 +3,17 @@ module cosmossdk.io/store go 1.22.2 require ( + cosmossdk.io/core v0.12.1-0.20240813134434-072a29c838a5 cosmossdk.io/errors v1.0.1 - cosmossdk.io/log v1.4.0 + cosmossdk.io/log v1.4.1 cosmossdk.io/math v1.3.0 github.com/cometbft/cometbft v1.0.0-rc1 github.com/cometbft/cometbft/api v1.0.0-rc.1 - github.com/cosmos/cosmos-db v1.0.2 + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/gogoproto v1.7.0 - github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 - github.com/cosmos/ics23/go v0.10.0 + github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e + github.com/cosmos/ics23/go v0.11.0 github.com/golang/mock v1.6.0 github.com/hashicorp/go-hclog v1.6.3 github.com/hashicorp/go-metrics v0.5.3 @@ -21,7 +22,7 @@ require ( github.com/stretchr/testify v1.9.0 github.com/tidwall/btree v1.7.0 golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 - google.golang.org/grpc v1.65.0 + google.golang.org/grpc v1.66.0 google.golang.org/protobuf v1.34.2 gotest.tools/v3 v3.5.1 ) @@ -48,7 +49,7 @@ require ( github.com/hashicorp/go-uuid v1.0.1 // indirect github.com/hashicorp/yamux v0.1.1 // indirect github.com/jhump/protoreflect v1.15.3 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/linxGnu/grocksdb v1.8.14 // indirect @@ -60,9 +61,9 @@ require ( github.com/petermattis/goid v0.0.0-20221215004737-a150e88a970d // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/rs/zerolog v1.33.0 // indirect @@ -72,6 +73,6 @@ require ( golang.org/x/net v0.28.0 // indirect golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/store/go.sum b/store/go.sum index 59521b1cac28..a85c96b42769 100644 --- a/store/go.sum +++ b/store/go.sum @@ -1,7 +1,9 @@ +cosmossdk.io/core v0.12.1-0.20240813134434-072a29c838a5 h1:aIfrfJUronk2qHPH4N7M5nGzijdSWkRwHHqqPGnQBrk= +cosmossdk.io/core v0.12.1-0.20240813134434-072a29c838a5/go.mod h1:B8JQN1vmGCPSVFlmRb/22n1T736P4C2qfEsrSKDX1iM= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= @@ -39,16 +41,16 @@ github.com/cometbft/cometbft v1.0.0-rc1/go.mod h1:64cB2wvltmK5plHlJFLYOZYGsaTKNW github.com/cometbft/cometbft/api v1.0.0-rc.1 h1:GtdXwDGlqwHYs16A4egjwylfYOMYyEacLBrs3Zvpt7g= github.com/cometbft/cometbft/api v1.0.0-rc.1/go.mod h1:NDFKiBBD8HJC6QQLAoUI99YhsiRZtg2+FJWfk6A6m6o= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e h1:LEii0v/FxtXa/F7mRn+tijZ0zaXBPn2ZkKwb6Qm4rqE= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e/go.mod h1:3ywr0wDnWeD7MUH6qu50wZ5bxuKH3LBrGG4/lZX8lVY= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -128,8 +130,8 @@ github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -190,8 +192,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -199,8 +201,8 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -234,6 +236,8 @@ github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqri github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -308,10 +312,10 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/store/iavl/store.go b/store/iavl/store.go index 198948b30091..789e7c5d5eb1 100644 --- a/store/iavl/store.go +++ b/store/iavl/store.go @@ -6,10 +6,10 @@ import ( "io" cmtprotocrypto "github.com/cometbft/cometbft/api/cometbft/crypto/v1" - dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/iavl" ics23 "github.com/cosmos/ics23/go" + corestore "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" "cosmossdk.io/store/cachekv" "cosmossdk.io/store/internal/kv" @@ -17,7 +17,6 @@ import ( pruningtypes "cosmossdk.io/store/pruning/types" "cosmossdk.io/store/tracekv" "cosmossdk.io/store/types" - "cosmossdk.io/store/wrapper" ) const ( @@ -43,7 +42,7 @@ type Store struct { // LoadStore returns an IAVL Store as a CommitKVStore. Internally, it will load the // store's version (id) from the provided DB. An error is returned if the version // fails to load, or if called with a positive version on an empty tree. -func LoadStore(db dbm.DB, logger types.Logger, key types.StoreKey, id types.CommitID, cacheSize int, disableFastNode bool, metrics metrics.StoreMetrics) (types.CommitKVStore, error) { +func LoadStore(db corestore.KVStoreWithBatch, logger types.Logger, key types.StoreKey, id types.CommitID, cacheSize int, disableFastNode bool, metrics metrics.StoreMetrics) (types.CommitKVStore, error) { return LoadStoreWithInitialVersion(db, logger, key, id, 0, cacheSize, disableFastNode, metrics) } @@ -51,8 +50,8 @@ func LoadStore(db dbm.DB, logger types.Logger, key types.StoreKey, id types.Comm // to the one given. Internally, it will load the store's version (id) from the // provided DB. An error is returned if the version fails to load, or if called with a positive // version on an empty tree. -func LoadStoreWithInitialVersion(db dbm.DB, logger types.Logger, key types.StoreKey, id types.CommitID, initialVersion uint64, cacheSize int, disableFastNode bool, metrics metrics.StoreMetrics) (types.CommitKVStore, error) { - tree := iavl.NewMutableTree(wrapper.NewDBWrapper(db), cacheSize, disableFastNode, logger, iavl.InitialVersionOption(initialVersion), iavl.AsyncPruningOption(true)) +func LoadStoreWithInitialVersion(db corestore.KVStoreWithBatch, logger types.Logger, key types.StoreKey, id types.CommitID, initialVersion uint64, cacheSize int, disableFastNode bool, metrics metrics.StoreMetrics) (types.CommitKVStore, error) { + tree := iavl.NewMutableTree(db, cacheSize, disableFastNode, logger, iavl.InitialVersionOption(initialVersion), iavl.AsyncPruningOption(true)) isUpgradeable, err := tree.IsUpgradeable() if err != nil { diff --git a/store/iavl/store_test.go b/store/iavl/store_test.go index 7ad24d7fe33d..406d7af87966 100644 --- a/store/iavl/store_test.go +++ b/store/iavl/store_test.go @@ -12,12 +12,12 @@ import ( "github.com/cosmos/iavl" "github.com/stretchr/testify/require" + corestore "cosmossdk.io/core/store" "cosmossdk.io/log" "cosmossdk.io/store/cachekv" "cosmossdk.io/store/internal/kv" "cosmossdk.io/store/metrics" "cosmossdk.io/store/types" - "cosmossdk.io/store/wrapper" ) var ( @@ -36,9 +36,9 @@ func randBytes(numBytes int) []byte { } // make a tree with data from above and save it -func newAlohaTree(t *testing.T, db dbm.DB) (*iavl.MutableTree, types.CommitID) { +func newAlohaTree(t *testing.T, db corestore.KVStoreWithBatch) (*iavl.MutableTree, types.CommitID) { t.Helper() - tree := iavl.NewMutableTree(wrapper.NewDBWrapper(db), cacheSize, false, log.NewNopLogger()) + tree := iavl.NewMutableTree(db, cacheSize, false, log.NewNopLogger()) for k, v := range treeData { _, err := tree.Set([]byte(k), []byte(v)) @@ -286,7 +286,7 @@ func TestIAVLIterator(t *testing.T) { } func TestIAVLReverseIterator(t *testing.T) { - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() tree := iavl.NewMutableTree(db, cacheSize, false, log.NewNopLogger()) @@ -320,7 +320,7 @@ func TestIAVLReverseIterator(t *testing.T) { } func TestIAVLPrefixIterator(t *testing.T) { - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() tree := iavl.NewMutableTree(db, cacheSize, false, log.NewNopLogger()) iavlStore := UnsafeNewStore(tree) @@ -383,7 +383,7 @@ func TestIAVLPrefixIterator(t *testing.T) { } func TestIAVLReversePrefixIterator(t *testing.T) { - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() tree := iavl.NewMutableTree(db, cacheSize, false, log.NewNopLogger()) iavlStore := UnsafeNewStore(tree) @@ -450,7 +450,7 @@ func nextVersion(iavl *Store) { } func TestIAVLNoPrune(t *testing.T) { - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() tree := iavl.NewMutableTree(db, cacheSize, false, log.NewNopLogger()) iavlStore := UnsafeNewStore(tree) @@ -468,7 +468,7 @@ func TestIAVLNoPrune(t *testing.T) { } func TestIAVLStoreQuery(t *testing.T) { - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() tree := iavl.NewMutableTree(db, cacheSize, false, log.NewNopLogger()) iavlStore := UnsafeNewStore(tree) @@ -580,7 +580,7 @@ func TestIAVLStoreQuery(t *testing.T) { func BenchmarkIAVLIteratorNext(b *testing.B) { b.ReportAllocs() - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() treeSize := 1000 tree := iavl.NewMutableTree(db, cacheSize, false, log.NewNopLogger()) @@ -616,7 +616,7 @@ func TestSetInitialVersion(t *testing.T) { { "works with a mutable tree", func(db *dbm.MemDB) *Store { - tree := iavl.NewMutableTree(wrapper.NewDBWrapper(db), cacheSize, false, log.NewNopLogger()) + tree := iavl.NewMutableTree(db, cacheSize, false, log.NewNopLogger()) store := UnsafeNewStore(tree) return store @@ -625,7 +625,7 @@ func TestSetInitialVersion(t *testing.T) { { "throws error on immutable tree", func(db *dbm.MemDB) *Store { - tree := iavl.NewMutableTree(wrapper.NewDBWrapper(db), cacheSize, false, log.NewNopLogger()) + tree := iavl.NewMutableTree(db, cacheSize, false, log.NewNopLogger()) store := UnsafeNewStore(tree) _, version, err := store.tree.SaveVersion() require.NoError(t, err) @@ -673,7 +673,7 @@ func TestChangeSets(t *testing.T) { treeSize := 1000 treeVersion := int64(10) targetVersion := int64(6) - tree := iavl.NewMutableTree(wrapper.NewDBWrapper(db), cacheSize, false, log.NewNopLogger(), iavl.FlushThresholdOption(math.MaxInt)) + tree := iavl.NewMutableTree(db, cacheSize, false, log.NewNopLogger(), iavl.FlushThresholdOption(math.MaxInt)) for j := int64(0); j < treeVersion; j++ { keys := [][]byte{} diff --git a/store/iavl/tree.go b/store/iavl/tree.go index f6a2db1ffc79..cc1e07e55ba6 100644 --- a/store/iavl/tree.go +++ b/store/iavl/tree.go @@ -4,7 +4,8 @@ import ( "fmt" "github.com/cosmos/iavl" - idb "github.com/cosmos/iavl/db" + + corestore "cosmossdk.io/core/store" ) var ( @@ -33,7 +34,7 @@ type ( GetVersioned(key []byte, version int64) ([]byte, error) GetImmutable(version int64) (*iavl.ImmutableTree, error) SetInitialVersion(version uint64) - Iterator(start, end []byte, ascending bool) (idb.Iterator, error) + Iterator(start, end []byte, ascending bool) (corestore.Iterator, error) AvailableVersions() []int LoadVersionForOverwriting(targetVersion int64) error TraverseStateChanges(startVersion, endVersion int64, fn func(version int64, changeSet *iavl.ChangeSet) error) error diff --git a/store/iavl/tree_test.go b/store/iavl/tree_test.go index 243355e42e08..63a12a2e5d28 100644 --- a/store/iavl/tree_test.go +++ b/store/iavl/tree_test.go @@ -8,12 +8,11 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/log" - "cosmossdk.io/store/wrapper" ) func TestImmutableTreePanics(t *testing.T) { t.Parallel() - immTree := iavl.NewImmutableTree(wrapper.NewDBWrapper(dbm.NewMemDB()), 100, false, log.NewNopLogger()) + immTree := iavl.NewImmutableTree(dbm.NewMemDB(), 100, false, log.NewNopLogger()) it := &immutableTree{immTree} require.Panics(t, func() { _, err := it.Set([]byte{}, []byte{}) diff --git a/store/internal/kv/kv.pb.go b/store/internal/kv/kv.pb.go index 847bd11d4484..311a1913b359 100644 --- a/store/internal/kv/kv.pb.go +++ b/store/internal/kv/kv.pb.go @@ -24,6 +24,11 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Pairs defines a repeated slice of Pair objects. +// +// Deprecated: Store v1 is deprecated as of v0.50.x, please use Store v2 types +// instead. +// +// Deprecated: Do not use. type Pairs struct { Pairs []Pair `protobuf:"bytes,1,rep,name=pairs,proto3" json:"pairs"` } @@ -69,6 +74,11 @@ func (m *Pairs) GetPairs() []Pair { } // Pair defines a key/value bytes tuple. +// +// Deprecated: Store v1 is deprecated as of v0.50.x, please use Store v2 types +// instead. +// +// Deprecated: Do not use. type Pair struct { Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` @@ -131,21 +141,21 @@ func init() { } var fileDescriptor_534782c4083e056d = []byte{ - // 217 bytes of a gzipped FileDescriptorProto + // 223 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x4c, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0x2f, 0x2e, 0xc9, 0x2f, 0x4a, 0xd5, 0xcf, 0xcc, 0x2b, 0x49, 0x2d, 0xca, 0x4b, 0xcc, 0xd1, 0xcf, 0x2e, 0xd3, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0xcf, 0x2e, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x80, 0x28, 0xd5, 0x03, 0x2b, 0xd5, 0x83, 0x29, 0xd5, 0xcb, 0x2e, 0xd3, 0x83, 0x2a, 0x95, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, 0xd6, 0x07, 0xb1, - 0x20, 0xfa, 0x94, 0xbc, 0xb9, 0x58, 0x03, 0x12, 0x33, 0x8b, 0x8a, 0x85, 0x9c, 0xb8, 0x58, 0x0b, + 0x20, 0xfa, 0x94, 0xfc, 0xb9, 0x58, 0x03, 0x12, 0x33, 0x8b, 0x8a, 0x85, 0x9c, 0xb8, 0x58, 0x0b, 0x40, 0x0c, 0x09, 0x46, 0x05, 0x66, 0x0d, 0x6e, 0x23, 0x35, 0x3d, 0x42, 0x06, 0xea, 0x81, 0xf4, - 0x39, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, 0xd1, 0xaa, 0xa4, 0xc7, 0xc5, 0x02, 0x12, 0x14, - 0x12, 0xe0, 0x62, 0xce, 0x4e, 0xad, 0x94, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x09, 0x02, 0x31, 0x85, - 0x44, 0xb8, 0x58, 0xcb, 0x12, 0x73, 0x4a, 0x53, 0x25, 0x98, 0xc0, 0x62, 0x10, 0x8e, 0x93, 0xc5, - 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, - 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0xc9, 0x41, 0x6c, 0x2f, 0x4e, 0xc9, - 0xd6, 0xcb, 0xcc, 0xc7, 0xf4, 0x7f, 0x12, 0x1b, 0xd8, 0xf5, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x5d, 0xad, 0x97, 0xdd, 0x22, 0x01, 0x00, 0x00, + 0x39, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, 0xd1, 0x6a, 0xc5, 0x24, 0xc1, 0xa8, 0x64, 0xc4, + 0xc5, 0x02, 0x92, 0x10, 0x12, 0xe0, 0x62, 0xce, 0x4e, 0xad, 0x94, 0x60, 0x54, 0x60, 0xd4, 0xe0, + 0x09, 0x02, 0x31, 0x85, 0x44, 0xb8, 0x58, 0xcb, 0x12, 0x73, 0x4a, 0x53, 0x25, 0x98, 0xc0, 0x62, + 0x10, 0x0e, 0x48, 0x8f, 0x93, 0xc5, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, + 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, + 0xc9, 0x41, 0x5c, 0x51, 0x9c, 0x92, 0xad, 0x97, 0x99, 0x8f, 0x19, 0x0e, 0x49, 0x6c, 0x60, 0x5f, + 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xf8, 0x41, 0x82, 0x6e, 0x2a, 0x01, 0x00, 0x00, } func (m *Pairs) Marshal() (dAtA []byte, err error) { diff --git a/store/prefix/store_test.go b/store/prefix/store_test.go index 01022aa7d215..89706f5bbde1 100644 --- a/store/prefix/store_test.go +++ b/store/prefix/store_test.go @@ -14,7 +14,6 @@ import ( "cosmossdk.io/store/gaskv" "cosmossdk.io/store/iavl" "cosmossdk.io/store/types" - "cosmossdk.io/store/wrapper" ) // copied from iavl/store_test.go @@ -91,7 +90,7 @@ func testPrefixStore(t *testing.T, baseStore types.KVStore, prefix []byte) { } func TestIAVLStorePrefix(t *testing.T) { - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() tree := tiavl.NewMutableTree(db, cacheSize, false, log.NewNopLogger()) iavlStore := iavl.UnsafeNewStore(tree) diff --git a/store/pruning/manager.go b/store/pruning/manager.go index ddc9569ffe64..74380af34814 100644 --- a/store/pruning/manager.go +++ b/store/pruning/manager.go @@ -6,8 +6,7 @@ import ( "sort" "sync" - dbm "github.com/cosmos/cosmos-db" - + corestore "cosmossdk.io/core/store" "cosmossdk.io/store/pruning/types" storetypes "cosmossdk.io/store/types" ) @@ -16,7 +15,7 @@ import ( // determining when to prune old heights of the store // based on the strategy described by the pruning options. type Manager struct { - db dbm.DB + db corestore.KVStoreWithBatch logger storetypes.Logger opts types.PruningOptions snapshotInterval uint64 @@ -46,7 +45,7 @@ var pruneSnapshotHeightsKey = []byte("s/prunesnapshotheights") // The returned manager uses a pruning strategy of "nothing" which // keeps all heights. Users of the Manager may change the strategy // by calling SetOptions. -func NewManager(db dbm.DB, logger storetypes.Logger) *Manager { +func NewManager(db corestore.KVStoreWithBatch, logger storetypes.Logger) *Manager { return &Manager{ db: db, logger: logger, @@ -89,7 +88,7 @@ func (m *Manager) HandleSnapshotHeight(height int64) { m.pruneSnapshotHeights = m.pruneSnapshotHeights[k-1:] // flush the updates to disk so that they are not lost if crash happens. - if err := m.db.SetSync(pruneSnapshotHeightsKey, int64SliceToBytes(m.pruneSnapshotHeights)); err != nil { + if err := m.db.Set(pruneSnapshotHeightsKey, int64SliceToBytes(m.pruneSnapshotHeights)); err != nil { panic(err) } } @@ -137,7 +136,7 @@ func (m *Manager) GetPruningHeight(height int64) int64 { } // LoadSnapshotHeights loads the snapshot heights from the database as a crash recovery. -func (m *Manager) LoadSnapshotHeights(db dbm.DB) error { +func (m *Manager) LoadSnapshotHeights(db corestore.KVStoreWithBatch) error { if m.opts.GetPruningStrategy() == types.PruningNothing { return nil } @@ -156,7 +155,7 @@ func (m *Manager) LoadSnapshotHeights(db dbm.DB) error { return nil } -func loadPruningSnapshotHeights(db dbm.DB) ([]int64, error) { +func loadPruningSnapshotHeights(db corestore.KVStoreWithBatch) ([]int64, error) { bz, err := db.Get(pruneSnapshotHeightsKey) if err != nil { return nil, fmt.Errorf("failed to get post-snapshot pruned heights: %w", err) diff --git a/store/pruning/manager_test.go b/store/pruning/manager_test.go index 006891de8570..1468546e5f18 100644 --- a/store/pruning/manager_test.go +++ b/store/pruning/manager_test.go @@ -202,7 +202,7 @@ func TestHandleSnapshotHeight_DbErr_Panic(t *testing.T) { // Setup dbMock := mock.NewMockDB(ctrl) - dbMock.EXPECT().SetSync(gomock.Any(), gomock.Any()).Return(errors.New(dbErr)).Times(1) + dbMock.EXPECT().Set(gomock.Any(), gomock.Any()).Return(errors.New(dbErr)).Times(1) manager := pruning.NewManager(dbMock, log.NewNopLogger()) manager.SetOptions(types.NewPruningOptions(types.PruningEverything)) diff --git a/store/rootmulti/dbadapter.go b/store/rootmulti/dbadapter.go index 65cd41c66a28..c0954e8532ab 100644 --- a/store/rootmulti/dbadapter.go +++ b/store/rootmulti/dbadapter.go @@ -17,7 +17,7 @@ var ( // commitDBStoreWrapper should only be used for simulation/debugging, // as it doesn't compute any commit hash, and it cannot load older state. -// Wrapper type for dbm.Db with implementation of KVStore +// Wrapper type for corestore.KVStoreWithBatch with implementation of KVStore type commitDBStoreAdapter struct { dbadapter.Store } diff --git a/store/rootmulti/snapshot_test.go b/store/rootmulti/snapshot_test.go index 635be92970a3..a845c09d16f5 100644 --- a/store/rootmulti/snapshot_test.go +++ b/store/rootmulti/snapshot_test.go @@ -14,6 +14,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + corestore "cosmossdk.io/core/store" "cosmossdk.io/log" "cosmossdk.io/store/iavl" "cosmossdk.io/store/metrics" @@ -23,7 +24,7 @@ import ( "cosmossdk.io/store/types" ) -func newMultiStoreWithGeneratedData(db dbm.DB, stores uint8, storeKeys uint64) *rootmulti.Store { +func newMultiStoreWithGeneratedData(db corestore.KVStoreWithBatch, stores uint8, storeKeys uint64) *rootmulti.Store { multiStore := rootmulti.NewStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) r := rand.New(rand.NewSource(49872768940)) // Fixed seed for deterministic tests @@ -61,7 +62,7 @@ func newMultiStoreWithGeneratedData(db dbm.DB, stores uint8, storeKeys uint64) * return multiStore } -func newMultiStoreWithMixedMounts(db dbm.DB) *rootmulti.Store { +func newMultiStoreWithMixedMounts(db corestore.KVStoreWithBatch) *rootmulti.Store { store := rootmulti.NewStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) store.MountStoreWithDB(types.NewKVStoreKey("iavl1"), types.StoreTypeIAVL, nil) store.MountStoreWithDB(types.NewKVStoreKey("iavl2"), types.StoreTypeIAVL, nil) @@ -73,7 +74,7 @@ func newMultiStoreWithMixedMounts(db dbm.DB) *rootmulti.Store { return store } -func newMultiStoreWithMixedMountsAndBasicData(db dbm.DB) *rootmulti.Store { +func newMultiStoreWithMixedMountsAndBasicData(db corestore.KVStoreWithBatch) *rootmulti.Store { store := newMultiStoreWithMixedMounts(db) store1 := store.GetStoreByName("iavl1").(types.CommitKVStore) store2 := store.GetStoreByName("iavl2").(types.CommitKVStore) diff --git a/store/rootmulti/store.go b/store/rootmulti/store.go index 1226f63d1ac3..f9d1c1b7383f 100644 --- a/store/rootmulti/store.go +++ b/store/rootmulti/store.go @@ -16,6 +16,7 @@ import ( gogotypes "github.com/cosmos/gogoproto/types" iavltree "github.com/cosmos/iavl" + corestore "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" "cosmossdk.io/store/cachemulti" "cosmossdk.io/store/dbadapter" @@ -55,7 +56,7 @@ func keysFromStoreKeyMap[V any](m map[types.StoreKey]V) []types.StoreKey { // cacheMultiStore which is used for branching other MultiStores. It implements // the CommitMultiStore interface. type Store struct { - db dbm.DB + db corestore.KVStoreWithBatch logger iavltree.Logger lastCommitInfo *types.CommitInfo pruningManager *pruning.Manager @@ -84,7 +85,7 @@ var ( // store will be created with a PruneNothing pruning strategy by default. After // a store is created, KVStores must be mounted and finally LoadLatestVersion or // LoadVersion must be called. -func NewStore(db dbm.DB, logger iavltree.Logger, metricGatherer metrics.StoreMetrics) *Store { +func NewStore(db corestore.KVStoreWithBatch, logger iavltree.Logger, metricGatherer metrics.StoreMetrics) *Store { return &Store{ db: db, logger: logger, @@ -137,7 +138,7 @@ func (rs *Store) GetStoreType() types.StoreType { } // MountStoreWithDB implements CommitMultiStore. -func (rs *Store) MountStoreWithDB(key types.StoreKey, typ types.StoreType, db dbm.DB) { +func (rs *Store) MountStoreWithDB(key types.StoreKey, typ types.StoreType, db corestore.KVStoreWithBatch) { if key == nil { panic("MountIAVLStore() key cannot be nil") } @@ -1013,13 +1014,13 @@ loop: } func (rs *Store) loadCommitStoreFromParams(key types.StoreKey, id types.CommitID, params storeParams) (types.CommitKVStore, error) { - var db dbm.DB + var db corestore.KVStoreWithBatch if params.db != nil { - db = dbm.NewPrefixDB(params.db, []byte("s/_/")) + db = dbm.NewPrefixDB(params.db.(dbm.DB), []byte("s/_/")) } else { prefix := "s/k:" + params.key.Name() + "/" - db = dbm.NewPrefixDB(rs.db, []byte(prefix)) + db = dbm.NewPrefixDB(rs.db.(dbm.DB), []byte(prefix)) } switch params.typ { @@ -1141,7 +1142,7 @@ func (rs *Store) GetCommitInfo(ver int64) (*types.CommitInfo, error) { return cInfo, nil } -func (rs *Store) flushMetadata(db dbm.DB, version int64, cInfo *types.CommitInfo) { +func (rs *Store) flushMetadata(db corestore.KVStoreWithBatch, version int64, cInfo *types.CommitInfo) { rs.logger.Debug("flushing metadata", "height", version) batch := db.NewBatch() defer func() { @@ -1164,12 +1165,12 @@ func (rs *Store) flushMetadata(db dbm.DB, version int64, cInfo *types.CommitInfo type storeParams struct { key types.StoreKey - db dbm.DB + db corestore.KVStoreWithBatch typ types.StoreType initialVersion uint64 } -func newStoreParams(key types.StoreKey, db dbm.DB, typ types.StoreType, initialVersion uint64) storeParams { +func newStoreParams(key types.StoreKey, db corestore.KVStoreWithBatch, typ types.StoreType, initialVersion uint64) storeParams { return storeParams{ key: key, db: db, @@ -1178,7 +1179,7 @@ func newStoreParams(key types.StoreKey, db dbm.DB, typ types.StoreType, initialV } } -func GetLatestVersion(db dbm.DB) int64 { +func GetLatestVersion(db corestore.KVStoreWithBatch) int64 { bz, err := db.Get([]byte(latestVersionKey)) if err != nil { panic(err) diff --git a/store/rootmulti/store_test.go b/store/rootmulti/store_test.go index be23d3deda9c..351b20eec20e 100644 --- a/store/rootmulti/store_test.go +++ b/store/rootmulti/store_test.go @@ -10,6 +10,7 @@ import ( dbm "github.com/cosmos/cosmos-db" "github.com/stretchr/testify/require" + corestore "cosmossdk.io/core/store" "cosmossdk.io/errors" "cosmossdk.io/log" "cosmossdk.io/store/cachemulti" @@ -27,7 +28,7 @@ func TestStoreType(t *testing.T) { } func TestGetCommitKVStore(t *testing.T) { - var db dbm.DB = dbm.NewMemDB() + var db corestore.KVStoreWithBatch = dbm.NewMemDB() ms := newMultiStoreWithMounts(db, pruningtypes.NewPruningOptions(pruningtypes.PruningDefault)) err := ms.LoadLatestVersion() require.Nil(t, err) @@ -60,7 +61,7 @@ func TestStoreMount(t *testing.T) { } func TestCacheMultiStore(t *testing.T) { - var db dbm.DB = dbm.NewMemDB() + var db corestore.KVStoreWithBatch = dbm.NewMemDB() ms := newMultiStoreWithMounts(db, pruningtypes.NewPruningOptions(pruningtypes.PruningNothing)) cacheMulti := ms.CacheMultiStore() @@ -68,7 +69,7 @@ func TestCacheMultiStore(t *testing.T) { } func TestCacheMultiStoreWithVersion(t *testing.T) { - var db dbm.DB = dbm.NewMemDB() + var db corestore.KVStoreWithBatch = dbm.NewMemDB() ms := newMultiStoreWithMounts(db, pruningtypes.NewPruningOptions(pruningtypes.PruningNothing)) err := ms.LoadLatestVersion() require.Nil(t, err) @@ -121,7 +122,7 @@ func TestCacheMultiStoreWithVersion(t *testing.T) { } func TestHashStableWithEmptyCommit(t *testing.T) { - var db dbm.DB = dbm.NewMemDB() + var db corestore.KVStoreWithBatch = dbm.NewMemDB() ms := newMultiStoreWithMounts(db, pruningtypes.NewPruningOptions(pruningtypes.PruningNothing)) err := ms.LoadLatestVersion() require.Nil(t, err) @@ -151,7 +152,7 @@ func TestHashStableWithEmptyCommit(t *testing.T) { } func TestMultistoreCommitLoad(t *testing.T) { - var db dbm.DB = dbm.NewMemDB() + var db corestore.KVStoreWithBatch = dbm.NewMemDB() store := newMultiStoreWithMounts(db, pruningtypes.NewPruningOptions(pruningtypes.PruningNothing)) err := store.LoadLatestVersion() require.Nil(t, err) @@ -204,7 +205,7 @@ func TestMultistoreCommitLoad(t *testing.T) { } func TestMultistoreLoadWithUpgrade(t *testing.T) { - var db dbm.DB = dbm.NewMemDB() + var db corestore.KVStoreWithBatch = dbm.NewMemDB() store := newMultiStoreWithMounts(db, pruningtypes.NewPruningOptions(pruningtypes.PruningNothing)) err := store.LoadLatestVersion() require.Nil(t, err) @@ -668,7 +669,7 @@ func TestPausePruningOnCommit(t *testing.T) { // TestUnevenStoresHeightCheck tests if loading root store correctly errors when // there's any module store with the wrong height func TestUnevenStoresHeightCheck(t *testing.T) { - var db dbm.DB = dbm.NewMemDB() + var db corestore.KVStoreWithBatch = dbm.NewMemDB() store := newMultiStoreWithMounts(db, pruningtypes.NewPruningOptions(pruningtypes.PruningNothing)) err := store.LoadLatestVersion() require.Nil(t, err) @@ -788,7 +789,7 @@ func TestTraceConcurrency(t *testing.T) { } func TestCommitOrdered(t *testing.T) { - var db dbm.DB = dbm.NewMemDB() + var db corestore.KVStoreWithBatch = dbm.NewMemDB() multi := newMultiStoreWithMounts(db, pruningtypes.NewPruningOptions(pruningtypes.PruningNothing)) err := multi.LoadLatestVersion() require.Nil(t, err) @@ -832,7 +833,7 @@ var ( testStoreKey3 = types.NewKVStoreKey("store3") ) -func newMultiStoreWithMounts(db dbm.DB, pruningOpts pruningtypes.PruningOptions) *Store { +func newMultiStoreWithMounts(db corestore.KVStoreWithBatch, pruningOpts pruningtypes.PruningOptions) *Store { store := NewStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) store.SetPruning(pruningOpts) @@ -843,7 +844,7 @@ func newMultiStoreWithMounts(db dbm.DB, pruningOpts pruningtypes.PruningOptions) return store } -func newMultiStoreWithModifiedMounts(db dbm.DB, pruningOpts pruningtypes.PruningOptions) (*Store, *types.StoreUpgrades) { +func newMultiStoreWithModifiedMounts(db corestore.KVStoreWithBatch, pruningOpts pruningtypes.PruningOptions) (*Store, *types.StoreUpgrades) { store := NewStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) store.SetPruning(pruningOpts) @@ -929,7 +930,7 @@ func (tl *MockListener) OnWrite(storeKey types.StoreKey, key, value []byte, dele } func TestStateListeners(t *testing.T) { - var db dbm.DB = dbm.NewMemDB() + var db corestore.KVStoreWithBatch = dbm.NewMemDB() ms := newMultiStoreWithMounts(db, pruningtypes.NewPruningOptions(pruningtypes.PruningNothing)) require.Empty(t, ms.listeners) @@ -969,7 +970,7 @@ func (stub *commitKVStoreStub) Commit() types.CommitID { } func prepareStoreMap() (map[types.StoreKey]types.CommitKVStore, error) { - var db dbm.DB = dbm.NewMemDB() + var db corestore.KVStoreWithBatch = dbm.NewMemDB() store := NewStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) store.MountStoreWithDB(types.NewKVStoreKey("iavl1"), types.StoreTypeIAVL, nil) store.MountStoreWithDB(types.NewKVStoreKey("iavl2"), types.StoreTypeIAVL, nil) diff --git a/store/snapshots/README.md b/store/snapshots/README.md index 6de723246885..34e5d54c40b8 100644 --- a/store/snapshots/README.md +++ b/store/snapshots/README.md @@ -11,8 +11,9 @@ This document describes the Cosmos SDK implementation of the ABCI state sync interface, for more information on CometBFT state sync in general see: * [CometBFT State Sync for Developers](https://medium.com/cometbft/cometbft-core-state-sync-for-developers-70a96ba3ee35) -* [ABCI State Sync Spec](https://docs.cometbft.com/v0.37/spec/p2p/messages/state-sync) -* [ABCI State Sync Method/Type Reference](https://docs.cometbft.com/v0.37/spec/p2p/messages/state-sync) +* [CometBFT State Sync](https://docs.cometbft.com/v0.38/core/state-sync) +* [ABCI State Sync Spec](https://docs.cometbft.com/v0.38/spec/p2p/legacy-docs/messages/state-sync) +* [ABCI State Sync Method/Type Reference](https://docs.cometbft.com/v0.38/spec/p2p/legacy-docs/messages/state-sync) ## Overview diff --git a/store/store.go b/store/store.go index e02ea24a66e8..0568e37c85cd 100644 --- a/store/store.go +++ b/store/store.go @@ -1,15 +1,14 @@ package store import ( - dbm "github.com/cosmos/cosmos-db" - + corestore "cosmossdk.io/core/store" "cosmossdk.io/store/cache" "cosmossdk.io/store/metrics" "cosmossdk.io/store/rootmulti" "cosmossdk.io/store/types" ) -func NewCommitMultiStore(db dbm.DB, logger types.Logger, metricGatherer metrics.StoreMetrics) types.CommitMultiStore { +func NewCommitMultiStore(db corestore.KVStoreWithBatch, logger types.Logger, metricGatherer metrics.StoreMetrics) types.CommitMultiStore { return rootmulti.NewStore(db, logger, metricGatherer) } diff --git a/store/types/store.go b/store/types/store.go index 7846876eeb6d..de77e2c548aa 100644 --- a/store/types/store.go +++ b/store/types/store.go @@ -5,8 +5,8 @@ import ( "io" crypto "github.com/cometbft/cometbft/api/cometbft/crypto/v1" - dbm "github.com/cosmos/cosmos-db" + corestore "cosmossdk.io/core/store" "cosmossdk.io/store/metrics" pruningtypes "cosmossdk.io/store/pruning/types" snapshottypes "cosmossdk.io/store/snapshots/types" @@ -178,7 +178,7 @@ type CommitMultiStore interface { // MountStoreWithDB mount a store of type using the given db. // If db == nil, the new store will use the CommitMultiStore db. - MountStoreWithDB(key StoreKey, typ StoreType, db dbm.DB) + MountStoreWithDB(key StoreKey, typ StoreType, db corestore.KVStoreWithBatch) // GetCommitStore panics on a nil key. GetCommitStore(key StoreKey) CommitStore @@ -276,7 +276,7 @@ type KVStore interface { } // Iterator is an alias db's Iterator for convenience. -type Iterator = dbm.Iterator +type Iterator = corestore.Iterator // CacheKVStore branches a KVStore and provides read cache functionality. // After calling .Write() on the CacheKVStore, all previously created diff --git a/store/v2/commitment/iavl/tree.go b/store/v2/commitment/iavl/tree.go index 5fbff6e32931..2783ba3a70af 100644 --- a/store/v2/commitment/iavl/tree.go +++ b/store/v2/commitment/iavl/tree.go @@ -10,7 +10,6 @@ import ( corestore "cosmossdk.io/core/store" "cosmossdk.io/store/v2" "cosmossdk.io/store/v2/commitment" - dbm "cosmossdk.io/store/v2/db" ) var ( @@ -25,7 +24,7 @@ type IavlTree struct { // NewIavlTree creates a new IavlTree instance. func NewIavlTree(db corestore.KVStoreWithBatch, logger log.Logger, cfg *Config) *IavlTree { - tree := iavl.NewMutableTree(dbm.NewWrapper(db), cfg.CacheSize, cfg.SkipFastStorageUpgrade, logger, iavl.AsyncPruningOption(true)) + tree := iavl.NewMutableTree(db, cfg.CacheSize, cfg.SkipFastStorageUpgrade, logger, iavl.AsyncPruningOption(true)) return &IavlTree{ tree: tree, } diff --git a/store/v2/commitment/store.go b/store/v2/commitment/store.go index 68c83e1c3de1..da0440987524 100644 --- a/store/v2/commitment/store.go +++ b/store/v2/commitment/store.go @@ -4,11 +4,11 @@ import ( "errors" "fmt" "io" + "maps" "math" - "sort" + "slices" protoio "github.com/cosmos/gogoproto/io" - "golang.org/x/exp/maps" corelog "cosmossdk.io/core/log" corestore "cosmossdk.io/core/store" @@ -111,9 +111,7 @@ func (c *CommitStore) LoadVersion(targetVersion uint64) error { func (c *CommitStore) LoadVersionAndUpgrade(targetVersion uint64, upgrades *corestore.StoreUpgrades) error { // deterministic iteration order for upgrades (as the underlying store may change and // upgrades make store changes where the execution order may matter) - storeKeys := maps.Keys(c.multiTrees) - sort.Strings(storeKeys) - + storeKeys := slices.Sorted(maps.Keys(c.multiTrees)) removeTree := func(storeKey string) error { if oldTree, ok := c.multiTrees[storeKey]; ok { if err := oldTree.Close(); err != nil { diff --git a/store/v2/db/wrapper.go b/store/v2/db/wrapper.go deleted file mode 100644 index 72d4ddca3045..000000000000 --- a/store/v2/db/wrapper.go +++ /dev/null @@ -1,39 +0,0 @@ -package db - -import ( - idb "github.com/cosmos/iavl/db" - - corestore "cosmossdk.io/core/store" -) - -// Wrapper wraps a `corestore.KVStoreWithBatch` to implement iavl.DB which is used by iavl.Tree. -type Wrapper struct { - corestore.KVStoreWithBatch -} - -var _ idb.DB = (*Wrapper)(nil) - -// NewWrapper returns a new Wrapper. -func NewWrapper(db corestore.KVStoreWithBatch) *Wrapper { - return &Wrapper{KVStoreWithBatch: db} -} - -// Iterator implements iavl.DB. -func (db *Wrapper) Iterator(start, end []byte) (idb.Iterator, error) { - return db.KVStoreWithBatch.Iterator(start, end) -} - -// ReverseIterator implements iavl.DB. -func (db *Wrapper) ReverseIterator(start, end []byte) (idb.Iterator, error) { - return db.KVStoreWithBatch.ReverseIterator(start, end) -} - -// NewBatch implements iavl.DB. -func (db *Wrapper) NewBatch() idb.Batch { - return db.KVStoreWithBatch.NewBatch() -} - -// NewBatchWithSize implements iavl.DB. -func (db *Wrapper) NewBatchWithSize(size int) idb.Batch { - return db.KVStoreWithBatch.NewBatchWithSize(size) -} diff --git a/store/v2/go.mod b/store/v2/go.mod index 2deb6692e0ad..661a8d1a1f1a 100644 --- a/store/v2/go.mod +++ b/store/v2/go.mod @@ -1,17 +1,17 @@ module cosmossdk.io/store/v2 -go 1.21 +go 1.23 require ( - cosmossdk.io/core v0.12.1-0.20240725072823-6a2d039e1212 + cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 - cosmossdk.io/log v1.4.0 + cosmossdk.io/log v1.4.1 github.com/cockroachdb/pebble v1.1.0 github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/gogoproto v1.7.0 - github.com/cosmos/iavl v1.2.1-0.20240731145221-594b181f427e - github.com/cosmos/ics23/go v0.10.0 + github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e + github.com/cosmos/ics23/go v0.11.0 github.com/google/btree v1.1.2 github.com/hashicorp/go-metrics v0.5.3 github.com/linxGnu/grocksdb v1.8.14 @@ -20,19 +20,17 @@ require ( github.com/stretchr/testify v1.9.0 github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d go.uber.org/mock v0.4.0 - golang.org/x/exp v0.0.0-20231006140011-7918f672742d golang.org/x/sync v0.8.0 ) require ( github.com/DataDog/zstd v1.5.5 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cockroachdb/errors v1.11.1 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect - github.com/cosmos/cosmos-db v1.0.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/emicklei/dot v1.6.2 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect @@ -43,7 +41,7 @@ require ( github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-uuid v1.0.1 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect - github.com/klauspost/compress v1.17.7 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect @@ -51,15 +49,16 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/rs/zerolog v1.33.0 // indirect github.com/tidwall/btree v1.7.0 // indirect golang.org/x/crypto v0.26.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/store/v2/go.sum b/store/v2/go.sum index 7a8709080eda..abdcc1b70227 100644 --- a/store/v2/go.sum +++ b/store/v2/go.sum @@ -1,7 +1,7 @@ cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 h1:IQNdY2kB+k+1OM2DvqFG1+UgeU1JzZrWtwuWzI3ZfwA= cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5/go.mod h1:0CuYKkFHxc1vw2JC+t21THBCALJVROrWVR/3PQ1urpc= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= @@ -14,8 +14,8 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -34,16 +34,14 @@ github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= -github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/cosmos/iavl v1.2.1-0.20240731145221-594b181f427e h1:5bxw1E0peLMrr8ZO9mYT0d9sxy0WgR1ZEWb92yjKnnk= -github.com/cosmos/iavl v1.2.1-0.20240731145221-594b181f427e/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e h1:LEii0v/FxtXa/F7mRn+tijZ0zaXBPn2ZkKwb6Qm4rqE= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e/go.mod h1:3ywr0wDnWeD7MUH6qu50wZ5bxuKH3LBrGG4/lZX8lVY= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -72,8 +70,6 @@ github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -119,8 +115,8 @@ github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= -github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -178,8 +174,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -187,8 +183,8 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -243,8 +239,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= +golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -276,8 +272,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/store/v2/root/factory.go b/store/v2/root/factory.go index 17e2d39e87eb..b10c87770aee 100644 --- a/store/v2/root/factory.go +++ b/store/v2/root/factory.go @@ -139,9 +139,9 @@ func CreateRootStore(opts *FactoryOptions) (store.RootStore, error) { case SCTypeIavl: return iavl.NewIavlTree(db.NewPrefixDB(opts.SCRawDB, []byte(key)), opts.Logger, storeOpts.IavlConfig), nil case SCTypeIavlV2: - return nil, fmt.Errorf("iavl v2 not supported") + return nil, errors.New("iavl v2 not supported") default: - return nil, fmt.Errorf("unsupported commitment store type") + return nil, errors.New("unsupported commitment store type") } } } diff --git a/store/v2/root/store.go b/store/v2/root/store.go index 218af42b6f89..c39119a9aaf3 100644 --- a/store/v2/root/store.go +++ b/store/v2/root/store.go @@ -245,7 +245,7 @@ func (s *Store) LoadVersion(version uint64) error { // NOTE: It cannot be called while the store is migrating. func (s *Store) LoadVersionAndUpgrade(version uint64, upgrades *corestore.StoreUpgrades) error { if upgrades == nil { - return fmt.Errorf("upgrades cannot be nil") + return errors.New("upgrades cannot be nil") } if s.telemetry != nil { @@ -253,7 +253,7 @@ func (s *Store) LoadVersionAndUpgrade(version uint64, upgrades *corestore.StoreU } if s.isMigrating { - return fmt.Errorf("cannot upgrade while migrating") + return errors.New("cannot upgrade while migrating") } if err := s.loadVersion(version, upgrades); err != nil { @@ -283,7 +283,7 @@ func (s *Store) loadVersion(v uint64, upgrades *corestore.StoreUpgrades) error { // if upgrades are provided, we need to load the version and apply the upgrades upgradeableStore, ok := s.stateCommitment.(store.UpgradeableStore) if !ok { - return fmt.Errorf("SC store does not support upgrades") + return errors.New("SC store does not support upgrades") } if err := upgradeableStore.LoadVersionAndUpgrade(v, upgrades); err != nil { return fmt.Errorf("failed to load SS version with upgrades %d: %w", v, err) diff --git a/store/wrapper/wrapper.go b/store/wrapper/wrapper.go deleted file mode 100644 index 33b195e706ec..000000000000 --- a/store/wrapper/wrapper.go +++ /dev/null @@ -1,34 +0,0 @@ -package wrapper - -import ( - dbm "github.com/cosmos/cosmos-db" - idb "github.com/cosmos/iavl/db" -) - -var _ idb.DB = &DBWrapper{} - -// DBWrapper is a simple wrapper of dbm.DB that implements the iavl.DB interface. -type DBWrapper struct { - dbm.DB -} - -// NewDBWrapper creates a new DBWrapper instance. -func NewDBWrapper(db dbm.DB) *DBWrapper { - return &DBWrapper{db} -} - -func (dbw *DBWrapper) NewBatch() idb.Batch { - return dbw.DB.NewBatch() -} - -func (dbw *DBWrapper) NewBatchWithSize(size int) idb.Batch { - return dbw.DB.NewBatchWithSize(size) -} - -func (dbw *DBWrapper) Iterator(start, end []byte) (idb.Iterator, error) { - return dbw.DB.Iterator(start, end) -} - -func (dbw *DBWrapper) ReverseIterator(start, end []byte) (idb.Iterator, error) { - return dbw.DB.ReverseIterator(start, end) -} diff --git a/tests/e2e/accounts/lockup/utils.go b/tests/e2e/accounts/lockup/utils.go index b1a90d7ece72..69606d58d743 100644 --- a/tests/e2e/accounts/lockup/utils.go +++ b/tests/e2e/accounts/lockup/utils.go @@ -5,8 +5,8 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "google.golang.org/protobuf/runtime/protoiface" + "cosmossdk.io/core/transaction" "cosmossdk.io/simapp" "cosmossdk.io/x/accounts/defaults/lockup/types" "cosmossdk.io/x/bank/testutil" @@ -15,8 +15,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -type ProtoMsg = protoiface.MessageV1 - var ( ownerAddr = secp256k1.GenPrivKey().PubKey().Address() accOwner = sdk.AccAddress(ownerAddr) @@ -52,7 +50,7 @@ func (s *E2ETestSuite) executeTx(ctx sdk.Context, msg sdk.Msg, app *simapp.SimAp return err } -func (s *E2ETestSuite) queryAcc(ctx sdk.Context, req sdk.Msg, app *simapp.SimApp, accAddr []byte) (ProtoMsg, error) { +func (s *E2ETestSuite) queryAcc(ctx sdk.Context, req sdk.Msg, app *simapp.SimApp, accAddr []byte) (transaction.Msg, error) { resp, err := app.AccountsKeeper.Query(ctx, accAddr, req) return resp, err } diff --git a/tests/e2e/accounts/multisig/test_suite.go b/tests/e2e/accounts/multisig/test_suite.go index 1f333cf2a0c7..3aa23f147d25 100644 --- a/tests/e2e/accounts/multisig/test_suite.go +++ b/tests/e2e/accounts/multisig/test_suite.go @@ -6,8 +6,8 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "google.golang.org/protobuf/runtime/protoiface" + "cosmossdk.io/core/transaction" "cosmossdk.io/math" "cosmossdk.io/simapp" multisigaccount "cosmossdk.io/x/accounts/defaults/multisig" @@ -19,8 +19,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -type ProtoMsg = protoiface.MessageV1 - type E2ETestSuite struct { suite.Suite @@ -59,7 +57,7 @@ func (s *E2ETestSuite) executeTx(ctx context.Context, msg sdk.Msg, accAddr, send return err } -func (s *E2ETestSuite) queryAcc(ctx context.Context, req sdk.Msg, accAddr []byte) (ProtoMsg, error) { +func (s *E2ETestSuite) queryAcc(ctx context.Context, req sdk.Msg, accAddr []byte) (transaction.Msg, error) { resp, err := s.app.AccountsKeeper.Query(ctx, accAddr, req) return resp, err } diff --git a/tests/e2e/auth/keeper/account_retriever_test.go b/tests/e2e/auth/keeper/account_retriever_test.go index 3a98cb9373d0..7fcfcaa98c2b 100644 --- a/tests/e2e/auth/keeper/account_retriever_test.go +++ b/tests/e2e/auth/keeper/account_retriever_test.go @@ -5,9 +5,8 @@ import ( "github.com/stretchr/testify/require" - "cosmossdk.io/x/auth/types" - "github.com/cosmos/cosmos-sdk/testutil/network" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestAccountRetriever(t *testing.T) { diff --git a/tests/e2e/auth/keeper/app_config.go b/tests/e2e/auth/keeper/app_config.go index 526d19acba92..7d761d63129e 100644 --- a/tests/e2e/auth/keeper/app_config.go +++ b/tests/e2e/auth/keeper/app_config.go @@ -1,16 +1,16 @@ package keeper import ( - _ "cosmossdk.io/x/accounts" // import as blank for app wiring - _ "cosmossdk.io/x/auth" // import as blank for app wiring - _ "cosmossdk.io/x/auth/tx/config" // import as blank for app wiring`` - _ "cosmossdk.io/x/auth/vesting" // import as blank for app wiring - _ "cosmossdk.io/x/bank" // import as blank for app wiring - _ "cosmossdk.io/x/consensus" // import as blank for app wiring - _ "cosmossdk.io/x/staking" // import as blank for app wiring + _ "cosmossdk.io/x/accounts" // import as blank for app wiring + _ "cosmossdk.io/x/bank" // import as blank for app wiring + _ "cosmossdk.io/x/consensus" // import as blank for app wiring + _ "cosmossdk.io/x/staking" // import as blank for app wiring "github.com/cosmos/cosmos-sdk/testutil/configurator" - _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring`` + _ "github.com/cosmos/cosmos-sdk/x/auth/vesting" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring ) var AppConfig = configurator.NewAppConfig( diff --git a/tests/e2e/auth/keeper/keeper_bench_test.go b/tests/e2e/auth/keeper/keeper_bench_test.go index a8c370ca3dfc..345c46ae9d5d 100644 --- a/tests/e2e/auth/keeper/keeper_bench_test.go +++ b/tests/e2e/auth/keeper/keeper_bench_test.go @@ -7,10 +7,10 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/log" - "cosmossdk.io/x/auth/keeper" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/keeper" ) func BenchmarkAccountMapperGetAccountFound(b *testing.B) { diff --git a/tests/e2e/auth/keeper/module_test.go b/tests/e2e/auth/keeper/module_test.go index 7154aaac454f..d9724bde6267 100644 --- a/tests/e2e/auth/keeper/module_test.go +++ b/tests/e2e/auth/keeper/module_test.go @@ -7,10 +7,10 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/log" - "cosmossdk.io/x/auth/keeper" - "cosmossdk.io/x/auth/types" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + "github.com/cosmos/cosmos-sdk/x/auth/keeper" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestItCreatesModuleAccountOnInitBlock(t *testing.T) { diff --git a/tests/e2e/auth/suite.go b/tests/e2e/auth/suite.go index ffc896810ee0..544fef1683b4 100644 --- a/tests/e2e/auth/suite.go +++ b/tests/e2e/auth/suite.go @@ -14,8 +14,6 @@ import ( "cosmossdk.io/core/address" "cosmossdk.io/depinject" "cosmossdk.io/math" - authcli "cosmossdk.io/x/auth/client/cli" - authclitestutil "cosmossdk.io/x/auth/client/testutil" banktypes "cosmossdk.io/x/bank/types" govtestutil "cosmossdk.io/x/gov/client/testutil" govtypes "cosmossdk.io/x/gov/types/v1beta1" @@ -35,6 +33,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/tx" "github.com/cosmos/cosmos-sdk/types/tx/signing" + authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli" + authclitestutil "github.com/cosmos/cosmos-sdk/x/auth/client/testutil" "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" ) diff --git a/tests/e2e/authz/tx.go b/tests/e2e/authz/tx.go index fe3bc7131e3a..811cdf51ded5 100644 --- a/tests/e2e/authz/tx.go +++ b/tests/e2e/authz/tx.go @@ -10,7 +10,6 @@ import ( // without this import amino json encoding will fail when resolving any types _ "cosmossdk.io/api/cosmos/authz/v1beta1" "cosmossdk.io/math" - authcli "cosmossdk.io/x/auth/client/cli" "cosmossdk.io/x/authz" "cosmossdk.io/x/authz/client/cli" authzclitestutil "cosmossdk.io/x/authz/client/testutil" @@ -28,6 +27,7 @@ import ( clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/cosmos/cosmos-sdk/testutil/network" sdk "github.com/cosmos/cosmos-sdk/types" + authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli" ) type E2ETestSuite struct { diff --git a/tests/e2e/baseapp/block_gas_test.go b/tests/e2e/baseapp/block_gas_test.go index c8f9148b5bc7..469e01a7499c 100644 --- a/tests/e2e/baseapp/block_gas_test.go +++ b/tests/e2e/baseapp/block_gas_test.go @@ -18,7 +18,6 @@ import ( sdkmath "cosmossdk.io/math" store "cosmossdk.io/store/types" _ "cosmossdk.io/x/accounts" - xauthsigning "cosmossdk.io/x/auth/signing" baseapptestutil "github.com/cosmos/cosmos-sdk/baseapp/testutil" "github.com/cosmos/cosmos-sdk/client" @@ -36,6 +35,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" txtypes "github.com/cosmos/cosmos-sdk/types/tx" "github.com/cosmos/cosmos-sdk/types/tx/signing" + xauthsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" ) var blockMaxGas = uint64(simtestutil.DefaultConsensusParams.Block.MaxGas) diff --git a/tests/e2e/baseapp/utils.go b/tests/e2e/baseapp/utils.go index aa69a28e73ee..3c49847c3372 100644 --- a/tests/e2e/baseapp/utils.go +++ b/tests/e2e/baseapp/utils.go @@ -9,9 +9,6 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/math" - _ "cosmossdk.io/x/auth" - _ "cosmossdk.io/x/auth/tx/config" - authtypes "cosmossdk.io/x/auth/types" _ "cosmossdk.io/x/bank" banktypes "cosmossdk.io/x/bank/types" _ "cosmossdk.io/x/consensus" @@ -23,6 +20,9 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/mock" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/x/auth" + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) // GenesisStateWithSingleValidator initializes GenesisState with a single validator and genesis accounts diff --git a/tests/e2e/genutil/export_test.go b/tests/e2e/genutil/export_test.go index e7ff24f10ac2..cb41aa53d2c5 100644 --- a/tests/e2e/genutil/export_test.go +++ b/tests/e2e/genutil/export_test.go @@ -22,6 +22,7 @@ import ( "gotest.tools/v3/assert" corectx "cosmossdk.io/core/context" + corestore "cosmossdk.io/core/store" "cosmossdk.io/log" "cosmossdk.io/simapp" @@ -204,7 +205,7 @@ func setupApp(t *testing.T, tempDir string) (*simapp.SimApp, context.Context, ge _, err = app.Commit() assert.NilError(t, err) - cmd := genutilcli.ExportCmd(func(_ log.Logger, _ dbm.DB, _ io.Writer, height int64, forZeroHeight bool, jailAllowedAddrs []string, appOptions types.AppOptions, modulesToExport []string) (types.ExportedApp, error) { + cmd := genutilcli.ExportCmd(func(_ log.Logger, _ corestore.KVStoreWithBatch, _ io.Writer, height int64, forZeroHeight bool, jailAllowedAddrs []string, appOptions types.AppOptions, modulesToExport []string) (types.ExportedApp, error) { var simApp *simapp.SimApp if height != -1 { simApp = simapp.NewSimApp(logger, db, nil, false, appOptions) diff --git a/tests/e2e/gov/tx.go b/tests/e2e/gov/tx.go index 9c7e5959db0e..3806e54a8823 100644 --- a/tests/e2e/gov/tx.go +++ b/tests/e2e/gov/tx.go @@ -8,7 +8,6 @@ import ( "github.com/stretchr/testify/suite" "cosmossdk.io/math" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/gov/client/cli" govclitestutil "cosmossdk.io/x/gov/client/testutil" "cosmossdk.io/x/gov/types" @@ -20,6 +19,7 @@ import ( clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/cosmos/cosmos-sdk/testutil/network" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) type E2ETestSuite struct { diff --git a/tests/e2e/tx/benchmarks_test.go b/tests/e2e/tx/benchmarks_test.go index 7cd0acae62b2..e16850f61952 100644 --- a/tests/e2e/tx/benchmarks_test.go +++ b/tests/e2e/tx/benchmarks_test.go @@ -8,7 +8,6 @@ import ( sdkmath "cosmossdk.io/math" "cosmossdk.io/simapp" - authclient "cosmossdk.io/x/auth/client" banktypes "cosmossdk.io/x/bank/types" "github.com/cosmos/cosmos-sdk/client" @@ -19,6 +18,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/tx" "github.com/cosmos/cosmos-sdk/types/tx/signing" + authclient "github.com/cosmos/cosmos-sdk/x/auth/client" ) type E2EBenchmarkSuite struct { diff --git a/tests/e2e/tx/service_test.go b/tests/e2e/tx/service_test.go index b9c500cf53de..b9e875f1173e 100644 --- a/tests/e2e/tx/service_test.go +++ b/tests/e2e/tx/service_test.go @@ -13,9 +13,6 @@ import ( "cosmossdk.io/math" "cosmossdk.io/simapp" - authclient "cosmossdk.io/x/auth/client" - authtest "cosmossdk.io/x/auth/client/testutil" - "cosmossdk.io/x/auth/migrations/legacytx" banktypes "cosmossdk.io/x/bank/types" "github.com/cosmos/cosmos-sdk/client" @@ -32,6 +29,9 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" "github.com/cosmos/cosmos-sdk/types/tx" "github.com/cosmos/cosmos-sdk/types/tx/signing" + authclient "github.com/cosmos/cosmos-sdk/x/auth/client" + authtest "github.com/cosmos/cosmos-sdk/x/auth/client/testutil" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) var bankMsgSendEventAction = fmt.Sprintf("message.action='%s'", sdk.MsgTypeURL(&banktypes.MsgSend{})) diff --git a/tests/go.mod b/tests/go.mod index 6735f3e336a2..ebb16686c750 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -1,14 +1,13 @@ module github.com/cosmos/cosmos-sdk/tests -go 1.22.2 +go 1.23 require ( cosmossdk.io/api v0.7.5 cosmossdk.io/collections v0.4.0 - cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 + cosmossdk.io/core v1.0.0 cosmossdk.io/depinject v1.0.0 - cosmossdk.io/errors v1.0.1 // indirect - cosmossdk.io/log v1.4.0 + cosmossdk.io/log v1.4.1 cosmossdk.io/math v1.3.0 cosmossdk.io/simapp v0.0.0-20230309163709-87da587416ba cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc @@ -19,7 +18,7 @@ require ( cosmossdk.io/x/tx v0.13.4 cosmossdk.io/x/upgrade v0.0.0-20230613133644-0a778132a60f github.com/cometbft/cometbft v1.0.0-rc1 - github.com/cosmos/cosmos-db v1.0.2 + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 github.com/cosmos/cosmos-proto v1.0.0-beta.5 // this version is not used as it is always replaced by the latest Cosmos SDK version github.com/cosmos/cosmos-sdk v0.53.0 @@ -27,7 +26,7 @@ require ( github.com/golang/mock v1.6.0 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 - google.golang.org/grpc v1.65.0 + google.golang.org/grpc v1.66.0 google.golang.org/protobuf v1.34.2 gotest.tools/v3 v3.5.1 pgregory.net/rapid v1.1.0 @@ -38,7 +37,6 @@ require ( cosmossdk.io/x/accounts v0.0.0-20240226161501-23359a0b6d91 cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5 cosmossdk.io/x/accounts/defaults/multisig v0.0.0-00010101000000-000000000000 - cosmossdk.io/x/auth v0.0.0-20240226161501-23359a0b6d91 cosmossdk.io/x/authz v0.0.0-00010101000000-000000000000 cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 @@ -58,14 +56,15 @@ require ( require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect - cloud.google.com/go v0.115.0 // indirect - cloud.google.com/go/auth v0.5.1 // indirect - cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect - cloud.google.com/go/compute/metadata v0.3.0 // indirect - cloud.google.com/go/iam v1.1.8 // indirect - cloud.google.com/go/storage v1.42.0 // indirect + cloud.google.com/go v0.115.1 // indirect + cloud.google.com/go/auth v0.8.1 // indirect + cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect + cloud.google.com/go/compute/metadata v0.5.0 // indirect + cloud.google.com/go/iam v1.1.13 // indirect + cloud.google.com/go/storage v1.43.0 // indirect cosmossdk.io/client/v2 v2.0.0-20230630094428-02b760776860 // indirect - cosmossdk.io/schema v0.1.1 // indirect + cosmossdk.io/errors v1.0.1 // indirect + cosmossdk.io/schema v0.2.0 // indirect cosmossdk.io/x/circuit v0.0.0-20230613133644-0a778132a60f // indirect cosmossdk.io/x/epochs v0.0.0-20240522060652-a1ae4c3e0337 // indirect filippo.io/edwards25519 v1.1.0 // indirect @@ -74,7 +73,7 @@ require ( github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/aws/aws-sdk-go v1.54.6 // indirect + github.com/aws/aws-sdk-go v1.55.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.2.0 // indirect @@ -95,7 +94,7 @@ require ( github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -125,10 +124,10 @@ require ( github.com/google/btree v1.1.2 // indirect github.com/google/flatbuffers v2.0.8+incompatible // indirect github.com/google/orderedcode v0.0.1 // indirect - github.com/google/s2a-go v0.1.7 // indirect + github.com/google/s2a-go v0.1.8 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect - github.com/googleapis/gax-go/v2 v2.12.5 // indirect + github.com/googleapis/gax-go/v2 v2.13.0 // indirect github.com/gorilla/handlers v1.5.2 // indirect github.com/gorilla/mux v1.8.1 // indirect github.com/gorilla/websocket v1.5.3 // indirect @@ -136,7 +135,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-getter v1.7.5 // indirect + github.com/hashicorp/go-getter v1.7.6 // indirect github.com/hashicorp/go-hclog v1.6.3 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-metrics v0.5.3 // indirect @@ -171,13 +170,13 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -202,27 +201,27 @@ require ( gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 // indirect - go.opentelemetry.io/otel v1.27.0 // indirect - go.opentelemetry.io/otel/metric v1.27.0 // indirect - go.opentelemetry.io/otel/trace v1.27.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect + go.opentelemetry.io/otel v1.28.0 // indirect + go.opentelemetry.io/otel/metric v1.28.0 // indirect + go.opentelemetry.io/otel/trace v1.28.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.26.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/oauth2 v0.21.0 // indirect + golang.org/x/oauth2 v0.22.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.24.0 // indirect golang.org/x/term v0.23.0 // indirect golang.org/x/text v0.17.0 // indirect - golang.org/x/time v0.5.0 // indirect + golang.org/x/time v0.6.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect - google.golang.org/api v0.185.0 // indirect - google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect + google.golang.org/api v0.192.0 // indirect + google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect sigs.k8s.io/yaml v1.4.0 // indirect @@ -245,7 +244,6 @@ replace ( cosmossdk.io/x/accounts => ../x/accounts cosmossdk.io/x/accounts/defaults/lockup => ../x/accounts/defaults/lockup cosmossdk.io/x/accounts/defaults/multisig => ../x/accounts/defaults/multisig - cosmossdk.io/x/auth => ../x/auth cosmossdk.io/x/authz => ../x/authz cosmossdk.io/x/bank => ../x/bank cosmossdk.io/x/circuit => ../x/circuit @@ -273,4 +271,5 @@ replace ( github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 // We always want to test against the latest version of the SDK. github.com/cosmos/cosmos-sdk => ../. + github.com/cosmos/iavl => github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e ) diff --git a/tests/go.sum b/tests/go.sum index 3372efa7b826..0a0037f619bd 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -34,8 +34,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.115.0 h1:CnFSK6Xo3lDYRoBKEcAtia6VSC837/ZkJuRduSFnr14= -cloud.google.com/go v0.115.0/go.mod h1:8jIM5vVgoAEoiVxQ/O4BFTfHqulPZgs/ufEzMcFMdWU= +cloud.google.com/go v0.115.1 h1:Jo0SM9cQnSkYfp44+v+NQXHpcHqlnRJk2qxh6yvxxxQ= +cloud.google.com/go v0.115.1/go.mod h1:DuujITeaufu3gL68/lOFIirVNJwQeyf5UXyi+Wbgknc= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= @@ -50,10 +50,10 @@ cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjby cloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY= cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw= cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI= -cloud.google.com/go/auth v0.5.1 h1:0QNO7VThG54LUzKiQxv8C6x1YX7lUrzlAa1nVLF8CIw= -cloud.google.com/go/auth v0.5.1/go.mod h1:vbZT8GjzDf3AVqCcQmqeeM32U9HBFc32vVVAbwDsa6s= -cloud.google.com/go/auth/oauth2adapt v0.2.2 h1:+TTV8aXpjeChS9M+aTtN/TjdQnzJvmzKFt//oWu7HX4= -cloud.google.com/go/auth/oauth2adapt v0.2.2/go.mod h1:wcYjgpZI9+Yu7LyYBg4pqSiaRkfEK3GQcpb7C/uyF1Q= +cloud.google.com/go/auth v0.8.1 h1:QZW9FjC5lZzN864p13YxvAtGUlQ+KgRL+8Sg45Z6vxo= +cloud.google.com/go/auth v0.8.1/go.mod h1:qGVp/Y3kDRSDZ5gFD/XPUfYQ9xW1iI7q8RIRoCyBbJc= +cloud.google.com/go/auth/oauth2adapt v0.2.4 h1:0GWE/FUsXhf6C+jAkWgYm7X9tK8cuEIfy19DBn6B6bY= +cloud.google.com/go/auth/oauth2adapt v0.2.4/go.mod h1:jC/jOpwFP6JBxhB3P5Rr0a9HLMC/Pe3eaL4NmdvqPtc= cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0= cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= @@ -76,8 +76,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc= -cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= +cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY= +cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= @@ -115,14 +115,14 @@ cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y97 cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= -cloud.google.com/go/iam v1.1.8 h1:r7umDwhj+BQyz0ScZMp4QrGXjSTI3ZINnpgU2nlB/K0= -cloud.google.com/go/iam v1.1.8/go.mod h1:GvE6lyMmfxXauzNq8NbgJbeVQNspG+tcdL/W8QO1+zE= +cloud.google.com/go/iam v1.1.13 h1:7zWBXG9ERbMLrzQBRhFliAV+kjcRToDTgQT3CTwYyv4= +cloud.google.com/go/iam v1.1.13/go.mod h1:K8mY0uSXwEXS30KrnVb+j54LB/ntfZu1dr+4zFMNbus= cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= cloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08= -cloud.google.com/go/longrunning v0.5.7 h1:WLbHekDbjK1fVFD3ibpFFVoyizlLRl73I7YKuAKilhU= -cloud.google.com/go/longrunning v0.5.7/go.mod h1:8GClkudohy1Fxm3owmBGid8W0pSgodEMwEAztp38Xng= +cloud.google.com/go/longrunning v0.5.11 h1:Havn1kGjz3whCfoD8dxMLP73Ph5w+ODyZB9RUsDxtGk= +cloud.google.com/go/longrunning v0.5.11/go.mod h1:rDn7//lmlfWV1Dx6IB4RatCPenTwwmqXuiP0/RgoEO4= cloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4= cloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w= cloud.google.com/go/memcache v1.4.0/go.mod h1:rTOfiGZtJX1AaFUrOgsMHX5kAzaTQ8azHiuDoTPzNsE= @@ -179,8 +179,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= -cloud.google.com/go/storage v1.42.0 h1:4QtGpplCVt1wz6g5o1ifXd656P5z+yNgzdw1tVfp0cU= -cloud.google.com/go/storage v1.42.0/go.mod h1:HjMXRFq65pGKFn6hxj6x3HCyR41uSB72Z0SO/Vn6JFQ= +cloud.google.com/go/storage v1.43.0 h1:CcxnSohZwizt4LCzQHWvBf1/kvtHUn7gk9QERXPyXFs= +cloud.google.com/go/storage v1.43.0/go.mod h1:ajvxEa7WmZS1PxvKRq4bq0tFT3vMd502JwstCcYv0Q0= cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= @@ -196,12 +196,12 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= -cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= +cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk= +cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -231,8 +231,8 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= -github.com/aws/aws-sdk-go v1.54.6 h1:HEYUib3yTt8E6vxjMWM3yAq5b+qjj/6aKA62mkgux9g= -github.com/aws/aws-sdk-go v1.54.6/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= +github.com/aws/aws-sdk-go v1.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU= +github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -306,8 +306,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/crypto v0.1.2 h1:Yn500sPY+9sKVdhiPUSDtt8JOpBGMB515dOmla4zfls= @@ -319,10 +319,10 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e h1:LEii0v/FxtXa/F7mRn+tijZ0zaXBPn2ZkKwb6Qm4rqE= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e/go.mod h1:3ywr0wDnWeD7MUH6qu50wZ5bxuKH3LBrGG4/lZX8lVY= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= @@ -514,8 +514,8 @@ github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= -github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= +github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM= +github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -534,8 +534,8 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99 github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= -github.com/googleapis/gax-go/v2 v2.12.5 h1:8gw9KZK8TiVKB6q3zHY3SBzLnrGp6HQjyfYBYGmXdxA= -github.com/googleapis/gax-go/v2 v2.12.5/go.mod h1:BUDKcWo+RaKq5SC9vVYL0wLADa3VcfswbOMMRmB9H3E= +github.com/googleapis/gax-go/v2 v2.13.0 h1:yitjD5f7jQHhyDsnhKEBU52NdvvdSeGzlAnDPT0hH1s= +github.com/googleapis/gax-go/v2 v2.13.0/go.mod h1:Z/fvTZXF8/uw7Xu5GuslPw+bplx6SS338j1Is2S+B7A= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= @@ -552,8 +552,8 @@ github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NM github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-getter v1.7.5 h1:dT58k9hQ/vbxNMwoI5+xFYAJuv6152UNvdHokfI5wE4= -github.com/hashicorp/go-getter v1.7.5/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-getter v1.7.6 h1:5jHuM+aH373XNtXl9TNTUH5Qd69Trve11tHIrB+6yj4= +github.com/hashicorp/go-getter v1.7.6/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= @@ -623,6 +623,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -695,8 +697,8 @@ github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4 github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba h1:3jPgmsFGBID1wFfU2AbYocNcN4wqU68UaHSdMjiw/7U= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= @@ -713,8 +715,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -723,8 +725,8 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -782,7 +784,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -824,21 +825,23 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0 h1:vS1Ao/R55RNV4O7TA2Qopok8yN+X0LIP6RVWLFkprck= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0/go.mod h1:BMsdeOxN04K0L5FNUBfjFdvwWGNe/rkmSwH4Aelu/X0= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 h1:9l89oX4ba9kHbBol3Xin3leYJ+252h0zszDtBwyKe2A= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0/go.mod h1:XLZfZboOJWHNKUv7eH0inh0E9VV6eWDFB/9yJyTLPp0= -go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= -go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= -go.opentelemetry.io/otel/metric v1.27.0 h1:hvj3vdEKyeCi4YaYfNjv2NUje8FqKqUY8IlF0FxV/ik= -go.opentelemetry.io/otel/metric v1.27.0/go.mod h1:mVFgmRlhljgBiuk/MP/oKylr4hs85GZAylncepAX/ak= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 h1:9G6E0TXzGFVfTnawRzrPl83iHOAV7L8NJiR8RSGYV1g= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0/go.mod h1:azvtTADFQJA8mX80jIH/akaE7h+dbm/sVuaHqN13w74= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= +go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= +go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= +go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= +go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= -go.opentelemetry.io/otel/trace v1.27.0 h1:IqYb813p7cmbHk0a5y6pD5JPakbVfftRXABGt5/Rscw= -go.opentelemetry.io/otel/trace v1.27.0/go.mod h1:6RiD1hkAprV4/q+yd2ln1HG9GoPx39SuvvstaLBl+l4= +go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= +go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= @@ -972,8 +975,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= -golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= +golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1094,8 +1097,8 @@ golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= +golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1163,8 +1166,6 @@ golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= -golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -1213,8 +1214,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.185.0 h1:ENEKk1k4jW8SmmaT6RE+ZasxmxezCrD5Vw4npvr+pAU= -google.golang.org/api v0.185.0/go.mod h1:HNfvIkJGlgrIlrbYkAm9W9IdkmKZjOTVh33YltygGbg= +google.golang.org/api v0.192.0 h1:PljqpNAfZaaSpS+TnANfnNAXKdzHM/B9bKhwRlo7JP0= +google.golang.org/api v0.192.0/go.mod h1:9VcphjvAxPKLmSxVSzPlSRXy/5ARMEw5bf58WoVXafQ= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1326,12 +1327,12 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4 h1:CUiCqkPw1nNrNQzCCG4WA65m0nAmQiwXHpub3dNyruU= -google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4/go.mod h1:EvuUDCulqGgV80RvP1BHuom+smhX4qtlhnNatHuroGQ= -google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 h1:MuYw1wJzT+ZkybKfaOXKp5hJiZDn2iHaXRw0mRYdHSc= -google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4/go.mod h1:px9SlOOZBg1wM1zdnr8jEL4CNGUBZ+ZKYtNPApNQc4c= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142 h1:oLiyxGgE+rt22duwci1+TG7bg2/L1LQsXwfjPlmuJA0= +google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142/go.mod h1:G11eXq53iI5Q+kyNOmCvnzBaxEA2Q/Ik5Tj7nqBE8j4= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -1367,8 +1368,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= diff --git a/tests/integration/auth/client/cli/suite_test.go b/tests/integration/auth/client/cli/suite_test.go index 2e59e9473323..b16d469ec445 100644 --- a/tests/integration/auth/client/cli/suite_test.go +++ b/tests/integration/auth/client/cli/suite_test.go @@ -13,9 +13,6 @@ import ( "cosmossdk.io/core/address" "cosmossdk.io/math" - "cosmossdk.io/x/auth" - authcli "cosmossdk.io/x/auth/client/cli" - authtestutil "cosmossdk.io/x/auth/client/testutil" "cosmossdk.io/x/bank" banktypes "cosmossdk.io/x/bank/types" "cosmossdk.io/x/gov" @@ -36,6 +33,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" testutilmod "github.com/cosmos/cosmos-sdk/types/module/testutil" "github.com/cosmos/cosmos-sdk/types/tx" + "github.com/cosmos/cosmos-sdk/x/auth" + authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli" + authtestutil "github.com/cosmos/cosmos-sdk/x/auth/client/testutil" "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" ) diff --git a/tests/integration/auth/keeper/msg_server_test.go b/tests/integration/auth/keeper/msg_server_test.go index fc93288c506b..d9985add6a61 100644 --- a/tests/integration/auth/keeper/msg_server_test.go +++ b/tests/integration/auth/keeper/msg_server_test.go @@ -15,10 +15,6 @@ import ( storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/accounts" baseaccount "cosmossdk.io/x/accounts/defaults/base" - "cosmossdk.io/x/auth" - authkeeper "cosmossdk.io/x/auth/keeper" - authsims "cosmossdk.io/x/auth/simulation" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/bank" bankkeeper "cosmossdk.io/x/bank/keeper" "cosmossdk.io/x/bank/testutil" @@ -36,6 +32,10 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/auth" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) type fixture struct { @@ -78,7 +78,7 @@ func initFixture(t *testing.T) *fixture { queryRouter := baseapp.NewGRPCQueryRouter() handler := directHandler{} - account := baseaccount.NewAccount("base", signing.NewHandlerMap(handler)) + account := baseaccount.NewAccount("base", signing.NewHandlerMap(handler), baseaccount.WithSecp256K1PubKey()) accountsKeeper, err := accounts.NewKeeper( cdc, runtime.NewEnvironment(runtime.NewKVStoreService(keys[accounts.StoreKey]), log.NewNopLogger(), runtime.EnvWithQueryRouterService(queryRouter), runtime.EnvWithMsgRouterService(router)), @@ -116,7 +116,7 @@ func initFixture(t *testing.T) *fixture { assert.NilError(t, bankKeeper.SetParams(newCtx, params)) accountsModule := accounts.NewAppModule(cdc, accountsKeeper) - authModule := auth.NewAppModule(cdc, authKeeper, accountsKeeper, authsims.RandomGenesisAccounts) + authModule := auth.NewAppModule(cdc, authKeeper, accountsKeeper, authsims.RandomGenesisAccounts, nil) bankModule := bank.NewAppModule(cdc, bankKeeper, authKeeper) integrationApp := integration.NewIntegrationApp(newCtx, logger, keys, cdc, diff --git a/tests/integration/bank/app_test.go b/tests/integration/bank/app_test.go index b4478a3e1f3d..6db4b4a0ff70 100644 --- a/tests/integration/bank/app_test.go +++ b/tests/integration/bank/app_test.go @@ -12,9 +12,6 @@ import ( "cosmossdk.io/log" sdkmath "cosmossdk.io/math" _ "cosmossdk.io/x/accounts" - _ "cosmossdk.io/x/auth" - _ "cosmossdk.io/x/auth/tx/config" - authtypes "cosmossdk.io/x/auth/types" bankkeeper "cosmossdk.io/x/bank/keeper" "cosmossdk.io/x/bank/testutil" "cosmossdk.io/x/bank/types" @@ -36,6 +33,9 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + _ "github.com/cosmos/cosmos-sdk/x/auth" + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) type ( diff --git a/tests/integration/bank/bench_test.go b/tests/integration/bank/bench_test.go index a52f7437351f..12ea9daa67ab 100644 --- a/tests/integration/bank/bench_test.go +++ b/tests/integration/bank/bench_test.go @@ -9,7 +9,6 @@ import ( abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" "github.com/stretchr/testify/require" - authtypes "cosmossdk.io/x/auth/types" _ "cosmossdk.io/x/bank" "cosmossdk.io/x/bank/testutil" "cosmossdk.io/x/bank/types" @@ -21,6 +20,7 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var moduleAccAddr = authtypes.NewModuleAddress(stakingtypes.BondedPoolName) diff --git a/tests/integration/bank/keeper/deterministic_test.go b/tests/integration/bank/keeper/deterministic_test.go index 130503b3dc41..de25231adbf2 100644 --- a/tests/integration/bank/keeper/deterministic_test.go +++ b/tests/integration/bank/keeper/deterministic_test.go @@ -12,12 +12,6 @@ import ( "cosmossdk.io/log" "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/auth" - authkeeper "cosmossdk.io/x/auth/keeper" - authsims "cosmossdk.io/x/auth/simulation" - authtestutil "cosmossdk.io/x/auth/testutil" - _ "cosmossdk.io/x/auth/tx/config" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/bank" "cosmossdk.io/x/bank/keeper" banktestutil "cosmossdk.io/x/bank/testutil" @@ -34,6 +28,12 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/auth" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" + authtestutil "github.com/cosmos/cosmos-sdk/x/auth/testutil" + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var ( @@ -116,7 +116,7 @@ func initDeterministicFixture(t *testing.T) *deterministicFixture { assert.NilError(t, bankKeeper.SetParams(newCtx, banktypes.DefaultParams())) - authModule := auth.NewAppModule(cdc, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts) + authModule := auth.NewAppModule(cdc, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts, nil) bankModule := bank.NewAppModule(cdc, bankKeeper, accountKeeper) integrationApp := integration.NewIntegrationApp(newCtx, logger, keys, cdc, diff --git a/tests/integration/distribution/appconfig.go b/tests/integration/distribution/appconfig.go index a7f023f81065..62cf1fc57b4b 100644 --- a/tests/integration/distribution/appconfig.go +++ b/tests/integration/distribution/appconfig.go @@ -1,18 +1,18 @@ package distribution_test import ( - _ "cosmossdk.io/x/accounts" // import as blank for app wiring - _ "cosmossdk.io/x/auth" // import as blank for app wiring - _ "cosmossdk.io/x/auth/tx/config" // import as blank for app wiring - _ "cosmossdk.io/x/bank" // import as blank for app wiring - _ "cosmossdk.io/x/consensus" // import as blank for app wiring - _ "cosmossdk.io/x/distribution" // import as blank for app wiring - _ "cosmossdk.io/x/mint" // import as blank for app wiring - _ "cosmossdk.io/x/protocolpool" // import as blank for app wiring - _ "cosmossdk.io/x/staking" // import as blank for app wiring + _ "cosmossdk.io/x/accounts" // import as blank for app wiring + _ "cosmossdk.io/x/bank" // import as blank for app wiring + _ "cosmossdk.io/x/consensus" // import as blank for app wiring + _ "cosmossdk.io/x/distribution" // import as blank for app wiring + _ "cosmossdk.io/x/mint" // import as blank for app wiring + _ "cosmossdk.io/x/protocolpool" // import as blank for app wiring + _ "cosmossdk.io/x/staking" // import as blank for app wiring "github.com/cosmos/cosmos-sdk/testutil/configurator" - _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring ) var AppConfig = configurator.NewAppConfig( diff --git a/tests/integration/distribution/keeper/msg_server_test.go b/tests/integration/distribution/keeper/msg_server_test.go index 9a85cac995e0..6b7e12430428 100644 --- a/tests/integration/distribution/keeper/msg_server_test.go +++ b/tests/integration/distribution/keeper/msg_server_test.go @@ -15,11 +15,6 @@ import ( "cosmossdk.io/log" "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/auth" - authkeeper "cosmossdk.io/x/auth/keeper" - authsims "cosmossdk.io/x/auth/simulation" - authtestutil "cosmossdk.io/x/auth/testutil" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/bank" bankkeeper "cosmossdk.io/x/bank/keeper" banktypes "cosmossdk.io/x/bank/types" @@ -43,6 +38,11 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/integration" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/auth" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" + authtestutil "github.com/cosmos/cosmos-sdk/x/auth/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var ( @@ -141,7 +141,7 @@ func initFixture(t *testing.T) *fixture { cdc, runtime.NewEnvironment(runtime.NewKVStoreService(keys[distrtypes.StoreKey]), logger), accountKeeper, bankKeeper, stakingKeeper, cometService, distrtypes.ModuleName, authority.String(), ) - authModule := auth.NewAppModule(cdc, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts) + authModule := auth.NewAppModule(cdc, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts, nil) bankModule := bank.NewAppModule(cdc, bankKeeper, accountKeeper) stakingModule := staking.NewAppModule(cdc, stakingKeeper, accountKeeper, bankKeeper) distrModule := distribution.NewAppModule(cdc, distrKeeper, accountKeeper, bankKeeper, stakingKeeper) diff --git a/tests/integration/distribution/module_test.go b/tests/integration/distribution/module_test.go index b1523a825e73..ce6e902c6b7c 100644 --- a/tests/integration/distribution/module_test.go +++ b/tests/integration/distribution/module_test.go @@ -7,11 +7,11 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/log" - authkeeper "cosmossdk.io/x/auth/keeper" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/distribution/types" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestItCreatesModuleAccountOnInitBlock(t *testing.T) { diff --git a/tests/integration/evidence/app_config.go b/tests/integration/evidence/app_config.go index def4a99d5423..02640cf9a0b1 100644 --- a/tests/integration/evidence/app_config.go +++ b/tests/integration/evidence/app_config.go @@ -1,17 +1,17 @@ package evidence_test import ( - _ "cosmossdk.io/x/accounts" // import as blank for app wiring - _ "cosmossdk.io/x/auth" // import as blank for app wiring - _ "cosmossdk.io/x/auth/tx/config" // import as blank for app wiring - _ "cosmossdk.io/x/bank" // import as blank for app wiring - _ "cosmossdk.io/x/consensus" // import as blank for app wiring - _ "cosmossdk.io/x/evidence" // import as blank for app wiring - _ "cosmossdk.io/x/slashing" // import as blank for app wiring - _ "cosmossdk.io/x/staking" // import as blank for app wiring + _ "cosmossdk.io/x/accounts" // import as blank for app wiring + _ "cosmossdk.io/x/bank" // import as blank for app wiring + _ "cosmossdk.io/x/consensus" // import as blank for app wiring + _ "cosmossdk.io/x/evidence" // import as blank for app wiring + _ "cosmossdk.io/x/slashing" // import as blank for app wiring + _ "cosmossdk.io/x/staking" // import as blank for app wiring "github.com/cosmos/cosmos-sdk/testutil/configurator" - _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring ) var AppConfig = configurator.NewAppConfig( diff --git a/tests/integration/evidence/keeper/infraction_test.go b/tests/integration/evidence/keeper/infraction_test.go index 607ee77b47e0..b9a71a8c785a 100644 --- a/tests/integration/evidence/keeper/infraction_test.go +++ b/tests/integration/evidence/keeper/infraction_test.go @@ -17,11 +17,6 @@ import ( "cosmossdk.io/core/header" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/auth" - authkeeper "cosmossdk.io/x/auth/keeper" - authsims "cosmossdk.io/x/auth/simulation" - authtestutil "cosmossdk.io/x/auth/testutil" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/bank" bankkeeper "cosmossdk.io/x/bank/keeper" banktypes "cosmossdk.io/x/bank/types" @@ -52,6 +47,11 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/auth" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" + authtestutil "github.com/cosmos/cosmos-sdk/x/auth/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var ( @@ -155,7 +155,7 @@ func initFixture(tb testing.TB) *fixture { router = router.AddRoute(evidencetypes.RouteEquivocation, testEquivocationHandler(evidenceKeeper)) evidenceKeeper.SetRouter(router) - authModule := auth.NewAppModule(cdc, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts) + authModule := auth.NewAppModule(cdc, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts, nil) bankModule := bank.NewAppModule(cdc, bankKeeper, accountKeeper) stakingModule := staking.NewAppModule(cdc, stakingKeeper, accountKeeper, bankKeeper) slashingModule := slashing.NewAppModule(cdc, slashingKeeper, accountKeeper, bankKeeper, stakingKeeper, cdc.InterfaceRegistry(), cometInfoService) diff --git a/tests/integration/example/example_test.go b/tests/integration/example/example_test.go index b8bac7848849..ced052da114f 100644 --- a/tests/integration/example/example_test.go +++ b/tests/integration/example/example_test.go @@ -13,11 +13,6 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/auth" - authkeeper "cosmossdk.io/x/auth/keeper" - authsims "cosmossdk.io/x/auth/simulation" - authtestutil "cosmossdk.io/x/auth/testutil" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/mint" mintkeeper "cosmossdk.io/x/mint/keeper" minttypes "cosmossdk.io/x/mint/types" @@ -29,6 +24,11 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/integration" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/auth" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" + authtestutil "github.com/cosmos/cosmos-sdk/x/auth/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) // Example shows how to use the integration test framework to test the integration of SDK modules. @@ -70,7 +70,7 @@ func Example() { ) // subspace is nil because we don't test params (which is legacy anyway) - authModule := auth.NewAppModule(encodingCfg.Codec, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts) + authModule := auth.NewAppModule(encodingCfg.Codec, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts, nil) // here bankkeeper and staking keeper is nil because we are not testing them // subspace is nil because we don't test params (which is legacy anyway) @@ -174,7 +174,7 @@ func Example_oneModule() { ) // subspace is nil because we don't test params (which is legacy anyway) - authModule := auth.NewAppModule(encodingCfg.Codec, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts) + authModule := auth.NewAppModule(encodingCfg.Codec, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts, nil) // create the application and register all the modules from the previous step integrationApp := integration.NewIntegrationApp( diff --git a/tests/integration/gov/abci_test.go b/tests/integration/gov/abci_test.go index 733d7236f9b7..ff1664ed4f0d 100644 --- a/tests/integration/gov/abci_test.go +++ b/tests/integration/gov/abci_test.go @@ -8,7 +8,6 @@ import ( "cosmossdk.io/collections" "cosmossdk.io/math" - authtypes "cosmossdk.io/x/auth/types" banktypes "cosmossdk.io/x/bank/types" "cosmossdk.io/x/gov/keeper" "cosmossdk.io/x/gov/types" @@ -19,6 +18,7 @@ import ( addresscodec "github.com/cosmos/cosmos-sdk/codec/address" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestUnregisteredProposal_InactiveProposalFails(t *testing.T) { diff --git a/tests/integration/gov/common_test.go b/tests/integration/gov/common_test.go index 746ca2bc6c3f..ced80fc6ad84 100644 --- a/tests/integration/gov/common_test.go +++ b/tests/integration/gov/common_test.go @@ -13,8 +13,6 @@ import ( sdklog "cosmossdk.io/log" "cosmossdk.io/math" _ "cosmossdk.io/x/accounts" - _ "cosmossdk.io/x/auth" - authtypes "cosmossdk.io/x/auth/types" _ "cosmossdk.io/x/bank" _ "cosmossdk.io/x/consensus" "cosmossdk.io/x/gov/types" @@ -29,6 +27,8 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/configurator" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/x/auth" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var ( diff --git a/tests/integration/gov/genesis_test.go b/tests/integration/gov/genesis_test.go index e54b3eb012a1..9092b46bd493 100644 --- a/tests/integration/gov/genesis_test.go +++ b/tests/integration/gov/genesis_test.go @@ -14,9 +14,6 @@ import ( "cosmossdk.io/log" sdkmath "cosmossdk.io/math" _ "cosmossdk.io/x/accounts" - _ "cosmossdk.io/x/auth" - authkeeper "cosmossdk.io/x/auth/keeper" - authtypes "cosmossdk.io/x/auth/types" _ "cosmossdk.io/x/bank" bankkeeper "cosmossdk.io/x/bank/keeper" banktypes "cosmossdk.io/x/bank/types" @@ -34,6 +31,9 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/configurator" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/x/auth" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) type suite struct { diff --git a/tests/integration/gov/keeper/common_test.go b/tests/integration/gov/keeper/common_test.go index 38d7b964f753..51b84406c141 100644 --- a/tests/integration/gov/keeper/common_test.go +++ b/tests/integration/gov/keeper/common_test.go @@ -6,7 +6,6 @@ import ( "gotest.tools/v3/assert" "cosmossdk.io/math" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/gov/types" v1 "cosmossdk.io/x/gov/types/v1" "cosmossdk.io/x/gov/types/v1beta1" @@ -14,6 +13,7 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var TestProposal = getTestProposal() diff --git a/tests/integration/gov/keeper/keeper_test.go b/tests/integration/gov/keeper/keeper_test.go index bb2f58979edf..84df68e4cc5e 100644 --- a/tests/integration/gov/keeper/keeper_test.go +++ b/tests/integration/gov/keeper/keeper_test.go @@ -10,11 +10,6 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/auth" - authkeeper "cosmossdk.io/x/auth/keeper" - authsims "cosmossdk.io/x/auth/simulation" - authtestutil "cosmossdk.io/x/auth/testutil" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/bank" bankkeeper "cosmossdk.io/x/bank/keeper" banktypes "cosmossdk.io/x/bank/types" @@ -37,6 +32,11 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/integration" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/auth" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" + authtestutil "github.com/cosmos/cosmos-sdk/x/auth/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) type fixture struct { @@ -142,7 +142,7 @@ func initFixture(tb testing.TB) *fixture { err = govKeeper.Params.Set(newCtx, v1.DefaultParams()) assert.NilError(tb, err) - authModule := auth.NewAppModule(cdc, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts) + authModule := auth.NewAppModule(cdc, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts, nil) bankModule := bank.NewAppModule(cdc, bankKeeper, accountKeeper) stakingModule := staking.NewAppModule(cdc, stakingKeeper, accountKeeper, bankKeeper) govModule := gov.NewAppModule(cdc, govKeeper, accountKeeper, bankKeeper, poolKeeper) diff --git a/tests/integration/gov/module_test.go b/tests/integration/gov/module_test.go index c1d41a0b6cb5..826f6a7d68d6 100644 --- a/tests/integration/gov/module_test.go +++ b/tests/integration/gov/module_test.go @@ -8,14 +8,14 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/log" _ "cosmossdk.io/x/accounts" - authkeeper "cosmossdk.io/x/auth/keeper" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/gov/types" _ "cosmossdk.io/x/mint" _ "cosmossdk.io/x/protocolpool" "github.com/cosmos/cosmos-sdk/testutil/configurator" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestItCreatesModuleAccountOnInitBlock(t *testing.T) { diff --git a/tests/integration/mint/app_config.go b/tests/integration/mint/app_config.go index 5c717ff9d37a..438b652f4ca5 100644 --- a/tests/integration/mint/app_config.go +++ b/tests/integration/mint/app_config.go @@ -1,16 +1,16 @@ package mint import ( - _ "cosmossdk.io/x/accounts" // import as blank for app wiring - _ "cosmossdk.io/x/auth" // import as blank for app wiring - _ "cosmossdk.io/x/auth/tx/config" // import as blank for app wiring - _ "cosmossdk.io/x/bank" // import as blank for app wiring - _ "cosmossdk.io/x/consensus" // import as blank for app wiring - _ "cosmossdk.io/x/mint" // import as blank for app wiring - _ "cosmossdk.io/x/staking" // import as blank for app wiring + _ "cosmossdk.io/x/accounts" // import as blank for app wiring + _ "cosmossdk.io/x/bank" // import as blank for app wiring + _ "cosmossdk.io/x/consensus" // import as blank for app wiring + _ "cosmossdk.io/x/mint" // import as blank for app wiring + _ "cosmossdk.io/x/staking" // import as blank for app wiring "github.com/cosmos/cosmos-sdk/testutil/configurator" - _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring ) var AppConfig = configurator.NewAppConfig( diff --git a/tests/integration/mint/module_test.go b/tests/integration/mint/module_test.go index 59a5c091a9f5..e0d9896ac149 100644 --- a/tests/integration/mint/module_test.go +++ b/tests/integration/mint/module_test.go @@ -7,11 +7,11 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/log" - authkeeper "cosmossdk.io/x/auth/keeper" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/mint/types" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestItCreatesModuleAccountOnInitBlock(t *testing.T) { diff --git a/tests/integration/protocolpool/app_config.go b/tests/integration/protocolpool/app_config.go index 15c814073e15..686a6b93dcd6 100644 --- a/tests/integration/protocolpool/app_config.go +++ b/tests/integration/protocolpool/app_config.go @@ -1,18 +1,18 @@ package protocolpool import ( - _ "cosmossdk.io/x/accounts" // import as blank for app wiring - _ "cosmossdk.io/x/auth" // import as blank for app wiring - _ "cosmossdk.io/x/auth/tx/config" // import as blank for app wiring - _ "cosmossdk.io/x/bank" // import as blank for app wiring - _ "cosmossdk.io/x/consensus" // import as blank for app wiring - _ "cosmossdk.io/x/distribution" // import as blank for app wiring - _ "cosmossdk.io/x/mint" // import as blank for app wiring - _ "cosmossdk.io/x/protocolpool" // import as blank for app wiring - _ "cosmossdk.io/x/staking" // import as blank for app wiring + _ "cosmossdk.io/x/accounts" // import as blank for app wiring + _ "cosmossdk.io/x/bank" // import as blank for app wiring + _ "cosmossdk.io/x/consensus" // import as blank for app wiring + _ "cosmossdk.io/x/distribution" // import as blank for app wiring + _ "cosmossdk.io/x/mint" // import as blank for app wiring + _ "cosmossdk.io/x/protocolpool" // import as blank for app wiring + _ "cosmossdk.io/x/staking" // import as blank for app wiring "github.com/cosmos/cosmos-sdk/testutil/configurator" - _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring ) var AppConfig = configurator.NewAppConfig( diff --git a/tests/integration/protocolpool/module_test.go b/tests/integration/protocolpool/module_test.go index b8148be37106..8a7afd427918 100644 --- a/tests/integration/protocolpool/module_test.go +++ b/tests/integration/protocolpool/module_test.go @@ -11,8 +11,6 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/log" "cosmossdk.io/math" - authkeeper "cosmossdk.io/x/auth/keeper" - authtypes "cosmossdk.io/x/auth/types" bankkeeper "cosmossdk.io/x/bank/keeper" "cosmossdk.io/x/mint/types" protocolpoolkeeper "cosmossdk.io/x/protocolpool/keeper" @@ -21,6 +19,8 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) // TestWithdrawAnytime tests if withdrawing funds many times vs withdrawing funds once diff --git a/tests/integration/rapidgen/rapidgen.go b/tests/integration/rapidgen/rapidgen.go index 86d3d988094a..e33e794b00f2 100644 --- a/tests/integration/rapidgen/rapidgen.go +++ b/tests/integration/rapidgen/rapidgen.go @@ -29,8 +29,6 @@ import ( stakingapi "cosmossdk.io/api/cosmos/staking/v1beta1" upgradeapi "cosmossdk.io/api/cosmos/upgrade/v1beta1" vestingapi "cosmossdk.io/api/cosmos/vesting/v1beta1" - authtypes "cosmossdk.io/x/auth/types" - vestingtypes "cosmossdk.io/x/auth/vesting/types" authztypes "cosmossdk.io/x/authz" banktypes "cosmossdk.io/x/bank/types" consensustypes "cosmossdk.io/x/consensus/types" @@ -46,6 +44,8 @@ import ( upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/crypto/keys/multisig" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" ) type GeneratedType struct { diff --git a/tests/integration/runtime/query_test.go b/tests/integration/runtime/query_test.go index f06c27b3f01e..22b261206c36 100644 --- a/tests/integration/runtime/query_test.go +++ b/tests/integration/runtime/query_test.go @@ -15,8 +15,6 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/log" _ "cosmossdk.io/x/accounts" - _ "cosmossdk.io/x/auth" - _ "cosmossdk.io/x/auth/tx/config" _ "cosmossdk.io/x/bank" _ "cosmossdk.io/x/consensus" _ "cosmossdk.io/x/staking" @@ -26,6 +24,8 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/configurator" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/x/auth" + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" ) type fixture struct { diff --git a/tests/integration/server/grpc/out_of_gas_test.go b/tests/integration/server/grpc/out_of_gas_test.go index 4a91d3e05201..3e26d54c4f1b 100644 --- a/tests/integration/server/grpc/out_of_gas_test.go +++ b/tests/integration/server/grpc/out_of_gas_test.go @@ -10,8 +10,6 @@ import ( "google.golang.org/grpc/metadata" _ "cosmossdk.io/x/accounts" - _ "cosmossdk.io/x/auth" - _ "cosmossdk.io/x/auth/tx/config" _ "cosmossdk.io/x/bank" banktypes "cosmossdk.io/x/bank/types" _ "cosmossdk.io/x/consensus" @@ -23,6 +21,8 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/network" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + _ "github.com/cosmos/cosmos-sdk/x/auth" + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" ) type IntegrationTestOutOfGasSuite struct { diff --git a/tests/integration/server/grpc/server_test.go b/tests/integration/server/grpc/server_test.go index f22793c56921..c0cc8748a6bd 100644 --- a/tests/integration/server/grpc/server_test.go +++ b/tests/integration/server/grpc/server_test.go @@ -13,9 +13,6 @@ import ( "google.golang.org/grpc/metadata" _ "cosmossdk.io/x/accounts" - _ "cosmossdk.io/x/auth" - authclient "cosmossdk.io/x/auth/client" - _ "cosmossdk.io/x/auth/tx/config" _ "cosmossdk.io/x/bank" banktypes "cosmossdk.io/x/bank/types" _ "cosmossdk.io/x/consensus" @@ -34,6 +31,9 @@ import ( grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" txtypes "github.com/cosmos/cosmos-sdk/types/tx" "github.com/cosmos/cosmos-sdk/types/tx/signing" + _ "github.com/cosmos/cosmos-sdk/x/auth" + authclient "github.com/cosmos/cosmos-sdk/x/auth/client" + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" ) type IntegrationTestSuite struct { diff --git a/tests/integration/slashing/abci_test.go b/tests/integration/slashing/abci_test.go index 2d45d09b1811..96e869743e5d 100644 --- a/tests/integration/slashing/abci_test.go +++ b/tests/integration/slashing/abci_test.go @@ -10,7 +10,6 @@ import ( coreheader "cosmossdk.io/core/header" "cosmossdk.io/depinject" "cosmossdk.io/log" - authkeeper "cosmossdk.io/x/auth/keeper" bankkeeper "cosmossdk.io/x/bank/keeper" "cosmossdk.io/x/slashing" slashingkeeper "cosmossdk.io/x/slashing/keeper" @@ -22,6 +21,7 @@ import ( "github.com/cosmos/cosmos-sdk/runtime" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" ) // TestBeginBlocker is a unit test function that tests the behavior of the BeginBlocker function. diff --git a/tests/integration/slashing/app_config.go b/tests/integration/slashing/app_config.go index 038672031f21..f649e196fb75 100644 --- a/tests/integration/slashing/app_config.go +++ b/tests/integration/slashing/app_config.go @@ -1,19 +1,19 @@ package slashing import ( - _ "cosmossdk.io/x/accounts" // import as blank for app wiring - _ "cosmossdk.io/x/auth" // import as blank for app wiring - _ "cosmossdk.io/x/auth/tx/config" // import as blank for app wiring - _ "cosmossdk.io/x/bank" // import as blank for app wiring - _ "cosmossdk.io/x/consensus" // import as blank for app wiring - _ "cosmossdk.io/x/distribution" // import as blank for app wiring - _ "cosmossdk.io/x/mint" // import as blank for app wiring - _ "cosmossdk.io/x/protocolpool" // import as blank for app wiring - _ "cosmossdk.io/x/slashing" // import as blank for app wiring - _ "cosmossdk.io/x/staking" // import as blank for app wiring + _ "cosmossdk.io/x/accounts" // import as blank for app wiring + _ "cosmossdk.io/x/bank" // import as blank for app wiring + _ "cosmossdk.io/x/consensus" // import as blank for app wiring + _ "cosmossdk.io/x/distribution" // import as blank for app wiring + _ "cosmossdk.io/x/mint" // import as blank for app wiring + _ "cosmossdk.io/x/protocolpool" // import as blank for app wiring + _ "cosmossdk.io/x/slashing" // import as blank for app wiring + _ "cosmossdk.io/x/staking" // import as blank for app wiring "github.com/cosmos/cosmos-sdk/testutil/configurator" - _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring ) var AppConfig = configurator.NewAppConfig( diff --git a/tests/integration/slashing/keeper/keeper_test.go b/tests/integration/slashing/keeper/keeper_test.go index 2e925d49c4e7..8ca08ddffec3 100644 --- a/tests/integration/slashing/keeper/keeper_test.go +++ b/tests/integration/slashing/keeper/keeper_test.go @@ -14,10 +14,6 @@ import ( coreheader "cosmossdk.io/core/header" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/auth" - authkeeper "cosmossdk.io/x/auth/keeper" - authtestutil "cosmossdk.io/x/auth/testutil" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/bank" bankkeeper "cosmossdk.io/x/bank/keeper" banktypes "cosmossdk.io/x/bank/types" @@ -41,6 +37,10 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/auth" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtestutil "github.com/cosmos/cosmos-sdk/x/auth/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) type fixture struct { diff --git a/tests/integration/slashing/keeper/slash_redelegation_test.go b/tests/integration/slashing/keeper/slash_redelegation_test.go index 96f6a50db081..b1a8ce858925 100644 --- a/tests/integration/slashing/keeper/slash_redelegation_test.go +++ b/tests/integration/slashing/keeper/slash_redelegation_test.go @@ -11,7 +11,6 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/log" "cosmossdk.io/math" - authkeeper "cosmossdk.io/x/auth/keeper" bankkeeper "cosmossdk.io/x/bank/keeper" banktestutil "cosmossdk.io/x/bank/testutil" distributionkeeper "cosmossdk.io/x/distribution/keeper" @@ -23,6 +22,7 @@ import ( "github.com/cosmos/cosmos-sdk/tests/integration/slashing" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" ) func TestSlashRedelegation(t *testing.T) { diff --git a/tests/integration/slashing/slashing_test.go b/tests/integration/slashing/slashing_test.go index bec39e2449f8..035d013b369e 100644 --- a/tests/integration/slashing/slashing_test.go +++ b/tests/integration/slashing/slashing_test.go @@ -10,7 +10,6 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/log" "cosmossdk.io/math" - authtypes "cosmossdk.io/x/auth/types" bankkeeper "cosmossdk.io/x/bank/keeper" "cosmossdk.io/x/slashing/keeper" "cosmossdk.io/x/slashing/types" @@ -24,6 +23,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/configurator" "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var ( @@ -114,5 +114,5 @@ func TestSlashingMsgs(t *testing.T) { headerInfo = header.Info{Height: app.LastBlockHeight() + 1} _, _, err = sims.SignCheckDeliver(t, txConfig, app.BaseApp, headerInfo, []sdk.Msg{unjailMsg}, "", []uint64{0}, []uint64{1}, false, false, priv1) require.Error(t, err) - require.True(t, errors.Is(types.ErrValidatorNotJailed, err)) + require.True(t, errors.Is(err, types.ErrValidatorNotJailed)) } diff --git a/tests/integration/staking/app_config.go b/tests/integration/staking/app_config.go index 7f936c4b69b7..9bfb400e6c09 100644 --- a/tests/integration/staking/app_config.go +++ b/tests/integration/staking/app_config.go @@ -1,19 +1,19 @@ package staking import ( - _ "cosmossdk.io/x/accounts" // import as blank for app wiring - _ "cosmossdk.io/x/auth" // import as blank for app wiring - _ "cosmossdk.io/x/auth/tx/config" // import as blank for app wiring - _ "cosmossdk.io/x/bank" // import as blank for app wiring - _ "cosmossdk.io/x/consensus" // import as blank for app wiring - _ "cosmossdk.io/x/distribution" // import as blank for app wiring - _ "cosmossdk.io/x/mint" // import as blank for app wiring - _ "cosmossdk.io/x/protocolpool" // import as blank for app wiring - _ "cosmossdk.io/x/slashing" // import as blank for app wiring - _ "cosmossdk.io/x/staking" // import as blank for app wiring + _ "cosmossdk.io/x/accounts" // import as blank for app wiring + _ "cosmossdk.io/x/bank" // import as blank for app wiring + _ "cosmossdk.io/x/consensus" // import as blank for app wiring + _ "cosmossdk.io/x/distribution" // import as blank for app wiring + _ "cosmossdk.io/x/mint" // import as blank for app wiring + _ "cosmossdk.io/x/protocolpool" // import as blank for app wiring + _ "cosmossdk.io/x/slashing" // import as blank for app wiring + _ "cosmossdk.io/x/staking" // import as blank for app wiring "github.com/cosmos/cosmos-sdk/testutil/configurator" - _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring ) var AppConfig = configurator.NewAppConfig( diff --git a/tests/integration/staking/keeper/common_test.go b/tests/integration/staking/keeper/common_test.go index c9fd09258d37..3558683b2131 100644 --- a/tests/integration/staking/keeper/common_test.go +++ b/tests/integration/staking/keeper/common_test.go @@ -12,11 +12,6 @@ import ( "cosmossdk.io/log" "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/auth" - authkeeper "cosmossdk.io/x/auth/keeper" - authsims "cosmossdk.io/x/auth/simulation" - authtestutil "cosmossdk.io/x/auth/testutil" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/bank" bankkeeper "cosmossdk.io/x/bank/keeper" banktypes "cosmossdk.io/x/bank/types" @@ -37,6 +32,11 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/auth" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" + authtestutil "github.com/cosmos/cosmos-sdk/x/auth/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var PKs = simtestutil.CreateTestPubKeys(500) @@ -164,7 +164,7 @@ func initFixture(tb testing.TB) *fixture { stakingKeeper := stakingkeeper.NewKeeper(cdc, runtime.NewEnvironment(runtime.NewKVStoreService(keys[types.StoreKey]), log.NewNopLogger(), runtime.EnvWithQueryRouterService(queryRouter), runtime.EnvWithMsgRouterService(msgRouter)), accountKeeper, bankKeeper, authority.String(), addresscodec.NewBech32Codec(sdk.Bech32PrefixValAddr), addresscodec.NewBech32Codec(sdk.Bech32PrefixConsAddr), runtime.NewContextAwareCometInfoService()) - authModule := auth.NewAppModule(cdc, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts) + authModule := auth.NewAppModule(cdc, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts, nil) bankModule := bank.NewAppModule(cdc, bankKeeper, accountKeeper) stakingModule := staking.NewAppModule(cdc, stakingKeeper, accountKeeper, bankKeeper) diff --git a/tests/integration/staking/keeper/deterministic_test.go b/tests/integration/staking/keeper/deterministic_test.go index 4219174fcd14..5d6f7c7d20d6 100644 --- a/tests/integration/staking/keeper/deterministic_test.go +++ b/tests/integration/staking/keeper/deterministic_test.go @@ -13,11 +13,6 @@ import ( "cosmossdk.io/log" "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/auth" - authkeeper "cosmossdk.io/x/auth/keeper" - authsims "cosmossdk.io/x/auth/simulation" - authtestutil "cosmossdk.io/x/auth/testutil" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/bank" bankkeeper "cosmossdk.io/x/bank/keeper" banktestutil "cosmossdk.io/x/bank/testutil" @@ -39,6 +34,11 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/auth" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" + authtestutil "github.com/cosmos/cosmos-sdk/x/auth/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var ( @@ -126,7 +126,7 @@ func initDeterministicFixture(t *testing.T) *deterministicFixture { stakingKeeper := stakingkeeper.NewKeeper(cdc, runtime.NewEnvironment(runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), log.NewNopLogger()), accountKeeper, bankKeeper, authority.String(), addresscodec.NewBech32Codec(sdk.Bech32PrefixValAddr), addresscodec.NewBech32Codec(sdk.Bech32PrefixConsAddr), runtime.NewContextAwareCometInfoService()) - authModule := auth.NewAppModule(cdc, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts) + authModule := auth.NewAppModule(cdc, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts, nil) bankModule := bank.NewAppModule(cdc, bankKeeper, accountKeeper) stakingModule := staking.NewAppModule(cdc, stakingKeeper, accountKeeper, bankKeeper) diff --git a/tests/integration/staking/keeper/slash_test.go b/tests/integration/staking/keeper/slash_test.go index 447cd8003b14..f9620b9e05cc 100644 --- a/tests/integration/staking/keeper/slash_test.go +++ b/tests/integration/staking/keeper/slash_test.go @@ -14,7 +14,6 @@ import ( "cosmossdk.io/log" "cosmossdk.io/math" _ "cosmossdk.io/x/accounts" - authkeeper "cosmossdk.io/x/auth/keeper" bankkeeper "cosmossdk.io/x/bank/keeper" banktestutil "cosmossdk.io/x/bank/testutil" _ "cosmossdk.io/x/consensus" @@ -32,6 +31,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/configurator" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" ) // bootstrapSlashTest creates 3 validators and bootstrap the app. diff --git a/tests/integration/staking/module_test.go b/tests/integration/staking/module_test.go index cd864646062e..4eaaefd0be3e 100644 --- a/tests/integration/staking/module_test.go +++ b/tests/integration/staking/module_test.go @@ -7,11 +7,11 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/log" - authKeeper "cosmossdk.io/x/auth/keeper" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/staking/types" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + authKeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestItCreatesModuleAccountOnInitBlock(t *testing.T) { diff --git a/tests/integration/staking/simulation/operations_test.go b/tests/integration/staking/simulation/operations_test.go index 023b050034e4..a5a6fbc41e14 100644 --- a/tests/integration/staking/simulation/operations_test.go +++ b/tests/integration/staking/simulation/operations_test.go @@ -17,8 +17,6 @@ import ( "cosmossdk.io/depinject" sdklog "cosmossdk.io/log" "cosmossdk.io/math" - authkeeper "cosmossdk.io/x/auth/keeper" - authtypes "cosmossdk.io/x/auth/types" bankkeeper "cosmossdk.io/x/bank/keeper" banktestutil "cosmossdk.io/x/bank/testutil" distrkeeper "cosmossdk.io/x/distribution/keeper" @@ -40,6 +38,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) type SimTestSuite struct { diff --git a/tests/integration/tx/aminojson/aminojson_test.go b/tests/integration/tx/aminojson/aminojson_test.go index 3fbbc33a8eb7..ec218ca47da3 100644 --- a/tests/integration/tx/aminojson/aminojson_test.go +++ b/tests/integration/tx/aminojson/aminojson_test.go @@ -33,13 +33,6 @@ import ( txv1beta1 "cosmossdk.io/api/cosmos/tx/v1beta1" vestingapi "cosmossdk.io/api/cosmos/vesting/v1beta1" "cosmossdk.io/math" - "cosmossdk.io/x/auth" - "cosmossdk.io/x/auth/migrations/legacytx" - "cosmossdk.io/x/auth/signing" - "cosmossdk.io/x/auth/tx" - authtypes "cosmossdk.io/x/auth/types" - "cosmossdk.io/x/auth/vesting" - vestingtypes "cosmossdk.io/x/auth/vesting/types" authztypes "cosmossdk.io/x/authz" authzmodule "cosmossdk.io/x/authz/module" "cosmossdk.io/x/bank" @@ -75,6 +68,13 @@ import ( "github.com/cosmos/cosmos-sdk/types/bech32" "github.com/cosmos/cosmos-sdk/types/module/testutil" signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" + "github.com/cosmos/cosmos-sdk/x/auth/signing" + "github.com/cosmos/cosmos-sdk/x/auth/tx" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/auth/vesting" + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" ) // TestAminoJSON_Equivalence tests that x/tx/Encoder encoding is equivalent to the legacy Encoder encoding. diff --git a/tests/integration/tx/decode_test.go b/tests/integration/tx/decode_test.go index e7c6b14e66c3..3b58b5c829d7 100644 --- a/tests/integration/tx/decode_test.go +++ b/tests/integration/tx/decode_test.go @@ -12,9 +12,6 @@ import ( msgv1 "cosmossdk.io/api/cosmos/msg/v1" "cosmossdk.io/math" - "cosmossdk.io/x/auth" - "cosmossdk.io/x/auth/migrations/legacytx" - "cosmossdk.io/x/auth/vesting" authzmodule "cosmossdk.io/x/authz/module" "cosmossdk.io/x/bank" "cosmossdk.io/x/consensus" @@ -39,6 +36,9 @@ import ( "github.com/cosmos/cosmos-sdk/types/module/testutil" txtypes "github.com/cosmos/cosmos-sdk/types/tx" "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" + "github.com/cosmos/cosmos-sdk/x/auth/vesting" ) // TestDecode tests that the tx decoder can decode all the txs in the test suite. diff --git a/tests/integration/types/pagination_test.go b/tests/integration/types/pagination_test.go index 7e7c53b3dfa1..2ab998fd1170 100644 --- a/tests/integration/types/pagination_test.go +++ b/tests/integration/types/pagination_test.go @@ -13,8 +13,6 @@ import ( "cosmossdk.io/math" "cosmossdk.io/store/prefix" _ "cosmossdk.io/x/accounts" - _ "cosmossdk.io/x/auth" - authkeeper "cosmossdk.io/x/auth/keeper" _ "cosmossdk.io/x/bank" bankkeeper "cosmossdk.io/x/bank/keeper" "cosmossdk.io/x/bank/testutil" @@ -31,6 +29,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/cosmos/cosmos-sdk/x/auth" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" ) const ( diff --git a/tests/sims/authz/operations_test.go b/tests/sims/authz/operations_test.go index 7e59d00a827f..3769d30c798b 100644 --- a/tests/sims/authz/operations_test.go +++ b/tests/sims/authz/operations_test.go @@ -12,9 +12,6 @@ import ( coretesting "cosmossdk.io/core/testing" "cosmossdk.io/depinject" _ "cosmossdk.io/x/accounts" // import as blank for app wiring - _ "cosmossdk.io/x/auth" // import as blank for app wiring - authkeeper "cosmossdk.io/x/auth/keeper" - _ "cosmossdk.io/x/auth/tx/config" // import as blank for app wiring "cosmossdk.io/x/authz" authzkeeper "cosmossdk.io/x/authz/keeper" _ "cosmossdk.io/x/authz/module" // import as blank for app wiring @@ -36,7 +33,10 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring ) var AppConfig = configurator.NewAppConfig( diff --git a/tests/sims/bank/operations_test.go b/tests/sims/bank/operations_test.go index 0243cf19dd40..e2177fb14a20 100644 --- a/tests/sims/bank/operations_test.go +++ b/tests/sims/bank/operations_test.go @@ -10,8 +10,6 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/log" _ "cosmossdk.io/x/accounts" - _ "cosmossdk.io/x/auth" - _ "cosmossdk.io/x/auth/tx/config" _ "cosmossdk.io/x/bank" "cosmossdk.io/x/bank/keeper" "cosmossdk.io/x/bank/simulation" @@ -27,6 +25,8 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + _ "github.com/cosmos/cosmos-sdk/x/auth" + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" ) type SimTestSuite struct { diff --git a/tests/sims/distribution/app_config.go b/tests/sims/distribution/app_config.go index 8c97052076ba..989d74b74f5a 100644 --- a/tests/sims/distribution/app_config.go +++ b/tests/sims/distribution/app_config.go @@ -1,18 +1,18 @@ package distribution import ( - _ "cosmossdk.io/x/accounts" // import as blank for app wiring - _ "cosmossdk.io/x/auth" // import as blank for app wiring - _ "cosmossdk.io/x/auth/tx/config" // import as blank for app wiring - _ "cosmossdk.io/x/bank" // import as blank for app wiring - _ "cosmossdk.io/x/consensus" // import as blank for app wiring - _ "cosmossdk.io/x/distribution" // import as blank for app wiring - _ "cosmossdk.io/x/mint" // import as blank for app wiring - _ "cosmossdk.io/x/protocolpool" // import as blank for app wiring - _ "cosmossdk.io/x/staking" // import as blank for app wiring + _ "cosmossdk.io/x/accounts" // import as blank for app wiring + _ "cosmossdk.io/x/bank" // import as blank for app wiring + _ "cosmossdk.io/x/consensus" // import as blank for app wiring + _ "cosmossdk.io/x/distribution" // import as blank for app wiring + _ "cosmossdk.io/x/mint" // import as blank for app wiring + _ "cosmossdk.io/x/protocolpool" // import as blank for app wiring + _ "cosmossdk.io/x/staking" // import as blank for app wiring "github.com/cosmos/cosmos-sdk/testutil/configurator" - _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring ) var AppConfig = configurator.NewAppConfig( diff --git a/tests/sims/distribution/operations_test.go b/tests/sims/distribution/operations_test.go index a5451da0866b..972217c6cf37 100644 --- a/tests/sims/distribution/operations_test.go +++ b/tests/sims/distribution/operations_test.go @@ -11,7 +11,6 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/log" "cosmossdk.io/math" - authkeeper "cosmossdk.io/x/auth/keeper" bankkeeper "cosmossdk.io/x/bank/keeper" banktestutil "cosmossdk.io/x/bank/testutil" "cosmossdk.io/x/distribution/keeper" @@ -27,6 +26,7 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" ) // TestWeightedOperations tests the weights of the operations. diff --git a/tests/sims/feegrant/operations_test.go b/tests/sims/feegrant/operations_test.go index d280cd6c40ba..11b4f39615c8 100644 --- a/tests/sims/feegrant/operations_test.go +++ b/tests/sims/feegrant/operations_test.go @@ -12,9 +12,6 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/log" _ "cosmossdk.io/x/accounts" // import as blank for app wiring - _ "cosmossdk.io/x/auth" - authkeeper "cosmossdk.io/x/auth/keeper" - _ "cosmossdk.io/x/auth/tx/config" _ "cosmossdk.io/x/bank" bankkeeper "cosmossdk.io/x/bank/keeper" banktestutil "cosmossdk.io/x/bank/testutil" @@ -28,13 +25,15 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" - codecaddress "github.com/cosmos/cosmos-sdk/codec/address" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/testutil/configurator" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + _ "github.com/cosmos/cosmos-sdk/x/auth" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" _ "github.com/cosmos/cosmos-sdk/x/genutil" ) @@ -101,9 +100,8 @@ func (suite *SimTestSuite) TestWeightedOperations() { appParams := make(simtypes.AppParams) weightedOps := simulation.WeightedOperations( - suite.interfaceRegistry, - appParams, suite.cdc, suite.txConfig, suite.accountKeeper, - suite.bankKeeper, suite.feegrantKeeper, codecaddress.NewBech32Codec("cosmos"), + appParams, suite.txConfig, suite.accountKeeper, + suite.bankKeeper, suite.feegrantKeeper, ) s := rand.NewSource(1) @@ -153,7 +151,7 @@ func (suite *SimTestSuite) TestSimulateMsgGrantAllowance() { require.NoError(err) // execute operation - op := simulation.SimulateMsgGrantAllowance(codec.NewProtoCodec(suite.interfaceRegistry), suite.txConfig, suite.accountKeeper, suite.bankKeeper, suite.feegrantKeeper) + op := simulation.SimulateMsgGrantAllowance(suite.txConfig, suite.accountKeeper, suite.bankKeeper, suite.feegrantKeeper) operationMsg, futureOperations, err := op(r, app.BaseApp, ctx.WithHeaderInfo(header.Info{Time: time.Now()}), accounts, "") require.NoError(err) @@ -197,7 +195,7 @@ func (suite *SimTestSuite) TestSimulateMsgRevokeAllowance() { require.NoError(err) // execute operation - op := simulation.SimulateMsgRevokeAllowance(codec.NewProtoCodec(suite.interfaceRegistry), suite.txConfig, suite.accountKeeper, suite.bankKeeper, suite.feegrantKeeper) + op := simulation.SimulateMsgRevokeAllowance(suite.txConfig, suite.accountKeeper, suite.bankKeeper, suite.feegrantKeeper) operationMsg, futureOperations, err := op(r, app.BaseApp, ctx, accounts, "") require.NoError(err) diff --git a/tests/sims/gov/operations_test.go b/tests/sims/gov/operations_test.go index 93159e6f5206..95f99f33ab19 100644 --- a/tests/sims/gov/operations_test.go +++ b/tests/sims/gov/operations_test.go @@ -15,9 +15,6 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/log" _ "cosmossdk.io/x/accounts" - _ "cosmossdk.io/x/auth" - authkeeper "cosmossdk.io/x/auth/keeper" - _ "cosmossdk.io/x/auth/tx/config" _ "cosmossdk.io/x/bank" bankkeeper "cosmossdk.io/x/bank/keeper" "cosmossdk.io/x/bank/testutil" @@ -38,6 +35,9 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + _ "github.com/cosmos/cosmos-sdk/x/auth" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" ) var ( diff --git a/tests/sims/nft/app_config.go b/tests/sims/nft/app_config.go index 83f60f874c0d..7b3a4bb869b3 100644 --- a/tests/sims/nft/app_config.go +++ b/tests/sims/nft/app_config.go @@ -1,17 +1,17 @@ package nft import ( - _ "cosmossdk.io/x/accounts" // import as blank for app wiring - _ "cosmossdk.io/x/auth" // import as blank for app wiring - _ "cosmossdk.io/x/auth/tx/config" // import as blank for app wiring - _ "cosmossdk.io/x/bank" // import as blank for app wiring - _ "cosmossdk.io/x/consensus" // import as blank for app wiring - _ "cosmossdk.io/x/mint" // import as blank for app wiring - _ "cosmossdk.io/x/nft/module" // import as blank for app wiring - _ "cosmossdk.io/x/staking" // import as blank for app wiring + _ "cosmossdk.io/x/accounts" // import as blank for app wiring + _ "cosmossdk.io/x/bank" // import as blank for app wiring + _ "cosmossdk.io/x/consensus" // import as blank for app wiring + _ "cosmossdk.io/x/mint" // import as blank for app wiring + _ "cosmossdk.io/x/nft/module" // import as blank for app wiring + _ "cosmossdk.io/x/staking" // import as blank for app wiring "github.com/cosmos/cosmos-sdk/testutil/configurator" - _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring ) var AppConfig = configurator.NewAppConfig( diff --git a/tests/sims/nft/operations_test.go b/tests/sims/nft/operations_test.go index ee2e92603645..1fc693200c85 100644 --- a/tests/sims/nft/operations_test.go +++ b/tests/sims/nft/operations_test.go @@ -11,7 +11,6 @@ import ( "cosmossdk.io/core/header" "cosmossdk.io/depinject" "cosmossdk.io/log" - authkeeper "cosmossdk.io/x/auth/keeper" bankkeeper "cosmossdk.io/x/bank/keeper" banktestutil "cosmossdk.io/x/bank/testutil" "cosmossdk.io/x/nft" @@ -26,6 +25,7 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" ) type SimTestSuite struct { diff --git a/tests/sims/protocolpool/app_config.go b/tests/sims/protocolpool/app_config.go index e388d4102e24..d8b1ace75263 100644 --- a/tests/sims/protocolpool/app_config.go +++ b/tests/sims/protocolpool/app_config.go @@ -1,18 +1,18 @@ package protocolpool import ( - _ "cosmossdk.io/x/accounts" // import as blank for app wiring - _ "cosmossdk.io/x/auth" // import as blank for app wiring - _ "cosmossdk.io/x/auth/tx/config" // import as blank for app wiring - _ "cosmossdk.io/x/bank" // import as blank for app wiring - _ "cosmossdk.io/x/consensus" // import as blank for app wiring - _ "cosmossdk.io/x/distribution" // import as blank for app wiring - _ "cosmossdk.io/x/mint" // import as blank for app wiring - _ "cosmossdk.io/x/protocolpool" // import as blank for app wiring - _ "cosmossdk.io/x/staking" // import as blank for app wiring + _ "cosmossdk.io/x/accounts" // import as blank for app wiring + _ "cosmossdk.io/x/bank" // import as blank for app wiring + _ "cosmossdk.io/x/consensus" // import as blank for app wiring + _ "cosmossdk.io/x/distribution" // import as blank for app wiring + _ "cosmossdk.io/x/mint" // import as blank for app wiring + _ "cosmossdk.io/x/protocolpool" // import as blank for app wiring + _ "cosmossdk.io/x/staking" // import as blank for app wiring "github.com/cosmos/cosmos-sdk/testutil/configurator" - _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring ) var AppConfig = configurator.NewAppConfig( diff --git a/tests/sims/protocolpool/operations_test.go b/tests/sims/protocolpool/operations_test.go index bdfaf0970c90..dffebefd97b6 100644 --- a/tests/sims/protocolpool/operations_test.go +++ b/tests/sims/protocolpool/operations_test.go @@ -9,7 +9,6 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/log" - authkeeper "cosmossdk.io/x/auth/keeper" bankkeeper "cosmossdk.io/x/bank/keeper" banktestutil "cosmossdk.io/x/bank/testutil" "cosmossdk.io/x/protocolpool/keeper" @@ -23,6 +22,7 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" ) type suite struct { diff --git a/tests/sims/slashing/app_config.go b/tests/sims/slashing/app_config.go index 038672031f21..f649e196fb75 100644 --- a/tests/sims/slashing/app_config.go +++ b/tests/sims/slashing/app_config.go @@ -1,19 +1,19 @@ package slashing import ( - _ "cosmossdk.io/x/accounts" // import as blank for app wiring - _ "cosmossdk.io/x/auth" // import as blank for app wiring - _ "cosmossdk.io/x/auth/tx/config" // import as blank for app wiring - _ "cosmossdk.io/x/bank" // import as blank for app wiring - _ "cosmossdk.io/x/consensus" // import as blank for app wiring - _ "cosmossdk.io/x/distribution" // import as blank for app wiring - _ "cosmossdk.io/x/mint" // import as blank for app wiring - _ "cosmossdk.io/x/protocolpool" // import as blank for app wiring - _ "cosmossdk.io/x/slashing" // import as blank for app wiring - _ "cosmossdk.io/x/staking" // import as blank for app wiring + _ "cosmossdk.io/x/accounts" // import as blank for app wiring + _ "cosmossdk.io/x/bank" // import as blank for app wiring + _ "cosmossdk.io/x/consensus" // import as blank for app wiring + _ "cosmossdk.io/x/distribution" // import as blank for app wiring + _ "cosmossdk.io/x/mint" // import as blank for app wiring + _ "cosmossdk.io/x/protocolpool" // import as blank for app wiring + _ "cosmossdk.io/x/slashing" // import as blank for app wiring + _ "cosmossdk.io/x/staking" // import as blank for app wiring "github.com/cosmos/cosmos-sdk/testutil/configurator" - _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring + _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring ) var AppConfig = configurator.NewAppConfig( diff --git a/tests/sims/slashing/operations_test.go b/tests/sims/slashing/operations_test.go index b0df7052dab2..f4b6c31773bd 100644 --- a/tests/sims/slashing/operations_test.go +++ b/tests/sims/slashing/operations_test.go @@ -16,7 +16,6 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/log" "cosmossdk.io/math" - authkeeper "cosmossdk.io/x/auth/keeper" bankkeeper "cosmossdk.io/x/bank/keeper" banktestutil "cosmossdk.io/x/bank/testutil" distributionkeeper "cosmossdk.io/x/distribution/keeper" @@ -37,6 +36,7 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" ) type SimTestSuite struct { diff --git a/tests/systemtests/cli.go b/tests/systemtests/cli.go index bae6c55eaf73..871d810ea4a3 100644 --- a/tests/systemtests/cli.go +++ b/tests/systemtests/cli.go @@ -8,6 +8,7 @@ import ( "os" "os/exec" "path/filepath" + "slices" "strings" "testing" "time" @@ -15,7 +16,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/tidwall/gjson" - "golang.org/x/exp/slices" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -223,7 +223,7 @@ func (c CLIWrapper) runWithInput(args []string, input io.Reader) (output string, cmd := exec.Command(locateExecutable(c.execBinary), args...) //nolint:gosec // test code only cmd.Dir = WorkDir cmd.Stdin = input - return cmd.Output() + return cmd.CombinedOutput() }() gotOut = filterProtoNoise(gotOut) ok = c.assertErrorFn(c.t, gotErr, string(gotOut)) diff --git a/tests/systemtests/go.mod b/tests/systemtests/go.mod index aa6ac25a86c8..25f22265b448 100644 --- a/tests/systemtests/go.mod +++ b/tests/systemtests/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/tests/systemtests -go 1.22 +go 1.23 require ( github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect @@ -13,14 +13,14 @@ require ( github.com/gorilla/mux v1.8.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/spf13/cast v1.7.0 // indirect github.com/spf13/cobra v1.8.1 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/testify v1.9.0 github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/grpc v1.65.0 // indirect + google.golang.org/grpc v1.66.0 // indirect ) require ( @@ -29,7 +29,6 @@ require ( github.com/creachadair/tomledit v0.0.26 github.com/tidwall/gjson v1.14.2 github.com/tidwall/sjson v1.2.5 - golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc ) require ( @@ -38,7 +37,7 @@ require ( cosmossdk.io/core v0.11.0 // indirect cosmossdk.io/depinject v1.0.0 // indirect cosmossdk.io/errors v1.0.1 // indirect - cosmossdk.io/log v1.4.0 // indirect + cosmossdk.io/log v1.4.1 // indirect cosmossdk.io/store v1.1.0 // indirect cosmossdk.io/x/tx v0.13.3-0.20240419091757-db5906b1e894 // indirect filippo.io/edwards25519 v1.0.0 // indirect @@ -59,9 +58,9 @@ require ( github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/cometbft/cometbft-db v0.9.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-db v1.0.2 // indirect + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.1.2 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -105,7 +104,7 @@ require ( github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.7 // indirect @@ -121,11 +120,11 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -147,13 +146,14 @@ require ( go.etcd.io/bbolt v1.3.8 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.26.0 // indirect + golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.24.0 // indirect golang.org/x/term v0.23.0 // indirect golang.org/x/text v0.17.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/tests/systemtests/go.sum b/tests/systemtests/go.sum index 5c066ab6f8ba..5e0a5a200982 100644 --- a/tests/systemtests/go.sum +++ b/tests/systemtests/go.sum @@ -10,8 +10,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.1.0 h1:LnKwgYMc9BInn9PhpTFEQVbL9UK475G2H911CGGnWHk= @@ -139,8 +139,8 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/cosmos-sdk v0.50.6 h1:efR3MsvMHX5sxS3be+hOobGk87IzlZbSpsI2x/Vw3hk= @@ -154,8 +154,8 @@ github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fr github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.1.4 h1:Z0cVVjeQqOUp78/nWt/uhQy83vYluWlAMGQ4zbH9G34= github.com/cosmos/iavl v1.1.4/go.mod h1:vCYmRQUJU1wwj0oRD3wMEtOM9sJNDP+GFMaXmIxZ/rU= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= @@ -442,8 +442,8 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -454,6 +454,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= @@ -571,8 +573,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 h1:jik8PHtAIsPlCRJjJzl4udgEf7hawInF9texMeO2jrU= @@ -597,8 +599,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -613,8 +615,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -689,8 +691,6 @@ github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3 github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -699,10 +699,7 @@ 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/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -948,10 +945,10 @@ google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -969,8 +966,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/tests/systemtests/system.go b/tests/systemtests/system.go index bc8f4351b33d..8505d20d7868 100644 --- a/tests/systemtests/system.go +++ b/tests/systemtests/system.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "maps" "os" "os/exec" "path/filepath" @@ -23,7 +24,6 @@ import ( tmtypes "github.com/cometbft/cometbft/types" "github.com/stretchr/testify/require" "github.com/tidwall/sjson" - "golang.org/x/exp/maps" "github.com/cosmos/cosmos-sdk/server" sdk "github.com/cosmos/cosmos-sdk/types" @@ -247,7 +247,7 @@ func (s *SystemUnderTest) AwaitUpgradeInfo(t *testing.T) { case err == nil: found = true case !os.IsNotExist(err): - t.Fatalf(err.Error()) + t.Fatal(err.Error()) } }) time.Sleep(s.blockTime / 2) @@ -336,7 +336,7 @@ func (s *SystemUnderTest) withEachPid(cb func(p *os.Process)) { pids := maps.Keys(s.pids) s.pidsLock.RUnlock() - for _, pid := range pids { + for pid := range pids { p, err := os.FindProcess(pid) if err != nil { continue diff --git a/tests/systemtests/unordered_tx_test.go b/tests/systemtests/unordered_tx_test.go index 4b22df92b0a5..6b1a9c743e7d 100644 --- a/tests/systemtests/unordered_tx_test.go +++ b/tests/systemtests/unordered_tx_test.go @@ -12,6 +12,7 @@ import ( ) func TestUnorderedTXDuplicate(t *testing.T) { + t.Skip("The unordered tx antehanlder is missing in v2") // scenario: test unordered tx duplicate // given a running chain with a tx in the unordered tx pool // when a new tx with the same hash is broadcasted diff --git a/testutil/cli/cmd.go b/testutil/cli/cmd.go index 90093fb0ec8b..f401902344f8 100644 --- a/testutil/cli/cmd.go +++ b/testutil/cli/cmd.go @@ -113,7 +113,7 @@ func SubmitTestTx(clientCtx client.Context, msg proto.Message, from sdk.AccAddre return nil, err } - err = tx.Sign(context.Background(), txFactory, keyRecord.Name, txBuilder, true) + err = tx.Sign(clientCtx, txFactory, keyRecord.Name, txBuilder, true) if err != nil { return nil, err } diff --git a/testutil/cli/tx.go b/testutil/cli/tx.go index 1adf81bd0e07..73f0f8867670 100644 --- a/testutil/cli/tx.go +++ b/testutil/cli/tx.go @@ -3,12 +3,11 @@ package cli import ( "fmt" - authcli "cosmossdk.io/x/auth/client/cli" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/testutil/network" sdk "github.com/cosmos/cosmos-sdk/types" + authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli" ) // CheckTxCode verifies that the transaction result returns a specific code diff --git a/testutil/integration/router.go b/testutil/integration/router.go index 952d371df191..02562a85517e 100644 --- a/testutil/integration/router.go +++ b/testutil/integration/router.go @@ -15,8 +15,6 @@ import ( "cosmossdk.io/store" "cosmossdk.io/store/metrics" storetypes "cosmossdk.io/store/types" - authtx "cosmossdk.io/x/auth/tx" - authtypes "cosmossdk.io/x/auth/types" consensusparamkeeper "cosmossdk.io/x/consensus/keeper" consensusparamtypes "cosmossdk.io/x/consensus/types" @@ -27,6 +25,8 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) const appName = "integration-app" diff --git a/testutil/mock/types_mock_appmodule.go b/testutil/mock/types_mock_appmodule.go index b0b94179ae99..016660bb0f18 100644 --- a/testutil/mock/types_mock_appmodule.go +++ b/testutil/mock/types_mock_appmodule.go @@ -10,7 +10,7 @@ import ( reflect "reflect" appmodule "cosmossdk.io/core/appmodule" - appmodule0 "cosmossdk.io/core/appmodule/v2" + appmodulev2 "cosmossdk.io/core/appmodule/v2" types "github.com/cosmos/cosmos-sdk/types" module "github.com/cosmos/cosmos-sdk/types/module" gomock "github.com/golang/mock/gomock" @@ -269,10 +269,10 @@ func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) ExportGenesis(ctx inte } // InitGenesis mocks base method. -func (m *MockAppModuleWithAllExtensionsABCI) InitGenesis(ctx context.Context, data json.RawMessage) ([]appmodule0.ValidatorUpdate, error) { +func (m *MockAppModuleWithAllExtensionsABCI) InitGenesis(ctx context.Context, data json.RawMessage) ([]appmodulev2.ValidatorUpdate, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "InitGenesis", ctx, data) - ret0, _ := ret[0].([]appmodule0.ValidatorUpdate) + ret0, _ := ret[0].([]appmodulev2.ValidatorUpdate) ret1, _ := ret[1].(error) return ret0, ret1 } diff --git a/testutil/mock/types_module_module.go b/testutil/mock/types_module_module.go index 6e8832ec9cfc..be1de62e6626 100644 --- a/testutil/mock/types_module_module.go +++ b/testutil/mock/types_module_module.go @@ -14,6 +14,7 @@ import ( module "github.com/cosmos/cosmos-sdk/types/module" gomock "github.com/golang/mock/gomock" runtime "github.com/grpc-ecosystem/grpc-gateway/runtime" + grpc "google.golang.org/grpc" ) // MockAppModuleBasic is a mock of AppModuleBasic interface. @@ -264,6 +265,67 @@ func (mr *MockHasServicesMockRecorder) RegisterServices(arg0 interface{}) *gomoc return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterServices", reflect.TypeOf((*MockHasServices)(nil).RegisterServices), arg0) } +// MockhasServicesV1 is a mock of hasServicesV1 interface. +type MockhasServicesV1 struct { + ctrl *gomock.Controller + recorder *MockhasServicesV1MockRecorder +} + +// MockhasServicesV1MockRecorder is the mock recorder for MockhasServicesV1. +type MockhasServicesV1MockRecorder struct { + mock *MockhasServicesV1 +} + +// NewMockhasServicesV1 creates a new mock instance. +func NewMockhasServicesV1(ctrl *gomock.Controller) *MockhasServicesV1 { + mock := &MockhasServicesV1{ctrl: ctrl} + mock.recorder = &MockhasServicesV1MockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockhasServicesV1) EXPECT() *MockhasServicesV1MockRecorder { + return m.recorder +} + +// IsAppModule mocks base method. +func (m *MockhasServicesV1) IsAppModule() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "IsAppModule") +} + +// IsAppModule indicates an expected call of IsAppModule. +func (mr *MockhasServicesV1MockRecorder) IsAppModule() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAppModule", reflect.TypeOf((*MockhasServicesV1)(nil).IsAppModule)) +} + +// IsOnePerModuleType mocks base method. +func (m *MockhasServicesV1) IsOnePerModuleType() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "IsOnePerModuleType") +} + +// IsOnePerModuleType indicates an expected call of IsOnePerModuleType. +func (mr *MockhasServicesV1MockRecorder) IsOnePerModuleType() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsOnePerModuleType", reflect.TypeOf((*MockhasServicesV1)(nil).IsOnePerModuleType)) +} + +// RegisterServices mocks base method. +func (m *MockhasServicesV1) RegisterServices(arg0 grpc.ServiceRegistrar) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RegisterServices", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// RegisterServices indicates an expected call of RegisterServices. +func (mr *MockhasServicesV1MockRecorder) RegisterServices(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterServices", reflect.TypeOf((*MockhasServicesV1)(nil).RegisterServices), arg0) +} + // MockHasABCIEndBlock is a mock of HasABCIEndBlock interface. type MockHasABCIEndBlock struct { ctrl *gomock.Controller diff --git a/testutil/network/network.go b/testutil/network/network.go index cd59d0b08502..183adfbe1758 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -29,7 +29,6 @@ import ( sdkmath "cosmossdk.io/math" "cosmossdk.io/math/unsafe" pruningtypes "cosmossdk.io/store/pruning/types" - authtypes "cosmossdk.io/x/auth/types" banktypes "cosmossdk.io/x/bank/types" stakingtypes "cosmossdk.io/x/staking/types" @@ -49,9 +48,11 @@ import ( srvconfig "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" "github.com/cosmos/cosmos-sdk/testutil" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/genutil" ) @@ -210,7 +211,10 @@ func DefaultConfigWithAppConfig(appConfig depinject.Config, baseappOpts ...func( if err := depinject.Inject( depinject.Configs( appConfig, - depinject.Supply(val.GetLogger()), + depinject.Supply( + val.GetLogger(), + simtestutil.NewAppOptionsWithFlagHome(val.GetViper().GetString(flags.FlagHome)), + ), ), &appBuilder); err != nil { panic(err) @@ -520,8 +524,23 @@ func New(l Logger, baseDir string, cfg Config) (NetworkI, error) { WithKeybase(kb). WithTxConfig(cfg.TxConfig) - err = tx.Sign(context.Background(), txFactory, nodeDirName, txBuilder, true) - if err != nil { + clientCtx := client.Context{}. + WithKeyringDir(clientDir). + WithKeyring(kb). + WithHomeDir(cmtCfg.RootDir). + WithChainID(cfg.ChainID). + WithInterfaceRegistry(cfg.InterfaceRegistry). + WithCodec(cfg.Codec). + WithLegacyAmino(cfg.LegacyAmino). + WithTxConfig(cfg.TxConfig). + WithAccountRetriever(cfg.AccountRetriever). + WithAddressCodec(cfg.AddressCodec). + WithValidatorAddressCodec(cfg.ValidatorAddressCodec). + WithConsensusAddressCodec(cfg.ConsensusAddressCodec). + WithNodeURI(cmtCfg.RPC.ListenAddress). + WithCmdContext(context.TODO()) + + if err := tx.Sign(clientCtx, txFactory, nodeDirName, txBuilder, true); err != nil { return nil, err } @@ -538,21 +557,6 @@ func New(l Logger, baseDir string, cfg Config) (NetworkI, error) { return nil, err } - clientCtx := client.Context{}. - WithKeyringDir(clientDir). - WithKeyring(kb). - WithHomeDir(cmtCfg.RootDir). - WithChainID(cfg.ChainID). - WithInterfaceRegistry(cfg.InterfaceRegistry). - WithCodec(cfg.Codec). - WithLegacyAmino(cfg.LegacyAmino). - WithTxConfig(cfg.TxConfig). - WithAccountRetriever(cfg.AccountRetriever). - WithAddressCodec(cfg.AddressCodec). - WithValidatorAddressCodec(cfg.ValidatorAddressCodec). - WithConsensusAddressCodec(cfg.ConsensusAddressCodec). - WithNodeURI(cmtCfg.RPC.ListenAddress) - // Provide ChainID here since we can't modify it in the Comet config. viper.Set(flags.FlagChainID, cfg.ChainID) diff --git a/testutil/network/util.go b/testutil/network/util.go index 4d9ebdacb94c..415b687400f5 100644 --- a/testutil/network/util.go +++ b/testutil/network/util.go @@ -18,7 +18,6 @@ import ( "golang.org/x/sync/errgroup" "cosmossdk.io/log" - authtypes "cosmossdk.io/x/auth/types" banktypes "cosmossdk.io/x/bank/types" "github.com/cosmos/cosmos-sdk/client" @@ -27,6 +26,7 @@ import ( servergrpc "github.com/cosmos/cosmos-sdk/server/grpc" servercmtlog "github.com/cosmos/cosmos-sdk/server/log" "github.com/cosmos/cosmos-sdk/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltest "github.com/cosmos/cosmos-sdk/x/genutil/client/testutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" diff --git a/testutil/sims/app_helpers.go b/testutil/sims/app_helpers.go index 1a1762d78437..08d9a71656d1 100644 --- a/testutil/sims/app_helpers.go +++ b/testutil/sims/app_helpers.go @@ -13,9 +13,9 @@ import ( dbm "github.com/cosmos/cosmos-db" coreheader "cosmossdk.io/core/header" + corestore "cosmossdk.io/core/store" "cosmossdk.io/depinject" sdkmath "cosmossdk.io/math" - authtypes "cosmossdk.io/x/auth/types" banktypes "cosmossdk.io/x/bank/types" stakingtypes "cosmossdk.io/x/staking/types" @@ -28,6 +28,7 @@ import ( servertypes "github.com/cosmos/cosmos-sdk/server/types" "github.com/cosmos/cosmos-sdk/testutil/mock" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) const DefaultGenTxGas = 10000000 @@ -84,7 +85,7 @@ type StartupConfig struct { BaseAppOption runtime.BaseAppOption AtGenesis bool GenesisAccounts []GenesisAccount - DB dbm.DB + DB corestore.KVStoreWithBatch } func DefaultStartUpConfig() StartupConfig { diff --git a/testutil/sims/simulation_helpers.go b/testutil/sims/simulation_helpers.go index 1712d9986ac5..b8a235936eb4 100644 --- a/testutil/sims/simulation_helpers.go +++ b/testutil/sims/simulation_helpers.go @@ -9,6 +9,7 @@ import ( dbm "github.com/cosmos/cosmos-db" + corestore "cosmossdk.io/core/store" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" @@ -24,7 +25,7 @@ import ( // SetupSimulation creates the config, db (levelDB), temporary directory and logger for the simulation tests. // If `skip` is false it skips the current test. `skip` should be set using the `FlagEnabledValue` flag. // Returns error on an invalid db instantiation or temp dir creation. -func SetupSimulation(config simtypes.Config, dirPrefix, dbName string, verbose, skip bool) (dbm.DB, string, log.Logger, bool, error) { +func SetupSimulation(config simtypes.Config, dirPrefix, dbName string, verbose, skip bool) (corestore.KVStoreWithBatch, string, log.Logger, bool, error) { if !skip { return nil, "", nil, true, nil } @@ -109,7 +110,7 @@ func CheckExportSimulation(app runtime.AppSimI, config simtypes.Config, params s } // PrintStats prints the corresponding statistics from the app DB. -func PrintStats(db dbm.DB) { +func PrintStats(db *dbm.GoLevelDB) { fmt.Println("\nLevelDB Stats") fmt.Println(db.Stats()["leveldb.stats"]) fmt.Println("LevelDB cached block size", db.Stats()["leveldb.cachedblock"]) diff --git a/testutil/sims/state_helpers.go b/testutil/sims/state_helpers.go index 631ec379b81f..684ef474d724 100644 --- a/testutil/sims/state_helpers.go +++ b/testutil/sims/state_helpers.go @@ -14,7 +14,6 @@ import ( "cosmossdk.io/core/address" "cosmossdk.io/math" - authtypes "cosmossdk.io/x/auth/types" banktypes "cosmossdk.io/x/bank/types" stakingtypes "cosmossdk.io/x/staking/types" @@ -25,6 +24,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" ) diff --git a/testutil/sims/tx_helpers.go b/testutil/sims/tx_helpers.go index c681594b3f01..9f71f8aadb20 100644 --- a/testutil/sims/tx_helpers.go +++ b/testutil/sims/tx_helpers.go @@ -11,7 +11,6 @@ import ( "cosmossdk.io/core/header" "cosmossdk.io/errors" - authsign "cosmossdk.io/x/auth/signing" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" @@ -19,6 +18,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/types/tx/signing" + authsign "github.com/cosmos/cosmos-sdk/x/auth/signing" ) // GenSignedMockTx generates a signed mock transaction. diff --git a/testutil/x/counter/autocli.go b/testutil/x/counter/autocli.go index 2067df6b81d5..572ec584e773 100644 --- a/testutil/x/counter/autocli.go +++ b/testutil/x/counter/autocli.go @@ -23,7 +23,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { RpcMethod: "IncreaseCount", - Use: "increase-count [count]", + Use: "increase-count ", Alias: []string{"increase-counter", "increase", "inc", "bump"}, Short: "Increase the counter by the specified amount", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "count"}}, diff --git a/testutil/x/counter/proto/buf.gen.gogo.yaml b/testutil/x/counter/proto/buf.gen.gogo.yaml index db36231d0c82..0f9cc94023f0 100644 --- a/testutil/x/counter/proto/buf.gen.gogo.yaml +++ b/testutil/x/counter/proto/buf.gen.gogo.yaml @@ -2,7 +2,7 @@ version: v1 plugins: - name: gocosmos out: .. - opt: plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/gogoproto/types/any + opt: plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/gogoproto/types/any,Mcosmos/app/v1alpha1/module.proto=cosmossdk.io/api/cosmos/app/v1alpha1 - name: grpc-gateway out: .. opt: logtostderr=true,allow_colon_final_segments=true diff --git a/testutil/x/counter/testutil/expected_keepers_mocks.go b/testutil/x/counter/testutil/expected_keepers_mocks.go index 83c92ceeebc2..528d1b2fddb3 100644 --- a/testutil/x/counter/testutil/expected_keepers_mocks.go +++ b/testutil/x/counter/testutil/expected_keepers_mocks.go @@ -7,7 +7,7 @@ package testutil import ( reflect "reflect" - types0 "cosmossdk.io/x/auth/types" + types0 "github.com/cosmos/cosmos-sdk/x/auth/types" types "github.com/cosmos/cosmos-sdk/types" gomock "github.com/golang/mock/gomock" diff --git a/testutil/x/counter/types/module.pb.go b/testutil/x/counter/types/module.pb.go index 37b734e319bc..f9d466fce784 100644 --- a/testutil/x/counter/types/module.pb.go +++ b/testutil/x/counter/types/module.pb.go @@ -4,7 +4,7 @@ package types import ( - _ "cosmossdk.io/depinject/appconfig/v1alpha1" + _ "cosmossdk.io/api/cosmos/app/v1alpha1" fmt "fmt" proto "github.com/cosmos/gogoproto/proto" io "io" diff --git a/testutils/sims/runner.go b/testutils/sims/runner.go index 34acc544bdc0..14d81e4469d6 100644 --- a/testutils/sims/runner.go +++ b/testutils/sims/runner.go @@ -3,12 +3,14 @@ package sims import ( "fmt" "io" + "os" "path/filepath" "testing" dbm "github.com/cosmos/cosmos-db" "github.com/stretchr/testify/require" + corestore "cosmossdk.io/core/store" "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/baseapp" @@ -49,6 +51,7 @@ type SimulationApp interface { SetNotSigverifyTx() GetBaseApp() *baseapp.BaseApp TxConfig() client.TxConfig + Close() error } // Run is a helper function that runs a simulation test with the given parameters. @@ -59,7 +62,7 @@ func Run[T SimulationApp]( t *testing.T, appFactory func( logger log.Logger, - db dbm.DB, + db corestore.KVStoreWithBatch, traceStore io.Writer, loadLatest bool, appOpts servertypes.AppOptions, @@ -85,7 +88,7 @@ func RunWithSeeds[T SimulationApp]( t *testing.T, appFactory func( logger log.Logger, - db dbm.DB, + db corestore.KVStoreWithBatch, traceStore io.Writer, loadLatest bool, appOpts servertypes.AppOptions, @@ -113,7 +116,6 @@ func RunWithSeeds[T SimulationApp]( runLogger = log.NewTestLoggerInfo(t) } runLogger = runLogger.With("seed", tCfg.Seed) - app := testInstance.App stateFactory := setupStateFactory(app) simParams, err := simulation.SimulateFromSeedX( @@ -123,7 +125,7 @@ func RunWithSeeds[T SimulationApp]( app.GetBaseApp(), stateFactory.AppStateFn, simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 - simtestutil.SimulationOperations(app, stateFactory.Codec, tCfg, testInstance.App.TxConfig()), + simtestutil.SimulationOperations(app, stateFactory.Codec, tCfg, app.TxConfig()), stateFactory.BlockedAddr, tCfg, stateFactory.Codec, @@ -133,12 +135,13 @@ func RunWithSeeds[T SimulationApp]( require.NoError(t, err) err = simtestutil.CheckExportSimulation(app, tCfg, simParams) require.NoError(t, err) - if tCfg.Commit { - simtestutil.PrintStats(testInstance.DB) + if tCfg.Commit && tCfg.DBBackend == "goleveldb" { + simtestutil.PrintStats(testInstance.DB.(*dbm.GoLevelDB)) } for _, step := range postRunActions { step(t, testInstance) } + require.NoError(t, app.Close()) }) } } @@ -153,7 +156,7 @@ func RunWithSeeds[T SimulationApp]( // - ExecLogWriter: Captures block and operation data coming from the simulation type TestInstance[T SimulationApp] struct { App T - DB dbm.DB + DB corestore.KVStoreWithBatch WorkDir string Cfg simtypes.Config AppLogger log.Logger @@ -168,10 +171,12 @@ type TestInstance[T SimulationApp] struct { func NewSimulationAppInstance[T SimulationApp]( t *testing.T, tCfg simtypes.Config, - appFactory func(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp)) T, + appFactory func(logger log.Logger, db corestore.KVStoreWithBatch, traceStore io.Writer, loadLatest bool, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp)) T, ) TestInstance[T] { t.Helper() workDir := t.TempDir() + require.NoError(t, os.Mkdir(filepath.Join(workDir, "data"), 0o755)) + dbDir := filepath.Join(workDir, "leveldb-app-sim") var logger log.Logger if cli.FlagVerboseValue { @@ -184,7 +189,7 @@ func NewSimulationAppInstance[T SimulationApp]( db, err := dbm.NewDB("Simulation", dbm.BackendType(tCfg.DBBackend), dbDir) require.NoError(t, err) t.Cleanup(func() { - require.NoError(t, db.Close()) + _ = db.Close() // ensure db is closed }) appOptions := make(simtestutil.AppOptionsMap) appOptions[flags.FlagHome] = workDir diff --git a/tools/confix/CHANGELOG.md b/tools/confix/CHANGELOG.md index 531daaf7b5c1..890cabbe7543 100644 --- a/tools/confix/CHANGELOG.md +++ b/tools/confix/CHANGELOG.md @@ -31,15 +31,16 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] -### Features +* [#21052](https://github.com/cosmos/cosmos-sdk/pull/21052) Add a migration to v2 config. -* (confix) [#21202](https://github.com/cosmos/cosmos-sdk/pull/21202) Allow customization of migration `PlanBuilder`. +## [v0.1.2](https://github.com/cosmos/cosmos-sdk/releases/tag/tools/confix/v0.1.2) - 2024-08-13 + +* [#21202](https://github.com/cosmos/cosmos-sdk/pull/21202) Allow customization of migration `PlanBuilder`. ## [v0.1.1](https://github.com/cosmos/cosmos-sdk/releases/tag/tools/confix/v0.1.1) - 2023-12-11 * [#18496](https://github.com/cosmos/cosmos-sdk/pull/18496) Remove invalid non SDK config from app.toml migration templates. - ## [v0.1.0](https://github.com/cosmos/cosmos-sdk/releases/tag/tools/confix/v0.1.0) - 2023-11-07 * [#17904](https://github.com/cosmos/cosmos-sdk/pull/17904) Add `view` command. diff --git a/tools/confix/README.md b/tools/confix/README.md index af7a5aa8f5f5..64b2f49b3dc7 100644 --- a/tools/confix/README.md +++ b/tools/confix/README.md @@ -39,6 +39,11 @@ An implementation example can be found in `simapp`. The command will be available as `simd config`. +```tip +Using confix directly in the application can have less features than using it standalone. +This is because confix is versioned with the SDK, while `latest` is the standalone version. +``` + ### Using Confix Standalone To use Confix standalone, without having to add it in your application, install it with the following command: @@ -136,6 +141,15 @@ confix view ~/.simapp/config/client.toml # views the current app client conf At each SDK modification of the default configuration, add the default SDK config under `data/v0.XX-app.toml`. This allows users to use the tool standalone. +### Compatibility + +The recommended standalone version is `latest`, which is using the latest development version of the Confix. + +| SDK Version | Confix Version | +| ----------- | -------------- | +| v0.50 | v0.1.x | +| v0.52 | v0.2.x | + ## Credits This project is based on the [CometBFT RFC 019](https://github.com/cometbft/cometbft/blob/5013bc3f4a6d64dcc2bf02ccc002ebc9881c62e4/docs/rfc/rfc-019-config-version.md) and their own implementation of [confix](https://github.com/cometbft/cometbft/blob/v0.36.x/scripts/confix/confix.go). diff --git a/tools/confix/cmd/diff.go b/tools/confix/cmd/diff.go index f6d71bcaa5c5..89226a112236 100644 --- a/tools/confix/cmd/diff.go +++ b/tools/confix/cmd/diff.go @@ -3,11 +3,12 @@ package cmd import ( "errors" "fmt" + "maps" "path/filepath" + "slices" "strings" "github.com/spf13/cobra" - "golang.org/x/exp/maps" "cosmossdk.io/tools/confix" @@ -43,7 +44,7 @@ func DiffCommand() *cobra.Command { targetVersion := args[0] if _, ok := confix.Migrations[targetVersion]; !ok { - return fmt.Errorf("unknown version %q, supported versions are: %q", targetVersion, maps.Keys(confix.Migrations)) + return fmt.Errorf("unknown version %q, supported versions are: %q", targetVersion, slices.Collect(maps.Keys(confix.Migrations))) } targetVersionFile, err := confix.LoadLocalConfig(targetVersion, configType) diff --git a/tools/confix/cmd/migrate.go b/tools/confix/cmd/migrate.go index a7122161d14e..7e6c01e03401 100644 --- a/tools/confix/cmd/migrate.go +++ b/tools/confix/cmd/migrate.go @@ -4,11 +4,12 @@ import ( "context" "errors" "fmt" + "maps" "path/filepath" + "slices" "strings" "github.com/spf13/cobra" - "golang.org/x/exp/maps" "cosmossdk.io/tools/confix" @@ -60,7 +61,7 @@ In case of any error in updating the file, no output is written.`, targetVersion := args[0] plan, ok := confix.Migrations[targetVersion] if !ok { - return fmt.Errorf("unknown version %q, supported versions are: %q", targetVersion, maps.Keys(confix.Migrations)) + return fmt.Errorf("unknown version %q, supported versions are: %q", targetVersion, slices.Collect(maps.Keys(confix.Migrations))) } rawFile, err := confix.LoadConfig(configPath) diff --git a/tools/confix/cmd/mutate.go b/tools/confix/cmd/mutate.go index 772f38e7a86e..9dd4a34ff08f 100644 --- a/tools/confix/cmd/mutate.go +++ b/tools/confix/cmd/mutate.go @@ -20,7 +20,7 @@ import ( // SetCommand returns a CLI command to interactively update an application config value. func SetCommand() *cobra.Command { cmd := &cobra.Command{ - Use: "set [config] [key] [value]", + Use: "set ", Short: "Set an application config value", Long: "Set an application config value. The [config] argument must be the path of the file when using the `confix` tool standalone, otherwise it must be the name of the config file without the .toml extension.", Args: cobra.ExactArgs(3), @@ -92,7 +92,7 @@ func SetCommand() *cobra.Command { // GetCommand returns a CLI command to interactively get an application config value. func GetCommand() *cobra.Command { cmd := &cobra.Command{ - Use: "get [config] [key]", + Use: "get ", Short: "Get an application config value", Long: "Get an application config value. The [config] argument must be the path of the file when using the `confix` tool standalone, otherwise it must be the name of the config file without the .toml extension.", Args: cobra.ExactArgs(2), diff --git a/tools/confix/cmd/view.go b/tools/confix/cmd/view.go index 4c41c2963ef6..d88c68574057 100644 --- a/tools/confix/cmd/view.go +++ b/tools/confix/cmd/view.go @@ -16,7 +16,7 @@ func ViewCommand() *cobra.Command { flagOutputFormat := "output-format" cmd := &cobra.Command{ - Use: "view [config]", + Use: "view ", Short: "View the config file", Long: "View the config file. The [config] argument must be the path of the file when using the `confix` tool standalone, otherwise it must be the name of the config file without the .toml extension.", Args: cobra.ExactArgs(1), diff --git a/tools/confix/data/v2-app.toml b/tools/confix/data/v2-app.toml index 6a93006eccfb..8f7f7f9940d2 100644 --- a/tools/confix/data/v2-app.toml +++ b/tools/confix/data/v2-app.toml @@ -28,6 +28,10 @@ max-recv-msg-size = 10485760 # The default value is math.MaxInt32. max-send-msg-size = 2147483647 +[server] +# minimum-gas-prices defines the price which a validator is willing to accept for processing a transaction. A transaction's fees must meet the minimum of any denomination specified in this config (e.g. 0.25token1;0.0001token2). +minimum-gas-prices = '0stake' + [store] # The type of database for application and snapshots databases. app-db-backend = 'goleveldb' diff --git a/tools/confix/go.mod b/tools/confix/go.mod index 42df1ee360f4..076f9114e302 100644 --- a/tools/confix/go.mod +++ b/tools/confix/go.mod @@ -1,15 +1,14 @@ module cosmossdk.io/tools/confix -go 1.21 +go 1.23 require ( github.com/cosmos/cosmos-sdk v0.50.9 - github.com/creachadair/atomicfile v0.3.4 + github.com/creachadair/atomicfile v0.3.5 github.com/creachadair/tomledit v0.0.26 - github.com/pelletier/go-toml/v2 v2.2.2 + github.com/pelletier/go-toml/v2 v2.2.3 github.com/spf13/cobra v1.8.1 github.com/spf13/viper v1.19.0 - golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc gotest.tools/v3 v3.5.1 ) @@ -19,7 +18,7 @@ require ( cosmossdk.io/core v0.11.1 // indirect cosmossdk.io/depinject v1.0.0 // indirect cosmossdk.io/errors v1.0.1 // indirect - cosmossdk.io/log v1.4.0 // indirect + cosmossdk.io/log v1.4.1 // indirect cosmossdk.io/math v1.3.0 // indirect cosmossdk.io/store v1.1.0 // indirect cosmossdk.io/x/tx v0.13.4 // indirect @@ -42,13 +41,13 @@ require ( github.com/cometbft/cometbft v0.38.10 // indirect github.com/cometbft/cometbft-db v0.9.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-db v1.0.2 // indirect + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 // indirect github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/gogoproto v1.7.0 // indirect github.com/cosmos/iavl v1.1.4 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.1.2 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -97,7 +96,7 @@ require ( github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.7 // indirect @@ -115,9 +114,9 @@ require ( github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -140,15 +139,16 @@ require ( go.etcd.io/bbolt v1.3.8 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.26.0 // indirect + golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.24.0 // indirect golang.org/x/term v0.23.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect - google.golang.org/grpc v1.65.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect + google.golang.org/grpc v1.66.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/tools/confix/go.sum b/tools/confix/go.sum index 6ea6e9f027f6..1d1fb3b5ea1a 100644 --- a/tools/confix/go.sum +++ b/tools/confix/go.sum @@ -10,8 +10,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.1.0 h1:LnKwgYMc9BInn9PhpTFEQVbL9UK475G2H911CGGnWHk= @@ -139,8 +139,8 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/cosmos-sdk v0.50.9 h1:gt2usjz0H0qW6KwAxWw7ZJ3XU8uDwmhN+hYG3nTLeSg= @@ -154,17 +154,17 @@ github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fr github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.1.4 h1:Z0cVVjeQqOUp78/nWt/uhQy83vYluWlAMGQ4zbH9G34= github.com/cosmos/iavl v1.1.4/go.mod h1:vCYmRQUJU1wwj0oRD3wMEtOM9sJNDP+GFMaXmIxZ/rU= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= 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.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creachadair/atomicfile v0.3.4 h1:AjNK7To+S1p+nk7uJXJMZFpcV9XHOyAaULyDeU6LEqM= -github.com/creachadair/atomicfile v0.3.4/go.mod h1:ByEUbfQyms+tRtE7Wk7WdS6PZeyMzfSFlNX1VoKEh6E= -github.com/creachadair/mds v0.13.3 h1:OqXNRorXKsuvfjor+0ixtrpA4IINApH8zgm23XLlngk= -github.com/creachadair/mds v0.13.3/go.mod h1:4vrFYUzTXMJpMBU+OA292I6IUxKWCCfZkgXg+/kBZMo= +github.com/creachadair/atomicfile v0.3.5 h1:i93bxeaH/rQR6XfJslola3XkOM1nEP3eIexuk9SWcSc= +github.com/creachadair/atomicfile v0.3.5/go.mod h1:m7kIY2OUMygtETnMYe141rubsG4b+EusFLinlxxdHYM= +github.com/creachadair/mds v0.16.0 h1:v6DlvKXClowXFg4hkjLCR1FEFiREMf0qgX+Lm5GsEKk= +github.com/creachadair/mds v0.16.0/go.mod h1:4vrFYUzTXMJpMBU+OA292I6IUxKWCCfZkgXg+/kBZMo= github.com/creachadair/tomledit v0.0.26 h1:MoDdgHIHZ5PctBVsAZDjxdxreWUEa9ObPKTRkk5PPwA= github.com/creachadair/tomledit v0.0.26/go.mod h1:SJi1OxKpMyR141tq1lzsbPtIg3j8TeVPM/ZftfieD7o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= @@ -445,8 +445,8 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -457,6 +457,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= @@ -572,8 +574,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba h1:3jPgmsFGBID1wFfU2AbYocNcN4wqU68UaHSdMjiw/7U= @@ -598,8 +600,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -614,8 +616,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -690,8 +692,6 @@ github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3 github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -700,10 +700,7 @@ 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/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -945,10 +942,10 @@ google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -966,8 +963,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/tools/confix/migrations.go b/tools/confix/migrations.go index 4a500898bc04..437c628d7b25 100644 --- a/tools/confix/migrations.go +++ b/tools/confix/migrations.go @@ -39,11 +39,12 @@ type v2KeyChangesMap map[string][]string // list all the keys which are need to be modified in v2 var v2KeyChanges = v2KeyChangesMap{ - "min-retain-blocks": []string{"comet.min-retain-blocks"}, - "index-events": []string{"comet.index-events"}, - "halt-height": []string{"comet.halt-height"}, - "halt-time": []string{"comet.halt-time"}, - "app-db-backend": []string{"store.app-db-backend"}, + "minimum-gas-prices": []string{"server.minimum-gas-prices"}, + "min-retain-blocks": []string{"comet.min-retain-blocks"}, + "index-events": []string{"comet.index-events"}, + "halt-height": []string{"comet.halt-height"}, + "halt-time": []string{"comet.halt-time"}, + "app-db-backend": []string{"store.app-db-backend"}, "pruning-keep-recent": []string{ "store.options.ss-pruning-option.keep-recent", "store.options.sc-pruning-option.keep-recent", diff --git a/tools/cosmovisor/CHANGELOG.md b/tools/cosmovisor/CHANGELOG.md index 3931ccd3a3b2..a4c78e469c45 100644 --- a/tools/cosmovisor/CHANGELOG.md +++ b/tools/cosmovisor/CHANGELOG.md @@ -36,16 +36,20 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +### Improvements + +* [#21462](https://github.com/cosmos/cosmos-sdk/pull/21462) Pass `stdin` to binary. + ## v1.6.0 - 2024-08-12 ## Improvements * Bump `cosmossdk.io/x/upgrade` to v0.1.4 (including go-getter vulnerability fix) * [#19995](https://github.com/cosmos/cosmos-sdk/pull/19995): - * `init command` writes the configuration to the config file only at the default path `DAEMON_HOME/cosmovisor/config.toml`. - * Provide `--cosmovisor-config` flag with value as args to provide the path to the configuration file in the `run` command. `run --cosmovisor-config (other cmds with flags) ...`. - * Add `--cosmovisor-config` flag to provide `config.toml` path to the configuration file in root command used by `add-upgrade` and `config` subcommands. - * `config command` now displays the configuration from the config file if it is provided. If the config file is not provided, it will display the configuration from the environment variables. + * `init command` writes the configuration to the config file only at the default path `DAEMON_HOME/cosmovisor/config.toml`. + * Provide `--cosmovisor-config` flag with value as args to provide the path to the configuration file in the `run` command. `run --cosmovisor-config (other cmds with flags) ...`. + * Add `--cosmovisor-config` flag to provide `config.toml` path to the configuration file in root command used by `add-upgrade` and `config` subcommands. + * `config command` now displays the configuration from the config file if it is provided. If the config file is not provided, it will display the configuration from the environment variables. ## Bug Fixes @@ -75,7 +79,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### API Breaking Changes -* [#13603](https://github.com/cosmos-sdk/pull/13603) Rename cosmovisor package to `cosmossdk.io/tools/cosmovisor`. +* [#13603](https://github.com/cosmos/cosmos-sdk/pull/13603) Rename cosmovisor package to `cosmossdk.io/tools/cosmovisor`. ## v1.3.0 - 2022-09-11 diff --git a/tools/cosmovisor/cmd/cosmovisor/add_upgrade.go b/tools/cosmovisor/cmd/cosmovisor/add_upgrade.go index b188ab05fdc4..a197f33bc1dc 100644 --- a/tools/cosmovisor/cmd/cosmovisor/add_upgrade.go +++ b/tools/cosmovisor/cmd/cosmovisor/add_upgrade.go @@ -15,7 +15,7 @@ import ( func NewAddUpgradeCmd() *cobra.Command { addUpgrade := &cobra.Command{ - Use: "add-upgrade [upgrade-name] [path to executable]", + Use: "add-upgrade ", Short: "Add APP upgrade binary to cosmovisor", SilenceUsage: true, Args: cobra.ExactArgs(2), diff --git a/tools/cosmovisor/cmd/cosmovisor/run.go b/tools/cosmovisor/cmd/cosmovisor/run.go index 0e1513cf6766..f835b59e5280 100644 --- a/tools/cosmovisor/cmd/cosmovisor/run.go +++ b/tools/cosmovisor/cmd/cosmovisor/run.go @@ -45,11 +45,11 @@ func run(cfgPath string, args []string, options ...RunOption) error { return err } - doUpgrade, err := launcher.Run(args, runCfg.StdOut, runCfg.StdErr) + doUpgrade, err := launcher.Run(args, runCfg.StdIn, runCfg.StdOut, runCfg.StdErr) // if RestartAfterUpgrade, we launch after a successful upgrade (given that condition launcher.Run returns nil) for cfg.RestartAfterUpgrade && err == nil && doUpgrade { logger.Info("upgrade detected, relaunching", "app", cfg.Name) - doUpgrade, err = launcher.Run(args, runCfg.StdOut, runCfg.StdErr) + doUpgrade, err = launcher.Run(args, runCfg.StdIn, runCfg.StdOut, runCfg.StdErr) } if doUpgrade && err == nil { diff --git a/tools/cosmovisor/cmd/cosmovisor/run_config.go b/tools/cosmovisor/cmd/cosmovisor/run_config.go index 3f865c610933..f025b06eb619 100644 --- a/tools/cosmovisor/cmd/cosmovisor/run_config.go +++ b/tools/cosmovisor/cmd/cosmovisor/run_config.go @@ -7,18 +7,27 @@ import ( // DefaultRunConfig defintes a default RunConfig that writes to os.Stdout and os.Stderr var DefaultRunConfig = RunConfig{ + StdIn: os.Stdin, StdOut: os.Stdout, StdErr: os.Stderr, } // RunConfig defines the configuration for running a command type RunConfig struct { + StdIn io.Reader StdOut io.Writer StdErr io.Writer } type RunOption func(*RunConfig) +// StdInRunOption sets the StdIn reader for the Run command +func StdInRunOption(r io.Reader) RunOption { + return func(cfg *RunConfig) { + cfg.StdIn = r + } +} + // StdOutRunOption sets the StdOut writer for the Run command func StdOutRunOption(w io.Writer) RunOption { return func(cfg *RunConfig) { diff --git a/tools/cosmovisor/go.mod b/tools/cosmovisor/go.mod index a3f6f72cc91a..132760ef4d45 100644 --- a/tools/cosmovisor/go.mod +++ b/tools/cosmovisor/go.mod @@ -1,24 +1,24 @@ module cosmossdk.io/tools/cosmovisor -go 1.22.4 +go 1.23 require ( - cosmossdk.io/log v1.4.0 + cosmossdk.io/log v1.4.1 cosmossdk.io/x/upgrade v0.1.4 github.com/otiai10/copy v1.14.0 - github.com/pelletier/go-toml/v2 v2.2.2 + github.com/pelletier/go-toml/v2 v2.2.3 github.com/spf13/cobra v1.8.1 github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 ) require ( - cloud.google.com/go v0.115.0 // indirect - cloud.google.com/go/auth v0.5.1 // indirect - cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect - cloud.google.com/go/compute/metadata v0.3.0 // indirect - cloud.google.com/go/iam v1.1.8 // indirect - cloud.google.com/go/storage v1.42.0 // indirect + cloud.google.com/go v0.115.1 // indirect + cloud.google.com/go/auth v0.8.1 // indirect + cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect + cloud.google.com/go/compute/metadata v0.5.0 // indirect + cloud.google.com/go/iam v1.1.13 // indirect + cloud.google.com/go/storage v1.43.0 // indirect cosmossdk.io/api v0.7.5 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/core v0.11.0 // indirect @@ -33,7 +33,7 @@ require ( github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/aws/aws-sdk-go v1.54.6 // indirect + github.com/aws/aws-sdk-go v1.55.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.2.0 // indirect @@ -55,7 +55,7 @@ require ( github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/gogoproto v1.7.0 // indirect github.com/cosmos/iavl v1.2.0 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -85,10 +85,10 @@ require ( github.com/google/btree v1.1.2 // indirect github.com/google/flatbuffers v24.3.25+incompatible // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/google/s2a-go v0.1.7 // indirect + github.com/google/s2a-go v0.1.8 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect - github.com/googleapis/gax-go/v2 v2.12.5 // indirect + github.com/googleapis/gax-go/v2 v2.13.0 // indirect github.com/gorilla/handlers v1.5.2 // indirect github.com/gorilla/mux v1.8.1 // indirect github.com/gorilla/websocket v1.5.1 // indirect @@ -96,7 +96,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-getter v1.7.5 // indirect + github.com/hashicorp/go-getter v1.7.6 // indirect github.com/hashicorp/go-hclog v1.6.3 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-metrics v0.5.3 // indirect @@ -132,9 +132,9 @@ require ( github.com/petermattis/goid v0.0.0-20240503122002-4b96552b8156 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -156,26 +156,26 @@ require ( github.com/zondax/ledger-go v0.14.3 // indirect go.etcd.io/bbolt v1.4.0-alpha.1 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 // indirect - go.opentelemetry.io/otel v1.27.0 // indirect - go.opentelemetry.io/otel/metric v1.27.0 // indirect - go.opentelemetry.io/otel/trace v1.27.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect + go.opentelemetry.io/otel v1.28.0 // indirect + go.opentelemetry.io/otel/metric v1.28.0 // indirect + go.opentelemetry.io/otel/trace v1.28.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.26.0 // indirect golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/oauth2 v0.21.0 // indirect + golang.org/x/oauth2 v0.22.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.24.0 // indirect golang.org/x/term v0.23.0 // indirect golang.org/x/text v0.17.0 // indirect - golang.org/x/time v0.5.0 // indirect - google.golang.org/api v0.185.0 // indirect - google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect - google.golang.org/grpc v1.65.0 // indirect + golang.org/x/time v0.6.0 // indirect + google.golang.org/api v0.192.0 // indirect + google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect + google.golang.org/grpc v1.66.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/tools/cosmovisor/go.sum b/tools/cosmovisor/go.sum index 9d4df4cee603..817b1c2ce714 100644 --- a/tools/cosmovisor/go.sum +++ b/tools/cosmovisor/go.sum @@ -30,8 +30,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.115.0 h1:CnFSK6Xo3lDYRoBKEcAtia6VSC837/ZkJuRduSFnr14= -cloud.google.com/go v0.115.0/go.mod h1:8jIM5vVgoAEoiVxQ/O4BFTfHqulPZgs/ufEzMcFMdWU= +cloud.google.com/go v0.115.1 h1:Jo0SM9cQnSkYfp44+v+NQXHpcHqlnRJk2qxh6yvxxxQ= +cloud.google.com/go v0.115.1/go.mod h1:DuujITeaufu3gL68/lOFIirVNJwQeyf5UXyi+Wbgknc= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= @@ -46,10 +46,10 @@ cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjby cloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY= cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw= cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI= -cloud.google.com/go/auth v0.5.1 h1:0QNO7VThG54LUzKiQxv8C6x1YX7lUrzlAa1nVLF8CIw= -cloud.google.com/go/auth v0.5.1/go.mod h1:vbZT8GjzDf3AVqCcQmqeeM32U9HBFc32vVVAbwDsa6s= -cloud.google.com/go/auth/oauth2adapt v0.2.2 h1:+TTV8aXpjeChS9M+aTtN/TjdQnzJvmzKFt//oWu7HX4= -cloud.google.com/go/auth/oauth2adapt v0.2.2/go.mod h1:wcYjgpZI9+Yu7LyYBg4pqSiaRkfEK3GQcpb7C/uyF1Q= +cloud.google.com/go/auth v0.8.1 h1:QZW9FjC5lZzN864p13YxvAtGUlQ+KgRL+8Sg45Z6vxo= +cloud.google.com/go/auth v0.8.1/go.mod h1:qGVp/Y3kDRSDZ5gFD/XPUfYQ9xW1iI7q8RIRoCyBbJc= +cloud.google.com/go/auth/oauth2adapt v0.2.4 h1:0GWE/FUsXhf6C+jAkWgYm7X9tK8cuEIfy19DBn6B6bY= +cloud.google.com/go/auth/oauth2adapt v0.2.4/go.mod h1:jC/jOpwFP6JBxhB3P5Rr0a9HLMC/Pe3eaL4NmdvqPtc= cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0= cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= @@ -72,8 +72,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc= -cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= +cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY= +cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= @@ -111,14 +111,14 @@ cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y97 cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= -cloud.google.com/go/iam v1.1.8 h1:r7umDwhj+BQyz0ScZMp4QrGXjSTI3ZINnpgU2nlB/K0= -cloud.google.com/go/iam v1.1.8/go.mod h1:GvE6lyMmfxXauzNq8NbgJbeVQNspG+tcdL/W8QO1+zE= +cloud.google.com/go/iam v1.1.13 h1:7zWBXG9ERbMLrzQBRhFliAV+kjcRToDTgQT3CTwYyv4= +cloud.google.com/go/iam v1.1.13/go.mod h1:K8mY0uSXwEXS30KrnVb+j54LB/ntfZu1dr+4zFMNbus= cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= cloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08= -cloud.google.com/go/longrunning v0.5.7 h1:WLbHekDbjK1fVFD3ibpFFVoyizlLRl73I7YKuAKilhU= -cloud.google.com/go/longrunning v0.5.7/go.mod h1:8GClkudohy1Fxm3owmBGid8W0pSgodEMwEAztp38Xng= +cloud.google.com/go/longrunning v0.5.11 h1:Havn1kGjz3whCfoD8dxMLP73Ph5w+ODyZB9RUsDxtGk= +cloud.google.com/go/longrunning v0.5.11/go.mod h1:rDn7//lmlfWV1Dx6IB4RatCPenTwwmqXuiP0/RgoEO4= cloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4= cloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w= cloud.google.com/go/memcache v1.4.0/go.mod h1:rTOfiGZtJX1AaFUrOgsMHX5kAzaTQ8azHiuDoTPzNsE= @@ -175,8 +175,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= -cloud.google.com/go/storage v1.42.0 h1:4QtGpplCVt1wz6g5o1ifXd656P5z+yNgzdw1tVfp0cU= -cloud.google.com/go/storage v1.42.0/go.mod h1:HjMXRFq65pGKFn6hxj6x3HCyR41uSB72Z0SO/Vn6JFQ= +cloud.google.com/go/storage v1.43.0 h1:CcxnSohZwizt4LCzQHWvBf1/kvtHUn7gk9QERXPyXFs= +cloud.google.com/go/storage v1.43.0/go.mod h1:ajvxEa7WmZS1PxvKRq4bq0tFT3vMd502JwstCcYv0Q0= cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= @@ -198,8 +198,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.1.0 h1:LnKwgYMc9BInn9PhpTFEQVbL9UK475G2H911CGGnWHk= @@ -246,8 +246,8 @@ github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6l github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= -github.com/aws/aws-sdk-go v1.54.6 h1:HEYUib3yTt8E6vxjMWM3yAq5b+qjj/6aKA62mkgux9g= -github.com/aws/aws-sdk-go v1.54.6/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= +github.com/aws/aws-sdk-go v1.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU= +github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -337,8 +337,8 @@ github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fr github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= @@ -551,8 +551,8 @@ github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= -github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= +github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM= +github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -572,8 +572,8 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99 github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= -github.com/googleapis/gax-go/v2 v2.12.5 h1:8gw9KZK8TiVKB6q3zHY3SBzLnrGp6HQjyfYBYGmXdxA= -github.com/googleapis/gax-go/v2 v2.12.5/go.mod h1:BUDKcWo+RaKq5SC9vVYL0wLADa3VcfswbOMMRmB9H3E= +github.com/googleapis/gax-go/v2 v2.13.0 h1:yitjD5f7jQHhyDsnhKEBU52NdvvdSeGzlAnDPT0hH1s= +github.com/googleapis/gax-go/v2 v2.13.0/go.mod h1:Z/fvTZXF8/uw7Xu5GuslPw+bplx6SS338j1Is2S+B7A= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= @@ -604,8 +604,8 @@ github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-getter v1.7.5 h1:dT58k9hQ/vbxNMwoI5+xFYAJuv6152UNvdHokfI5wE4= -github.com/hashicorp/go-getter v1.7.5/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-getter v1.7.6 h1:5jHuM+aH373XNtXl9TNTUH5Qd69Trve11tHIrB+6yj4= +github.com/hashicorp/go-getter v1.7.6/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= @@ -812,8 +812,8 @@ github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FI github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20240503122002-4b96552b8156 h1:UOk0WKXxKXmHSlIkwQNhT5AWlMtkijU5pfj8bCOI9vQ= @@ -838,8 +838,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -854,8 +854,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -933,7 +933,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -979,18 +978,18 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0 h1:vS1Ao/R55RNV4O7TA2Qopok8yN+X0LIP6RVWLFkprck= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0/go.mod h1:BMsdeOxN04K0L5FNUBfjFdvwWGNe/rkmSwH4Aelu/X0= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 h1:9l89oX4ba9kHbBol3Xin3leYJ+252h0zszDtBwyKe2A= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0/go.mod h1:XLZfZboOJWHNKUv7eH0inh0E9VV6eWDFB/9yJyTLPp0= -go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= -go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= -go.opentelemetry.io/otel/metric v1.27.0 h1:hvj3vdEKyeCi4YaYfNjv2NUje8FqKqUY8IlF0FxV/ik= -go.opentelemetry.io/otel/metric v1.27.0/go.mod h1:mVFgmRlhljgBiuk/MP/oKylr4hs85GZAylncepAX/ak= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 h1:9G6E0TXzGFVfTnawRzrPl83iHOAV7L8NJiR8RSGYV1g= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0/go.mod h1:azvtTADFQJA8mX80jIH/akaE7h+dbm/sVuaHqN13w74= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= +go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= +go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= +go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= +go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= -go.opentelemetry.io/otel/trace v1.27.0 h1:IqYb813p7cmbHk0a5y6pD5JPakbVfftRXABGt5/Rscw= -go.opentelemetry.io/otel/trace v1.27.0/go.mod h1:6RiD1hkAprV4/q+yd2ln1HG9GoPx39SuvvstaLBl+l4= +go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= +go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -1143,8 +1142,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= -golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= +golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1275,8 +1274,8 @@ golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= +golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1348,8 +1347,6 @@ golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= -golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= @@ -1399,8 +1396,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.185.0 h1:ENEKk1k4jW8SmmaT6RE+ZasxmxezCrD5Vw4npvr+pAU= -google.golang.org/api v0.185.0/go.mod h1:HNfvIkJGlgrIlrbYkAm9W9IdkmKZjOTVh33YltygGbg= +google.golang.org/api v0.192.0 h1:PljqpNAfZaaSpS+TnANfnNAXKdzHM/B9bKhwRlo7JP0= +google.golang.org/api v0.192.0/go.mod h1:9VcphjvAxPKLmSxVSzPlSRXy/5ARMEw5bf58WoVXafQ= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1515,12 +1512,12 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4 h1:CUiCqkPw1nNrNQzCCG4WA65m0nAmQiwXHpub3dNyruU= -google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4/go.mod h1:EvuUDCulqGgV80RvP1BHuom+smhX4qtlhnNatHuroGQ= -google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 h1:MuYw1wJzT+ZkybKfaOXKp5hJiZDn2iHaXRw0mRYdHSc= -google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4/go.mod h1:px9SlOOZBg1wM1zdnr8jEL4CNGUBZ+ZKYtNPApNQc4c= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142 h1:oLiyxGgE+rt22duwci1+TG7bg2/L1LQsXwfjPlmuJA0= +google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142/go.mod h1:G11eXq53iI5Q+kyNOmCvnzBaxEA2Q/Ik5Tj7nqBE8j4= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1562,8 +1559,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= diff --git a/tools/cosmovisor/process.go b/tools/cosmovisor/process.go index c288515005fd..ac759bde39f4 100644 --- a/tools/cosmovisor/process.go +++ b/tools/cosmovisor/process.go @@ -39,7 +39,7 @@ func NewLauncher(logger log.Logger, cfg *Config) (Launcher, error) { // Run launches the app in a subprocess and returns when the subprocess (app) // exits (either when it dies, or *after* a successful upgrade.) and upgrade finished. // Returns true if the upgrade request was detected and the upgrade process started. -func (l Launcher) Run(args []string, stdout, stderr io.Writer) (bool, error) { +func (l Launcher) Run(args []string, stdin io.Reader, stdout, stderr io.Writer) (bool, error) { bin, err := l.cfg.CurrentBin() if err != nil { return false, fmt.Errorf("error creating symlink to genesis: %w", err) @@ -51,6 +51,7 @@ func (l Launcher) Run(args []string, stdout, stderr io.Writer) (bool, error) { l.logger.Info("running app", "path", bin, "args", args) cmd := exec.Command(bin, args...) + cmd.Stdin = stdin cmd.Stdout = stdout cmd.Stderr = stderr if err := cmd.Start(); err != nil { diff --git a/tools/cosmovisor/process_test.go b/tools/cosmovisor/process_test.go index 09658f265cdb..988bcf0a8074 100644 --- a/tools/cosmovisor/process_test.go +++ b/tools/cosmovisor/process_test.go @@ -7,6 +7,7 @@ import ( "bytes" "fmt" "io/fs" + "os" "path/filepath" "sync" "testing" @@ -24,10 +25,11 @@ import ( func TestLaunchProcess(t *testing.T) { // binaries from testdata/validate directory home := copyTestData(t, "validate") - cfg := &cosmovisor.Config{Home: home, Name: "dummyd", PollInterval: 20, UnsafeSkipBackup: true} + cfg := &cosmovisor.Config{Home: home, Name: "dummyd", PollInterval: 15, UnsafeSkipBackup: true} logger := log.NewTestLogger(t).With(log.ModuleKey, "cosmosvisor") // should run the genesis binary and produce expected output + stdin, _ := os.Open(os.DevNull) stdout, stderr := newBuffer(), newBuffer() currentBin, err := cfg.CurrentBin() require.NoError(t, err) @@ -39,7 +41,7 @@ func TestLaunchProcess(t *testing.T) { upgradeFile := cfg.UpgradeInfoFilePath() args := []string{"foo", "bar", "1234", upgradeFile} - doUpgrade, err := launcher.Run(args, stdout, stderr) + doUpgrade, err := launcher.Run(args, stdin, stdout, stderr) require.NoError(t, err) require.True(t, doUpgrade) require.Empty(t, stderr.String()) @@ -54,7 +56,7 @@ func TestLaunchProcess(t *testing.T) { stdout.Reset() stderr.Reset() - doUpgrade, err = launcher.Run(args, stdout, stderr) + doUpgrade, err = launcher.Run(args, stdin, stdout, stderr) require.NoError(t, err) require.False(t, doUpgrade) require.Empty(t, stderr.String()) @@ -72,6 +74,7 @@ func TestPlanDisableRecase(t *testing.T) { logger := log.NewTestLogger(t).With(log.ModuleKey, "cosmosvisor") // should run the genesis binary and produce expected output + stdin, _ := os.Open(os.DevNull) stdout, stderr := newBuffer(), newBuffer() currentBin, err := cfg.CurrentBin() require.NoError(t, err) @@ -83,7 +86,7 @@ func TestPlanDisableRecase(t *testing.T) { upgradeFile := cfg.UpgradeInfoFilePath() args := []string{"foo", "bar", "1234", upgradeFile} - doUpgrade, err := launcher.Run(args, stdout, stderr) + doUpgrade, err := launcher.Run(args, stdin, stdout, stderr) require.NoError(t, err) require.True(t, doUpgrade) require.Empty(t, stderr.String()) @@ -98,7 +101,7 @@ func TestPlanDisableRecase(t *testing.T) { stdout.Reset() stderr.Reset() - doUpgrade, err = launcher.Run(args, stdout, stderr) + doUpgrade, err = launcher.Run(args, stdin, stdout, stderr) require.NoError(t, err) require.False(t, doUpgrade) require.Empty(t, stderr.String()) @@ -115,6 +118,7 @@ func TestLaunchProcessWithRestartDelay(t *testing.T) { logger := log.NewTestLogger(t).With(log.ModuleKey, "cosmosvisor") // should run the genesis binary and produce expected output + stdin, _ := os.Open(os.DevNull) stdout, stderr := newBuffer(), newBuffer() currentBin, err := cfg.CurrentBin() require.NoError(t, err) @@ -126,7 +130,7 @@ func TestLaunchProcessWithRestartDelay(t *testing.T) { upgradeFile := cfg.UpgradeInfoFilePath() start := time.Now() - doUpgrade, err := launcher.Run([]string{"foo", "bar", "1234", upgradeFile}, stdout, stderr) + doUpgrade, err := launcher.Run([]string{"foo", "bar", "1234", upgradeFile}, stdin, stdout, stderr) require.NoError(t, err) require.True(t, doUpgrade) @@ -141,10 +145,11 @@ func TestLaunchProcessWithRestartDelay(t *testing.T) { func TestPlanShutdownGrace(t *testing.T) { // binaries from testdata/validate directory home := copyTestData(t, "dontdie") - cfg := &cosmovisor.Config{Home: home, Name: "dummyd", PollInterval: 20, UnsafeSkipBackup: true, ShutdownGrace: 2 * time.Second} + cfg := &cosmovisor.Config{Home: home, Name: "dummyd", PollInterval: 15, UnsafeSkipBackup: true, ShutdownGrace: 2 * time.Second} logger := log.NewTestLogger(t).With(log.ModuleKey, "cosmosvisor") // should run the genesis binary and produce expected output + stdin, _ := os.Open(os.DevNull) stdout, stderr := newBuffer(), newBuffer() currentBin, err := cfg.CurrentBin() require.NoError(t, err) @@ -156,7 +161,7 @@ func TestPlanShutdownGrace(t *testing.T) { upgradeFile := cfg.UpgradeInfoFilePath() args := []string{"foo", "bar", "1234", upgradeFile} - doUpgrade, err := launcher.Run(args, stdout, stderr) + doUpgrade, err := launcher.Run(args, stdin, stdout, stderr) require.NoError(t, err) require.True(t, doUpgrade) require.Empty(t, stderr.String()) @@ -171,7 +176,7 @@ func TestPlanShutdownGrace(t *testing.T) { stdout.Reset() stderr.Reset() - doUpgrade, err = launcher.Run(args, stdout, stderr) + doUpgrade, err = launcher.Run(args, stdin, stdout, stderr) require.NoError(t, err) require.False(t, doUpgrade) require.Empty(t, stderr.String()) @@ -201,9 +206,10 @@ func TestLaunchProcessWithDownloads(t *testing.T) { launcher, err := cosmovisor.NewLauncher(logger, cfg) require.NoError(t, err) + stdin, _ := os.Open(os.DevNull) stdout, stderr := newBuffer(), newBuffer() args := []string{"some", "args", upgradeFilename} - doUpgrade, err := launcher.Run(args, stdout, stderr) + doUpgrade, err := launcher.Run(args, stdin, stdout, stderr) require.NoError(t, err) require.True(t, doUpgrade) require.Empty(t, stderr.String()) @@ -216,7 +222,7 @@ func TestLaunchProcessWithDownloads(t *testing.T) { stdout.Reset() stderr.Reset() args = []string{"run", "--fast", upgradeFilename} - doUpgrade, err = launcher.Run(args, stdout, stderr) + doUpgrade, err = launcher.Run(args, stdin, stdout, stderr) require.NoError(t, err) require.Empty(t, stderr.String()) @@ -231,7 +237,7 @@ func TestLaunchProcessWithDownloads(t *testing.T) { args = []string{"end", "--halt", upgradeFilename} stdout.Reset() stderr.Reset() - doUpgrade, err = launcher.Run(args, stdout, stderr) + doUpgrade, err = launcher.Run(args, stdin, stdout, stderr) require.NoError(t, err) require.False(t, doUpgrade) require.Empty(t, stderr.String()) @@ -270,9 +276,10 @@ func TestLaunchProcessWithDownloadsAndMissingPreupgrade(t *testing.T) { require.NoError(t, err) // Missing Preupgrade Script + stdin, _ := os.Open(os.DevNull) stdout, stderr := newBuffer(), newBuffer() args := []string{"some", "args", upgradeFilename} - _, err = launcher.Run(args, stdout, stderr) + _, err = launcher.Run(args, stdin, stdout, stderr) require.ErrorContains(t, err, "missing.sh") require.ErrorIs(t, err, fs.ErrNotExist) @@ -305,9 +312,10 @@ func TestLaunchProcessWithDownloadsAndPreupgrade(t *testing.T) { launcher, err := cosmovisor.NewLauncher(logger, cfg) require.NoError(t, err) + stdin, _ := os.Open(os.DevNull) stdout, stderr := newBuffer(), newBuffer() args := []string{"some", "args", upgradeFilename} - doUpgrade, err := launcher.Run(args, stdout, stderr) + doUpgrade, err := launcher.Run(args, stdin, stdout, stderr) require.NoError(t, err) require.True(t, doUpgrade) @@ -324,7 +332,7 @@ func TestLaunchProcessWithDownloadsAndPreupgrade(t *testing.T) { stdout.Reset() stderr.Reset() args = []string{"run", "--fast", upgradeFilename} - doUpgrade, err = launcher.Run(args, stdout, stderr) + doUpgrade, err = launcher.Run(args, stdin, stdout, stderr) require.NoError(t, err) require.Empty(t, stderr.String()) @@ -342,7 +350,7 @@ func TestLaunchProcessWithDownloadsAndPreupgrade(t *testing.T) { args = []string{"end", "--halt", upgradeFilename} stdout.Reset() stderr.Reset() - doUpgrade, err = launcher.Run(args, stdout, stderr) + doUpgrade, err = launcher.Run(args, stdin, stdout, stderr) require.NoError(t, err) require.False(t, doUpgrade) require.Empty(t, stderr.String()) diff --git a/tools/cosmovisor/scanner.go b/tools/cosmovisor/scanner.go index a5bfdf2cc05c..6b46f85bafa3 100644 --- a/tools/cosmovisor/scanner.go +++ b/tools/cosmovisor/scanner.go @@ -16,7 +16,7 @@ import ( ) type fileWatcher struct { - deamonHome string + daemonHome string filename string // full path to a watched file interval time.Duration @@ -53,7 +53,7 @@ func newUpgradeFileWatcher(cfg *Config) (*fileWatcher, error) { } return &fileWatcher{ - deamonHome: cfg.Home, + daemonHome: cfg.Home, currentBin: bin, filename: filenameAbs, interval: cfg.PollInterval, @@ -109,7 +109,32 @@ func (fw *fileWatcher) CheckUpdate(currentUpgrade upgradetypes.Plan) bool { stat, err := os.Stat(fw.filename) if err != nil { - // file doesn't exists + if os.IsNotExist(err) { + return false + } else { + panic(fmt.Errorf("failed to stat upgrade info file: %w", err)) + } + } + + // check https://github.com/cosmos/cosmos-sdk/issues/21086 + // If new file is still empty, wait a small amount of time for write to complete + if stat.Size() == 0 { + for range 10 { + time.Sleep(2 * time.Millisecond) + stat, err = os.Stat(fw.filename) + if err != nil { + if os.IsNotExist(err) { + return false + } else { + panic(fmt.Errorf("failed to stat upgrade info file: %w", err)) + } + } + if stat.Size() == 0 { + break + } + } + } + if stat.Size() == 0 { return false } @@ -118,13 +143,6 @@ func (fw *fileWatcher) CheckUpdate(currentUpgrade upgradetypes.Plan) bool { return false } - // if fw.lastModTime.IsZero() { // check https://github.com/cosmos/cosmos-sdk/issues/21086 - // // first initialization or daemon restart while upgrading-info.json exists. - // // it could be that it was just created and not fully written to disk. - // // wait tiniest bit of time to allow the file to be fully written. - // time.Sleep(2 * time.Millisecond) - // } - info, err := parseUpgradeInfoFile(fw.filename, fw.disableRecase) if err != nil { panic(fmt.Errorf("failed to parse upgrade info file: %w", err)) @@ -167,7 +185,7 @@ func (fw *fileWatcher) checkHeight() (int64, error) { return 0, nil } - result, err := exec.Command(fw.currentBin, "status", "--home", fw.deamonHome).CombinedOutput() //nolint:gosec // we want to execute the status command + result, err := exec.Command(fw.currentBin, "status", "--home", fw.daemonHome).CombinedOutput() //nolint:gosec // we want to execute the status command if err != nil { return 0, err } diff --git a/tools/cosmovisor/testdata/dontdie/cosmovisor/genesis/bin/dummyd b/tools/cosmovisor/testdata/dontdie/cosmovisor/genesis/bin/dummyd index 49e60a1e206d..8694ec8e8e0d 100755 --- a/tools/cosmovisor/testdata/dontdie/cosmovisor/genesis/bin/dummyd +++ b/tools/cosmovisor/testdata/dontdie/cosmovisor/genesis/bin/dummyd @@ -11,7 +11,10 @@ sleep 1 test -z $4 && exit 1001 echo 'UPGRADE "Chain2" NEEDED at height: 49: {}' echo '{"name":"Chain2","height":49,"info":""}' > $4 +# Shutdown grace test waits 2 seconds for flush +# Flush within 1 second sleep 1 echo 'Flushed' -sleep 1 +# Now chain is halted for shutdown grace test. +sleep 2 echo Did not kill in time. Never should be printed!!! diff --git a/tools/hubl/go.mod b/tools/hubl/go.mod index 2d1a39fb1d30..430e7a3f5242 100644 --- a/tools/hubl/go.mod +++ b/tools/hubl/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/tools/hubl -go 1.21 +go 1.21.0 + +toolchain go1.23.0 require ( cosmossdk.io/api v0.7.5 @@ -9,16 +11,16 @@ require ( cosmossdk.io/errors v1.0.1 github.com/cosmos/cosmos-sdk v0.50.9 github.com/manifoldco/promptui v0.9.0 - github.com/pelletier/go-toml/v2 v2.2.2 + github.com/pelletier/go-toml/v2 v2.2.3 github.com/spf13/cobra v1.8.1 - google.golang.org/grpc v1.65.0 + google.golang.org/grpc v1.66.0 google.golang.org/protobuf v1.34.2 ) require ( cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/depinject v1.0.0 // indirect - cosmossdk.io/log v1.4.0 // indirect + cosmossdk.io/log v1.4.1 // indirect cosmossdk.io/math v1.3.0 // indirect cosmossdk.io/store v1.1.0 // indirect cosmossdk.io/x/tx v0.13.4 // indirect @@ -42,13 +44,13 @@ require ( github.com/cometbft/cometbft v0.38.10 // indirect github.com/cometbft/cometbft-db v0.9.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-db v1.0.2 // indirect + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 // indirect github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/gogoproto v1.7.0 // indirect github.com/cosmos/iavl v1.1.4 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -96,7 +98,7 @@ require ( github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.7 // indirect @@ -114,9 +116,9 @@ require ( github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -147,8 +149,8 @@ require ( golang.org/x/term v0.23.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect diff --git a/tools/hubl/go.sum b/tools/hubl/go.sum index 2cb150af7a9b..d4b30a69bbb6 100644 --- a/tools/hubl/go.sum +++ b/tools/hubl/go.sum @@ -12,8 +12,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.1.0 h1:LnKwgYMc9BInn9PhpTFEQVbL9UK475G2H911CGGnWHk= @@ -145,8 +145,8 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/cosmos-sdk v0.50.9 h1:gt2usjz0H0qW6KwAxWw7ZJ3XU8uDwmhN+hYG3nTLeSg= @@ -160,8 +160,8 @@ github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fr github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.1.4 h1:Z0cVVjeQqOUp78/nWt/uhQy83vYluWlAMGQ4zbH9G34= github.com/cosmos/iavl v1.1.4/go.mod h1:vCYmRQUJU1wwj0oRD3wMEtOM9sJNDP+GFMaXmIxZ/rU= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= @@ -445,8 +445,8 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -457,6 +457,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= @@ -572,8 +574,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba h1:3jPgmsFGBID1wFfU2AbYocNcN4wqU68UaHSdMjiw/7U= @@ -598,8 +600,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -614,8 +616,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -690,8 +692,6 @@ github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3 github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -700,10 +700,7 @@ 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/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -941,10 +938,10 @@ google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -962,8 +959,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/tools/hubl/internal/remote.go b/tools/hubl/internal/remote.go index e792d6c1e661..0584c0800eb4 100644 --- a/tools/hubl/internal/remote.go +++ b/tools/hubl/internal/remote.go @@ -25,7 +25,7 @@ func InitCmd(config *config.Config, configDir string) *cobra.Command { var insecure bool cmd := &cobra.Command{ - Use: "init [foochain]", + Use: "init ", Short: "Initialize a new chain", Long: `To configure a new chain, run this command using the --init flag and the name of the chain as it's listed in the chain registry (https://github.com/cosmos/chain-registry). If the chain is not listed in the chain registry, you can use any unique name.`, diff --git a/types/abci.pb.go b/types/abci.pb.go index 2d7c0f59a582..b4dadfb2d040 100644 --- a/types/abci.pb.go +++ b/types/abci.pb.go @@ -63,8 +63,6 @@ type TxResponse struct { // these events include those emitted by processing all the messages and those // emitted from the ante. Whereas Logs contains the events, with // additional metadata, emitted only by processing the messages. - // - // Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 Events []v1.Event `protobuf:"bytes,13,rep,name=events,proto3" json:"events"` } diff --git a/types/address.go b/types/address.go index 8b19141e6569..afe35755487b 100644 --- a/types/address.go +++ b/types/address.go @@ -149,6 +149,7 @@ type Address interface { Marshal() ([]byte, error) MarshalJSON() ([]byte, error) Bytes() []byte + // Deprecated: Use an address.Codec to convert addresses from and to string/bytes. String() string Format(s fmt.State, verb rune) } @@ -179,6 +180,7 @@ func AccAddressFromHexUnsafe(address string) (addr AccAddress, err error) { } // MustAccAddressFromBech32 calls AccAddressFromBech32 and panics on error. +// Deprecated: Use an address.Codec to convert addresses from and to string/bytes. func MustAccAddressFromBech32(address string) AccAddress { addr, err := AccAddressFromBech32(address) if err != nil { @@ -189,6 +191,7 @@ func MustAccAddressFromBech32(address string) AccAddress { } // AccAddressFromBech32 creates an AccAddress from a Bech32 string. +// Deprecated: Use an address.Codec to convert addresses from and to string/bytes. func AccAddressFromBech32(address string) (addr AccAddress, err error) { bech32PrefixAccAddr := GetConfig().GetBech32AccountAddrPrefix() @@ -281,6 +284,7 @@ func (aa AccAddress) Bytes() []byte { } // String implements the Stringer interface. +// Deprecated: Use an address.Codec to convert addresses from and to string/bytes. func (aa AccAddress) String() string { if aa.Empty() { return "" @@ -328,6 +332,7 @@ func ValAddressFromHex(address string) (addr ValAddress, err error) { } // ValAddressFromBech32 creates a ValAddress from a Bech32 string. +// Deprecated: Use an address.Codec to convert addresses from and to string/bytes. func ValAddressFromBech32(address string) (addr ValAddress, err error) { bech32PrefixValAddr := GetConfig().GetBech32ValidatorAddrPrefix() @@ -336,6 +341,7 @@ func ValAddressFromBech32(address string) (addr ValAddress, err error) { } // MustValAddressFromBech32 calls ValAddressFromBech32 and panics on error. +// Deprecated: Use an address.Codec to convert addresses from and to string/bytes. func MustValAddressFromBech32(address string) ValAddress { addr, err := ValAddressFromBech32(address) if err != nil { @@ -432,6 +438,7 @@ func (va ValAddress) Bytes() []byte { } // String implements the Stringer interface. +// Deprecated: Use an address.Codec to convert addresses from and to string/bytes. func (va ValAddress) String() string { if va.Empty() { return "" @@ -480,6 +487,7 @@ func ConsAddressFromHex(address string) (addr ConsAddress, err error) { } // ConsAddressFromBech32 creates a ConsAddress from a Bech32 string. +// Deprecated: Use an address.Codec to convert addresses from and to string/bytes. func ConsAddressFromBech32(address string) (addr ConsAddress, err error) { bech32PrefixConsAddr := GetConfig().GetBech32ConsensusAddrPrefix() @@ -579,6 +587,7 @@ func (ca ConsAddress) Bytes() []byte { } // String implements the Stringer interface. +// Deprecated: Use an address.Codec to convert addresses from and to string/bytes. func (ca ConsAddress) String() string { if ca.Empty() { return "" diff --git a/types/address_test.go b/types/address_test.go index 394dc46a423d..04edc6d6075f 100644 --- a/types/address_test.go +++ b/types/address_test.go @@ -22,14 +22,6 @@ import ( "github.com/cosmos/cosmos-sdk/types/bech32/legacybech32" //nolint:staticcheck // we're using this to support the legacy way of dealing with bech32 ) -const ( - pubStr = "pub" - valoper = "valoper" - valoperpub = "valoperpub" - valcons = "valcons" - valconspub = "valconspub" -) - type addressTestSuite struct { suite.Suite } @@ -42,17 +34,22 @@ func (s *addressTestSuite) SetupSuite() { s.T().Parallel() } -var invalidStrs = []string{ - "hello, world!", - "0xAA", - "AAA", - types.Bech32PrefixAccAddr + "AB0C", - types.Bech32PrefixAccPub + "1234", - types.Bech32PrefixValAddr + "5678", - types.Bech32PrefixValPub + "BBAB", - types.Bech32PrefixConsAddr + "FF04", - types.Bech32PrefixConsPub + "6789", -} +var ( + invalidStrs = []string{ + "hello, world!", + "0xAA", + "AAA", + types.Bech32PrefixAccAddr + "AB0C", + types.Bech32PrefixAccPub + "1234", + types.Bech32PrefixValAddr + "5678", + types.Bech32PrefixValPub + "BBAB", + types.Bech32PrefixConsAddr + "FF04", + types.Bech32PrefixConsPub + "6789", + } + + addr10byte = []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} + addr20byte = []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19} +) func (s *addressTestSuite) testMarshal(original, res interface{}, marshal func() ([]byte, error), unmarshal func([]byte) error) { bz, err := marshal() @@ -161,6 +158,12 @@ func (s *addressTestSuite) TestUnmarshalYAMLWithInvalidInput() { s.Require().Equal(types.ErrEmptyHexAddress, err) } +func setConfigWithPrefix(conf *types.Config, prefix string) { + conf.SetBech32PrefixForAccount(prefix, types.GetBech32PrefixAccPub(prefix)) + conf.SetBech32PrefixForValidator(types.GetBech32PrefixValAddr(prefix), types.GetBech32PrefixValPub(prefix)) + conf.SetBech32PrefixForConsensusNode(types.GetBech32PrefixConsAddr(prefix), types.GetBech32PrefixConsPub(prefix)) +} + // Test that the account address cache ignores the bech32 prefix setting, retrieving bech32 addresses from the cache. // This will cause the AccAddress.String() to print out unexpected prefixes if the config was changed between bech32 lookups. // See https://github.com/cosmos/cosmos-sdk/issues/15317. @@ -173,18 +176,14 @@ func (s *addressTestSuite) TestAddrCache() { // Set SDK bech32 prefixes to 'osmo' prefix := "osmo" conf := types.GetConfig() - conf.SetBech32PrefixForAccount(prefix, prefix+pubStr) - conf.SetBech32PrefixForValidator(prefix+valoper, prefix+valoperpub) - conf.SetBech32PrefixForConsensusNode(prefix+valcons, prefix+valconspub) + setConfigWithPrefix(conf, prefix) acc := types.AccAddress(pub.Address()) osmoAddrBech32 := acc.String() // Set SDK bech32 to 'cosmos' prefix = "cosmos" - conf.SetBech32PrefixForAccount(prefix, prefix+pubStr) - conf.SetBech32PrefixForValidator(prefix+valoper, prefix+valoperpub) - conf.SetBech32PrefixForConsensusNode(prefix+valcons, prefix+valconspub) + setConfigWithPrefix(conf, prefix) // We name this 'addrCosmos' to prove a point, but the bech32 address will still begin with 'osmo' due to the cache behavior. addrCosmos := types.AccAddress(pub.Address()) @@ -210,18 +209,14 @@ func (s *addressTestSuite) TestAddrCacheDisabled() { // Set SDK bech32 prefixes to 'osmo' prefix := "osmo" conf := types.GetConfig() - conf.SetBech32PrefixForAccount(prefix, prefix+pubStr) - conf.SetBech32PrefixForValidator(prefix+valoper, prefix+valoperpub) - conf.SetBech32PrefixForConsensusNode(prefix+valcons, prefix+valconspub) + setConfigWithPrefix(conf, prefix) acc := types.AccAddress(pub.Address()) osmoAddrBech32 := acc.String() // Set SDK bech32 to 'cosmos' prefix = "cosmos" - conf.SetBech32PrefixForAccount(prefix, prefix+pubStr) - conf.SetBech32PrefixForValidator(prefix+valoper, prefix+valoperpub) - conf.SetBech32PrefixForConsensusNode(prefix+valcons, prefix+valconspub) + setConfigWithPrefix(conf, prefix) addrCosmos := types.AccAddress(pub.Address()) cosmosAddrBech32 := addrCosmos.String() @@ -409,8 +404,6 @@ func (s *addressTestSuite) TestAddressInterface() { } func (s *addressTestSuite) TestBech32ifyAddressBytes() { - addr10byte := []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} - addr20byte := []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19} type args struct { prefix string bs []byte @@ -442,8 +435,6 @@ func (s *addressTestSuite) TestBech32ifyAddressBytes() { } func (s *addressTestSuite) TestMustBech32ifyAddressBytes() { - addr10byte := []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} - addr20byte := []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19} type args struct { prefix string bs []byte @@ -536,7 +527,7 @@ func (s *addressTestSuite) TestGetFromBech32() { } func (s *addressTestSuite) TestMustValAddressFromBech32() { - valAddress1 := types.ValAddress([]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}) + valAddress1 := types.ValAddress(addr20byte) valAddress2 := types.MustValAddressFromBech32(valAddress1.String()) s.Require().Equal(valAddress1, valAddress2) @@ -589,7 +580,7 @@ func (s *addressTestSuite) TestGetBech32PrefixConsPub() { } func (s *addressTestSuite) TestMustAccAddressFromBech32() { - accAddress1 := types.AccAddress([]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}) + accAddress1 := types.AccAddress(addr20byte) accAddress2 := types.MustAccAddressFromBech32(accAddress1.String()) s.Require().Equal(accAddress1, accAddress2) } @@ -628,10 +619,9 @@ func (s *addressTestSuite) TestUnmarshalYAMLAccAddressWithEmptyString() { } func (s *addressTestSuite) TestFormatAccAddressAsString() { - addr20byte := []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19} accAddr := types.AccAddress(addr20byte) - actual := fmt.Sprintf("%s", accAddr) // this will call internally the method AccAddress.Format + actual := fmt.Sprintf("%s", accAddr) // this will internally calls AccAddress.Format method hrp := types.GetConfig().GetBech32AccountAddrPrefix() expected, err := bech32.ConvertAndEncode(hrp, addr20byte) @@ -640,9 +630,9 @@ func (s *addressTestSuite) TestFormatAccAddressAsString() { } func (s *addressTestSuite) TestFormatAccAddressAsPointer() { - accAddr := types.AccAddress([]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}) + accAddr := types.AccAddress(addr20byte) ptrAddr := &accAddr - actual := fmt.Sprintf("%p", ptrAddr) // this will call internally the method AccAddress.Format + actual := fmt.Sprintf("%p", ptrAddr) // this will internally calls AccAddress.Format method expected := fmt.Sprintf("0x%x", uintptr(unsafe.Pointer(&accAddr))) s.Require().Equal(expected, actual) } @@ -684,7 +674,6 @@ func (s *addressTestSuite) TestUnmarshalYAMLValAddressWithEmptyString() { } func (s *addressTestSuite) TestFormatValAddressAsString() { - addr20byte := []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19} accAddr := types.ValAddress(addr20byte) actual := fmt.Sprintf("%s", accAddr) @@ -696,7 +685,7 @@ func (s *addressTestSuite) TestFormatValAddressAsString() { } func (s *addressTestSuite) TestFormatValAddressAsPointer() { - accAddr := types.AccAddress([]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}) + accAddr := types.AccAddress(addr20byte) ptrAddr := &accAddr actual := fmt.Sprintf("%p", ptrAddr) expected := uintptr(unsafe.Pointer(&accAddr)) @@ -704,7 +693,7 @@ func (s *addressTestSuite) TestFormatValAddressAsPointer() { } func (s *addressTestSuite) TestFormatValAddressWhenVerbIsDifferentFromSOrP() { - myAddr := types.ValAddress([]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}) + myAddr := types.ValAddress(addr20byte) exp := "000102030405060708090A0B0C0D0E0F10111213" spec := []string{"%v", "%#v", "%t", "%b", "%c", "%d", "%o", "%O", "%x", "%X", "%U", "%e", "%E", "%f", "%F", "%g", "%G"} for _, v := range spec { @@ -740,7 +729,7 @@ func (s *addressTestSuite) TestUnmarshalYAMLConsAddressWithEmptyString() { } func (s *addressTestSuite) TestFormatConsAddressAsString() { - consAddr := types.ConsAddress([]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}) + consAddr := types.ConsAddress(addr20byte) actual := fmt.Sprintf("%s", consAddr) hrp := types.GetConfig().GetBech32ConsensusAddrPrefix() @@ -750,7 +739,7 @@ func (s *addressTestSuite) TestFormatConsAddressAsString() { } func (s *addressTestSuite) TestFormatConsAddressAsPointer() { - consAddr := types.ConsAddress([]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}) + consAddr := types.ConsAddress(addr20byte) ptrAddr := &consAddr actual := fmt.Sprintf("%p", ptrAddr) @@ -759,7 +748,7 @@ func (s *addressTestSuite) TestFormatConsAddressAsPointer() { } func (s *addressTestSuite) TestFormatConsAddressWhenVerbIsDifferentFromSOrP() { - myAddr := types.ConsAddress([]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}) + myAddr := types.ConsAddress(addr20byte) exp := "000102030405060708090A0B0C0D0E0F10111213" spec := []string{"%v", "%#v", "%t", "%b", "%c", "%d", "%o", "%O", "%x", "%X", "%U", "%e", "%E", "%f", "%F", "%g", "%G"} for _, v := range spec { diff --git a/types/coin.go b/types/coin.go index 99e74ee65df9..702d8591ddb0 100644 --- a/types/coin.go +++ b/types/coin.go @@ -285,7 +285,7 @@ func (coins Coins) Validate() error { } } -// IsSorted returns true when coins are order ASC sorted with denoms. +// IsSorted returns true when coins are sorted in ASC order by denoms. func (coins Coins) IsSorted() bool { for i := 1; i < len(coins); i++ { if coins[i-1].Denom > coins[i].Denom { diff --git a/types/config.go b/types/config.go index 7089ceaff74b..90008fb8512b 100644 --- a/types/config.go +++ b/types/config.go @@ -10,8 +10,16 @@ import ( // DefaultKeyringServiceName defines a default service name for the keyring. const DefaultKeyringServiceName = "cosmos" +func KeyringServiceName() string { + if len(version.Name) == 0 { + return DefaultKeyringServiceName + } + return version.Name +} + // Config is the structure that holds the SDK configuration parameters. -// This could be used to initialize certain configuration parameters for the SDK. +// Deprecated: The global SDK config is deprecated and users should prefer using an address codec. +// Users must still set the global config until the Stringer interface on `AccAddress`, `ValAddress`, and `ConsAddress` is removed. type Config struct { bech32AddressPrefix map[string]string mtx sync.RWMutex @@ -140,10 +148,3 @@ func (config *Config) GetBech32ValidatorPubPrefix() string { func (config *Config) GetBech32ConsensusPubPrefix() string { return config.bech32AddressPrefix["consensus_pub"] } - -func KeyringServiceName() string { - if len(version.Name) == 0 { - return DefaultKeyringServiceName - } - return version.Name -} diff --git a/types/context.go b/types/context.go index 04b74c19d8ce..3f5778c638f1 100644 --- a/types/context.go +++ b/types/context.go @@ -45,11 +45,11 @@ type Context struct { chainID string // Deprecated: Use HeaderService for chainID and CometService for the rest txBytes []byte logger log.Logger - voteInfo []abci.VoteInfo // Deprecated: use Cometinfo.LastCommit.Votes instead, will be removed after 0.51 + voteInfo []abci.VoteInfo // Deprecated: use Cometinfo.LastCommit.Votes instead, will be removed after 0.52 gasMeter storetypes.GasMeter blockGasMeter storetypes.GasMeter - checkTx bool // Deprecated: use execMode instead, will be removed after 0.51 - recheckTx bool // if recheckTx == true, then checkTx must also be true // Deprecated: use execMode instead, will be removed after 0.51 + checkTx bool // Deprecated: use execMode instead, will be removed after 0.52 + recheckTx bool // if recheckTx == true, then checkTx must also be true // Deprecated: use execMode instead, will be removed after 0.52 sigverifyTx bool // when run simulation, because the private key corresponding to the account in the genesis.json randomly generated, we must skip the sigverify. execMode ExecMode minGasPrice DecCoins @@ -102,7 +102,7 @@ func (c Context) HeaderHash() []byte { return hash } -// Deprecated: getting consensus params from the context is deprecated and will be removed after 0.51 +// Deprecated: getting consensus params from the context is deprecated and will be removed after 0.52 // Querying the consensus module for the parameters is required in server/v2 func (c Context) ConsensusParams() cmtproto.ConsensusParams { return c.consParams @@ -138,7 +138,7 @@ func NewContext(ms storetypes.MultiStore, isCheckTx bool, logger log.Logger) Con kvGasConfig: storetypes.KVGasConfig(), transientKVGasConfig: storetypes.TransientGasConfig(), headerInfo: header.Info{ - Time: h.Time.UTC(), + Time: h.Time, }, } } @@ -161,7 +161,7 @@ func (c Context) WithBlockHeader(header cmtproto.Header) Context { header.Time = header.Time.UTC() c.header = header - // when calling withBlockheader on a new context chainID in the struct is empty + // when calling withBlockheader on a new context, chainID in the struct will be empty c.chainID = header.ChainID return c } @@ -208,7 +208,7 @@ func (c Context) WithLogger(logger log.Logger) Context { } // WithVoteInfos returns a Context with an updated consensus VoteInfo. -// Deprecated: use WithCometinfo() instead, will be removed after 0.51 +// Deprecated: use WithCometinfo() instead, will be removed after 0.52 func (c Context) WithVoteInfos(voteInfo []abci.VoteInfo) Context { c.voteInfo = voteInfo return c diff --git a/types/context_test.go b/types/context_test.go index f705bc33c87e..8975c048f01e 100644 --- a/types/context_test.go +++ b/types/context_test.go @@ -10,6 +10,7 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "cosmossdk.io/core/comet" storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" @@ -18,6 +19,8 @@ import ( "github.com/cosmos/cosmos-sdk/types" ) +type dummyCtxKey struct{} + type contextTestSuite struct { suite.Suite } @@ -137,7 +140,7 @@ func (s *contextTestSuite) TestContextWithCustom() { s.Require().Equal(cp, ctx.WithConsensusParams(cp).ConsensusParams()) // test inner context - newContext := context.WithValue(ctx.Context(), struct{}{}, "value") + newContext := context.WithValue(ctx.Context(), dummyCtxKey{}, "value") s.Require().NotEqual(ctx.Context(), ctx.WithContext(newContext).Context()) } @@ -225,7 +228,124 @@ func (s *contextTestSuite) TestUnwrapSDKContext() { s.Require().Panics(func() { types.UnwrapSDKContext(ctx) }) // test unwrapping when we've used context.WithValue - ctx = context.WithValue(sdkCtx, struct{}{}, "bar") + ctx = context.WithValue(sdkCtx, dummyCtxKey{}, "bar") sdkCtx2 = types.UnwrapSDKContext(ctx) s.Require().Equal(sdkCtx, sdkCtx2) } + +func (s *contextTestSuite) TestTryUnwrapSDKContext() { + sdkCtx := types.NewContext(nil, false, nil) + ctx := types.WrapSDKContext(sdkCtx) + unwrappedCtx, ok := types.TryUnwrapSDKContext(ctx) + s.Require().True(ok) + s.Require().Equal(sdkCtx, unwrappedCtx) + + // test case where context doesn't have sdk.Context + ctxWithoutSDK := context.Background() + unwrappedCtx, ok = types.TryUnwrapSDKContext(ctxWithoutSDK) + s.Require().False(ok) + s.Require().Equal(types.Context{}, unwrappedCtx) + + // test try unwrapping when we've used context.WithValue + ctx = context.WithValue(sdkCtx, dummyCtxKey{}, "bar") + unwrappedCtx, ok = types.TryUnwrapSDKContext(ctx) + s.Require().True(ok) + s.Require().Equal(sdkCtx, unwrappedCtx) +} + +func (s *contextTestSuite) TestToSDKEvidence() { + misbehaviors := []abci.Misbehavior{ + { + Type: abci.MisbehaviorType(1), + Height: 100, + Time: time.Now(), + TotalVotingPower: 10, + Validator: abci.Validator{ + Address: []byte("address1"), + Power: 5, + }, + }, + } + + expEvidences := []comet.Evidence{ + { + Type: comet.MisbehaviorType(1), + Height: 100, + Time: misbehaviors[0].Time, + TotalVotingPower: 10, + Validator: comet.Validator{ + Address: []byte("address1"), + Power: 5, + }, + }, + } + + // test ToSDKEvidence method + evidence := types.ToSDKEvidence(misbehaviors) + s.Require().Len(evidence, len(misbehaviors)) + s.Require().Equal(expEvidences, evidence) +} + +func (s *contextTestSuite) TestToSDKCommitInfo() { + commitInfo := abci.CommitInfo{ + Round: 1, + Votes: []abci.VoteInfo{ + { + Validator: abci.Validator{ + Address: []byte("address1"), + Power: 5, + }, + BlockIdFlag: cmtproto.BlockIDFlagCommit, + }, + }, + } + + expCommit := comet.CommitInfo{ + Round: 1, + Votes: []comet.VoteInfo{ + { + Validator: comet.Validator{ + Address: []byte("address1"), + Power: 5, + }, + BlockIDFlag: comet.BlockIDFlagCommit, + }, + }, + } + + // test ToSDKCommitInfo method + commit := types.ToSDKCommitInfo(commitInfo) + s.Require().Equal(expCommit, commit) +} + +func (s *contextTestSuite) TestToSDKExtendedCommitInfo() { + extendedCommitInfo := abci.ExtendedCommitInfo{ + Round: 1, + Votes: []abci.ExtendedVoteInfo{ + { + Validator: abci.Validator{ + Address: []byte("address1"), + Power: 5, + }, + BlockIdFlag: cmtproto.BlockIDFlagCommit, + }, + }, + } + + expCommitInfo := comet.CommitInfo{ + Round: 1, + Votes: []comet.VoteInfo{ + { + Validator: comet.Validator{ + Address: []byte("address1"), + Power: 5, + }, + BlockIDFlag: comet.BlockIDFlagCommit, + }, + }, + } + + // test ToSDKExtendedCommitInfo + commitInfo := types.ToSDKExtendedCommitInfo(extendedCommitInfo) + s.Require().Equal(expCommitInfo, commitInfo) +} diff --git a/types/events.go b/types/events.go index 748b35ce63d4..55568c385897 100644 --- a/types/events.go +++ b/types/events.go @@ -3,6 +3,7 @@ package types import ( "encoding/json" "fmt" + "maps" "reflect" "slices" "strings" @@ -10,7 +11,6 @@ import ( abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" "github.com/cosmos/gogoproto/jsonpb" "github.com/cosmos/gogoproto/proto" - "golang.org/x/exp/maps" "github.com/cosmos/cosmos-sdk/codec" ) @@ -100,9 +100,7 @@ func TypedEventToEvent(tev proto.Message) (Event, error) { } // sort the keys to ensure the order is always the same - keys := maps.Keys(attrMap) - slices.Sort(keys) - + keys := slices.Sorted(maps.Keys(attrMap)) attrs := make([]abci.EventAttribute, 0, len(attrMap)) for _, k := range keys { v := attrMap[k] diff --git a/types/mempool/mempool_test.go b/types/mempool/mempool_test.go index 5c3215857c6d..e1351414644e 100644 --- a/types/mempool/mempool_test.go +++ b/types/mempool/mempool_test.go @@ -14,7 +14,6 @@ import ( _ "cosmossdk.io/api/cosmos/crypto/secp256k1" "cosmossdk.io/core/transaction" "cosmossdk.io/log" - "cosmossdk.io/x/auth/signing" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" @@ -24,6 +23,7 @@ import ( moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" txsigning "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/signing" ) // testPubKey is a dummy implementation of PubKey used for testing. diff --git a/types/mempool/priority_nonce_test.go b/types/mempool/priority_nonce_test.go index 0a2f40355fbd..4b1c27c1808b 100644 --- a/types/mempool/priority_nonce_test.go +++ b/types/mempool/priority_nonce_test.go @@ -10,11 +10,11 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/log" - "cosmossdk.io/x/auth/signing" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/mempool" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/auth/signing" ) func TestOutOfOrder(t *testing.T) { @@ -71,7 +71,7 @@ func (a signerExtractionAdapter) GetSigners(tx sdk.Tx) ([]mempool.SignerData, er if err != nil { return nil, err } - signerData := make([]mempool.SignerData, len(sigs)) + signerData := make([]mempool.SignerData, 0, len(sigs)) for _, sig := range sigs { signerData = append(signerData, mempool.SignerData{ Signer: sig.PubKey.Address().Bytes(), diff --git a/types/mempool/sender_nonce.go b/types/mempool/sender_nonce.go index fc4902f64792..d69d5b6f6c18 100644 --- a/types/mempool/sender_nonce.go +++ b/types/mempool/sender_nonce.go @@ -10,9 +10,8 @@ import ( "github.com/huandu/skiplist" - "cosmossdk.io/x/auth/signing" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/signing" ) var ( diff --git a/types/mempool/sender_nonce_property_test.go b/types/mempool/sender_nonce_property_test.go index 5ebda7d6f93d..faf0eae86b6d 100644 --- a/types/mempool/sender_nonce_property_test.go +++ b/types/mempool/sender_nonce_property_test.go @@ -7,11 +7,11 @@ import ( "pgregory.net/rapid" "cosmossdk.io/log" - "cosmossdk.io/x/auth/signing" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/mempool" + "github.com/cosmos/cosmos-sdk/x/auth/signing" ) var ( diff --git a/types/mempool/signer_extraction_adapter.go b/types/mempool/signer_extraction_adapter.go index f79d6c0693d5..10718cb9dddd 100644 --- a/types/mempool/signer_extraction_adapter.go +++ b/types/mempool/signer_extraction_adapter.go @@ -3,9 +3,8 @@ package mempool import ( "fmt" - "cosmossdk.io/x/auth/signing" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/signing" ) // SignerData contains canonical useful information about the signer of a transaction diff --git a/types/module/module.go b/types/module/module.go index 06be7817eb14..1a20635f9dac 100644 --- a/types/module/module.go +++ b/types/module/module.go @@ -24,12 +24,13 @@ import ( "encoding/json" "errors" "fmt" + "maps" + "slices" "sort" abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - "golang.org/x/exp/maps" "google.golang.org/grpc" "cosmossdk.io/core/appmodule" @@ -41,6 +42,8 @@ import ( storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -96,7 +99,7 @@ type HasServices interface { // hasServicesV1 is the interface for registering service in baseapp Cosmos SDK. // This API is part of core/appmodule but commented out for dependencies. type hasServicesV1 interface { - appmodule.AppModule + appmodulev2.AppModule RegisterServices(grpc.ServiceRegistrar) error } @@ -292,7 +295,11 @@ func (m *Manager) SetOrderMigrations(moduleNames ...string) { // RegisterLegacyAminoCodec registers all module codecs func (m *Manager) RegisterLegacyAminoCodec(cdc legacy.Amino) { - for _, b := range m.Modules { + for name, b := range m.Modules { + if _, ok := b.(interface{ RegisterLegacyAminoCodec(*codec.LegacyAmino) }); ok { + panic(fmt.Sprintf("%s uses a deprecated amino registration api, implement HasAminoCodec instead if necessary", name)) + } + if mod, ok := b.(HasAminoCodec); ok { mod.RegisterLegacyAminoCodec(cdc) } @@ -301,7 +308,13 @@ func (m *Manager) RegisterLegacyAminoCodec(cdc legacy.Amino) { // RegisterInterfaces registers all module interface types func (m *Manager) RegisterInterfaces(registrar registry.InterfaceRegistrar) { - for _, b := range m.Modules { + for name, b := range m.Modules { + if _, ok := b.(interface { + RegisterInterfaces(cdctypes.InterfaceRegistry) + }); ok { + panic(fmt.Sprintf("%s uses a deprecated interface registration api, implement appmodule.HasRegisterInterfaces instead", name)) + } + if mod, ok := b.(appmodule.HasRegisterInterfaces); ok { mod.RegisterInterfaces(registrar) } @@ -713,7 +726,6 @@ func (m Manager) RunMigrations(ctx context.Context, cfg Configurator, fromVM app // It takes the current context as a parameter and returns a boolean value // indicating whether the migration was successfully executed or not. func (m *Manager) PreBlock(ctx sdk.Context) error { - ctx = ctx.WithEventManager(sdk.NewEventManager()) for _, moduleName := range m.OrderPreBlockers { if module, ok := m.Modules[moduleName].(appmodule.HasPreBlocker); ok { if err := module.PreBlock(ctx); err != nil { @@ -832,7 +844,7 @@ func (m *Manager) GetVersionMap() appmodule.VersionMap { // ModuleNames returns list of all module names, without any particular order. func (m *Manager) ModuleNames() []string { - return maps.Keys(m.Modules) + return slices.Collect(maps.Keys(m.Modules)) } // DefaultMigrationsOrder returns a default migrations order: ascending alphabetical by module name, diff --git a/types/module/module_test.go b/types/module/module_test.go index 990dc0d2a711..fb2b5f746540 100644 --- a/types/module/module_test.go +++ b/types/module/module_test.go @@ -15,13 +15,13 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/log" - authtypes "cosmossdk.io/x/auth/types" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/testutil/mock" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var errFoo = errors.New("dummy") diff --git a/types/module/testutil/codec.go b/types/module/testutil/codec.go index c6753e6b271e..2250b1208555 100644 --- a/types/module/testutil/codec.go +++ b/types/module/testutil/codec.go @@ -1,14 +1,13 @@ package testutil import ( - "cosmossdk.io/x/auth/tx" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/testutil" "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/std" "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/x/auth/tx" ) // TestEncodingConfig defines an encoding configuration that is used for testing diff --git a/x/accounts/account_test.go b/x/accounts/account_test.go index 6d6834b90fa7..f5b7b8117125 100644 --- a/x/accounts/account_test.go +++ b/x/accounts/account_test.go @@ -2,15 +2,18 @@ package accounts import ( "context" + "fmt" "strconv" "github.com/cosmos/gogoproto/types" - bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" - basev1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" "cosmossdk.io/collections" + "cosmossdk.io/math" "cosmossdk.io/x/accounts/accountstd" "cosmossdk.io/x/accounts/internal/implementation" + banktypes "cosmossdk.io/x/bank/types" + + sdk "github.com/cosmos/cosmos-sdk/types" ) var _ implementation.Account = (*TestAccount)(nil) @@ -28,7 +31,7 @@ type TestAccount struct { func (t TestAccount) RegisterInitHandler(builder *implementation.InitBuilder) { implementation.RegisterInitHandler(builder, func(ctx context.Context, _ *types.Empty) (*types.Empty, error) { // we also force a module call here to test things work as expected. - _, err := implementation.QueryModule[bankv1beta1.QueryBalanceResponse](ctx, &bankv1beta1.QueryBalanceRequest{ + _, err := implementation.QueryModule(ctx, &banktypes.QueryBalanceRequest{ Address: string(implementation.Whoami(ctx)), Denom: "atom", }) @@ -52,15 +55,10 @@ func (t TestAccount) RegisterExecuteHandlers(builder *implementation.ExecuteBuil // this is for intermodule comms testing, we simulate a bank send implementation.RegisterExecuteHandler(builder, func(ctx context.Context, req *types.Int64Value) (*types.Empty, error) { - resp, err := implementation.ExecModule[bankv1beta1.MsgSendResponse](ctx, &bankv1beta1.MsgSend{ + resp, err := implementation.ExecModule(ctx, &banktypes.MsgSend{ FromAddress: string(implementation.Whoami(ctx)), ToAddress: "recipient", - Amount: []*basev1beta1.Coin{ - { - Denom: "test", - Amount: strconv.FormatInt(req.Value, 10), - }, - }, + Amount: sdk.NewCoins(sdk.NewCoin("test", math.NewInt(req.Value))), }) if err != nil { return nil, err @@ -90,7 +88,7 @@ func (t TestAccount) RegisterQueryHandlers(builder *implementation.QueryBuilder) // test intermodule comms, we simulate someone is sending the account a request for the accounts balance // of a given denom. implementation.RegisterQueryHandler(builder, func(ctx context.Context, req *types.StringValue) (*types.Int64Value, error) { - resp, err := implementation.QueryModule[bankv1beta1.QueryBalanceResponse](ctx, &bankv1beta1.QueryBalanceRequest{ + resp, err := implementation.QueryModule(ctx, &banktypes.QueryBalanceRequest{ Address: string(implementation.Whoami(ctx)), Denom: req.Value, }) @@ -98,11 +96,12 @@ func (t TestAccount) RegisterQueryHandlers(builder *implementation.QueryBuilder) return nil, err } - amt, err := strconv.ParseInt(resp.Balance.Amount, 10, 64) - if err != nil { - return nil, err + r, ok := resp.(*banktypes.QueryBalanceResponse) + if !ok { + panic(fmt.Sprintf("unexpected response type: %T", resp)) } - return &types.Int64Value{Value: amt}, nil + + return &types.Int64Value{Value: r.Balance.Amount.Int64()}, nil }) // genesis testing; DoubleValue does not make sense as a request type for this query, but empty is already taken diff --git a/x/accounts/accountstd/exports.go b/x/accounts/accountstd/exports.go index ea181db0a6b0..24ffc17c1e98 100644 --- a/x/accounts/accountstd/exports.go +++ b/x/accounts/accountstd/exports.go @@ -6,6 +6,7 @@ import ( "context" "fmt" + "cosmossdk.io/core/transaction" "cosmossdk.io/x/accounts/internal/implementation" sdk "github.com/cosmos/cosmos-sdk/types" @@ -90,18 +91,13 @@ func SenderIsAccountsModule(ctx context.Context) bool { // returns nil. func Funds(ctx context.Context) sdk.Coins { return implementation.Funds(ctx) } -// ExecModule can be used to execute a message towards a module. -func ExecModule[Resp any, RespProto implementation.ProtoMsgG[Resp], Req any, ReqProto implementation.ProtoMsgG[Req]](ctx context.Context, msg ReqProto) (RespProto, error) { - return implementation.ExecModule[Resp, RespProto, Req, ReqProto](ctx, msg) -} - -func ExecModuleUntyped(ctx context.Context, msg implementation.ProtoMsg) (implementation.ProtoMsg, error) { - return implementation.ExecModuleUntyped(ctx, msg) +func ExecModule(ctx context.Context, msg transaction.Msg) (transaction.Msg, error) { + return implementation.ExecModule(ctx, msg) } // QueryModule can be used by an account to execute a module query. -func QueryModule[Resp any, RespProto implementation.ProtoMsgG[Resp], Req any, ReqProto implementation.ProtoMsgG[Req]](ctx context.Context, req ReqProto) (RespProto, error) { - return implementation.QueryModule[Resp, RespProto, Req, ReqProto](ctx, req) +func QueryModule(ctx context.Context, req transaction.Msg) (transaction.Msg, error) { + return implementation.QueryModule(ctx, req) } // UnpackAny unpacks a protobuf Any message generically. @@ -110,7 +106,7 @@ func UnpackAny[Msg any, ProtoMsg implementation.ProtoMsgG[Msg]](any *implementat } // PackAny packs a protobuf Any message generically. -func PackAny(msg implementation.ProtoMsg) (*implementation.Any, error) { +func PackAny(msg transaction.Msg) (*implementation.Any, error) { return implementation.PackAny(msg) } @@ -124,7 +120,7 @@ func ExecModuleAnys(ctx context.Context, msgs []*implementation.Any) ([]*impleme if err != nil { return nil, fmt.Errorf("error unpacking message %d: %w", i, err) } - resp, err := ExecModuleUntyped(ctx, concreteMessage) + resp, err := ExecModule(ctx, concreteMessage) if err != nil { return nil, fmt.Errorf("error executing message %d: %w", i, err) } diff --git a/x/accounts/accountstd/test_util.go b/x/accounts/accountstd/test_util.go index 0ab912868820..6188c265a972 100644 --- a/x/accounts/accountstd/test_util.go +++ b/x/accounts/accountstd/test_util.go @@ -4,7 +4,7 @@ import ( "context" "cosmossdk.io/core/store" - "cosmossdk.io/core/testing" + coretesting "cosmossdk.io/core/testing" "cosmossdk.io/x/accounts/internal/implementation" sdk "github.com/cosmos/cosmos-sdk/types" @@ -16,14 +16,13 @@ func NewMockContext( sender []byte, funds sdk.Coins, moduleExec implementation.ModuleExecFunc, - moduleExecUntyped implementation.ModuleExecUntypedFunc, moduleQuery implementation.ModuleQueryFunc, ) (context.Context, store.KVStoreService) { ctx := coretesting.Context() ss := coretesting.KVStoreService(ctx, "test") return implementation.MakeAccountContext( - ctx, ss, accNumber, accountAddr, sender, funds, moduleExec, moduleExecUntyped, moduleQuery, + ctx, ss, accNumber, accountAddr, sender, funds, moduleExec, moduleQuery, ), ss } diff --git a/x/accounts/cli/cli.go b/x/accounts/cli/cli.go index 12d7170ae821..e1458acbb045 100644 --- a/x/accounts/cli/cli.go +++ b/x/accounts/cli/cli.go @@ -41,7 +41,7 @@ func QueryCmd(name string) *cobra.Command { func GetTxInitCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "init [account-type] [json-message]", + Use: "init ", Short: "Initialize a new account", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { @@ -95,7 +95,7 @@ func GetTxInitCmd() *cobra.Command { func GetExecuteCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "execute [account-address] [execute-msg-type-url] [json-message]", + Use: "execute ", Short: "Execute state transition to account", Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) error { @@ -132,7 +132,7 @@ func GetExecuteCmd() *cobra.Command { func GetQueryAccountCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "query [account-address] [query-request-type-url] [json-message]", + Use: "query ", Short: "Query account state", Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) error { diff --git a/x/accounts/coin_transfer.go b/x/accounts/coin_transfer.go index 3f0c852bb39d..096498867da1 100644 --- a/x/accounts/coin_transfer.go +++ b/x/accounts/coin_transfer.go @@ -1,12 +1,9 @@ package accounts import ( - "google.golang.org/protobuf/proto" - - bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" - v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" "cosmossdk.io/core/address" - "cosmossdk.io/x/accounts/internal/implementation" + "cosmossdk.io/core/transaction" + banktypes "cosmossdk.io/x/bank/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -14,49 +11,22 @@ import ( // coinsTransferMsgFunc defines a function that creates a message to send coins from one // address to the other, and also a message that parses such response. // This in most cases will be implemented as a bank.MsgSend creator, but we keep x/accounts independent of bank. -type coinsTransferMsgFunc = func(from, to []byte, coins sdk.Coins) (implementation.ProtoMsg, implementation.ProtoMsg, error) - -type gogoProtoPlusV2 interface { - proto.Message - implementation.ProtoMsg -} - -// protoV2GogoWrapper is a wrapper of a protov2 message into a gogo message. -// this is exceptionally allowed to enable accounts to be decoupled from -// the SDK, since x/accounts can support only protov1 in its APIs. -// But in order to keep it decoupled from the SDK we need to use the API module. -// This is a hack to make an API module type work in x/accounts. Once the SDK -// has protov2 support, we can migrate internal/implementation/encoding.go to -// work with protov2. -type protoV2GogoWrapper struct { - gogoProtoPlusV2 -} - -func (h protoV2GogoWrapper) XXX_MessageName() string { - return string(proto.MessageName(h.gogoProtoPlusV2)) -} +type coinsTransferMsgFunc = func(from, to []byte, coins sdk.Coins) (transaction.Msg, error) func defaultCoinsTransferMsgFunc(addrCdc address.Codec) coinsTransferMsgFunc { - return func(from, to []byte, coins sdk.Coins) (implementation.ProtoMsg, implementation.ProtoMsg, error) { + return func(from, to []byte, coins sdk.Coins) (transaction.Msg, error) { fromAddr, err := addrCdc.BytesToString(from) if err != nil { - return nil, nil, err + return nil, err } toAddr, err := addrCdc.BytesToString(to) if err != nil { - return nil, nil, err - } - v2Coins := make([]*v1beta1.Coin, len(coins)) - for i, coin := range coins { - v2Coins[i] = &v1beta1.Coin{ - Denom: coin.Denom, - Amount: coin.Amount.String(), - } + return nil, err } - return protoV2GogoWrapper{&bankv1beta1.MsgSend{ + return &banktypes.MsgSend{ FromAddress: fromAddr, ToAddress: toAddr, - Amount: v2Coins, - }}, new(bankv1beta1.MsgSendResponse), nil + Amount: coins, + }, nil } } diff --git a/x/accounts/defaults/base/account.go b/x/accounts/defaults/base/account.go index 731658db403d..eef6e6c2153e 100644 --- a/x/accounts/defaults/base/account.go +++ b/x/accounts/defaults/base/account.go @@ -5,7 +5,6 @@ import ( "errors" "fmt" - dcrd_secp256k1 "github.com/decred/dcrd/dcrec/secp256k1/v4" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/anypb" @@ -20,42 +19,56 @@ import ( accountsv1 "cosmossdk.io/x/accounts/v1" "cosmossdk.io/x/tx/signing" - "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" "github.com/cosmos/cosmos-sdk/types/tx" ) var ( - PubKeyPrefix = collections.NewPrefix(0) - SequencePrefix = collections.NewPrefix(1) + PubKeyPrefix = collections.NewPrefix(0) + PubKeyTypePrefix = collections.NewPrefix(1) + SequencePrefix = collections.NewPrefix(2) ) -func NewAccount(name string, handlerMap *signing.HandlerMap) accountstd.AccountCreatorFunc { +type Option func(a *Account) + +func NewAccount(name string, handlerMap *signing.HandlerMap, options ...Option) accountstd.AccountCreatorFunc { return func(deps accountstd.Dependencies) (string, accountstd.Interface, error) { - return name, Account{ - PubKey: collections.NewItem(deps.SchemaBuilder, PubKeyPrefix, "pub_key", codec.CollValue[secp256k1.PubKey](deps.LegacyStateCodec)), - Sequence: collections.NewSequence(deps.SchemaBuilder, SequencePrefix, "sequence"), - addrCodec: deps.AddressCodec, - signingHandlers: handlerMap, - hs: deps.Environment.HeaderService, - }, nil + acc := Account{ + PubKey: collections.NewItem(deps.SchemaBuilder, PubKeyPrefix, "pub_key_bytes", collections.BytesValue), + PubKeyType: collections.NewItem(deps.SchemaBuilder, PubKeyTypePrefix, "pub_key_type", collections.StringValue), + Sequence: collections.NewSequence(deps.SchemaBuilder, SequencePrefix, "sequence"), + addrCodec: deps.AddressCodec, + hs: deps.Environment.HeaderService, + supportedPubKeys: map[string]pubKeyImpl{}, + signingHandlers: handlerMap, + } + for _, option := range options { + option(&acc) + } + if len(acc.supportedPubKeys) == 0 { + return "", nil, fmt.Errorf("no public keys plugged for account type %s", name) + } + return name, acc, nil } } // Account implements a base account. type Account struct { - PubKey collections.Item[secp256k1.PubKey] + PubKey collections.Item[[]byte] + PubKeyType collections.Item[string] + Sequence collections.Sequence addrCodec address.Codec hs header.Service + supportedPubKeys map[string]pubKeyImpl + signingHandlers *signing.HandlerMap } func (a Account) Init(ctx context.Context, msg *v1.MsgInit) (*v1.MsgInitResponse, error) { - return &v1.MsgInitResponse{}, a.verifyAndSetPubKey(ctx, msg.PubKey) + return &v1.MsgInitResponse{}, a.savePubKey(ctx, msg.PubKey) } func (a Account) SwapPubKey(ctx context.Context, msg *v1.MsgSwapPubKey) (*v1.MsgSwapPubKeyResponse, error) { @@ -63,15 +76,7 @@ func (a Account) SwapPubKey(ctx context.Context, msg *v1.MsgSwapPubKey) (*v1.Msg return nil, errors.New("unauthorized") } - return &v1.MsgSwapPubKeyResponse{}, a.verifyAndSetPubKey(ctx, msg.NewPubKey) -} - -func (a Account) verifyAndSetPubKey(ctx context.Context, key []byte) error { - _, err := dcrd_secp256k1.ParsePubKey(key) - if err != nil { - return err - } - return a.PubKey.Set(ctx, secp256k1.PubKey{Key: key}) + return &v1.MsgSwapPubKeyResponse{}, a.savePubKey(ctx, msg.NewPubKey) } // Authenticate implements the authentication flow of an abstracted base account. @@ -82,12 +87,12 @@ func (a Account) Authenticate(ctx context.Context, msg *aa_interface_v1.MsgAuthe pubKey, signerData, err := a.computeSignerData(ctx) if err != nil { - return nil, err + return nil, fmt.Errorf("unable to compute signer data: %w", err) } txData, err := a.getTxData(msg) if err != nil { - return nil, err + return nil, fmt.Errorf("unable to get tx data: %w", err) } gotSeq := msg.Tx.AuthInfo.SignerInfos[msg.SignerIndex].Sequence @@ -104,7 +109,7 @@ func (a Account) Authenticate(ctx context.Context, msg *aa_interface_v1.MsgAuthe signBytes, err := a.signingHandlers.GetSignBytes(ctx, signMode, signerData, txData) if err != nil { - return nil, err + return nil, fmt.Errorf("unable to get sign bytes: %w", err) } if !pubKey.VerifySignature(signBytes, signature) { @@ -123,31 +128,31 @@ func parseSignMode(info *tx.ModeInfo) (signingv1beta1.SignMode, error) { } // computeSignerData will populate signer data and also increase the sequence. -func (a Account) computeSignerData(ctx context.Context) (secp256k1.PubKey, signing.SignerData, error) { +func (a Account) computeSignerData(ctx context.Context) (PubKey, signing.SignerData, error) { addrStr, err := a.addrCodec.BytesToString(accountstd.Whoami(ctx)) if err != nil { - return secp256k1.PubKey{}, signing.SignerData{}, err + return nil, signing.SignerData{}, err } chainID := a.hs.HeaderInfo(ctx).ChainID wantSequence, err := a.Sequence.Next(ctx) if err != nil { - return secp256k1.PubKey{}, signing.SignerData{}, err + return nil, signing.SignerData{}, err } - pk, err := a.PubKey.Get(ctx) + pk, err := a.loadPubKey(ctx) if err != nil { - return secp256k1.PubKey{}, signing.SignerData{}, err + return nil, signing.SignerData{}, err } - pkAny, err := codectypes.NewAnyWithValue(&pk) + pkAny, err := codectypes.NewAnyWithValue(pk) if err != nil { - return secp256k1.PubKey{}, signing.SignerData{}, err + return nil, signing.SignerData{}, err } accNum, err := a.getNumber(ctx, addrStr) if err != nil { - return secp256k1.PubKey{}, signing.SignerData{}, err + return nil, signing.SignerData{}, err } return pk, signing.SignerData{ @@ -163,12 +168,17 @@ func (a Account) computeSignerData(ctx context.Context) (secp256k1.PubKey, signi } func (a Account) getNumber(ctx context.Context, addrStr string) (uint64, error) { - accNum, err := accountstd.QueryModule[accountsv1.AccountNumberResponse](ctx, &accountsv1.AccountNumberRequest{Address: addrStr}) + accNum, err := accountstd.QueryModule(ctx, &accountsv1.AccountNumberRequest{Address: addrStr}) if err != nil { return 0, err } - return accNum.Number, nil + resp, ok := accNum.(*accountsv1.AccountNumberResponse) + if !ok { + return 0, fmt.Errorf("unexpected response type: %T", accNum) + } + + return resp.Number, nil } func (a Account) getTxData(msg *aa_interface_v1.MsgAuthenticate) (signing.TxData, error) { @@ -195,6 +205,54 @@ func (a Account) getTxData(msg *aa_interface_v1.MsgAuthenticate) (signing.TxData }, nil } +func (a Account) loadPubKey(ctx context.Context) (PubKey, error) { + pkType, err := a.PubKeyType.Get(ctx) + if err != nil { + return nil, err + } + + publicKey, exists := a.supportedPubKeys[pkType] + // this means that the chain developer suddenly started using a key type. + if !exists { + return nil, fmt.Errorf("pubkey type %s is not supported by the chain anymore", pkType) + } + + pkBytes, err := a.PubKey.Get(ctx) + if err != nil { + return nil, err + } + + pubKey, err := publicKey.decode(pkBytes) + if err != nil { + return nil, err + } + return pubKey, nil +} + +func (a Account) savePubKey(ctx context.Context, anyPk *codectypes.Any) error { + // check if known + name := nameFromTypeURL(anyPk.TypeUrl) + impl, exists := a.supportedPubKeys[name] + if !exists { + return fmt.Errorf("unknown pubkey type %s", name) + } + pk, err := impl.decode(anyPk.Value) + if err != nil { + return fmt.Errorf("unable to decode pubkey: %w", err) + } + err = impl.validate(pk) + if err != nil { + return fmt.Errorf("unable to validate pubkey: %w", err) + } + + // save into state + err = a.PubKey.Set(ctx, anyPk.Value) + if err != nil { + return fmt.Errorf("unable to save pubkey: %w", err) + } + return a.PubKeyType.Set(ctx, name) +} + func (a Account) QuerySequence(ctx context.Context, _ *v1.QuerySequence) (*v1.QuerySequenceResponse, error) { seq, err := a.Sequence.Peek(ctx) if err != nil { diff --git a/x/accounts/defaults/base/account_test.go b/x/accounts/defaults/base/account_test.go index a895d0f68ecd..8523d47c1f9b 100644 --- a/x/accounts/defaults/base/account_test.go +++ b/x/accounts/defaults/base/account_test.go @@ -5,6 +5,9 @@ import ( "errors" "testing" + gogoproto "github.com/cosmos/gogoproto/proto" + types "github.com/cosmos/gogoproto/types/any" + dcrd_secp256k1 "github.com/decred/dcrd/dcrec/secp256k1/v4" "github.com/stretchr/testify/require" "cosmossdk.io/core/store" @@ -24,7 +27,10 @@ func setupBaseAccount(t *testing.T, ss store.KVStoreService) Account { deps := makeMockDependencies(ss) handler := directHandler{} - createAccFn := NewAccount("base", signing.NewHandlerMap(handler)) + createAccFn := NewAccount("base", signing.NewHandlerMap(handler), WithPubKeyWithValidationFunc(func(pt *secp256k1.PubKey) error { + _, err := dcrd_secp256k1.ParsePubKey(pt.Key) + return err + })) _, acc, err := createAccFn(deps) baseAcc := acc.(Account) require.NoError(t, err) @@ -36,7 +42,7 @@ func TestInit(t *testing.T) { ctx, ss := newMockContext(t) baseAcc := setupBaseAccount(t, ss) _, err := baseAcc.Init(ctx, &v1.MsgInit{ - PubKey: secp256k1.GenPrivKey().PubKey().Bytes(), + PubKey: toAnyPb(t, secp256k1.GenPrivKey().PubKey()), }) require.NoError(t, err) @@ -48,14 +54,14 @@ func TestInit(t *testing.T) { { "valid init", &v1.MsgInit{ - PubKey: secp256k1.GenPrivKey().PubKey().Bytes(), + PubKey: toAnyPb(t, secp256k1.GenPrivKey().PubKey()), }, false, }, { "invalid pubkey", &v1.MsgInit{ - PubKey: []byte("invalid_pk"), + PubKey: toAnyPb(t, &secp256k1.PubKey{Key: []byte("invalid")}), }, true, }, @@ -77,7 +83,7 @@ func TestSwapKey(t *testing.T) { ctx, ss := newMockContext(t) baseAcc := setupBaseAccount(t, ss) _, err := baseAcc.Init(ctx, &v1.MsgInit{ - PubKey: secp256k1.GenPrivKey().PubKey().Bytes(), + PubKey: toAnyPb(t, secp256k1.GenPrivKey().PubKey()), }) require.NoError(t, err) @@ -94,7 +100,7 @@ func TestSwapKey(t *testing.T) { return accountstd.SetSender(ctx, []byte("mock_base_account")) }, &v1.MsgSwapPubKey{ - NewPubKey: secp256k1.GenPrivKey().PubKey().Bytes(), + NewPubKey: toAnyPb(t, secp256k1.GenPrivKey().PubKey()), }, false, nil, @@ -105,7 +111,7 @@ func TestSwapKey(t *testing.T) { return accountstd.SetSender(ctx, []byte("sender")) }, &v1.MsgSwapPubKey{ - NewPubKey: secp256k1.GenPrivKey().PubKey().Bytes(), + NewPubKey: toAnyPb(t, secp256k1.GenPrivKey().PubKey()), }, true, errors.New("unauthorized"), @@ -116,7 +122,7 @@ func TestSwapKey(t *testing.T) { return accountstd.SetSender(ctx, []byte("mock_base_account")) }, &v1.MsgSwapPubKey{ - NewPubKey: []byte("invalid_pk"), + NewPubKey: toAnyPb(t, &secp256k1.PubKey{Key: []byte("invalid")}), }, true, nil, @@ -149,7 +155,7 @@ func TestAuthenticate(t *testing.T) { pkAny, err := codectypes.NewAnyWithValue(privKey.PubKey()) require.NoError(t, err) _, err = baseAcc.Init(ctx, &v1.MsgInit{ - PubKey: privKey.PubKey().Bytes(), + PubKey: toAnyPb(t, privKey.PubKey()), }) require.NoError(t, err) @@ -251,3 +257,13 @@ func TestAuthenticate(t *testing.T) { }) require.Equal(t, errors.New("signature verification failed"), err) } + +func toAnyPb(t *testing.T, pm gogoproto.Message) *codectypes.Any { + t.Helper() + if gogoproto.MessageName(pm) == gogoproto.MessageName(&types.Any{}) { + t.Fatal("no") + } + pb, err := codectypes.NewAnyWithValue(pm) + require.NoError(t, err) + return pb +} diff --git a/x/accounts/defaults/base/pubkey.go b/x/accounts/defaults/base/pubkey.go new file mode 100644 index 000000000000..874d53ea6a7f --- /dev/null +++ b/x/accounts/defaults/base/pubkey.go @@ -0,0 +1,75 @@ +package base + +import ( + "fmt" + "strings" + + gogoproto "github.com/cosmos/gogoproto/proto" + dcrd_secp256k1 "github.com/decred/dcrd/dcrec/secp256k1/v4" + + "cosmossdk.io/core/transaction" + + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" +) + +// this file implements a general mechanism to plugin public keys to a baseaccount + +// PubKey defines a generic pubkey. +type PubKey interface { + transaction.Msg + VerifySignature(msg, sig []byte) bool +} + +type PubKeyG[T any] interface { + *T + PubKey +} + +type pubKeyImpl struct { + decode func(b []byte) (PubKey, error) + validate func(key PubKey) error +} + +func WithSecp256K1PubKey() Option { + return WithPubKeyWithValidationFunc(func(pt *secp256k1.PubKey) error { + _, err := dcrd_secp256k1.ParsePubKey(pt.Key) + return err + }) +} + +func WithPubKey[T any, PT PubKeyG[T]]() Option { + return WithPubKeyWithValidationFunc[T, PT](func(_ PT) error { + return nil + }) +} + +func WithPubKeyWithValidationFunc[T any, PT PubKeyG[T]](validateFn func(PT) error) Option { + pkImpl := pubKeyImpl{ + decode: func(b []byte) (PubKey, error) { + key := PT(new(T)) + err := gogoproto.Unmarshal(b, key) + if err != nil { + return nil, err + } + return key, nil + }, + validate: func(k PubKey) error { + concrete, ok := k.(PT) + if !ok { + return fmt.Errorf("invalid pubkey type passed for validation, wanted: %T, got: %T", concrete, k) + } + return validateFn(concrete) + }, + } + return func(a *Account) { + a.supportedPubKeys[gogoproto.MessageName(PT(new(T)))] = pkImpl + } +} + +func nameFromTypeURL(url string) string { + name := url + if i := strings.LastIndexByte(url, '/'); i >= 0 { + name = name[i+len("/"):] + } + return name +} diff --git a/x/accounts/defaults/base/utils_test.go b/x/accounts/defaults/base/utils_test.go index 90c2c9deb5a2..93cd76ea8495 100644 --- a/x/accounts/defaults/base/utils_test.go +++ b/x/accounts/defaults/base/utils_test.go @@ -5,15 +5,14 @@ import ( "testing" gogoproto "github.com/cosmos/gogoproto/proto" - "github.com/stretchr/testify/require" - "google.golang.org/protobuf/runtime/protoiface" signingv1beta1 "cosmossdk.io/api/cosmos/tx/signing/v1beta1" "cosmossdk.io/collections" - "cosmossdk.io/core/appmodule/v2" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/event" "cosmossdk.io/core/header" "cosmossdk.io/core/store" + "cosmossdk.io/core/transaction" "cosmossdk.io/x/accounts/accountstd" accountsv1 "cosmossdk.io/x/accounts/v1" "cosmossdk.io/x/tx/signing" @@ -24,8 +23,6 @@ import ( "github.com/cosmos/cosmos-sdk/types/tx" ) -type ProtoMsg = protoiface.MessageV1 - // mock statecodec type mockStateCodec struct { codec.Codec @@ -58,17 +55,13 @@ func (a addressCodec) BytesToString(bz []byte) (string, error) { return string func newMockContext(t *testing.T) (context.Context, store.KVStoreService) { t.Helper() return accountstd.NewMockContext( - 0, []byte("mock_base_account"), []byte("sender"), nil, func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error { - return nil - }, func(ctx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) { + 0, []byte("mock_base_account"), []byte("sender"), nil, + func(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) { return nil, nil - }, func(ctx context.Context, req, resp ProtoMsg) error { - _, ok := req.(*accountsv1.AccountNumberRequest) - require.True(t, ok) - gogoproto.Merge(resp.(gogoproto.Message), &accountsv1.AccountNumberResponse{ + }, func(ctx context.Context, req transaction.Msg) (transaction.Msg, error) { + return &accountsv1.AccountNumberResponse{ Number: 1, - }) - return nil + }, nil }, ) } @@ -80,7 +73,7 @@ func makeMockDependencies(storeservice store.KVStoreService) accountstd.Dependen SchemaBuilder: sb, AddressCodec: addressCodec{}, LegacyStateCodec: mockStateCodec{}, - Environment: appmodule.Environment{ + Environment: appmodulev2.Environment{ EventService: eventService{}, HeaderService: headerService{}, }, diff --git a/x/accounts/defaults/base/v1/base.pb.go b/x/accounts/defaults/base/v1/base.pb.go index 4affa55d7009..cc9078c736e1 100644 --- a/x/accounts/defaults/base/v1/base.pb.go +++ b/x/accounts/defaults/base/v1/base.pb.go @@ -6,6 +6,7 @@ package v1 import ( fmt "fmt" proto "github.com/cosmos/gogoproto/proto" + any "github.com/cosmos/gogoproto/types/any" io "io" math "math" math_bits "math/bits" @@ -24,8 +25,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // MsgInit is used to initialize a base account. type MsgInit struct { - // pub_key defines the secp256k1 pubkey for the account. - PubKey []byte `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` + // pub_key defines a pubkey for the account arbitrary encapsulated. + PubKey *any.Any `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` } func (m *MsgInit) Reset() { *m = MsgInit{} } @@ -61,7 +62,7 @@ func (m *MsgInit) XXX_DiscardUnknown() { var xxx_messageInfo_MsgInit proto.InternalMessageInfo -func (m *MsgInit) GetPubKey() []byte { +func (m *MsgInit) GetPubKey() *any.Any { if m != nil { return m.PubKey } @@ -109,7 +110,7 @@ var xxx_messageInfo_MsgInitResponse proto.InternalMessageInfo // MsgSwapPubKey is used to change the pubkey for the account. type MsgSwapPubKey struct { // new_pub_key defines the secp256k1 pubkey to swap the account to. - NewPubKey []byte `protobuf:"bytes,1,opt,name=new_pub_key,json=newPubKey,proto3" json:"new_pub_key,omitempty"` + NewPubKey *any.Any `protobuf:"bytes,1,opt,name=new_pub_key,json=newPubKey,proto3" json:"new_pub_key,omitempty"` } func (m *MsgSwapPubKey) Reset() { *m = MsgSwapPubKey{} } @@ -145,7 +146,7 @@ func (m *MsgSwapPubKey) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSwapPubKey proto.InternalMessageInfo -func (m *MsgSwapPubKey) GetNewPubKey() []byte { +func (m *MsgSwapPubKey) GetNewPubKey() *any.Any { if m != nil { return m.NewPubKey } @@ -273,6 +274,88 @@ func (m *QuerySequenceResponse) GetSequence() uint64 { return 0 } +// QueryPubKey is the request used to query the pubkey of an account. +type QueryPubKey struct { +} + +func (m *QueryPubKey) Reset() { *m = QueryPubKey{} } +func (m *QueryPubKey) String() string { return proto.CompactTextString(m) } +func (*QueryPubKey) ProtoMessage() {} +func (*QueryPubKey) Descriptor() ([]byte, []int) { + return fileDescriptor_7c860870b5ed6dc2, []int{6} +} +func (m *QueryPubKey) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPubKey.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 *QueryPubKey) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPubKey.Merge(m, src) +} +func (m *QueryPubKey) XXX_Size() int { + return m.Size() +} +func (m *QueryPubKey) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPubKey.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPubKey proto.InternalMessageInfo + +// QueryPubKeyResponse is the response returned when a QueryPubKey message is sent. +type QueryPubKeyResponse struct { + PubKey *any.Any `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` +} + +func (m *QueryPubKeyResponse) Reset() { *m = QueryPubKeyResponse{} } +func (m *QueryPubKeyResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPubKeyResponse) ProtoMessage() {} +func (*QueryPubKeyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7c860870b5ed6dc2, []int{7} +} +func (m *QueryPubKeyResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPubKeyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPubKeyResponse.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 *QueryPubKeyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPubKeyResponse.Merge(m, src) +} +func (m *QueryPubKeyResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryPubKeyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPubKeyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPubKeyResponse proto.InternalMessageInfo + +func (m *QueryPubKeyResponse) GetPubKey() *any.Any { + if m != nil { + return m.PubKey + } + return nil +} + func init() { proto.RegisterType((*MsgInit)(nil), "cosmos.accounts.defaults.base.v1.MsgInit") proto.RegisterType((*MsgInitResponse)(nil), "cosmos.accounts.defaults.base.v1.MsgInitResponse") @@ -280,6 +363,8 @@ func init() { proto.RegisterType((*MsgSwapPubKeyResponse)(nil), "cosmos.accounts.defaults.base.v1.MsgSwapPubKeyResponse") proto.RegisterType((*QuerySequence)(nil), "cosmos.accounts.defaults.base.v1.QuerySequence") proto.RegisterType((*QuerySequenceResponse)(nil), "cosmos.accounts.defaults.base.v1.QuerySequenceResponse") + proto.RegisterType((*QueryPubKey)(nil), "cosmos.accounts.defaults.base.v1.QueryPubKey") + proto.RegisterType((*QueryPubKeyResponse)(nil), "cosmos.accounts.defaults.base.v1.QueryPubKeyResponse") } func init() { @@ -287,23 +372,26 @@ func init() { } var fileDescriptor_7c860870b5ed6dc2 = []byte{ - // 254 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x4e, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0x29, 0xd6, 0x4f, 0x49, 0x4d, 0x4b, - 0x2c, 0xcd, 0x29, 0x29, 0xd6, 0x4f, 0x4a, 0x2c, 0x4e, 0xd5, 0x2f, 0x33, 0x04, 0xd3, 0x7a, 0x05, - 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x0a, 0x10, 0xc5, 0x7a, 0x30, 0xc5, 0x7a, 0x30, 0xc5, 0x7a, 0x60, - 0x45, 0x65, 0x86, 0x4a, 0x4a, 0x5c, 0xec, 0xbe, 0xc5, 0xe9, 0x9e, 0x79, 0x99, 0x25, 0x42, 0xe2, - 0x5c, 0xec, 0x05, 0xa5, 0x49, 0xf1, 0xd9, 0xa9, 0x95, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x3c, 0x41, - 0x6c, 0x05, 0xa5, 0x49, 0xde, 0xa9, 0x95, 0x4a, 0x82, 0x5c, 0xfc, 0x50, 0x35, 0x41, 0xa9, 0xc5, - 0x05, 0xf9, 0x79, 0xc5, 0xa9, 0x4a, 0xfa, 0x5c, 0xbc, 0xbe, 0xc5, 0xe9, 0xc1, 0xe5, 0x89, 0x05, - 0x01, 0x60, 0x35, 0x42, 0x72, 0x5c, 0xdc, 0x79, 0xa9, 0xe5, 0xf1, 0xa8, 0x06, 0x70, 0xe6, 0xa5, - 0x96, 0x43, 0xe4, 0x95, 0xc4, 0xb9, 0x44, 0x51, 0x34, 0xc0, 0x4d, 0xe2, 0xe7, 0xe2, 0x0d, 0x2c, - 0x4d, 0x2d, 0xaa, 0x0c, 0x4e, 0x2d, 0x2c, 0x4d, 0xcd, 0x4b, 0x4e, 0x55, 0x32, 0xe6, 0x12, 0x45, - 0x11, 0x80, 0xa9, 0x14, 0x92, 0xe2, 0xe2, 0x28, 0x86, 0x8a, 0x81, 0xcd, 0x67, 0x09, 0x82, 0xf3, - 0x9d, 0x9c, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, - 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x03, 0x12, 0x04, - 0xc5, 0x29, 0xd9, 0x7a, 0x99, 0xf9, 0xfa, 0x15, 0xb8, 0xc3, 0x2d, 0x89, 0x0d, 0x1c, 0x66, 0xc6, - 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x99, 0x31, 0x20, 0x4a, 0x62, 0x01, 0x00, 0x00, + // 303 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x91, 0xcf, 0x4a, 0xc3, 0x40, + 0x10, 0xc6, 0x1b, 0x90, 0x56, 0xa7, 0x94, 0x62, 0xb4, 0xa8, 0x3d, 0x2c, 0x65, 0x4f, 0x05, 0x71, + 0x97, 0x5a, 0x0f, 0x5e, 0x2d, 0x7a, 0x10, 0x29, 0x68, 0x7a, 0xf3, 0x52, 0x92, 0x74, 0x1a, 0x4a, + 0xeb, 0x6e, 0xec, 0x66, 0x1b, 0xf3, 0x16, 0x3e, 0x96, 0xc7, 0x1e, 0x3d, 0x4a, 0xf2, 0x22, 0xc2, + 0xe6, 0x0f, 0xf6, 0x20, 0xe8, 0x69, 0x99, 0xe1, 0xf7, 0xfb, 0x06, 0xf6, 0x83, 0x73, 0x5f, 0xaa, + 0x17, 0xa9, 0xb8, 0xeb, 0xfb, 0x52, 0x8b, 0x48, 0xf1, 0x19, 0xce, 0x5d, 0xbd, 0x8a, 0x14, 0xf7, + 0x5c, 0x85, 0x7c, 0x33, 0x30, 0x2f, 0x0b, 0xd7, 0x32, 0x92, 0x76, 0x2f, 0x87, 0x59, 0x09, 0xb3, + 0x12, 0x66, 0x06, 0xda, 0x0c, 0xba, 0x67, 0x81, 0x94, 0xc1, 0x0a, 0xb9, 0xe1, 0x3d, 0x3d, 0xe7, + 0xae, 0x48, 0x72, 0x99, 0x5e, 0x43, 0x63, 0xac, 0x82, 0x7b, 0xb1, 0x88, 0xec, 0x0b, 0x68, 0x84, + 0xda, 0x9b, 0x2e, 0x31, 0x39, 0xb5, 0x7a, 0x56, 0xbf, 0x79, 0x79, 0xcc, 0x72, 0x8f, 0x95, 0x1e, + 0xbb, 0x11, 0x89, 0x53, 0x0f, 0xb5, 0xf7, 0x80, 0x09, 0x3d, 0x84, 0x76, 0x61, 0x3a, 0xa8, 0x42, + 0x29, 0x14, 0xd2, 0x3b, 0x68, 0x8d, 0x55, 0x30, 0x89, 0xdd, 0xf0, 0xd1, 0x30, 0xf6, 0x15, 0x34, + 0x05, 0xc6, 0xd3, 0xbf, 0xc4, 0x1e, 0x08, 0x8c, 0x73, 0x8b, 0x9e, 0x40, 0x67, 0x27, 0xa6, 0xca, + 0x6f, 0x43, 0xeb, 0x49, 0xe3, 0x3a, 0x99, 0xe0, 0xab, 0x46, 0xe1, 0x23, 0x1d, 0x42, 0x67, 0x67, + 0x51, 0x92, 0x76, 0x17, 0xf6, 0x55, 0xb1, 0x33, 0x57, 0xf7, 0x9c, 0x6a, 0xa6, 0x2d, 0x68, 0x1a, + 0xa9, 0xb8, 0x76, 0x0b, 0x47, 0x3f, 0xc6, 0x2a, 0xe1, 0x7f, 0xbf, 0x31, 0x1a, 0x7d, 0xa4, 0xc4, + 0xda, 0xa6, 0xc4, 0xfa, 0x4a, 0x89, 0xf5, 0x9e, 0x91, 0xda, 0x36, 0x23, 0xb5, 0xcf, 0x8c, 0xd4, + 0x9e, 0xfb, 0x79, 0x3d, 0x6a, 0xb6, 0x64, 0x0b, 0xc9, 0xdf, 0x7e, 0xef, 0xd4, 0xab, 0x9b, 0xe4, + 0xe1, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8f, 0xe1, 0xb2, 0xd8, 0xfe, 0x01, 0x00, 0x00, } func (m *MsgInit) Marshal() (dAtA []byte, err error) { @@ -326,10 +414,15 @@ func (m *MsgInit) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.PubKey) > 0 { - i -= len(m.PubKey) - copy(dAtA[i:], m.PubKey) - i = encodeVarintBase(dAtA, i, uint64(len(m.PubKey))) + if m.PubKey != nil { + { + size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBase(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0xa } @@ -379,10 +472,15 @@ func (m *MsgSwapPubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.NewPubKey) > 0 { - i -= len(m.NewPubKey) - copy(dAtA[i:], m.NewPubKey) - i = encodeVarintBase(dAtA, i, uint64(len(m.NewPubKey))) + if m.NewPubKey != nil { + { + size, err := m.NewPubKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBase(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0xa } @@ -463,6 +561,64 @@ func (m *QuerySequenceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *QueryPubKey) 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 *QueryPubKey) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryPubKeyResponse) 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 *QueryPubKeyResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPubKeyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PubKey != nil { + { + size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBase(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintBase(dAtA []byte, offset int, v uint64) int { offset -= sovBase(v) base := offset @@ -480,8 +636,8 @@ func (m *MsgInit) Size() (n int) { } var l int _ = l - l = len(m.PubKey) - if l > 0 { + if m.PubKey != nil { + l = m.PubKey.Size() n += 1 + l + sovBase(uint64(l)) } return n @@ -502,8 +658,8 @@ func (m *MsgSwapPubKey) Size() (n int) { } var l int _ = l - l = len(m.NewPubKey) - if l > 0 { + if m.NewPubKey != nil { + l = m.NewPubKey.Size() n += 1 + l + sovBase(uint64(l)) } return n @@ -539,6 +695,28 @@ func (m *QuerySequenceResponse) Size() (n int) { return n } +func (m *QueryPubKey) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryPubKeyResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PubKey != nil { + l = m.PubKey.Size() + n += 1 + l + sovBase(uint64(l)) + } + return n +} + func sovBase(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -578,7 +756,7 @@ func (m *MsgInit) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowBase @@ -588,24 +766,26 @@ func (m *MsgInit) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthBase } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthBase } if postIndex > l { return io.ErrUnexpectedEOF } - m.PubKey = append(m.PubKey[:0], dAtA[iNdEx:postIndex]...) if m.PubKey == nil { - m.PubKey = []byte{} + m.PubKey = &any.Any{} + } + if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: @@ -712,7 +892,7 @@ func (m *MsgSwapPubKey) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field NewPubKey", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowBase @@ -722,24 +902,26 @@ func (m *MsgSwapPubKey) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthBase } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthBase } if postIndex > l { return io.ErrUnexpectedEOF } - m.NewPubKey = append(m.NewPubKey[:0], dAtA[iNdEx:postIndex]...) if m.NewPubKey == nil { - m.NewPubKey = []byte{} + m.NewPubKey = &any.Any{} + } + if err := m.NewPubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: @@ -932,6 +1114,142 @@ func (m *QuerySequenceResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryPubKey) 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 ErrIntOverflowBase + } + 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: QueryPubKey: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPubKey: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipBase(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBase + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryPubKeyResponse) 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 ErrIntOverflowBase + } + 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: QueryPubKeyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPubKeyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBase + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBase + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PubKey == nil { + m.PubKey = &any.Any{} + } + if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBase(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBase + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipBase(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/accounts/defaults/lockup/go.mod b/x/accounts/defaults/lockup/go.mod index 77864684976e..03eeab57e464 100644 --- a/x/accounts/defaults/lockup/go.mod +++ b/x/accounts/defaults/lockup/go.mod @@ -1,10 +1,10 @@ module cosmossdk.io/x/accounts/defaults/lockup -go 1.22.2 +go 1.23 require ( cosmossdk.io/collections v0.4.0 - cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 + cosmossdk.io/core v1.0.0 cosmossdk.io/x/accounts v0.0.0-20240226161501-23359a0b6d91 cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 cosmossdk.io/x/distribution v0.0.0-00010101000000-000000000000 @@ -13,30 +13,22 @@ require ( github.com/cosmos/gogoproto v1.7.0 ) -require cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 // indirect - require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 // indirect - cosmossdk.io/depinject v1.0.0 // indirect - github.com/cometbft/cometbft/api v1.0.0-rc.1 // indirect - github.com/cosmos/crypto v0.1.2 // indirect - github.com/dgraph-io/badger/v4 v4.2.0 // indirect + cosmossdk.io/schema v0.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/google/flatbuffers v2.0.8+incompatible // indirect - github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/supranational/blst v0.3.12 // indirect - go.opencensus.io v0.24.0 // indirect ) require ( + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect cosmossdk.io/api v0.7.5 // indirect + cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 // indirect + cosmossdk.io/depinject v1.0.0 // indirect cosmossdk.io/errors v1.0.1 - cosmossdk.io/log v1.4.0 + cosmossdk.io/log v1.4.1 cosmossdk.io/math v1.3.0 cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc // indirect - cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 // indirect + cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/tx v0.13.3 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect @@ -53,16 +45,19 @@ require ( github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/cometbft/cometbft v1.0.0-rc1 // indirect github.com/cometbft/cometbft-db v0.12.0 // indirect + github.com/cometbft/cometbft/api v1.0.0-rc.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-db v1.0.2 // indirect + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 // indirect github.com/cosmos/cosmos-proto v1.0.0-beta.5 + github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect + github.com/dgraph-io/badger/v4 v4.2.0 // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.6.0 // indirect @@ -75,9 +70,10 @@ require ( github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/glog v1.2.1 // indirect - github.com/golang/protobuf v1.5.4 + github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect + github.com/google/flatbuffers v2.0.8+incompatible // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/gorilla/websocket v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect @@ -90,7 +86,7 @@ require ( github.com/iancoleman/strcase v0.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect @@ -100,14 +96,15 @@ require ( github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mtibben/percent v0.2.1 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -123,6 +120,7 @@ require ( github.com/spf13/viper v1.19.0 // indirect github.com/stretchr/testify v1.9.0 github.com/subosito/gotenv v1.6.0 // indirect + github.com/supranational/blst v0.3.12 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect github.com/tidwall/btree v1.7.0 // indirect @@ -131,6 +129,7 @@ require ( gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect + go.opencensus.io v0.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.26.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect @@ -140,9 +139,9 @@ require ( golang.org/x/term v0.23.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect - google.golang.org/grpc v1.65.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect + google.golang.org/grpc v1.66.0 // indirect google.golang.org/protobuf v1.34.2 gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -153,13 +152,15 @@ require ( replace github.com/cosmos/cosmos-sdk => ../../../../. +replace github.com/cosmos/iavl => github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e + replace ( cosmossdk.io/api => ../../../../api cosmossdk.io/collections => ../../../../collections // TODO tag new collections ASAP cosmossdk.io/core => ../../../../core cosmossdk.io/core/testing => ../../../../core/testing + cosmossdk.io/store => ../../../../store cosmossdk.io/x/accounts => ../../. - cosmossdk.io/x/auth => ../../../auth cosmossdk.io/x/bank => ../../../bank cosmossdk.io/x/consensus => ../../../consensus cosmossdk.io/x/distribution => ../../../distribution diff --git a/x/accounts/defaults/lockup/go.sum b/x/accounts/defaults/lockup/go.sum index 874cd912f6cd..99885ab82960 100644 --- a/x/accounts/defaults/lockup/go.sum +++ b/x/accounts/defaults/lockup/go.sum @@ -8,14 +8,12 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= -cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc h1:R9O9d75e0qZYUsVV0zzi+D7cNLnX2JrUOQNoIPaF0Bg= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc/go.mod h1:amTTatOUV3u1PsKmNb87z6/galCxrRbz9kRdJkL0DyU= +cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk= +cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= cosmossdk.io/x/tx v0.13.3 h1:Ha4mNaHmxBc6RMun9aKuqul8yHiL78EKJQ8g23Zf73g= cosmossdk.io/x/tx v0.13.3/go.mod h1:I8xaHv0rhUdIvIdptKIqzYy27+n2+zBVaxO6fscFhys= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= @@ -83,8 +81,8 @@ github.com/cometbft/cometbft/api v1.0.0-rc.1/go.mod h1:NDFKiBBD8HJC6QQLAoUI99Yhs github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/crypto v0.1.2 h1:Yn500sPY+9sKVdhiPUSDtt8JOpBGMB515dOmla4zfls= @@ -95,10 +93,10 @@ github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiK github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e h1:LEii0v/FxtXa/F7mRn+tijZ0zaXBPn2ZkKwb6Qm4rqE= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e/go.mod h1:3ywr0wDnWeD7MUH6qu50wZ5bxuKH3LBrGG4/lZX8lVY= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -273,8 +271,8 @@ github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -336,8 +334,8 @@ github.com/onsi/gomega v1.28.1 h1:MijcGUbfYuznzK/5R4CPNoUP/9Xvuo20sXfEm6XxoTA= github.com/onsi/gomega v1.28.1/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba h1:3jPgmsFGBID1wFfU2AbYocNcN4wqU68UaHSdMjiw/7U= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= @@ -354,8 +352,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -364,8 +362,8 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -418,7 +416,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -446,6 +443,8 @@ go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 h1:qxen9oVGzDdIRP6 go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5/go.mod h1:eW0HG9/oHQhvRCvb1/pIXW4cOvtDqeQK+XSi3TnwaXY= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -558,18 +557,18 @@ google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/x/accounts/defaults/lockup/lockup.go b/x/accounts/defaults/lockup/lockup.go index 060e656aa273..826f51c5a9a3 100644 --- a/x/accounts/defaults/lockup/lockup.go +++ b/x/accounts/defaults/lockup/lockup.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "errors" + "fmt" "time" "github.com/cosmos/gogoproto/proto" @@ -386,7 +387,7 @@ func (bva *BaseLockup) checkSender(ctx context.Context, sender string) error { } func sendMessage(ctx context.Context, msg proto.Message) ([]*codectypes.Any, error) { - response, err := accountstd.ExecModuleUntyped(ctx, msg) + response, err := accountstd.ExecModule(ctx, msg) if err != nil { return nil, err } @@ -401,13 +402,16 @@ func sendMessage(ctx context.Context, msg proto.Message) ([]*codectypes.Any, err func getStakingDenom(ctx context.Context) (string, error) { // Query account balance for the sent denom - paramsQueryReq := &stakingtypes.QueryParamsRequest{} - resp, err := accountstd.QueryModule[stakingtypes.QueryParamsResponse](ctx, paramsQueryReq) + resp, err := accountstd.QueryModule(ctx, &stakingtypes.QueryParamsRequest{}) if err != nil { return "", err } + res, ok := resp.(*stakingtypes.QueryParamsResponse) + if !ok { + return "", fmt.Errorf("unexpected response type: %T", resp) + } - return resp.Params.BondDenom, nil + return res.Params.BondDenom, nil } // TrackDelegation tracks a delegation amount for any given lockup account type @@ -532,13 +536,17 @@ func (bva *BaseLockup) TrackUndelegation(ctx context.Context, amount sdk.Coins) func (bva BaseLockup) getBalance(ctx context.Context, sender, denom string) (*sdk.Coin, error) { // Query account balance for the sent denom - balanceQueryReq := &banktypes.QueryBalanceRequest{Address: sender, Denom: denom} - resp, err := accountstd.QueryModule[banktypes.QueryBalanceResponse](ctx, balanceQueryReq) + resp, err := accountstd.QueryModule(ctx, &banktypes.QueryBalanceRequest{Address: sender, Denom: denom}) if err != nil { return nil, err } - return resp.Balance, nil + res, ok := resp.(*banktypes.QueryBalanceResponse) + if !ok { + return nil, fmt.Errorf("unexpected response type: %T", resp) + } + + return res.Balance, nil } func (bva BaseLockup) checkTokensSendable(ctx context.Context, sender string, amount, lockedCoins sdk.Coins) error { diff --git a/x/accounts/defaults/lockup/utils_test.go b/x/accounts/defaults/lockup/utils_test.go index a7032ceedeb3..6d5ce14af7ed 100644 --- a/x/accounts/defaults/lockup/utils_test.go +++ b/x/accounts/defaults/lockup/utils_test.go @@ -6,14 +6,13 @@ import ( "testing" gogoproto "github.com/cosmos/gogoproto/proto" - "github.com/golang/protobuf/proto" // nolint: staticcheck // needed because gogoproto.Merge does not work consistently. See NOTE: comments. "github.com/stretchr/testify/require" - "google.golang.org/protobuf/runtime/protoiface" "cosmossdk.io/collections" - "cosmossdk.io/core/appmodule/v2" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/header" "cosmossdk.io/core/store" + "cosmossdk.io/core/transaction" "cosmossdk.io/math" "cosmossdk.io/x/accounts/accountstd" banktypes "cosmossdk.io/x/bank/types" @@ -24,8 +23,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -type ProtoMsg = protoiface.MessageV1 - var TestFunds = sdk.NewCoins(sdk.NewCoin("test", math.NewInt(10))) // mock statecodec @@ -52,9 +49,9 @@ func (c mockStateCodec) Unmarshal(bz []byte, ptr gogoproto.Message) error { } type ( - ModuleExecUntypedFunc = func(ctx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) - ModuleExecFunc = func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error - ModuleQueryFunc = func(ctx context.Context, queryReq, queryResp ProtoMsg) error + ModuleExecUntypedFunc = func(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) + ModuleExecFunc = func(ctx context.Context, sender []byte, msg, msgResp transaction.Msg) error + ModuleQueryFunc = func(ctx context.Context, queryReq, queryResp transaction.Msg) error ) // mock address codec @@ -73,9 +70,8 @@ func (h headerService) HeaderInfo(ctx context.Context) header.Info { func newMockContext(t *testing.T) (context.Context, store.KVStoreService) { t.Helper() return accountstd.NewMockContext( - 0, []byte("lockup_account"), []byte("sender"), TestFunds, func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error { - return nil - }, func(ctx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) { + 0, []byte("lockup_account"), []byte("sender"), TestFunds, + func(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) { typeUrl := sdk.MsgTypeURL(msg) switch typeUrl { case "/cosmos.staking.v1beta1.MsgDelegate": @@ -89,28 +85,24 @@ func newMockContext(t *testing.T) (context.Context, store.KVStoreService) { default: return nil, errors.New("unrecognized request type") } - }, func(ctx context.Context, req, resp ProtoMsg) error { + }, func(ctx context.Context, req transaction.Msg) (transaction.Msg, error) { _, ok := req.(*banktypes.QueryBalanceRequest) if !ok { _, ok = req.(*stakingtypes.QueryParamsRequest) require.True(t, ok) - gogoproto.Merge(resp.(gogoproto.Message), &stakingtypes.QueryParamsResponse{ + return &stakingtypes.QueryParamsResponse{ Params: stakingtypes.Params{ BondDenom: "test", }, - }) - } else { - // NOTE: using gogoproto.Merge will fail for some reason unknown to me, but - // using proto.Merge with gogo messages seems to work fine. - proto.Merge(resp.(gogoproto.Message), &banktypes.QueryBalanceResponse{ - Balance: &(sdk.Coin{ - Denom: "test", - Amount: TestFunds.AmountOf("test"), - }), - }) + }, nil } - return nil + return &banktypes.QueryBalanceResponse{ + Balance: &(sdk.Coin{ + Denom: "test", + Amount: TestFunds.AmountOf("test"), + }), + }, nil }, ) } @@ -122,7 +114,7 @@ func makeMockDependencies(storeservice store.KVStoreService) accountstd.Dependen SchemaBuilder: sb, AddressCodec: addressCodec{}, LegacyStateCodec: mockStateCodec{}, - Environment: appmodule.Environment{ + Environment: appmodulev2.Environment{ HeaderService: headerService{}, }, } diff --git a/x/accounts/defaults/multisig/account_test.go b/x/accounts/defaults/multisig/account_test.go index 58d3e11a4457..a53b57f6884f 100644 --- a/x/accounts/defaults/multisig/account_test.go +++ b/x/accounts/defaults/multisig/account_test.go @@ -10,12 +10,13 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/core/store" + "cosmossdk.io/core/transaction" "cosmossdk.io/x/accounts/accountstd" v1 "cosmossdk.io/x/accounts/defaults/multisig/v1" accountsv1 "cosmossdk.io/x/accounts/v1" ) -func setup(t *testing.T, ctx context.Context, ss store.KVStoreService, timefn func() time.Time) *Account { +func setup(t *testing.T, _ context.Context, ss store.KVStoreService, timefn func() time.Time) *Account { t.Helper() deps := makeMockDependencies(ss, timefn) @@ -442,15 +443,13 @@ func TestProposal_NotPassing(t *testing.T) { } ctx, ss := accountstd.NewMockContext( - 0, []byte("multisig_acc"), []byte("addr1"), TestFunds, func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error { - return nil - }, func(ctx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) { + 0, []byte("multisig_acc"), []byte("addr1"), TestFunds, func(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) { if _, ok := msg.(*v1.MsgUpdateConfig); ok { return &v1.MsgUpdateConfigResponse{}, nil } return nil, nil - }, func(ctx context.Context, req, resp ProtoMsg) error { - return nil + }, func(ctx context.Context, req transaction.Msg) (transaction.Msg, error) { + return nil, nil }, ) @@ -565,9 +564,8 @@ func TestProposalPassing(t *testing.T) { var ctx context.Context var ss store.KVStoreService ctx, ss = accountstd.NewMockContext( - 0, []byte("multisig_acc"), []byte("addr1"), TestFunds, func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error { - return nil - }, func(ictx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) { + 0, []byte("multisig_acc"), []byte("addr1"), TestFunds, + func(ictx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) { if execmsg, ok := msg.(*accountsv1.MsgExecute); ok { updateCfg, err := accountstd.UnpackAny[v1.MsgUpdateConfig](execmsg.GetMessage()) if err != nil { @@ -578,8 +576,8 @@ func TestProposalPassing(t *testing.T) { return acc.UpdateConfig(ctx, updateCfg) } return nil, nil - }, func(ctx context.Context, req, resp ProtoMsg) error { - return nil + }, func(ctx context.Context, req transaction.Msg) (transaction.Msg, error) { + return nil, nil }, ) diff --git a/x/accounts/defaults/multisig/go.mod b/x/accounts/defaults/multisig/go.mod index 1cab71bcfb3f..85eaecfe167f 100644 --- a/x/accounts/defaults/multisig/go.mod +++ b/x/accounts/defaults/multisig/go.mod @@ -1,10 +1,10 @@ module cosmossdk.io/x/accounts/defaults/multisig -go 1.22.2 +go 1.23 require ( cosmossdk.io/collections v0.4.0 - cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 + cosmossdk.io/core v1.0.0 cosmossdk.io/math v1.3.0 cosmossdk.io/x/accounts v0.0.0-00010101000000-000000000000 cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 @@ -22,10 +22,9 @@ require ( cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/depinject v1.0.0 // indirect cosmossdk.io/errors v1.0.1 // indirect - cosmossdk.io/log v1.4.0 // indirect - cosmossdk.io/schema v0.1.1 // indirect + cosmossdk.io/log v1.4.1 // indirect + cosmossdk.io/schema v0.2.0 // indirect cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc // indirect - cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/tx v0.13.3 // indirect @@ -48,12 +47,12 @@ require ( github.com/cometbft/cometbft-db v0.12.0 // indirect github.com/cometbft/cometbft/api v1.0.0-rc.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-db v1.0.2 // indirect + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 // indirect github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -101,7 +100,7 @@ require ( github.com/iancoleman/strcase v0.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect @@ -117,13 +116,13 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -160,9 +159,9 @@ require ( golang.org/x/text v0.17.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect - google.golang.org/grpc v1.65.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect + google.golang.org/grpc v1.66.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect @@ -172,13 +171,15 @@ require ( replace github.com/cosmos/cosmos-sdk => ../../../../. +replace github.com/cosmos/iavl => github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e + replace ( cosmossdk.io/api => ../../../../api cosmossdk.io/collections => ../../../../collections // TODO tag new collections ASAP cosmossdk.io/core => ../../../../core cosmossdk.io/core/testing => ../../../../core/testing + cosmossdk.io/store => ../../../../store cosmossdk.io/x/accounts => ../../. - cosmossdk.io/x/auth => ../../../auth cosmossdk.io/x/bank => ../../../bank cosmossdk.io/x/consensus => ../../../consensus cosmossdk.io/x/gov => ../../../gov diff --git a/x/accounts/defaults/multisig/go.sum b/x/accounts/defaults/multisig/go.sum index 3a35408a4d6c..d7eadac38736 100644 --- a/x/accounts/defaults/multisig/go.sum +++ b/x/accounts/defaults/multisig/go.sum @@ -8,14 +8,12 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= -cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc h1:R9O9d75e0qZYUsVV0zzi+D7cNLnX2JrUOQNoIPaF0Bg= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc/go.mod h1:amTTatOUV3u1PsKmNb87z6/galCxrRbz9kRdJkL0DyU= +cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk= +cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= @@ -100,8 +98,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/crypto v0.1.2 h1:Yn500sPY+9sKVdhiPUSDtt8JOpBGMB515dOmla4zfls= @@ -113,10 +111,10 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e h1:LEii0v/FxtXa/F7mRn+tijZ0zaXBPn2ZkKwb6Qm4rqE= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e/go.mod h1:3ywr0wDnWeD7MUH6qu50wZ5bxuKH3LBrGG4/lZX8lVY= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -309,8 +307,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -320,6 +318,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -385,8 +385,8 @@ github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4 github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba h1:3jPgmsFGBID1wFfU2AbYocNcN4wqU68UaHSdMjiw/7U= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= @@ -403,8 +403,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -413,8 +413,8 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -470,7 +470,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -501,6 +500,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= @@ -633,10 +634,10 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEY google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -647,8 +648,8 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/x/accounts/defaults/multisig/utils_test.go b/x/accounts/defaults/multisig/utils_test.go index 47f185fef1cd..586be634a3ab 100644 --- a/x/accounts/defaults/multisig/utils_test.go +++ b/x/accounts/defaults/multisig/utils_test.go @@ -9,13 +9,13 @@ import ( types "github.com/cosmos/gogoproto/types/any" "github.com/stretchr/testify/require" "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/runtime/protoiface" "cosmossdk.io/collections" - "cosmossdk.io/core/appmodule/v2" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/event" "cosmossdk.io/core/header" "cosmossdk.io/core/store" + "cosmossdk.io/core/transaction" "cosmossdk.io/math" "cosmossdk.io/x/accounts/accountstd" banktypes "cosmossdk.io/x/bank/types" @@ -26,8 +26,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -type ProtoMsg = protoiface.MessageV1 - var TestFunds = sdk.NewCoins(sdk.NewCoin("test", math.NewInt(10))) // mock statecodec @@ -149,9 +147,9 @@ func (c mockStateCodec) Unmarshal(bz []byte, ptr gogoproto.Message) error { } type ( - ModuleExecUntypedFunc = func(ctx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) - ModuleExecFunc = func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error - ModuleQueryFunc = func(ctx context.Context, queryReq, queryResp ProtoMsg) error + ModuleExecUntypedFunc = func(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) + ModuleExecFunc = func(ctx context.Context, sender []byte, msg, msgResp transaction.Msg) error + ModuleQueryFunc = func(ctx context.Context, queryReq, queryResp transaction.Msg) error ) // mock address codec @@ -163,20 +161,19 @@ func (a addressCodec) BytesToString(bz []byte) (string, error) { return string func newMockContext(t *testing.T) (context.Context, store.KVStoreService) { t.Helper() return accountstd.NewMockContext( - 0, []byte("mock_multisig_account"), []byte("sender"), TestFunds, func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error { - return nil - }, func(ctx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) { + 0, []byte("mock_multisig_account"), []byte("sender"), TestFunds, func(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) { return nil, nil - }, func(ctx context.Context, req, resp ProtoMsg) error { + }, func(ctx context.Context, req transaction.Msg) (transaction.Msg, error) { + var resp transaction.Msg _, ok := req.(*banktypes.QueryBalanceRequest) require.True(t, ok) - gogoproto.Merge(resp.(gogoproto.Message), &banktypes.QueryBalanceResponse{ + gogoproto.Merge(resp, &banktypes.QueryBalanceResponse{ Balance: &sdk.Coin{ Denom: "test", Amount: math.NewInt(5), }, }) - return nil + return resp, nil }, ) } @@ -188,7 +185,7 @@ func makeMockDependencies(storeservice store.KVStoreService, timefn func() time. SchemaBuilder: sb, AddressCodec: addressCodec{}, LegacyStateCodec: mockStateCodec{}, - Environment: appmodule.Environment{ + Environment: appmodulev2.Environment{ HeaderService: headerService{timefn}, EventService: eventService{}, }, diff --git a/x/accounts/depinject.go b/x/accounts/depinject.go index 04a45c533453..1110a0525a20 100644 --- a/x/accounts/depinject.go +++ b/x/accounts/depinject.go @@ -64,7 +64,7 @@ func (s directHandler) GetSignBytes(_ context.Context, _ signing.SignerData, _ s func ProvideModule(in ModuleInputs) ModuleOutputs { handler := directHandler{} - account := baseaccount.NewAccount("base", signing.NewHandlerMap(handler)) + account := baseaccount.NewAccount("base", signing.NewHandlerMap(handler), baseaccount.WithSecp256K1PubKey()) accountskeeper, err := NewKeeper( in.Cdc, in.Environment, in.AddressCodec, in.Registry, account, accountstd.AddAccount(lockup.CONTINUOUS_LOCKING_ACCOUNT, lockup.NewContinuousLockingAccount), diff --git a/x/accounts/go.mod b/x/accounts/go.mod index 585991b393b0..843407019d1a 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -1,11 +1,11 @@ module cosmossdk.io/x/accounts -go 1.22.2 +go 1.23 require ( cosmossdk.io/api v0.7.5 cosmossdk.io/collections v0.4.0 - cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 + cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 cosmossdk.io/depinject v1.0.0 cosmossdk.io/x/accounts/defaults/multisig v0.0.0-00010101000000-000000000000 @@ -16,27 +16,21 @@ require ( github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 - google.golang.org/grpc v1.65.0 + google.golang.org/grpc v1.66.0 google.golang.org/protobuf v1.34.2 ) -require github.com/golang/mock v1.6.0 // indirect - -require ( - cosmossdk.io/schema v0.1.1 // indirect - github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect -) - require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect cosmossdk.io/errors v1.0.1 // indirect - cosmossdk.io/log v1.4.0 // indirect + cosmossdk.io/log v1.4.1 // indirect cosmossdk.io/math v1.3.0 + cosmossdk.io/schema v0.2.0 // indirect cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc // indirect cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5 - cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 // indirect + cosmossdk.io/x/distribution v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect @@ -57,13 +51,13 @@ require ( github.com/cometbft/cometbft-db v0.12.0 // indirect github.com/cometbft/cometbft/api v1.0.0-rc.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-db v1.0.2 // indirect + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 // indirect github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -85,6 +79,7 @@ require ( github.com/gogo/protobuf v1.3.2 github.com/golang/glog v1.2.1 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect @@ -110,7 +105,7 @@ require ( github.com/iancoleman/strcase v0.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect @@ -123,15 +118,16 @@ require ( github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mtibben/percent v0.2.1 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -167,8 +163,8 @@ require ( golang.org/x/text v0.17.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect @@ -178,14 +174,17 @@ require ( replace github.com/cosmos/cosmos-sdk => ../../. +replace github.com/cosmos/iavl => github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e + // TODO remove post spinning out all modules replace ( cosmossdk.io/api => ../../api cosmossdk.io/collections => ../../collections cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing + cosmossdk.io/store => ../../store + cosmossdk.io/x/accounts/defaults/lockup => ./defaults/lockup cosmossdk.io/x/accounts/defaults/multisig => ./defaults/multisig - cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank cosmossdk.io/x/consensus => ../consensus cosmossdk.io/x/distribution => ../distribution diff --git a/x/accounts/go.sum b/x/accounts/go.sum index 2b48d17bbdfb..7c1f771aabec 100644 --- a/x/accounts/go.sum +++ b/x/accounts/go.sum @@ -8,16 +8,12 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= -cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc h1:R9O9d75e0qZYUsVV0zzi+D7cNLnX2JrUOQNoIPaF0Bg= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc/go.mod h1:amTTatOUV3u1PsKmNb87z6/galCxrRbz9kRdJkL0DyU= -cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5 h1:eb0kcGyaYHSS0do7+MIWg7UKlskSH01biRNENbm/zDA= -cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5/go.mod h1:drzY4oVisyWvSgpsM7ccQ7IX3efMuVIvd9Eij1Gm/6o= +cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk= +cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= @@ -102,8 +98,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/crypto v0.1.2 h1:Yn500sPY+9sKVdhiPUSDtt8JOpBGMB515dOmla4zfls= @@ -115,10 +111,10 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e h1:LEii0v/FxtXa/F7mRn+tijZ0zaXBPn2ZkKwb6Qm4rqE= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e/go.mod h1:3ywr0wDnWeD7MUH6qu50wZ5bxuKH3LBrGG4/lZX8lVY= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -311,8 +307,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -322,6 +318,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -387,8 +385,8 @@ github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4 github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba h1:3jPgmsFGBID1wFfU2AbYocNcN4wqU68UaHSdMjiw/7U= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= @@ -405,8 +403,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -415,8 +413,8 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -472,7 +470,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -504,6 +501,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= @@ -639,10 +638,10 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEY google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -653,8 +652,8 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/x/accounts/internal/implementation/api_builder.go b/x/accounts/internal/implementation/api_builder.go index bd6e408215ea..fd554dad6e75 100644 --- a/x/accounts/internal/implementation/api_builder.go +++ b/x/accounts/internal/implementation/api_builder.go @@ -4,6 +4,8 @@ import ( "context" "errors" "fmt" + + "cosmossdk.io/core/transaction" ) var ( @@ -22,7 +24,7 @@ type InitBuilder struct { // handler is the handler function that will be called when the smart account is initialized. // Although the function here is defined to take an any, the smart account will work // with a typed version of it. - handler func(ctx context.Context, initRequest ProtoMsg) (initResponse ProtoMsg, err error) + handler func(ctx context.Context, initRequest transaction.Msg) (initResponse transaction.Msg, err error) // schema is the schema of the message that will be passed to the handler function. schema HandlerSchema @@ -30,7 +32,7 @@ type InitBuilder struct { // makeHandler returns the handler function that will be called when the smart account is initialized. // It returns an error if no handler was registered. -func (i *InitBuilder) makeHandler() (func(ctx context.Context, initRequest ProtoMsg) (initResponse ProtoMsg, err error), error) { +func (i *InitBuilder) makeHandler() (func(ctx context.Context, initRequest transaction.Msg) (initResponse transaction.Msg, err error), error) { if i.handler == nil { return nil, errNoInitHandler } @@ -40,7 +42,7 @@ func (i *InitBuilder) makeHandler() (func(ctx context.Context, initRequest Proto // NewExecuteBuilder creates a new ExecuteBuilder instance. func NewExecuteBuilder() *ExecuteBuilder { return &ExecuteBuilder{ - handlers: make(map[string]func(ctx context.Context, executeRequest ProtoMsg) (executeResponse ProtoMsg, err error)), + handlers: make(map[string]func(ctx context.Context, executeRequest transaction.Msg) (executeResponse transaction.Msg, err error)), handlersSchema: make(map[string]HandlerSchema), } } @@ -49,7 +51,7 @@ func NewExecuteBuilder() *ExecuteBuilder { // to a handler function for a specific account. type ExecuteBuilder struct { // handlers is a map of handler functions that will be called when the smart account is executed. - handlers map[string]func(ctx context.Context, executeRequest ProtoMsg) (executeResponse ProtoMsg, err error) + handlers map[string]func(ctx context.Context, executeRequest transaction.Msg) (executeResponse transaction.Msg, err error) // handlersSchema is a map of schemas for the messages that will be passed to the handler functions // and the messages that will be returned by the handler functions. @@ -59,10 +61,10 @@ type ExecuteBuilder struct { err error } -func (r *ExecuteBuilder) makeHandler() (func(ctx context.Context, executeRequest ProtoMsg) (executeResponse ProtoMsg, err error), error) { +func (r *ExecuteBuilder) makeHandler() (func(ctx context.Context, executeRequest transaction.Msg) (executeResponse transaction.Msg, err error), error) { // if no handler is registered it's fine, it means the account will not be accepting execution or query messages. if len(r.handlers) == 0 { - return func(ctx context.Context, _ ProtoMsg) (_ ProtoMsg, err error) { + return func(ctx context.Context, _ transaction.Msg) (_ transaction.Msg, err error) { return nil, errNoExecuteHandler }, nil } @@ -72,7 +74,7 @@ func (r *ExecuteBuilder) makeHandler() (func(ctx context.Context, executeRequest } // build the real execution handler - return func(ctx context.Context, executeRequest ProtoMsg) (executeResponse ProtoMsg, err error) { + return func(ctx context.Context, executeRequest transaction.Msg) (executeResponse transaction.Msg, err error) { messageName := MessageName(executeRequest) handler, ok := r.handlers[messageName] if !ok { @@ -96,7 +98,7 @@ type QueryBuilder struct { er *ExecuteBuilder } -func (r *QueryBuilder) makeHandler() (func(ctx context.Context, queryRequest ProtoMsg) (queryResponse ProtoMsg, err error), error) { +func (r *QueryBuilder) makeHandler() (func(ctx context.Context, queryRequest transaction.Msg) (queryResponse transaction.Msg, err error), error) { return r.er.makeHandler() } diff --git a/x/accounts/internal/implementation/context.go b/x/accounts/internal/implementation/context.go index 64ba2820d6cd..8a24ea7cd034 100644 --- a/x/accounts/internal/implementation/context.go +++ b/x/accounts/internal/implementation/context.go @@ -6,6 +6,7 @@ import ( "cosmossdk.io/collections" "cosmossdk.io/core/store" + "cosmossdk.io/core/transaction" "cosmossdk.io/x/accounts/internal/prefixstore" sdk "github.com/cosmos/cosmos-sdk/types" @@ -14,22 +15,20 @@ import ( var AccountStatePrefix = collections.NewPrefix(255) type ( - ModuleExecUntypedFunc = func(ctx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) - ModuleExecFunc = func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error - ModuleQueryFunc = func(ctx context.Context, queryReq, queryResp ProtoMsg) error + ModuleExecFunc = func(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) + ModuleQueryFunc = func(ctx context.Context, queryReq transaction.Msg) (transaction.Msg, error) ) type contextKey struct{} type contextValue struct { - store store.KVStore // store is the prefixed store for the account. - sender []byte // sender is the address of the entity invoking the account action. - whoami []byte // whoami is the address of the account being invoked. - funds sdk.Coins // funds reports the coins sent alongside the request. - parentContext context.Context // parentContext that was used to build the account context. - moduleExec ModuleExecFunc // moduleExec is a function that executes a module message, when the resp type is known. - moduleExecUntyped ModuleExecUntypedFunc // moduleExecUntyped is a function that executes a module message, when the resp type is unknown. - moduleQuery ModuleQueryFunc // moduleQuery is a function that queries a module. + store store.KVStore // store is the prefixed store for the account. + sender []byte // sender is the address of the entity invoking the account action. + whoami []byte // whoami is the address of the account being invoked. + funds sdk.Coins // funds reports the coins sent alongside the request. + parentContext context.Context // parentContext that was used to build the account context. + moduleExec ModuleExecFunc // moduleExec is a function that executes a module message, when the resp type is unknown. + moduleQuery ModuleQueryFunc // moduleQuery is a function that queries a module. } func addCtx(ctx context.Context, value contextValue) context.Context { @@ -55,18 +54,16 @@ func MakeAccountContext( sender []byte, funds sdk.Coins, moduleExec ModuleExecFunc, - moduleExecUntyped ModuleExecUntypedFunc, moduleQuery ModuleQueryFunc, ) context.Context { return addCtx(ctx, contextValue{ - store: makeAccountStore(ctx, storeSvc, accNumber), - sender: sender, - whoami: accountAddr, - funds: funds, - parentContext: ctx, - moduleExec: moduleExec, - moduleExecUntyped: moduleExecUntyped, - moduleQuery: moduleQuery, + store: makeAccountStore(ctx, storeSvc, accNumber), + sender: sender, + whoami: accountAddr, + funds: funds, + parentContext: ctx, + moduleExec: moduleExec, + moduleQuery: moduleQuery, }) } @@ -85,27 +82,12 @@ func makeAccountStore(ctx context.Context, storeSvc store.KVStoreService, accNum return prefixstore.New(storeSvc.OpenKVStore(ctx), append(AccountStatePrefix, prefix...)) } -// ExecModuleUntyped can be used to execute a message towards a module, when the response type is unknown. -func ExecModuleUntyped(ctx context.Context, msg ProtoMsg) (ProtoMsg, error) { +// ExecModule can be used to execute a message towards a module, when the response type is unknown. +func ExecModule(ctx context.Context, msg transaction.Msg) (transaction.Msg, error) { // get sender v := getCtx(ctx) - resp, err := v.moduleExecUntyped(v.parentContext, v.whoami, msg) - if err != nil { - return nil, err - } - - return resp, nil -} - -// ExecModule can be used to execute a message towards a module. -func ExecModule[Resp any, RespProto ProtoMsgG[Resp], Req any, ReqProto ProtoMsgG[Req]](ctx context.Context, msg ReqProto) (RespProto, error) { - // get sender - v := getCtx(ctx) - - // execute module, unwrapping the original context. - resp := RespProto(new(Resp)) - err := v.moduleExec(v.parentContext, v.whoami, msg, resp) + resp, err := v.moduleExec(v.parentContext, v.whoami, msg) if err != nil { return nil, err } @@ -114,12 +96,11 @@ func ExecModule[Resp any, RespProto ProtoMsgG[Resp], Req any, ReqProto ProtoMsgG } // QueryModule can be used by an account to execute a module query. -func QueryModule[Resp any, RespProto ProtoMsgG[Resp], Req any, ReqProto ProtoMsgG[Req]](ctx context.Context, req ReqProto) (RespProto, error) { +func QueryModule(ctx context.Context, req transaction.Msg) (transaction.Msg, error) { // we do not need to check the sender in a query because it is not a state transition. // we also unwrap the original context. v := getCtx(ctx) - resp := RespProto(new(Resp)) - err := v.moduleQuery(v.parentContext, req, resp) + resp, err := v.moduleQuery(v.parentContext, req) if err != nil { return nil, err } diff --git a/x/accounts/internal/implementation/context_test.go b/x/accounts/internal/implementation/context_test.go index ff47b50c89ef..9cf1108401aa 100644 --- a/x/accounts/internal/implementation/context_test.go +++ b/x/accounts/internal/implementation/context_test.go @@ -9,7 +9,8 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/collections" - "cosmossdk.io/core/testing" + coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/core/transaction" ) func TestMakeAccountContext(t *testing.T) { @@ -19,7 +20,7 @@ func TestMakeAccountContext(t *testing.T) { sender := []byte("sender") sb := collections.NewSchemaBuilderFromAccessor(openKVStore) - accountCtx := MakeAccountContext(originalContext, storeService, 1, accountAddr, sender, nil, nil, nil, nil) + accountCtx := MakeAccountContext(originalContext, storeService, 1, accountAddr, sender, nil, nil, nil) // ensure whoami require.Equal(t, accountAddr, Whoami(accountCtx)) @@ -43,38 +44,24 @@ func TestMakeAccountContext(t *testing.T) { value, err := store.Get(append(AccountStatePrefix, append(binary.BigEndian.AppendUint64(nil, 1), itemPrefix...)...)) require.NoError(t, err) require.Equal(t, []byte{0, 0, 0, 0, 0, 0, 3, 232}, value) - - // ensure calling ExecModule works - accountCtx = MakeAccountContext(originalContext, storeService, 1, []byte("legit-exec-module"), []byte("invoker"), nil, func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error { - // ensure we unwrapped the context when invoking a module call - require.Equal(t, originalContext, ctx) - Merge(msgResp, &types.StringValue{Value: "module exec was called"}) - return nil - }, nil, nil) - - resp, err := ExecModule[types.StringValue](accountCtx, &types.UInt64Value{Value: 1000}) - require.NoError(t, err) - require.True(t, Equal(&types.StringValue{Value: "module exec was called"}, resp)) - // ensure calling ExecModuleUntyped works - accountCtx = MakeAccountContext(originalContext, storeService, 1, []byte("legit-exec-module-untyped"), []byte("invoker"), nil, nil, func(ctx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) { + accountCtx = MakeAccountContext(originalContext, storeService, 1, []byte("legit-exec-module-untyped"), []byte("invoker"), nil, func(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) { require.Equal(t, originalContext, ctx) return &types.StringValue{Value: "module exec untyped was called"}, nil }, nil) - respUntyped, err := ExecModuleUntyped(accountCtx, &types.UInt64Value{Value: 1000}) + respUntyped, err := ExecModule(accountCtx, &types.UInt64Value{Value: 1000}) require.NoError(t, err) require.True(t, Equal(&types.StringValue{Value: "module exec untyped was called"}, respUntyped)) // ensure calling QueryModule works, also by setting everything else communication related to nil // we can guarantee that exec paths do not impact query paths. - accountCtx = MakeAccountContext(originalContext, storeService, 1, nil, nil, nil, nil, nil, func(ctx context.Context, req, resp ProtoMsg) error { + accountCtx = MakeAccountContext(originalContext, storeService, 1, nil, nil, nil, nil, func(ctx context.Context, req transaction.Msg) (transaction.Msg, error) { require.Equal(t, originalContext, ctx) - Merge(resp, &types.StringValue{Value: "module query was called"}) - return nil + return &types.StringValue{Value: "module query was called"}, nil }) - resp, err = QueryModule[types.StringValue](accountCtx, &types.UInt64Value{Value: 1000}) + resp, err := QueryModule(accountCtx, &types.UInt64Value{Value: 1000}) require.NoError(t, err) require.True(t, Equal(&types.StringValue{Value: "module query was called"}, resp)) } diff --git a/x/accounts/internal/implementation/encoding.go b/x/accounts/internal/implementation/encoding.go index 167ecb38aa9e..9b08d00bf862 100644 --- a/x/accounts/internal/implementation/encoding.go +++ b/x/accounts/internal/implementation/encoding.go @@ -6,35 +6,34 @@ import ( "strings" "github.com/cosmos/gogoproto/proto" - "google.golang.org/protobuf/runtime/protoiface" + + "cosmossdk.io/core/transaction" codectypes "github.com/cosmos/cosmos-sdk/codec/types" ) -type ProtoMsg = protoiface.MessageV1 - // ProtoMsgG is a generic interface for protobuf messages. type ProtoMsgG[T any] interface { *T - protoiface.MessageV1 + transaction.Msg } type Any = codectypes.Any -func FindMessageByName(name string) (ProtoMsg, error) { +func FindMessageByName(name string) (transaction.Msg, error) { typ := proto.MessageType(name) if typ == nil { return nil, fmt.Errorf("no message type found for %s", name) } - return reflect.New(typ.Elem()).Interface().(ProtoMsg), nil + return reflect.New(typ.Elem()).Interface().(transaction.Msg), nil } -func MessageName(msg ProtoMsg) string { +func MessageName(msg transaction.Msg) string { return proto.MessageName(msg) } // PackAny packs a proto message into an anypb.Any. -func PackAny(msg ProtoMsg) (*Any, error) { +func PackAny(msg transaction.Msg) (*Any, error) { return codectypes.NewAnyWithValue(msg) } @@ -44,7 +43,7 @@ func UnpackAny[T any, PT ProtoMsgG[T]](anyPB *Any) (PT, error) { return to, UnpackAnyTo(anyPB, PT(to)) } -func UnpackAnyTo(anyPB *Any, to ProtoMsg) error { +func UnpackAnyTo(anyPB *Any, to transaction.Msg) error { return proto.Unmarshal(anyPB.Value, to) } @@ -59,10 +58,10 @@ func UnpackAnyRaw(anyPB *Any) (proto.Message, error) { return to, UnpackAnyTo(anyPB, to) } -func Merge(a, b ProtoMsg) { +func Merge(a, b transaction.Msg) { proto.Merge(a, b) } -func Equal(a, b ProtoMsg) bool { +func Equal(a, b transaction.Msg) bool { return proto.Equal(a, b) } diff --git a/x/accounts/internal/implementation/implementation.go b/x/accounts/internal/implementation/implementation.go index 47457af718d1..6ee1edc39927 100644 --- a/x/accounts/internal/implementation/implementation.go +++ b/x/accounts/internal/implementation/implementation.go @@ -9,6 +9,7 @@ import ( "cosmossdk.io/collections" "cosmossdk.io/core/address" "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/transaction" "github.com/cosmos/cosmos-sdk/codec" ) @@ -107,11 +108,11 @@ func newImplementation(schemaBuilder *collections.SchemaBuilder, account Account // and non-generic implementation usable by the x/accounts module. type Implementation struct { // Init defines the initialisation handler for the smart account. - Init func(ctx context.Context, msg ProtoMsg) (resp ProtoMsg, err error) + Init func(ctx context.Context, msg transaction.Msg) (resp transaction.Msg, err error) // Execute defines the execution handler for the smart account. - Execute func(ctx context.Context, msg ProtoMsg) (resp ProtoMsg, err error) + Execute func(ctx context.Context, msg transaction.Msg) (resp transaction.Msg, err error) // Query defines the query handler for the smart account. - Query func(ctx context.Context, msg ProtoMsg) (resp ProtoMsg, err error) + Query func(ctx context.Context, msg transaction.Msg) (resp transaction.Msg, err error) // CollectionsSchema represents the state schema. CollectionsSchema collections.Schema // InitHandlerSchema represents the init handler schema. @@ -123,19 +124,19 @@ type Implementation struct { } // HasExec returns true if the account can execute the given msg. -func (i Implementation) HasExec(m ProtoMsg) bool { +func (i Implementation) HasExec(m transaction.Msg) bool { _, ok := i.ExecuteHandlersSchema[MessageName(m)] return ok } // HasQuery returns true if the account can execute the given request. -func (i Implementation) HasQuery(m ProtoMsg) bool { +func (i Implementation) HasQuery(m transaction.Msg) bool { _, ok := i.QueryHandlersSchema[MessageName(m)] return ok } // HasInit returns true if the account uses the provided init message. -func (i Implementation) HasInit(m ProtoMsg) bool { +func (i Implementation) HasInit(m transaction.Msg) bool { return i.InitHandlerSchema.RequestSchema.Name == MessageName(m) } @@ -145,7 +146,7 @@ type MessageSchema struct { // Name identifies the message name, this must be queryable from some reflection service. Name string // New is used to create a new message instance for the schema. - New func() ProtoMsg + New func() transaction.Msg } // HandlerSchema defines the schema of a handler. diff --git a/x/accounts/internal/implementation/protoaccount.go b/x/accounts/internal/implementation/protoaccount.go index 122ec1168827..e17c793316f2 100644 --- a/x/accounts/internal/implementation/protoaccount.go +++ b/x/accounts/internal/implementation/protoaccount.go @@ -5,6 +5,8 @@ import ( "fmt" "google.golang.org/protobuf/proto" + + "cosmossdk.io/core/transaction" ) // RegisterInitHandler registers an initialisation handler for a smart account that uses protobuf. @@ -14,7 +16,7 @@ func RegisterInitHandler[ ) { reqName := MessageName(ProtoReq(new(Req))) - router.handler = func(ctx context.Context, initRequest ProtoMsg) (initResponse ProtoMsg, err error) { + router.handler = func(ctx context.Context, initRequest transaction.Msg) (initResponse transaction.Msg, err error) { concrete, ok := initRequest.(ProtoReq) if !ok { return nil, fmt.Errorf("%w: wanted %s, got %T", errInvalidMessage, reqName, initRequest) @@ -40,7 +42,7 @@ func RegisterExecuteHandler[ return } - router.handlers[reqName] = func(ctx context.Context, executeRequest ProtoMsg) (executeResponse ProtoMsg, err error) { + router.handlers[reqName] = func(ctx context.Context, executeRequest transaction.Msg) (executeResponse transaction.Msg, err error) { concrete, ok := executeRequest.(ProtoReq) if !ok { return nil, fmt.Errorf("%w: wanted %s, got %T", errInvalidMessage, reqName, executeRequest) @@ -69,7 +71,7 @@ func NewProtoMessageSchema[T any, PT ProtoMsgG[T]]() *MessageSchema { } return &MessageSchema{ Name: MessageName(msg), - New: func() ProtoMsg { + New: func() transaction.Msg { return PT(new(T)) }, } diff --git a/x/accounts/keeper.go b/x/accounts/keeper.go index 91ef5d707c82..fee356a7736f 100644 --- a/x/accounts/keeper.go +++ b/x/accounts/keeper.go @@ -13,6 +13,7 @@ import ( "cosmossdk.io/collections" "cosmossdk.io/core/address" "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/transaction" "cosmossdk.io/x/accounts/accountstd" "cosmossdk.io/x/accounts/internal/implementation" v1 "cosmossdk.io/x/accounts/v1" @@ -137,9 +138,9 @@ func (k Keeper) Init( ctx context.Context, accountType string, creator []byte, - initRequest implementation.ProtoMsg, + initRequest transaction.Msg, funds sdk.Coins, -) (implementation.ProtoMsg, []byte, error) { +) (transaction.Msg, []byte, error) { // get the next account number num, err := k.AccountNumber.Next(ctx) if err != nil { @@ -158,7 +159,7 @@ func (k Keeper) Init( } // initFromMsg is a helper which inits an account given a v1.MsgInit. -func (k Keeper) initFromMsg(ctx context.Context, initMsg *v1.MsgInit) (implementation.ProtoMsg, []byte, error) { +func (k Keeper) initFromMsg(ctx context.Context, initMsg *v1.MsgInit) (transaction.Msg, []byte, error) { creator, err := k.addressCodec.StringToBytes(initMsg.Sender) if err != nil { return nil, nil, err @@ -182,9 +183,9 @@ func (k Keeper) init( creator []byte, accountNum uint64, accountAddr []byte, - initRequest implementation.ProtoMsg, + initRequest transaction.Msg, funds sdk.Coins, -) (implementation.ProtoMsg, error) { +) (transaction.Msg, error) { impl, ok := k.accounts[accountType] if !ok { return nil, fmt.Errorf("%w: not found %s", errAccountTypeNotFound, accountType) @@ -223,8 +224,8 @@ func (k Keeper) MigrateLegacyAccount( addr []byte, // The current address of the account accNum uint64, // The current account number accType string, // The account type to migrate to - msg implementation.ProtoMsg, // The init msg of the account type we're migrating to -) (implementation.ProtoMsg, error) { + msg transaction.Msg, // The init msg of the account type we're migrating to +) (transaction.Msg, error) { return k.init(ctx, accType, addr, accNum, addr, msg, nil) } @@ -233,9 +234,9 @@ func (k Keeper) Execute( ctx context.Context, accountAddr []byte, sender []byte, - execRequest implementation.ProtoMsg, + execRequest transaction.Msg, funds sdk.Coins, -) (implementation.ProtoMsg, error) { +) (transaction.Msg, error) { // get account implementation impl, err := k.getImplementation(ctx, accountAddr) if err != nil { @@ -265,8 +266,8 @@ func (k Keeper) Execute( func (k Keeper) Query( ctx context.Context, accountAddr []byte, - queryRequest implementation.ProtoMsg, -) (implementation.ProtoMsg, error) { + queryRequest transaction.Msg, +) (transaction.Msg, error) { // get account implementation impl, err := k.getImplementation(ctx, accountAddr) if err != nil { @@ -315,8 +316,7 @@ func (k Keeper) makeAccountContext(ctx context.Context, accountNumber uint64, ac accountAddr, sender, funds, - k.sendModuleMessage, - k.SendModuleMessageUntyped, + k.SendModuleMessage, k.queryModule, ) } @@ -330,10 +330,7 @@ func (k Keeper) makeAccountContext(ctx context.Context, accountNumber uint64, ac accountAddr, nil, nil, - func(ctx context.Context, sender []byte, msg, msgResp implementation.ProtoMsg) error { - return errors.New("cannot execute in query context") - }, - func(ctx context.Context, sender []byte, msg implementation.ProtoMsg) (implementation.ProtoMsg, error) { + func(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) { return nil, errors.New("cannot execute in query context") }, k.queryModule, @@ -350,7 +347,7 @@ func (k Keeper) sendAnyMessages(ctx context.Context, sender []byte, anyMessages if err != nil { return nil, err } - resp, err := k.SendModuleMessageUntyped(ctx, sender, msg) + resp, err := k.SendModuleMessage(ctx, sender, msg) if err != nil { return nil, fmt.Errorf("failed to execute message %d: %s", i, err.Error()) } @@ -363,9 +360,9 @@ func (k Keeper) sendAnyMessages(ctx context.Context, sender []byte, anyMessages return anyResponses, nil } -// SendModuleMessageUntyped can be used to send a message towards a module. +// SendModuleMessage can be used to send a message towards a module. // It should be used when the response type is not known by the caller. -func (k Keeper) SendModuleMessageUntyped(ctx context.Context, sender []byte, msg implementation.ProtoMsg) (implementation.ProtoMsg, error) { +func (k Keeper) SendModuleMessage(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) { // do sender assertions. wantSenders, _, err := k.codec.GetMsgSigners(msg) if err != nil { @@ -377,7 +374,7 @@ func (k Keeper) SendModuleMessageUntyped(ctx context.Context, sender []byte, msg if !bytes.Equal(sender, wantSenders[0]) { return nil, fmt.Errorf("%w: sender does not match expected sender", ErrUnauthorized) } - resp, err := k.MsgRouterService.InvokeUntyped(ctx, msg) + resp, err := k.MsgRouterService.Invoke(ctx, msg) if err != nil { return nil, err } @@ -388,26 +385,27 @@ func (k Keeper) SendModuleMessageUntyped(ctx context.Context, sender []byte, msg // sendModuleMessage can be used to send a message towards a module. It expects the // response type to be known by the caller. It will also assert the sender has the right // is not trying to impersonate another account. -func (k Keeper) sendModuleMessage(ctx context.Context, sender []byte, msg, msgResp implementation.ProtoMsg) error { +func (k Keeper) sendModuleMessage(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) { // do sender assertions. wantSenders, _, err := k.codec.GetMsgSigners(msg) if err != nil { - return fmt.Errorf("cannot get signers: %w", err) + return nil, fmt.Errorf("cannot get signers: %w", err) } if len(wantSenders) != 1 { - return fmt.Errorf("expected only one signer, got %d", len(wantSenders)) + return nil, fmt.Errorf("expected only one signer, got %d", len(wantSenders)) } if !bytes.Equal(sender, wantSenders[0]) { - return fmt.Errorf("%w: sender does not match expected sender", ErrUnauthorized) + return nil, fmt.Errorf("%w: sender does not match expected sender", ErrUnauthorized) } - return k.MsgRouterService.InvokeTyped(ctx, msg, msgResp) + + return k.MsgRouterService.Invoke(ctx, msg) } // queryModule is the entrypoint for an account to query a module. // It will try to find the query handler for the given query and execute it. // If multiple query handlers are found, it will return an error. -func (k Keeper) queryModule(ctx context.Context, queryReq, queryResp implementation.ProtoMsg) error { - return k.QueryRouterService.InvokeTyped(ctx, queryReq, queryResp) +func (k Keeper) queryModule(ctx context.Context, queryReq transaction.Msg) (transaction.Msg, error) { + return k.QueryRouterService.Invoke(ctx, queryReq) } // maybeSendFunds will send the provided coins between the provided addresses, if amt @@ -417,23 +415,24 @@ func (k Keeper) maybeSendFunds(ctx context.Context, from, to []byte, amt sdk.Coi return nil } - msg, msgResp, err := k.makeSendCoinsMsg(from, to, amt) + msg, err := k.makeSendCoinsMsg(from, to, amt) if err != nil { return err } // send module message ensures that "from" cannot impersonate. - err = k.sendModuleMessage(ctx, from, msg, msgResp) + _, err = k.sendModuleMessage(ctx, from, msg) if err != nil { return err } + return nil } const msgInterfaceName = "cosmos.accounts.v1.MsgInterface" // creates a new interface type which is an alias of the proto message interface to avoid conflicts with sdk.Msg -type msgInterface implementation.ProtoMsg +type msgInterface transaction.Msg var msgInterfaceType = (*msgInterface)(nil) diff --git a/x/accounts/proto/cosmos/accounts/defaults/base/v1/base.proto b/x/accounts/proto/cosmos/accounts/defaults/base/v1/base.proto index 0919c62bbd13..1df7f92b501d 100644 --- a/x/accounts/proto/cosmos/accounts/defaults/base/v1/base.proto +++ b/x/accounts/proto/cosmos/accounts/defaults/base/v1/base.proto @@ -4,10 +4,12 @@ package cosmos.accounts.defaults.base.v1; option go_package = "cosmossdk.io/x/accounts/defaults/base/v1"; +import "google/protobuf/any.proto"; + // MsgInit is used to initialize a base account. message MsgInit { - // pub_key defines the secp256k1 pubkey for the account. - bytes pub_key = 1; + // pub_key defines a pubkey for the account arbitrary encapsulated. + google.protobuf.Any pub_key = 1; } // MsgInitResponse is the response returned after base account initialization. @@ -17,7 +19,7 @@ message MsgInitResponse {} // MsgSwapPubKey is used to change the pubkey for the account. message MsgSwapPubKey { // new_pub_key defines the secp256k1 pubkey to swap the account to. - bytes new_pub_key = 1; + google.protobuf.Any new_pub_key = 1; } // MsgSwapPubKeyResponse is the response for the MsgSwapPubKey message. @@ -32,3 +34,11 @@ message QuerySequenceResponse { // sequence is the current sequence of the account. uint64 sequence = 1; } + +// QueryPubKey is the request used to query the pubkey of an account. +message QueryPubKey {} + +// QueryPubKeyResponse is the response returned when a QueryPubKey message is sent. +message QueryPubKeyResponse { + google.protobuf.Any pub_key = 1; +} \ No newline at end of file diff --git a/x/auth/CHANGELOG.md b/x/auth/CHANGELOG.md index 594f89f87267..587639c40030 100644 --- a/x/auth/CHANGELOG.md +++ b/x/auth/CHANGELOG.md @@ -37,10 +37,11 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#18780](https://github.com/cosmos/cosmos-sdk/pull/18780) Move sig verification out of the for loop, into the authenticate method. * [#19188](https://github.com/cosmos/cosmos-sdk/pull/19188) Remove creation of `BaseAccount` when sending a message to an account that does not exist. * When signing a transaction with an account that has not been created accountnumber 0 must be used +* [#19363](https://github.com/cosmos/cosmos-sdk/pull/19363), [#19370](https://github.com/cosmos/cosmos-sdk/pull/19370) RegisterMigrations, InitGenesis and ExportGenesis return error instead of panic. ### CLI Breaking Changes -* (vesting) [#18100](https://github.com/cosmos/cosmos-sdk/pull/18100) `appd tx vesting create-vesting-account` takes an amount of coin as last argument instead of second. Coins are space separated. +* (vesting) [#19539](https://github.com/cosmos/cosmos-sdk/pull/19539) Remove vesting CLI. ### API Breaking Changes @@ -49,9 +50,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#19161](https://github.com/cosmos/cosmos-sdk/pull/19161) Remove `simulate` from `SetGasMeter` * [#19363](https://github.com/cosmos/cosmos-sdk/pull/19363) Remove `IterateAccounts` and `GetAllAccounts` methods from the AccountKeeper interface and Keeper. * [#19290](https://github.com/cosmos/cosmos-sdk/issues/19290) Pass `appmodule.Environment` to NewKeeper instead of passing individual services. -* [#19535](https://github.com/cosmos/cosmos-sdk/pull/19535) Remove vesting account creation when the chain is running. The accounts module is required for creating vesting accounts on a running chain. +* [#19535](https://github.com/cosmos/cosmos-sdk/pull/19535) Remove vesting account creation when the chain is running. The accounts module is required for creating [#vesting accounts](../accounts/defaults/lockup/README.md) on a running chain. * [#19600](https://github.com/cosmos/cosmos-sdk/pull/19600) add a consensus query method to the consensus module in order for modules to query consensus for the consensus params. - +* [#19600](https://github.com/cosmos/cosmos-sdk/pull/21403) NewAppModule now takes in `ante.ExtensionOptionChecker`, but it's only used in server/v2 chains, so it's safe to pass in nil for the rest of the users. + ### Consensus Breaking Changes @@ -64,4 +66,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#19239](https://github.com/cosmos/cosmos-sdk/pull/19239) Sets from flag in multi-sign command to avoid no key name provided error. * [#19099](https://github.com/cosmos/cosmos-sdk/pull/19099) `verifyIsOnCurve` now checks if we are simulating to avoid malformed public key error. * [#20323](https://github.com/cosmos/cosmos-sdk/pull/20323) Ignore undecodable txs in GetBlocksWithTxs. -* [#20963](https://github.com/cosmos/cosmos-sdk/pull/20963) UseGrantedFees used to return error with raw addresses. Now it uses addresses in string format. \ No newline at end of file +* [#20963](https://github.com/cosmos/cosmos-sdk/pull/20963) UseGrantedFees used to return error with raw addresses. Now it uses addresses in string format. + +### Deprecated + +* (x/auth) [#20531](https://github.com/cosmos/cosmos-sdk/pull/20531) Deprecate auth keeper `NextAccountNumber`, use `keeper.AccountsModKeeper.NextAccountNumber` instead. diff --git a/x/auth/ante/ante.go b/x/auth/ante/ante.go index fb4eb6c7ad44..779418e96655 100644 --- a/x/auth/ante/ante.go +++ b/x/auth/ante/ante.go @@ -2,14 +2,15 @@ package ante import ( "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/gas" errorsmod "cosmossdk.io/errors" - storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/auth/types" txsigning "cosmossdk.io/x/tx/signing" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/ante/unorderedtx" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) // HandlerOptions are the options required for constructing a default SDK AnteHandler. @@ -21,8 +22,9 @@ type HandlerOptions struct { ExtensionOptionChecker ExtensionOptionChecker FeegrantKeeper FeegrantKeeper SignModeHandler *txsigning.HandlerMap - SigGasConsumer func(meter storetypes.GasMeter, sig signing.SignatureV2, params types.Params) error + SigGasConsumer func(meter gas.Meter, sig signing.SignatureV2, params types.Params) error TxFeeChecker TxFeeChecker + UnorderedTxManager *unorderedtx.Manager } // NewAnteHandler returns an AnteHandler that checks and increments sequence @@ -53,5 +55,9 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler, options.SigGasConsumer, options.AccountAbstractionKeeper), } + if options.UnorderedTxManager != nil { + anteDecorators = append(anteDecorators, NewUnorderedTxDecorator(unorderedtx.DefaultMaxTimeoutDuration, options.UnorderedTxManager, options.Environment, DefaultSha256Cost)) + } + return sdk.ChainAnteDecorators(anteDecorators...), nil } diff --git a/x/auth/ante/ante_test.go b/x/auth/ante/ante_test.go index 7377638550a6..638f6623b171 100644 --- a/x/auth/ante/ante_test.go +++ b/x/auth/ante/ante_test.go @@ -10,11 +10,10 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "cosmossdk.io/core/gas" + "cosmossdk.io/core/header" errorsmod "cosmossdk.io/errors" "cosmossdk.io/math" - storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/auth/ante" - authtypes "cosmossdk.io/x/auth/types" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" kmultisig "github.com/cosmos/cosmos-sdk/crypto/keys/multisig" @@ -24,6 +23,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) // Test that simulate transaction accurately estimates gas cost @@ -392,7 +393,7 @@ func TestAnteHandlerAccountNumbersAtBlockHeightZero(t *testing.T) { for _, tc := range testCases { t.Run(fmt.Sprintf("Case %s", tc.desc), func(t *testing.T) { suite := SetupTestSuite(t, false) - suite.ctx = suite.ctx.WithBlockHeight(0) + suite.ctx = suite.ctx.WithBlockHeight(0).WithHeaderInfo(header.Info{Height: 0, ChainID: suite.ctx.ChainID()}) suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder() args := tc.malleate(suite) @@ -1158,22 +1159,6 @@ func generatePubKeysAndSignatures(n int, msg []byte, _ bool) (pubkeys []cryptoty return } -func expectedGasCostByKeys(pubkeys []cryptotypes.PubKey) uint64 { - cost := uint64(0) - for _, pubkey := range pubkeys { - pubkeyType := strings.ToLower(fmt.Sprintf("%T", pubkey)) - switch { - case strings.Contains(pubkeyType, "ed25519"): - cost += authtypes.DefaultParams().SigVerifyCostED25519 - case strings.Contains(pubkeyType, "secp256k1"): - cost += authtypes.DefaultParams().SigVerifyCostSecp256k1 - default: - panic("unexpected key type") - } - } - return cost -} - func TestCountSubkeys(t *testing.T) { genPubKeys := func(n int) []cryptotypes.PubKey { var ret []cryptotypes.PubKey @@ -1266,11 +1251,10 @@ func TestCustomSignatureVerificationGasConsumer(t *testing.T) { BankKeeper: suite.bankKeeper, FeegrantKeeper: suite.feeGrantKeeper, SignModeHandler: suite.clientCtx.TxConfig.SignModeHandler(), - SigGasConsumer: func(meter storetypes.GasMeter, sig signing.SignatureV2, params authtypes.Params) error { + SigGasConsumer: func(meter gas.Meter, sig signing.SignatureV2, params authtypes.Params) error { switch pubkey := sig.PubKey.(type) { case *ed25519.PubKey: - meter.ConsumeGas(params.SigVerifyCostED25519, "ante verify: ed25519") - return nil + return meter.Consume(params.SigVerifyCostED25519, "ante verify: ed25519") default: return errorsmod.Wrapf(sdkerrors.ErrInvalidPubKey, "unrecognized public key type: %T", pubkey) } diff --git a/x/auth/ante/basic.go b/x/auth/ante/basic.go index 642230a6de3e..3f288460e8f7 100644 --- a/x/auth/ante/basic.go +++ b/x/auth/ante/basic.go @@ -4,12 +4,10 @@ import ( "context" "time" - "cosmossdk.io/core/appmodule/v2" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/transaction" errorsmod "cosmossdk.io/errors" storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/auth/migrations/legacytx" - authsigning "cosmossdk.io/x/auth/signing" "github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/crypto/keys/multisig" @@ -17,6 +15,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" + authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" ) // ValidateBasicDecorator will call tx.ValidateBasic and return any non-nil error. @@ -24,10 +24,10 @@ import ( // ValidateBasicDecorator decorator will not get executed on ReCheckTx since it // is not dependent on application state. type ValidateBasicDecorator struct { - env appmodule.Environment + env appmodulev2.Environment } -func NewValidateBasicDecorator(env appmodule.Environment) ValidateBasicDecorator { +func NewValidateBasicDecorator(env appmodulev2.Environment) ValidateBasicDecorator { return ValidateBasicDecorator{ env: env, } @@ -219,7 +219,7 @@ type ( // TxTimeoutHeightDecorator defines an AnteHandler decorator that checks for a // tx height timeout. TxTimeoutHeightDecorator struct { - env appmodule.Environment + env appmodulev2.Environment } // TxWithTimeoutHeight defines the interface a tx must implement in order for @@ -234,7 +234,7 @@ type ( // TxTimeoutHeightDecorator defines an AnteHandler decorator that checks for a // tx height timeout. -func NewTxTimeoutHeightDecorator(env appmodule.Environment) TxTimeoutHeightDecorator { +func NewTxTimeoutHeightDecorator(env appmodulev2.Environment) TxTimeoutHeightDecorator { return TxTimeoutHeightDecorator{ env: env, } diff --git a/x/auth/ante/basic_test.go b/x/auth/ante/basic_test.go index 599fc653913c..389096d3d7c6 100644 --- a/x/auth/ante/basic_test.go +++ b/x/auth/ante/basic_test.go @@ -8,10 +8,9 @@ import ( "github.com/stretchr/testify/require" - "cosmossdk.io/core/appmodule/v2" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/header" storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/auth/ante" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/crypto/types/multisig" @@ -19,6 +18,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/ante" ) func TestValidateBasic(t *testing.T) { @@ -189,7 +189,7 @@ func TestTxHeightTimeoutDecorator(t *testing.T) { suite := SetupTestSuite(t, true) mockHeaderService := &mockHeaderService{} - antehandler := sdk.ChainAnteDecorators(ante.NewTxTimeoutHeightDecorator(appmodule.Environment{HeaderService: mockHeaderService})) + antehandler := sdk.ChainAnteDecorators(ante.NewTxTimeoutHeightDecorator(appmodulev2.Environment{HeaderService: mockHeaderService})) // keys and addresses priv1, _, addr1 := testdata.KeyTestPubAddr() diff --git a/x/auth/ante/expected_keepers.go b/x/auth/ante/expected_keepers.go index 82fc9846a3af..2d83c384535e 100644 --- a/x/auth/ante/expected_keepers.go +++ b/x/auth/ante/expected_keepers.go @@ -5,10 +5,10 @@ import ( "cosmossdk.io/core/address" "cosmossdk.io/core/appmodule" - "cosmossdk.io/x/auth/types" consensustypes "cosmossdk.io/x/consensus/types" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) // AccountKeeper defines the contract needed for AccountKeeper related APIs. diff --git a/x/auth/ante/ext.go b/x/auth/ante/ext.go index b87a2b8b4f74..c6e568514426 100644 --- a/x/auth/ante/ext.go +++ b/x/auth/ante/ext.go @@ -1,6 +1,8 @@ package ante import ( + "context" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -32,7 +34,7 @@ type RejectExtensionOptionsDecorator struct { // options which can optionally be included in protobuf transactions that don't pass the checker. // Users that need extension options should pass a custom checker that returns true for the // needed extension options. -func NewExtensionOptionsDecorator(checker ExtensionOptionChecker) sdk.AnteDecorator { +func NewExtensionOptionsDecorator(checker ExtensionOptionChecker) RejectExtensionOptionsDecorator { if checker == nil { checker = rejectExtensionOption } @@ -42,10 +44,13 @@ func NewExtensionOptionsDecorator(checker ExtensionOptionChecker) sdk.AnteDecora var _ sdk.AnteDecorator = RejectExtensionOptionsDecorator{} +func (r RejectExtensionOptionsDecorator) ValidateTx(ctx context.Context, tx sdk.Tx) error { + return checkExtOpts(tx, r.checker) +} + // AnteHandle implements the AnteDecorator.AnteHandle method func (r RejectExtensionOptionsDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, _ bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { - err = checkExtOpts(tx, r.checker) - if err != nil { + if err := r.ValidateTx(ctx, tx); err != nil { return ctx, err } diff --git a/x/auth/ante/ext_test.go b/x/auth/ante/ext_test.go index 229d62af37ec..9181c7664a78 100644 --- a/x/auth/ante/ext_test.go +++ b/x/auth/ante/ext_test.go @@ -5,12 +5,11 @@ import ( "github.com/stretchr/testify/require" - "cosmossdk.io/x/auth/ante" - "cosmossdk.io/x/auth/tx" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + "github.com/cosmos/cosmos-sdk/x/auth/tx" ) func TestRejectExtensionOptionsDecorator(t *testing.T) { diff --git a/x/auth/ante/fee.go b/x/auth/ante/fee.go index 298fae30a4cc..ddc33508b927 100644 --- a/x/auth/ante/fee.go +++ b/x/auth/ante/fee.go @@ -2,19 +2,21 @@ package ante import ( "bytes" + "context" "fmt" + "cosmossdk.io/core/event" "cosmossdk.io/core/transaction" errorsmod "cosmossdk.io/errors" - "cosmossdk.io/x/auth/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) // TxFeeChecker checks if the provided fee is enough and returns the effective fee and tx priority. // The effective fee should be deducted later, and the priority should be returned in the ABCI response. -type TxFeeChecker func(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, int64, error) +type TxFeeChecker func(ctx context.Context, tx transaction.Tx) (sdk.Coins, int64, error) // DeductFeeDecorator deducts fees from the fee payer. The fee payer is the fee granter (if specified) or first signer of the tx. // If the fee payer does not have the funds to pay for the fees, return an InsufficientFunds error. @@ -25,60 +27,78 @@ type DeductFeeDecorator struct { bankKeeper types.BankKeeper feegrantKeeper FeegrantKeeper txFeeChecker TxFeeChecker + minGasPrices sdk.DecCoins } -func NewDeductFeeDecorator(ak AccountKeeper, bk types.BankKeeper, fk FeegrantKeeper, tfc TxFeeChecker) DeductFeeDecorator { - if tfc == nil { - tfc = checkTxFeeWithValidatorMinGasPrices - } - - return DeductFeeDecorator{ +func NewDeductFeeDecorator(ak AccountKeeper, bk types.BankKeeper, fk FeegrantKeeper, tfc TxFeeChecker) *DeductFeeDecorator { + dfd := &DeductFeeDecorator{ accountKeeper: ak, bankKeeper: bk, feegrantKeeper: fk, txFeeChecker: tfc, + minGasPrices: sdk.NewDecCoins(), + } + + if tfc == nil { + dfd.txFeeChecker = dfd.checkTxFeeWithValidatorMinGasPrices } + + return dfd } -func (dfd DeductFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, _ bool, next sdk.AnteHandler) (sdk.Context, error) { +// SetMinGasPrices sets the minimum-gas-prices value in the state of DeductFeeDecorator +func (dfd *DeductFeeDecorator) SetMinGasPrices(minGasPrices sdk.DecCoins) { + dfd.minGasPrices = minGasPrices +} + +// AnteHandle implements an AnteHandler decorator for the DeductFeeDecorator +func (dfd *DeductFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, _ bool, next sdk.AnteHandler) (sdk.Context, error) { + dfd.minGasPrices = ctx.MinGasPrices() + txPriority, err := dfd.innerValidateTx(ctx, tx) + if err != nil { + return ctx, err + } + + newCtx := ctx.WithPriority(txPriority) + return next(newCtx, tx, false) +} + +func (dfd *DeductFeeDecorator) innerValidateTx(ctx context.Context, tx transaction.Tx) (priority int64, err error) { feeTx, ok := tx.(sdk.FeeTx) if !ok { - return ctx, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must implement the FeeTx interface") + return 0, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must implement the FeeTx interface") } - txService := dfd.accountKeeper.GetEnvironment().TransactionService - execMode := txService.ExecMode(ctx) - if execMode != transaction.ExecModeSimulate && ctx.BlockHeight() > 0 && feeTx.GetGas() == 0 { - return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidGasLimit, "must provide positive gas") - } + execMode := dfd.accountKeeper.GetEnvironment().TransactionService.ExecMode(ctx) + headerInfo := dfd.accountKeeper.GetEnvironment().HeaderService.HeaderInfo(ctx) - var ( - priority int64 - err error - ) + if execMode != transaction.ExecModeSimulate && headerInfo.Height > 0 && feeTx.GetGas() == 0 { + return 0, errorsmod.Wrap(sdkerrors.ErrInvalidGasLimit, "must provide positive gas") + } fee := feeTx.GetFee() if execMode != transaction.ExecModeSimulate { fee, priority, err = dfd.txFeeChecker(ctx, tx) if err != nil { - return ctx, err + return 0, err } } - if err := dfd.checkDeductFee(ctx, tx, fee); err != nil { - return ctx, err - } - newCtx := ctx.WithPriority(priority) + if err := dfd.checkDeductFee(ctx, feeTx, fee); err != nil { + return 0, err + } - return next(newCtx, tx, false) + return priority, nil } -func (dfd DeductFeeDecorator) checkDeductFee(ctx sdk.Context, sdkTx sdk.Tx, fee sdk.Coins) error { - feeTx, ok := sdkTx.(sdk.FeeTx) - if !ok { - return errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must implement the FeeTx interface") - } +// ValidateTx implements an TxValidator for DeductFeeDecorator +// Note: This method is applicable only for transactions that implement the sdk.FeeTx interface. +func (dfd *DeductFeeDecorator) ValidateTx(ctx context.Context, tx transaction.Tx) error { + _, err := dfd.innerValidateTx(ctx, tx) + return err +} +func (dfd *DeductFeeDecorator) checkDeductFee(ctx context.Context, feeTx sdk.FeeTx, fee sdk.Coins) error { addr := dfd.accountKeeper.GetModuleAddress(types.FeeCollectorName) if len(addr) == 0 { return fmt.Errorf("fee collector module account (%s) has not been set", types.FeeCollectorName) @@ -91,12 +111,10 @@ func (dfd DeductFeeDecorator) checkDeductFee(ctx sdk.Context, sdkTx sdk.Tx, fee // if feegranter set, deduct fee from feegranter account. // this works only when feegrant is enabled. if feeGranter != nil { - feeGranterAddr := sdk.AccAddress(feeGranter) - if dfd.feegrantKeeper == nil { return sdkerrors.ErrInvalidRequest.Wrap("fee grants are not enabled") - } else if !bytes.Equal(feeGranterAddr, feePayer) { - err := dfd.feegrantKeeper.UseGrantedFees(ctx, feeGranterAddr, feePayer, fee, sdkTx.GetMsgs()) + } else if !bytes.Equal(feeGranter, feePayer) { + err := dfd.feegrantKeeper.UseGrantedFees(ctx, feeGranter, feePayer, fee, feeTx.GetMsgs()) if err != nil { granterAddr, acErr := dfd.accountKeeper.AddressCodec().BytesToString(feeGranter) if acErr != nil { @@ -109,38 +127,34 @@ func (dfd DeductFeeDecorator) checkDeductFee(ctx sdk.Context, sdkTx sdk.Tx, fee return errorsmod.Wrapf(err, "%s does not allow to pay fees for %s", granterAddr, payerAddr) } } - - deductFeesFrom = feeGranterAddr + deductFeesFrom = feeGranter } // deduct the fees if !fee.IsZero() { - err := DeductFees(dfd.bankKeeper, ctx, deductFeesFrom, fee) - if err != nil { + if err := DeductFees(dfd.bankKeeper, ctx, deductFeesFrom, fee); err != nil { return err } } - events := sdk.Events{ - sdk.NewEvent( - sdk.EventTypeTx, - sdk.NewAttribute(sdk.AttributeKeyFee, fee.String()), - sdk.NewAttribute(sdk.AttributeKeyFeePayer, sdk.AccAddress(deductFeesFrom).String()), - ), + if err := dfd.accountKeeper.GetEnvironment().EventService.EventManager(ctx).EmitKV( + sdk.EventTypeTx, + event.NewAttribute(sdk.AttributeKeyFee, fee.String()), + event.NewAttribute(sdk.AttributeKeyFeePayer, sdk.AccAddress(deductFeesFrom).String()), + ); err != nil { + return err } - ctx.EventManager().EmitEvents(events) return nil } // DeductFees deducts fees from the given account. -func DeductFees(bankKeeper types.BankKeeper, ctx sdk.Context, acc []byte, fees sdk.Coins) error { +func DeductFees(bankKeeper types.BankKeeper, ctx context.Context, acc []byte, fees sdk.Coins) error { if !fees.IsValid() { return errorsmod.Wrapf(sdkerrors.ErrInsufficientFee, "invalid fee amount: %s", fees) } - err := bankKeeper.SendCoinsFromAccountToModule(ctx, sdk.AccAddress(acc), types.FeeCollectorName, fees) - if err != nil { + if err := bankKeeper.SendCoinsFromAccountToModule(ctx, acc, types.FeeCollectorName, fees); err != nil { return fmt.Errorf("failed to deduct fees: %w", err) } diff --git a/x/auth/ante/fee_test.go b/x/auth/ante/fee_test.go index 0c9fa299a5e4..540f1d211f72 100644 --- a/x/auth/ante/fee_test.go +++ b/x/auth/ante/fee_test.go @@ -7,14 +7,14 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/math" - "cosmossdk.io/x/auth/ante" - authtypes "cosmossdk.io/x/auth/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestDeductFeeDecorator_ZeroGas(t *testing.T) { @@ -41,6 +41,11 @@ func TestDeductFeeDecorator_ZeroGas(t *testing.T) { // Set IsCheckTx to true s.ctx = s.ctx.WithIsCheckTx(true) + // Set current block height in headerInfo + headerInfo := s.ctx.HeaderInfo() + headerInfo.Height = s.ctx.BlockHeight() + s.ctx = s.ctx.WithHeaderInfo(headerInfo) + _, err = antehandler(s.ctx, tx, false) require.Error(t, err) diff --git a/x/auth/ante/feegrant_test.go b/x/auth/ante/feegrant_test.go index 80f858b042f6..234b7eadd7f8 100644 --- a/x/auth/ante/feegrant_test.go +++ b/x/auth/ante/feegrant_test.go @@ -10,12 +10,6 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" - "cosmossdk.io/x/auth/ante" - authsign "cosmossdk.io/x/auth/signing" - "cosmossdk.io/x/auth/testutil" - "cosmossdk.io/x/auth/tx" - authtypes "cosmossdk.io/x/auth/types" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" @@ -24,6 +18,11 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + authsign "github.com/cosmos/cosmos-sdk/x/auth/signing" + "github.com/cosmos/cosmos-sdk/x/auth/testutil" + "github.com/cosmos/cosmos-sdk/x/auth/tx" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestDeductFeesNoDelegation(t *testing.T) { diff --git a/x/auth/ante/setup.go b/x/auth/ante/setup.go index f048bb139324..e81a7cba5051 100644 --- a/x/auth/ante/setup.go +++ b/x/auth/ante/setup.go @@ -46,11 +46,16 @@ func (sud SetUpContextDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, _ bool, newCtx = SetGasMeter(ctx, gasTx.GetGas()) // TODO: possibly cache the result of this query for other antehandlers to use - var res consensusv1.QueryParamsResponse - if err := sud.env.QueryRouterService.InvokeTyped(ctx, &consensusv1.QueryParamsRequest{}, &res); err != nil { + resp, err := sud.env.QueryRouterService.Invoke(ctx, &consensusv1.QueryParamsRequest{}) + if err != nil { return newCtx, err } + res, ok := resp.(*consensusv1.QueryParamsResponse) + if !ok { + return newCtx, fmt.Errorf("unexpected response type: %T", resp) + } + if res.Params.Block != nil { // If there exists a maximum block gas limit, we must ensure that the tx // does not exceed it. diff --git a/x/auth/ante/setup_test.go b/x/auth/ante/setup_test.go index 1e10cafa9ed0..e04bc130611c 100644 --- a/x/auth/ante/setup_test.go +++ b/x/auth/ante/setup_test.go @@ -6,13 +6,13 @@ import ( "github.com/stretchr/testify/require" storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/auth/ante" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/ante" ) func TestSetupDecorator_BlockMaxGas(t *testing.T) { diff --git a/x/auth/ante/sigverify.go b/x/auth/ante/sigverify.go index a435ba03bdfa..f5e5a8626738 100644 --- a/x/auth/ante/sigverify.go +++ b/x/auth/ante/sigverify.go @@ -10,11 +10,10 @@ import ( secp256k1dcrd "github.com/decred/dcrd/dcrec/secp256k1/v4" "google.golang.org/protobuf/types/known/anypb" + "cosmossdk.io/core/event" + "cosmossdk.io/core/gas" "cosmossdk.io/core/transaction" errorsmod "cosmossdk.io/errors" - storetypes "cosmossdk.io/store/types" - authsigning "cosmossdk.io/x/auth/signing" - "cosmossdk.io/x/auth/types" txsigning "cosmossdk.io/x/tx/signing" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -28,6 +27,8 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/tx" "github.com/cosmos/cosmos-sdk/types/tx/signing" + authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) var ( @@ -47,7 +48,7 @@ func init() { // SignatureVerificationGasConsumer is the type of function that is used to both // consume gas when verifying signatures and also to accept or reject different types of pubkeys // This is where apps can define their own PubKey -type SignatureVerificationGasConsumer = func(meter storetypes.GasMeter, sig signing.SignatureV2, params types.Params) error +type SignatureVerificationGasConsumer = func(meter gas.Meter, sig signing.SignatureV2, params types.Params) error type AccountAbstractionKeeper interface { IsAbstractedAccount(ctx context.Context, addr []byte) (bool, error) @@ -150,31 +151,38 @@ func verifyIsOnCurve(pubKey cryptotypes.PubKey) (err error) { } func (svd SigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, _ bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { + if err := svd.ValidateTx(ctx, tx); err != nil { + return ctx, err + } + return next(ctx, tx, false) +} + +func (svd SigVerificationDecorator) ValidateTx(ctx context.Context, tx transaction.Tx) error { sigTx, ok := tx.(authsigning.Tx) if !ok { - return ctx, errorsmod.Wrap(sdkerrors.ErrTxDecode, "invalid transaction type") + return errorsmod.Wrap(sdkerrors.ErrTxDecode, "invalid transaction type") } // stdSigs contains the sequence number, account number, and signatures. // When simulating, this would just be a 0-length slice. signatures, err := sigTx.GetSignaturesV2() if err != nil { - return ctx, err + return err } signers, err := sigTx.GetSigners() if err != nil { - return ctx, err + return err } // check that signer length and signature length are the same if len(signatures) != len(signers) { - return ctx, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "invalid number of signer; expected: %d, got %d", len(signers), len(signatures)) + return errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "invalid number of signer; expected: %d, got %d", len(signers), len(signatures)) } pubKeys, err := sigTx.GetPubKeys() if err != nil { - return ctx, err + return err } // NOTE: the tx_wrapper implementation returns nil, in case the pubkey is not populated. @@ -182,44 +190,46 @@ func (svd SigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, _ boo // itself. If this does not work, it's a failure in the implementation of the interface. // we're erroring, but most likely we should be panicking. if len(pubKeys) != len(signers) { - return ctx, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "invalid number of pubkeys; expected %d, got %d", len(signers), len(pubKeys)) + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "invalid number of pubkeys; expected %d, got %d", len(signers), len(pubKeys)) } for i := range signers { err = svd.authenticate(ctx, sigTx, signers[i], signatures[i], pubKeys[i], i) if err != nil { - return ctx, err + return err } } - var events sdk.Events + eventMgr := svd.ak.GetEnvironment().EventService.EventManager(ctx) + events := [][]event.Attribute{} for i, sig := range signatures { signerStr, err := svd.ak.AddressCodec().BytesToString(signers[i]) if err != nil { - return ctx, err + return err } - events = append(events, sdk.NewEvent(sdk.EventTypeTx, - sdk.NewAttribute(sdk.AttributeKeyAccountSequence, fmt.Sprintf("%s/%d", signerStr, sig.Sequence)), - )) + + events = append(events, []event.Attribute{event.NewAttribute(sdk.AttributeKeyAccountSequence, fmt.Sprintf("%s/%d", signerStr, sig.Sequence))}) sigBzs, err := signatureDataToBz(sig.Data) if err != nil { - return ctx, err + return err } for _, sigBz := range sigBzs { - events = append(events, sdk.NewEvent(sdk.EventTypeTx, - sdk.NewAttribute(sdk.AttributeKeySignature, base64.StdEncoding.EncodeToString(sigBz)), - )) + events = append(events, []event.Attribute{event.NewAttribute(sdk.AttributeKeySignature, base64.StdEncoding.EncodeToString(sigBz))}) } } - ctx.EventManager().EmitEvents(events) + for _, v := range events { + if err := eventMgr.EmitKV(sdk.EventTypeTx, v...); err != nil { + return err + } + } - return next(ctx, tx, false) + return nil } // authenticate the authentication of the TX for a specific tx signer. -func (svd SigVerificationDecorator) authenticate(ctx sdk.Context, tx authsigning.Tx, signer []byte, sig signing.SignatureV2, txPubKey cryptotypes.PubKey, signerIndex int) error { +func (svd SigVerificationDecorator) authenticate(ctx context.Context, tx authsigning.Tx, signer []byte, sig signing.SignatureV2, txPubKey cryptotypes.PubKey, signerIndex int) error { // first we check if it's an AA if svd.aaKeeper != nil { isAa, err := svd.aaKeeper.IsAbstractedAccount(ctx, signer) @@ -276,7 +286,7 @@ func (svd SigVerificationDecorator) authenticate(ctx sdk.Context, tx authsigning // consumeSignatureGas will consume gas according to the pub-key being verified. func (svd SigVerificationDecorator) consumeSignatureGas( - ctx sdk.Context, + ctx context.Context, pubKey cryptotypes.PubKey, signature signing.SignatureV2, ) error { @@ -291,15 +301,11 @@ func (svd SigVerificationDecorator) consumeSignatureGas( Sequence: signature.Sequence, } - err := svd.sigGasConsumer(ctx.GasMeter(), signature, svd.ak.GetParams(ctx)) - if err != nil { - return err - } - return nil + return svd.sigGasConsumer(svd.ak.GetEnvironment().GasService.GasMeter(ctx), signature, svd.ak.GetParams(ctx)) } // verifySig will verify the signature of the provided signer account. -func (svd SigVerificationDecorator) verifySig(ctx sdk.Context, tx sdk.Tx, acc sdk.AccountI, sig signing.SignatureV2, newlyCreated bool) error { +func (svd SigVerificationDecorator) verifySig(ctx context.Context, tx sdk.Tx, acc sdk.AccountI, sig signing.SignatureV2, newlyCreated bool) error { if sig.Sequence != acc.GetSequence() { return errorsmod.Wrapf( sdkerrors.ErrWrongSequence, @@ -310,7 +316,9 @@ func (svd SigVerificationDecorator) verifySig(ctx sdk.Context, tx sdk.Tx, acc sd // we're in simulation mode, or in ReCheckTx, or context is not // on sig verify tx, then we do not need to verify the signatures // in the tx. - if svd.ak.GetEnvironment().TransactionService.ExecMode(ctx) == transaction.ExecModeSimulate || ctx.IsReCheckTx() || !ctx.IsSigverifyTx() { + if svd.ak.GetEnvironment().TransactionService.ExecMode(ctx) == transaction.ExecModeSimulate || + isRecheckTx(ctx, svd.ak.GetEnvironment().TransactionService) || + !isSigverifyTx(ctx) { return nil } @@ -321,8 +329,9 @@ func (svd SigVerificationDecorator) verifySig(ctx sdk.Context, tx sdk.Tx, acc sd } // retrieve signer data - genesis := ctx.BlockHeight() == 0 - chainID := ctx.ChainID() + hinfo := svd.ak.GetEnvironment().HeaderService.HeaderInfo(ctx) + genesis := hinfo.Height == 0 + chainID := hinfo.ChainID var accNum uint64 // if we are not in genesis use the account number from the account if !genesis { @@ -372,9 +381,9 @@ func (svd SigVerificationDecorator) verifySig(ctx sdk.Context, tx sdk.Tx, acc sd // setPubKey will attempt to set the pubkey for the account given the list of available public keys. // This must be called only in case the account has not a pubkey set yet. -func (svd SigVerificationDecorator) setPubKey(ctx sdk.Context, acc sdk.AccountI, txPubKey cryptotypes.PubKey) error { +func (svd SigVerificationDecorator) setPubKey(ctx context.Context, acc sdk.AccountI, txPubKey cryptotypes.PubKey) error { // if we're not in sig verify then we can just skip. - if !ctx.IsSigverifyTx() { + if !isSigverifyTx(ctx) { return nil } @@ -425,7 +434,7 @@ func (svd SigVerificationDecorator) increaseSequence(tx authsigning.Tx, acc sdk. } // authenticateAbstractedAccount computes an AA authentication instruction and invokes the auth flow on the AA. -func (svd SigVerificationDecorator) authenticateAbstractedAccount(ctx sdk.Context, authTx authsigning.Tx, signer []byte, index int) error { +func (svd SigVerificationDecorator) authenticateAbstractedAccount(ctx context.Context, authTx authsigning.Tx, signer []byte, index int) error { // the bundler is the AA itself. selfBundler, err := svd.ak.AddressCodec().BytesToString(signer) if err != nil { @@ -500,21 +509,21 @@ func (vscd ValidateSigCountDecorator) ValidateTx(ctx context.Context, tx sdk.Tx) // DefaultSigVerificationGasConsumer is the default implementation of SignatureVerificationGasConsumer. It consumes gas // for signature verification based upon the public key type. The cost is fetched from the given params and is matched // by the concrete type. -func DefaultSigVerificationGasConsumer(meter storetypes.GasMeter, sig signing.SignatureV2, params types.Params) error { +func DefaultSigVerificationGasConsumer(meter gas.Meter, sig signing.SignatureV2, params types.Params) error { pubkey := sig.PubKey switch pubkey := pubkey.(type) { case *ed25519.PubKey: - meter.ConsumeGas(params.SigVerifyCostED25519, "ante verify: ed25519") + if err := meter.Consume(params.SigVerifyCostED25519, "ante verify: ed25519"); err != nil { + return err + } return errorsmod.Wrap(sdkerrors.ErrInvalidPubKey, "ED25519 public keys are unsupported") case *secp256k1.PubKey: - meter.ConsumeGas(params.SigVerifyCostSecp256k1, "ante verify: secp256k1") - return nil + return meter.Consume(params.SigVerifyCostSecp256k1, "ante verify: secp256k1") case *secp256r1.PubKey: - meter.ConsumeGas(params.SigVerifyCostSecp256r1(), "ante verify: secp256r1") - return nil + return meter.Consume(params.SigVerifyCostSecp256r1(), "ante verify: secp256r1") case multisig.PubKey: multisignature, ok := sig.Data.(*signing.MultiSignatureData) @@ -536,7 +545,7 @@ func DefaultSigVerificationGasConsumer(meter storetypes.GasMeter, sig signing.Si // ConsumeMultisignatureVerificationGas consumes gas from a GasMeter for verifying a multisig pubKey signature. func ConsumeMultisignatureVerificationGas( - meter storetypes.GasMeter, sig *signing.MultiSignatureData, pubKey multisig.PubKey, + meter gas.Meter, sig *signing.MultiSignatureData, pubKey multisig.PubKey, params types.Params, accSeq uint64, ) error { // if BitArray is nil, it means tx has been built for simulation. @@ -571,7 +580,7 @@ func ConsumeMultisignatureVerificationGas( // multisignatureSimulationVerificationGas consume gas for verifying a simulation multisig pubKey signature. As it's // a simulation tx the number of signatures its equal to the multisig threshold. func multisignatureSimulationVerificationGas( - meter storetypes.GasMeter, sig *signing.MultiSignatureData, pubKey multisig.PubKey, + meter gas.Meter, sig *signing.MultiSignatureData, pubKey multisig.PubKey, params types.Params, accSeq uint64, ) error { for i := 0; i < len(sig.Signatures); i++ { @@ -592,7 +601,7 @@ func multisignatureSimulationVerificationGas( // GetSignerAcc returns an account for a given address that is expected to sign // a transaction. -func GetSignerAcc(ctx sdk.Context, ak AccountKeeper, addr sdk.AccAddress) sdk.AccountI { +func GetSignerAcc(ctx context.Context, ak AccountKeeper, addr sdk.AccAddress) sdk.AccountI { return ak.GetAccount(ctx, addr) } @@ -659,3 +668,19 @@ func signatureDataToBz(data signing.SignatureData) ([][]byte, error) { return nil, sdkerrors.ErrInvalidType.Wrapf("unexpected signature data type %T", data) } } + +// isSigverifyTx will always return true, unless the context is a sdk.Context, in which case we will return the +// value of IsSigverifyTx. +func isSigverifyTx(ctx context.Context) bool { + if sdkCtx, ok := sdk.TryUnwrapSDKContext(ctx); ok { + return sdkCtx.IsSigverifyTx() + } + return true +} + +func isRecheckTx(ctx context.Context, txSvc transaction.Service) bool { + if sdkCtx, ok := sdk.TryUnwrapSDKContext(ctx); ok { + return sdkCtx.IsReCheckTx() + } + return txSvc.ExecMode(ctx) == transaction.ExecModeReCheck +} diff --git a/x/auth/ante/sigverify_internal_test.go b/x/auth/ante/sigverify_internal_test.go index 40fbe6746fc7..e1937e5e7ede 100644 --- a/x/auth/ante/sigverify_internal_test.go +++ b/x/auth/ante/sigverify_internal_test.go @@ -8,12 +8,12 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/core/transaction" - "cosmossdk.io/x/auth/ante" - authcodec "cosmossdk.io/x/auth/codec" - authtypes "cosmossdk.io/x/auth/types" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) type mockAccount struct { diff --git a/x/auth/ante/sigverify_test.go b/x/auth/ante/sigverify_test.go index ab21482b48c8..00cbb6db6051 100644 --- a/x/auth/ante/sigverify_test.go +++ b/x/auth/ante/sigverify_test.go @@ -8,13 +8,10 @@ import ( "github.com/stretchr/testify/require" bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" + "cosmossdk.io/core/gas" + "cosmossdk.io/core/header" + gastestutil "cosmossdk.io/core/testing/gas" storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/auth/ante" - "cosmossdk.io/x/auth/migrations/legacytx" - authsign "cosmossdk.io/x/auth/signing" - authtx "cosmossdk.io/x/auth/tx" - txmodule "cosmossdk.io/x/auth/tx/config" - "cosmossdk.io/x/auth/types" txsigning "cosmossdk.io/x/tx/signing" "github.com/cosmos/cosmos-sdk/codec" @@ -27,6 +24,12 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" + authsign "github.com/cosmos/cosmos-sdk/x/auth/signing" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" + txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestConsumeSignatureVerificationGas(t *testing.T) { @@ -39,7 +42,6 @@ func TestConsumeSignatureVerificationGas(t *testing.T) { pkSet1, sigSet1 := generatePubKeysAndSignatures(5, msg, false) multisigKey1 := kmultisig.NewLegacyAminoPubKey(2, pkSet1) multisignature1 := multisig.NewMultisig(len(pkSet1)) - expectedCost1 := expectedGasCostByKeys(pkSet1) for i := 0; i < len(pkSet1); i++ { stdSig := legacytx.StdSignature{PubKey: pkSet1[i], Signature: sigSet1[i]} //nolint:staticcheck // SA1019: legacytx.StdSignature is deprecated sigV2, err := legacytx.StdSignatureToSignatureV2(suite.clientCtx.LegacyAmino, stdSig) @@ -48,7 +50,6 @@ func TestConsumeSignatureVerificationGas(t *testing.T) { require.NoError(t, err) } - simulationExpectedCost := expectedGasCostByKeys(pkSet1[:multisigKey1.Threshold]) simulationMultiSignatureData := make([]signing.SignatureData, 0, multisigKey1.Threshold) for i := uint32(0); i < multisigKey1.Threshold; i++ { simulationMultiSignatureData = append(simulationMultiSignatureData, &signing.SingleSignatureData{}) @@ -58,38 +59,77 @@ func TestConsumeSignatureVerificationGas(t *testing.T) { } type args struct { - meter storetypes.GasMeter - sig signing.SignatureData - pubkey cryptotypes.PubKey - params types.Params + sig signing.SignatureData + pubkey cryptotypes.PubKey + params types.Params + malleate func(*gastestutil.MockMeter) } tests := []struct { - name string - args args - gasConsumed uint64 - shouldErr bool + name string + args args + shouldErr bool }{ - {"PubKeyEd25519", args{storetypes.NewInfiniteGasMeter(), nil, ed25519.GenPrivKey().PubKey(), params}, p.SigVerifyCostED25519, true}, - {"PubKeySecp256k1", args{storetypes.NewInfiniteGasMeter(), nil, secp256k1.GenPrivKey().PubKey(), params}, p.SigVerifyCostSecp256k1, false}, - {"PubKeySecp256r1", args{storetypes.NewInfiniteGasMeter(), nil, skR1.PubKey(), params}, p.SigVerifyCostSecp256r1(), false}, - {"Multisig", args{storetypes.NewInfiniteGasMeter(), multisignature1, multisigKey1, params}, expectedCost1, false}, - {"Multisig simulation", args{storetypes.NewInfiniteGasMeter(), multisigSimulationSignature, multisigKey1, params}, simulationExpectedCost, false}, - {"unknown key", args{storetypes.NewInfiniteGasMeter(), nil, nil, params}, 0, true}, + { + "PubKeyEd25519", + args{nil, ed25519.GenPrivKey().PubKey(), params, func(mm *gastestutil.MockMeter) { + mm.EXPECT().Consume(p.SigVerifyCostED25519, "ante verify: ed25519").Times(1) + }}, + true, + }, + { + "PubKeySecp256k1", + args{nil, secp256k1.GenPrivKey().PubKey(), params, func(mm *gastestutil.MockMeter) { + mm.EXPECT().Consume(p.SigVerifyCostSecp256k1, "ante verify: secp256k1").Times(1) + }}, + false, + }, + { + "PubKeySecp256r1", + args{nil, skR1.PubKey(), params, func(mm *gastestutil.MockMeter) { + mm.EXPECT().Consume(p.SigVerifyCostSecp256r1(), "ante verify: secp256r1").Times(1) + }}, + false, + }, + { + "Multisig", + args{multisignature1, multisigKey1, params, func(mm *gastestutil.MockMeter) { + // 5 signatures + mm.EXPECT().Consume(p.SigVerifyCostSecp256k1, "ante verify: secp256k1").Times(5) + }}, + false, + }, + { + "Multisig simulation", + args{multisigSimulationSignature, multisigKey1, params, func(mm *gastestutil.MockMeter) { + mm.EXPECT().Consume(p.SigVerifyCostSecp256k1, "ante verify: secp256k1").Times(int(multisigKey1.Threshold)) + }}, + false, + }, + { + "unknown key", + args{nil, nil, params, func(mm *gastestutil.MockMeter) {}}, + true, + }, } for _, tt := range tests { - sigV2 := signing.SignatureV2{ - PubKey: tt.args.pubkey, - Data: tt.args.sig, - Sequence: 0, // Arbitrary account sequence - } - err := ante.DefaultSigVerificationGasConsumer(tt.args.meter, sigV2, tt.args.params) + t.Run(tt.name, func(t *testing.T) { + sigV2 := signing.SignatureV2{ + PubKey: tt.args.pubkey, + Data: tt.args.sig, + Sequence: 0, // Arbitrary account sequence + } - if tt.shouldErr { - require.NotNil(t, err) - } else { - require.Nil(t, err) - require.Equal(t, tt.gasConsumed, tt.args.meter.GasConsumed(), fmt.Sprintf("%d != %d", tt.gasConsumed, tt.args.meter.GasConsumed())) - } + ctrl := gomock.NewController(t) + mockMeter := gastestutil.NewMockMeter(ctrl) + tt.args.malleate(mockMeter) + err := ante.DefaultSigVerificationGasConsumer(mockMeter, sigV2, tt.args.params) + + if tt.shouldErr { + require.Error(t, err) + } else { + require.NoError(t, err) + } + }) } } @@ -118,7 +158,7 @@ func TestSigVerification(t *testing.T) { suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder() // make block height non-zero to ensure account numbers part of signBytes - suite.ctx = suite.ctx.WithBlockHeight(1) + suite.ctx = suite.ctx.WithBlockHeight(1).WithHeaderInfo(header.Info{Height: 1, ChainID: suite.ctx.ChainID()}) // keys and addresses priv1, _, addr1 := testdata.KeyTestPubAddr() @@ -154,7 +194,7 @@ func TestSigVerification(t *testing.T) { txConfigOpts, ) require.NoError(t, err) - noOpGasConsume := func(_ storetypes.GasMeter, _ signing.SignatureV2, _ types.Params) error { return nil } + noOpGasConsume := func(_ gas.Meter, _ signing.SignatureV2, _ types.Params) error { return nil } svd := ante.NewSigVerificationDecorator(suite.accountKeeper, anteTxConfig.SignModeHandler(), noOpGasConsume, nil) antehandler := sdk.ChainAnteDecorators(svd) defaultSignMode, err := authsign.APISignModeToInternal(anteTxConfig.SignModeHandler().DefaultMode()) @@ -188,6 +228,12 @@ func TestSigVerification(t *testing.T) { t.Run(fmt.Sprintf("%s with %s", tc.name, signMode), func(t *testing.T) { ctx, _ := suite.ctx.CacheContext() ctx = ctx.WithIsReCheckTx(tc.recheck).WithIsSigverifyTx(tc.sigverify) + if tc.recheck { + ctx = ctx.WithExecMode(sdk.ExecModeReCheck) + } else { + ctx = ctx.WithExecMode(sdk.ExecModeCheck) + } + suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder() // Create new txBuilder for each test require.NoError(t, suite.txBuilder.SetMsgs(msgs...)) @@ -246,23 +292,23 @@ func TestSigIntegration(t *testing.T) { params := types.DefaultParams() initialSigCost := params.SigVerifyCostSecp256k1 - initialCost, err := runSigDecorators(t, params, false, privs...) + initialCost, err := runSigDecorators(t, params, privs...) require.Nil(t, err) params.SigVerifyCostSecp256k1 *= 2 - doubleCost, err := runSigDecorators(t, params, false, privs...) + doubleCost, err := runSigDecorators(t, params, privs...) require.Nil(t, err) require.Equal(t, initialSigCost*uint64(len(privs)), doubleCost-initialCost) } -func runSigDecorators(t *testing.T, params types.Params, _ bool, privs ...cryptotypes.PrivKey) (storetypes.Gas, error) { +func runSigDecorators(t *testing.T, params types.Params, privs ...cryptotypes.PrivKey) (storetypes.Gas, error) { t.Helper() suite := SetupTestSuite(t, true) suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder() // Make block-height non-zero to include accNum in SignBytes - suite.ctx = suite.ctx.WithBlockHeight(1) + suite.ctx = suite.ctx.WithBlockHeight(1).WithHeaderInfo(header.Info{Height: 1}) err := suite.accountKeeper.Params.Set(suite.ctx, params) require.NoError(t, err) diff --git a/x/auth/ante/testutil/expected_keepers_mocks.go b/x/auth/ante/testutil/expected_keepers_mocks.go index e848a52342cf..cb2bac6de337 100644 --- a/x/auth/ante/testutil/expected_keepers_mocks.go +++ b/x/auth/ante/testutil/expected_keepers_mocks.go @@ -10,9 +10,9 @@ import ( address "cosmossdk.io/core/address" appmodule "cosmossdk.io/core/appmodule" - types "cosmossdk.io/x/auth/types" - types0 "cosmossdk.io/x/consensus/types" - types1 "github.com/cosmos/cosmos-sdk/types" + types "cosmossdk.io/x/consensus/types" + types0 "github.com/cosmos/cosmos-sdk/types" + types1 "github.com/cosmos/cosmos-sdk/x/auth/types" gomock "github.com/golang/mock/gomock" ) @@ -54,10 +54,10 @@ func (mr *MockAccountKeeperMockRecorder) AddressCodec() *gomock.Call { } // GetAccount mocks base method. -func (m *MockAccountKeeper) GetAccount(ctx context.Context, addr types1.AccAddress) types1.AccountI { +func (m *MockAccountKeeper) GetAccount(ctx context.Context, addr types0.AccAddress) types0.AccountI { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetAccount", ctx, addr) - ret0, _ := ret[0].(types1.AccountI) + ret0, _ := ret[0].(types0.AccountI) return ret0 } @@ -82,10 +82,10 @@ func (mr *MockAccountKeeperMockRecorder) GetEnvironment() *gomock.Call { } // GetModuleAddress mocks base method. -func (m *MockAccountKeeper) GetModuleAddress(moduleName string) types1.AccAddress { +func (m *MockAccountKeeper) GetModuleAddress(moduleName string) types0.AccAddress { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetModuleAddress", moduleName) - ret0, _ := ret[0].(types1.AccAddress) + ret0, _ := ret[0].(types0.AccAddress) return ret0 } @@ -96,10 +96,10 @@ func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(moduleName interface{} } // GetParams mocks base method. -func (m *MockAccountKeeper) GetParams(ctx context.Context) types.Params { +func (m *MockAccountKeeper) GetParams(ctx context.Context) types1.Params { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetParams", ctx) - ret0, _ := ret[0].(types.Params) + ret0, _ := ret[0].(types1.Params) return ret0 } @@ -110,10 +110,10 @@ func (mr *MockAccountKeeperMockRecorder) GetParams(ctx interface{}) *gomock.Call } // NewAccountWithAddress mocks base method. -func (m *MockAccountKeeper) NewAccountWithAddress(ctx context.Context, addr types1.AccAddress) types1.AccountI { +func (m *MockAccountKeeper) NewAccountWithAddress(ctx context.Context, addr types0.AccAddress) types0.AccountI { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "NewAccountWithAddress", ctx, addr) - ret0, _ := ret[0].(types1.AccountI) + ret0, _ := ret[0].(types0.AccountI) return ret0 } @@ -124,7 +124,7 @@ func (mr *MockAccountKeeperMockRecorder) NewAccountWithAddress(ctx, addr interfa } // SetAccount mocks base method. -func (m *MockAccountKeeper) SetAccount(ctx context.Context, acc types1.AccountI) { +func (m *MockAccountKeeper) SetAccount(ctx context.Context, acc types0.AccountI) { m.ctrl.T.Helper() m.ctrl.Call(m, "SetAccount", ctx, acc) } @@ -159,7 +159,7 @@ func (m *MockFeegrantKeeper) EXPECT() *MockFeegrantKeeperMockRecorder { } // UseGrantedFees mocks base method. -func (m *MockFeegrantKeeper) UseGrantedFees(ctx context.Context, granter, grantee types1.AccAddress, fee types1.Coins, msgs []types1.Msg) error { +func (m *MockFeegrantKeeper) UseGrantedFees(ctx context.Context, granter, grantee types0.AccAddress, fee types0.Coins, msgs []types0.Msg) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UseGrantedFees", ctx, granter, grantee, fee, msgs) ret0, _ := ret[0].(error) @@ -196,10 +196,10 @@ func (m *MockConsensusKeeper) EXPECT() *MockConsensusKeeperMockRecorder { } // Params mocks base method. -func (m *MockConsensusKeeper) Params(arg0 context.Context, arg1 *types0.QueryParamsRequest) (*types0.QueryParamsResponse, error) { +func (m *MockConsensusKeeper) Params(arg0 context.Context, arg1 *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Params", arg0, arg1) - ret0, _ := ret[0].(*types0.QueryParamsResponse) + ret0, _ := ret[0].(*types.QueryParamsResponse) ret1, _ := ret[1].(error) return ret0, ret1 } diff --git a/x/auth/ante/testutil_test.go b/x/auth/ante/testutil_test.go index f9ea3b397d70..f72c94f0f831 100644 --- a/x/auth/ante/testutil_test.go +++ b/x/auth/ante/testutil_test.go @@ -13,17 +13,9 @@ import ( _ "cosmossdk.io/api/cosmos/bank/v1beta1" _ "cosmossdk.io/api/cosmos/crypto/secp256k1" "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/header" coretesting "cosmossdk.io/core/testing" storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/auth" - "cosmossdk.io/x/auth/ante" - antetestutil "cosmossdk.io/x/auth/ante/testutil" - authcodec "cosmossdk.io/x/auth/codec" - "cosmossdk.io/x/auth/keeper" - xauthsigning "cosmossdk.io/x/auth/signing" - authtestutil "cosmossdk.io/x/auth/testutil" - txtestutil "cosmossdk.io/x/auth/tx/testutil" - "cosmossdk.io/x/auth/types" consensustypes "cosmossdk.io/x/consensus/types" "github.com/cosmos/cosmos-sdk/baseapp" @@ -40,6 +32,15 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + antetestutil "github.com/cosmos/cosmos-sdk/x/auth/ante/testutil" + authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" + "github.com/cosmos/cosmos-sdk/x/auth/keeper" + xauthsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" + authtestutil "github.com/cosmos/cosmos-sdk/x/auth/testutil" + txtestutil "github.com/cosmos/cosmos-sdk/x/auth/tx/testutil" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) // TestAccount represents an account used in the tests in x/auth/ante. @@ -77,7 +78,7 @@ func SetupTestSuite(t *testing.T, isCheckTx bool) *AnteTestSuite { key := storetypes.NewKVStoreKey(types.StoreKey) testCtx := testutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test")) - suite.ctx = testCtx.Ctx.WithIsCheckTx(isCheckTx).WithBlockHeight(1) + suite.ctx = testCtx.Ctx.WithIsCheckTx(isCheckTx).WithBlockHeight(1).WithHeaderInfo(header.Info{Height: 1, ChainID: testCtx.Ctx.ChainID()}) suite.encCfg = moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, auth.AppModule{}) accNum := uint64(0) diff --git a/x/auth/ante/unordered.go b/x/auth/ante/unordered.go index b97774ef6118..f494c78c49e0 100644 --- a/x/auth/ante/unordered.go +++ b/x/auth/ante/unordered.go @@ -2,20 +2,22 @@ package ante import ( "bytes" + "context" "crypto/sha256" "encoding/binary" + "fmt" "sync" "time" "github.com/cosmos/gogoproto/proto" - "cosmossdk.io/core/appmodule/v2" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/transaction" errorsmod "cosmossdk.io/errors" - "cosmossdk.io/x/auth/ante/unorderedtx" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/ante/unorderedtx" ) // bufPool is a pool of bytes.Buffer objects to reduce memory allocations. @@ -45,14 +47,14 @@ type UnorderedTxDecorator struct { // maxUnOrderedTTL defines the maximum TTL a transaction can define. maxTimeoutDuration time.Duration txManager *unorderedtx.Manager - env appmodule.Environment + env appmodulev2.Environment sha256Cost uint64 } func NewUnorderedTxDecorator( maxDuration time.Duration, m *unorderedtx.Manager, - env appmodule.Environment, + env appmodulev2.Environment, gasCost uint64, ) *UnorderedTxDecorator { return &UnorderedTxDecorator{ @@ -69,29 +71,41 @@ func (d *UnorderedTxDecorator) AnteHandle( _ bool, next sdk.AnteHandler, ) (sdk.Context, error) { + if err := d.ValidateTx(ctx, tx); err != nil { + return ctx, err + } + return next(ctx, tx, false) +} + +func (d *UnorderedTxDecorator) ValidateTx(ctx context.Context, tx transaction.Tx) error { + sdkTx, ok := tx.(sdk.Tx) + if !ok { + return fmt.Errorf("invalid tx type %T, expected sdk.Tx", tx) + } + unorderedTx, ok := tx.(sdk.TxWithUnordered) if !ok || !unorderedTx.GetUnordered() { // If the transaction does not implement unordered capabilities or has the // unordered value as false, we bypass. - return next(ctx, tx, false) + return nil } headerInfo := d.env.HeaderService.HeaderInfo(ctx) timeoutTimestamp := unorderedTx.GetTimeoutTimeStamp() if timeoutTimestamp.IsZero() || timeoutTimestamp.Unix() == 0 { - return ctx, errorsmod.Wrap( + return errorsmod.Wrap( sdkerrors.ErrInvalidRequest, "unordered transaction must have timeout_timestamp set", ) } if timeoutTimestamp.Before(headerInfo.Time) { - return ctx, errorsmod.Wrap( + return errorsmod.Wrap( sdkerrors.ErrInvalidRequest, "unordered transaction has a timeout_timestamp that has already passed", ) } if timeoutTimestamp.After(headerInfo.Time.Add(d.maxTimeoutDuration)) { - return ctx, errorsmod.Wrapf( + return errorsmod.Wrapf( sdkerrors.ErrInvalidRequest, "unordered tx ttl exceeds %s", d.maxTimeoutDuration.String(), @@ -100,24 +114,24 @@ func (d *UnorderedTxDecorator) AnteHandle( // consume gas in all exec modes to avoid gas estimation discrepancies if err := d.env.GasService.GasMeter(ctx).Consume(d.sha256Cost, "consume gas for calculating tx hash"); err != nil { - return ctx, errorsmod.Wrap(sdkerrors.ErrOutOfGas, "out of gas") + return errorsmod.Wrap(sdkerrors.ErrOutOfGas, "out of gas") } // Avoid checking for duplicates and creating the identifier in simulation mode // This is done to avoid sha256 computation in simulation mode if d.env.TransactionService.ExecMode(ctx) == transaction.ExecModeSimulate { - return next(ctx, tx, false) + return nil } // calculate the tx hash - txHash, err := TxIdentifier(uint64(timeoutTimestamp.Unix()), tx) + txHash, err := TxIdentifier(uint64(timeoutTimestamp.Unix()), sdkTx) if err != nil { - return ctx, err + return err } // check for duplicates if d.txManager.Contains(txHash) { - return ctx, errorsmod.Wrap( + return errorsmod.Wrap( sdkerrors.ErrInvalidRequest, "tx %X is duplicated", ) @@ -127,7 +141,7 @@ func (d *UnorderedTxDecorator) AnteHandle( d.txManager.Add(txHash, timeoutTimestamp) } - return next(ctx, tx, false) + return nil } // TxIdentifier returns a unique identifier for a transaction that is intended to be unordered. diff --git a/x/auth/ante/unordered_test.go b/x/auth/ante/unordered_test.go index b02fcc28c471..41100856b578 100644 --- a/x/auth/ante/unordered_test.go +++ b/x/auth/ante/unordered_test.go @@ -8,13 +8,13 @@ import ( "cosmossdk.io/core/header" storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/auth/ante" - "cosmossdk.io/x/auth/ante/unorderedtx" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + "github.com/cosmos/cosmos-sdk/x/auth/ante/unorderedtx" ) const gasConsumed = uint64(25) diff --git a/x/auth/ante/unorderedtx/manager.go b/x/auth/ante/unorderedtx/manager.go index 00e6ae624d5c..8b5a91ed2a01 100644 --- a/x/auth/ante/unorderedtx/manager.go +++ b/x/auth/ante/unorderedtx/manager.go @@ -8,13 +8,12 @@ import ( "errors" "fmt" "io" + "maps" "os" "path/filepath" - "sort" + "slices" "sync" "time" - - "golang.org/x/exp/maps" ) const ( @@ -32,7 +31,7 @@ type TxHash [32]byte // Manager contains the tx hash dictionary for duplicates checking, and expire // them when block production progresses. type Manager struct { - // blockCh defines a channel to receive newly committed block heights + // blockCh defines a channel to receive newly committed block time blockCh chan time.Time // doneCh allows us to ensure the purgeLoop has gracefully terminated prior to closing doneCh chan struct{} @@ -152,7 +151,7 @@ func (m *Manager) OnInit() error { return nil } -// OnNewBlock sends the latest block number to the background purge loop, which +// OnNewBlock sends the latest block time to the background purge loop, which // should be called in ABCI Commit event. func (m *Manager) OnNewBlock(blockTime time.Time) { m.blockCh <- blockTime @@ -162,9 +161,7 @@ func (m *Manager) exportSnapshot(height uint64, snapshotWriter func([]byte) erro var buf bytes.Buffer w := bufio.NewWriter(&buf) - keys := maps.Keys(m.txHashes) - sort.Slice(keys, func(i, j int) bool { return bytes.Compare(keys[i][:], keys[j][:]) < 0 }) - + keys := slices.SortedFunc(maps.Keys(m.txHashes), func(i, j TxHash) int { return bytes.Compare(i[:], j[:]) }) timestamp := time.Unix(int64(height), 0) for _, txHash := range keys { timeoutTime := m.txHashes[txHash] @@ -213,7 +210,7 @@ func (m *Manager) flushToFile() error { return nil } -// expiredTxs returns expired tx hashes based on the provided block height. +// expiredTxs returns expired tx hashes based on the provided block time. func (m *Manager) expiredTxs(blockTime time.Time) []TxHash { m.mu.RLock() defer m.mu.RUnlock() diff --git a/x/auth/ante/unorderedtx/manager_test.go b/x/auth/ante/unorderedtx/manager_test.go index 40e48c72be27..8c16933fce7f 100644 --- a/x/auth/ante/unorderedtx/manager_test.go +++ b/x/auth/ante/unorderedtx/manager_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" - "cosmossdk.io/x/auth/ante/unorderedtx" + "github.com/cosmos/cosmos-sdk/x/auth/ante/unorderedtx" ) func TestUnorderedTxManager_Close(t *testing.T) { @@ -103,11 +103,11 @@ func TestUnorderedTxManager_Flow(t *testing.T) { currentTime := time.Now() // Seed the manager with a txs, some of which should eventually be purged and - // the others will remain. Txs with TTL less than or equal to 50 should be purged. - for i := 1; i <= 100; i++ { + // the others will remain. First 25 Txs should be purged. + for i := 1; i <= 50; i++ { txHash := [32]byte{byte(i)} - if i <= 50 { + if i <= 25 { txm.Add(txHash, currentTime.Add(time.Millisecond*500*time.Duration(i))) } else { txm.Add(txHash, currentTime.Add(time.Hour)) @@ -123,19 +123,19 @@ func TestUnorderedTxManager_Flow(t *testing.T) { for t := range ticker.C { txm.OnNewBlock(t) - if t.After(currentTime.Add(time.Millisecond * 500 * time.Duration(50))) { + if t.After(currentTime.Add(time.Millisecond * 500 * time.Duration(25))) { doneBlockCh <- true return } } }() - // Eventually all the txs that should be expired by block 50 should be purged. + // Eventually all the txs that are expired should be purged. // The remaining txs should remain. require.Eventually( t, func() bool { - return txm.Size() == 50 + return txm.Size() == 25 }, 2*time.Minute, 5*time.Second, diff --git a/x/auth/ante/unorderedtx/snapshotter.go b/x/auth/ante/unorderedtx/snapshotter.go index 690c45445493..39142e956bb0 100644 --- a/x/auth/ante/unorderedtx/snapshotter.go +++ b/x/auth/ante/unorderedtx/snapshotter.go @@ -80,10 +80,8 @@ func (s *Snapshotter) restore(height uint64, payloadReader snapshot.ExtensionPay copy(txHash[:], payload[i:i+txHashSize]) timestamp := binary.BigEndian.Uint64(payload[i+txHashSize : i+chunkSize]) - // need to come up with a way to fetch blocktime to filter out expired txs - // - // right now we dont have access block time at this flow, so we would just include the expired txs - // and let it be purge during purge loop + + // purge any expired txs if timestamp != 0 && timestamp > height { s.m.Add(txHash, time.Unix(int64(timestamp), 0)) } diff --git a/x/auth/ante/unorderedtx/snapshotter_test.go b/x/auth/ante/unorderedtx/snapshotter_test.go index dcf7c05a0cd5..a2e66bfd869f 100644 --- a/x/auth/ante/unorderedtx/snapshotter_test.go +++ b/x/auth/ante/unorderedtx/snapshotter_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" - "cosmossdk.io/x/auth/ante/unorderedtx" + "github.com/cosmos/cosmos-sdk/x/auth/ante/unorderedtx" ) func TestSnapshotter(t *testing.T) { diff --git a/x/auth/ante/validator_tx_fee.go b/x/auth/ante/validator_tx_fee.go index af4f02fed05f..421068175bea 100644 --- a/x/auth/ante/validator_tx_fee.go +++ b/x/auth/ante/validator_tx_fee.go @@ -1,8 +1,10 @@ package ante import ( + "context" "math" + "cosmossdk.io/core/transaction" errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" @@ -12,7 +14,7 @@ import ( // checkTxFeeWithValidatorMinGasPrices implements the default fee logic, where the minimum price per // unit of gas is fixed and set by each validator, can the tx priority is computed from the gas price. -func checkTxFeeWithValidatorMinGasPrices(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, int64, error) { +func (dfd *DeductFeeDecorator) checkTxFeeWithValidatorMinGasPrices(ctx context.Context, tx transaction.Tx) (sdk.Coins, int64, error) { feeTx, ok := tx.(sdk.FeeTx) if !ok { return nil, 0, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx") @@ -24,8 +26,8 @@ func checkTxFeeWithValidatorMinGasPrices(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, // Ensure that the provided fees meet a minimum threshold for the validator, // if this is a CheckTx. This is only for local mempool purposes, and thus // is only ran on check tx. - if ctx.ExecMode() == sdk.ExecModeCheck { // NOTE: using environment here breaks the API of fee logic, an alternative must be found for server/v2. ref: https://github.com/cosmos/cosmos-sdk/issues/19640 - minGasPrices := ctx.MinGasPrices() + if dfd.accountKeeper.GetEnvironment().TransactionService.ExecMode(ctx) == transaction.ExecModeCheck { + minGasPrices := dfd.minGasPrices if !minGasPrices.IsZero() { requiredFees := make(sdk.Coins, len(minGasPrices)) diff --git a/x/auth/autocli.go b/x/auth/autocli.go index 974daf4df5b7..676a3e4af702 100644 --- a/x/auth/autocli.go +++ b/x/auth/autocli.go @@ -24,19 +24,19 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "Account", - Use: "account [address]", + Use: "account
", Short: "Query account by address", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}}, }, { RpcMethod: "AccountInfo", - Use: "account-info [address]", + Use: "account-info
", Short: "Query account info which is common to all account types.", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}}, }, { RpcMethod: "AccountAddressByID", - Use: "address-by-acc-num [acc-num]", + Use: "address-by-acc-num ", Short: "Query account address by account number", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "id"}}, }, @@ -47,20 +47,20 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "ModuleAccountByName", - Use: "module-account [module-name]", + Use: "module-account ", Short: "Query module account info by module name", Example: fmt.Sprintf("%s q auth module-account gov", version.AppName), PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "name"}}, }, { RpcMethod: "AddressBytesToString", - Use: "address-bytes-to-string [address-bytes]", + Use: "address-bytes-to-string ", Short: "Transform an address bytes to string", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address_bytes"}}, }, { RpcMethod: "AddressStringToBytes", - Use: "address-string-to-bytes [address-string]", + Use: "address-string-to-bytes ", Short: "Transform an address string to bytes", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address_string"}}, }, diff --git a/x/auth/client/cli/broadcast.go b/x/auth/client/cli/broadcast.go index f110e459ddc6..a57fa1caff8c 100644 --- a/x/auth/client/cli/broadcast.go +++ b/x/auth/client/cli/broadcast.go @@ -7,17 +7,16 @@ import ( "github.com/spf13/cobra" - authclient "cosmossdk.io/x/auth/client" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/version" + authclient "github.com/cosmos/cosmos-sdk/x/auth/client" ) // GetBroadcastCommand returns the tx broadcast command. func GetBroadcastCommand() *cobra.Command { cmd := &cobra.Command{ - Use: "broadcast [file_path]", + Use: "broadcast ", Short: "Broadcast transactions generated offline", Long: strings.TrimSpace(`Broadcast transactions created with the --generate-only flag and signed with the sign command. Read a transaction from [file_path] and diff --git a/x/auth/client/cli/decode.go b/x/auth/client/cli/decode.go index 2d49806b1244..0b6337bb7742 100644 --- a/x/auth/client/cli/decode.go +++ b/x/auth/client/cli/decode.go @@ -16,7 +16,7 @@ const flagHex = "hex" // it into a JSON-encoded transaction. func GetDecodeCommand() *cobra.Command { cmd := &cobra.Command{ - Use: "decode [protobuf-byte-string]", + Use: "decode ", Short: "Decode a binary encoded transaction string", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) (err error) { diff --git a/x/auth/client/cli/encode.go b/x/auth/client/cli/encode.go index dd677d4110ef..4a56d98aaabf 100644 --- a/x/auth/client/cli/encode.go +++ b/x/auth/client/cli/encode.go @@ -5,17 +5,16 @@ import ( "github.com/spf13/cobra" - authclient "cosmossdk.io/x/auth/client" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + authclient "github.com/cosmos/cosmos-sdk/x/auth/client" ) // GetEncodeCommand returns the encode command to take a JSONified transaction and turn it into // Amino-serialized bytes func GetEncodeCommand() *cobra.Command { cmd := &cobra.Command{ - Use: "encode [file]", + Use: "encode ", Short: "Encode transactions generated offline", Long: `Encode transactions created with the --generate-only flag or signed with the sign command. Read a transaction from , serialize it to the Protobuf wire protocol, and output it as base64. diff --git a/x/auth/client/cli/encode_test.go b/x/auth/client/cli/encode_test.go index 1234de797ac9..2b44bfb16991 100644 --- a/x/auth/client/cli/encode_test.go +++ b/x/auth/client/cli/encode_test.go @@ -7,14 +7,13 @@ import ( "github.com/stretchr/testify/require" - "cosmossdk.io/x/auth" - "cosmossdk.io/x/auth/client/cli" - "github.com/cosmos/cosmos-sdk/client" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/auth" + "github.com/cosmos/cosmos-sdk/x/auth/client/cli" ) func TestGetCommandEncode(t *testing.T) { diff --git a/x/auth/client/cli/query.go b/x/auth/client/cli/query.go index 93210ea7c7db..491c1ba7ad43 100644 --- a/x/auth/client/cli/query.go +++ b/x/auth/client/cli/query.go @@ -7,14 +7,13 @@ import ( "github.com/spf13/cobra" - authtx "cosmossdk.io/x/auth/tx" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" querytypes "github.com/cosmos/cosmos-sdk/types/query" "github.com/cosmos/cosmos-sdk/version" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" ) const ( @@ -79,7 +78,7 @@ for. Each module documents its respective events under 'xx_events.md'. // QueryTxCmd implements the default command for a tx query. func QueryTxCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "tx --type=[hash|acc_seq|signature] [hash|acc_seq|signature]", + Use: "tx --type={hash|acc_seq|signature} ", Short: "Query for a transaction by hash, \"/\" combination or comma-separated signatures in a committed block", Long: strings.TrimSpace(fmt.Sprintf(` Example: diff --git a/x/auth/client/cli/query_test.go b/x/auth/client/cli/query_test.go index 2639b81b4c86..58ee64fba217 100644 --- a/x/auth/client/cli/query_test.go +++ b/x/auth/client/cli/query_test.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/require" - "cosmossdk.io/x/auth/client/cli" + "github.com/cosmos/cosmos-sdk/x/auth/client/cli" ) func TestParseSigs(t *testing.T) { diff --git a/x/auth/client/cli/tx_multisign.go b/x/auth/client/cli/tx_multisign.go index ced781fed845..8b7d1ee3a253 100644 --- a/x/auth/client/cli/tx_multisign.go +++ b/x/auth/client/cli/tx_multisign.go @@ -11,8 +11,6 @@ import ( "google.golang.org/protobuf/types/known/anypb" errorsmod "cosmossdk.io/errors" - authclient "cosmossdk.io/x/auth/client" - "cosmossdk.io/x/auth/signing" txsigning "cosmossdk.io/x/tx/signing" "github.com/cosmos/cosmos-sdk/client" @@ -24,12 +22,14 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" "github.com/cosmos/cosmos-sdk/version" + authclient "github.com/cosmos/cosmos-sdk/x/auth/client" + "github.com/cosmos/cosmos-sdk/x/auth/signing" ) // GetMultiSignCommand returns the multi-sign command func GetMultiSignCommand() *cobra.Command { cmd := &cobra.Command{ - Use: "multi-sign [file] [name] [[signature]...]", + Use: "multi-sign [...]", Aliases: []string{"multisign"}, Short: "Generate multisig signatures for transactions generated offline", Long: strings.TrimSpace( @@ -211,7 +211,7 @@ func makeMultiSignCmd() func(cmd *cobra.Command, args []string) (err error) { func GetMultiSignBatchCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "multisign-batch [file] [name] [[signature-file]...]", + Use: "multisign-batch <[signature-file>...]", Aliases: []string{"multi-sign-batch"}, Short: "Assemble multisig transactions in batch from batch signatures", Long: strings.TrimSpace( diff --git a/x/auth/client/cli/tx_sign.go b/x/auth/client/cli/tx_sign.go index b4d062884ccb..07d8f5330f41 100644 --- a/x/auth/client/cli/tx_sign.go +++ b/x/auth/client/cli/tx_sign.go @@ -8,8 +8,6 @@ import ( "github.com/spf13/cobra" errorsmod "cosmossdk.io/errors" - authclient "cosmossdk.io/x/auth/client" - "cosmossdk.io/x/auth/signing" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" @@ -17,6 +15,8 @@ import ( kmultisig "github.com/cosmos/cosmos-sdk/crypto/keys/multisig" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" + authclient "github.com/cosmos/cosmos-sdk/x/auth/client" + "github.com/cosmos/cosmos-sdk/x/auth/signing" ) const ( @@ -31,7 +31,7 @@ const ( // GetSignBatchCommand returns the transaction sign-batch command. func GetSignBatchCommand() *cobra.Command { cmd := &cobra.Command{ - Use: "sign-batch [file] ([file2]...)", + Use: "sign-batch [...]", Short: "Sign transaction batch files", Long: `Sign batch files of transactions generated with --generate-only. The command processes list of transactions from a file (one StdTx each line), or multiple files. @@ -322,7 +322,7 @@ func setOutputFile(cmd *cobra.Command) (func(), error) { // GetSignCommand returns the transaction sign command. func GetSignCommand() *cobra.Command { cmd := &cobra.Command{ - Use: "sign [file]", + Use: "sign ", Short: "Sign a transaction generated offline", Long: `Sign a transaction created with the --generate-only flag. It will read a transaction from [file], sign it, and print its JSON encoding. diff --git a/x/auth/client/cli/tx_simulate.go b/x/auth/client/cli/tx_simulate.go index daff57403fce..5a8e71c38e3b 100644 --- a/x/auth/client/cli/tx_simulate.go +++ b/x/auth/client/cli/tx_simulate.go @@ -5,18 +5,17 @@ import ( "github.com/spf13/cobra" - authclient "cosmossdk.io/x/auth/client" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" + authclient "github.com/cosmos/cosmos-sdk/x/auth/client" ) // GetSimulateCmd returns a command that simulates whether a transaction will be // successful. func GetSimulateCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "simulate /path/to/unsigned-tx.json --from keyname", + Use: "simulate --from ", Short: "Simulate the gas usage of a transaction", Long: strings.TrimSpace(`Simulate whether a transaction will be successful: diff --git a/x/auth/client/cli/validate_sigs.go b/x/auth/client/cli/validate_sigs.go index 0638f78c38a9..98ec9a6c3de6 100644 --- a/x/auth/client/cli/validate_sigs.go +++ b/x/auth/client/cli/validate_sigs.go @@ -7,8 +7,6 @@ import ( "github.com/spf13/cobra" "google.golang.org/protobuf/types/known/anypb" - authclient "cosmossdk.io/x/auth/client" - authsigning "cosmossdk.io/x/auth/signing" txsigning "cosmossdk.io/x/tx/signing" "github.com/cosmos/cosmos-sdk/client" @@ -16,11 +14,13 @@ import ( "github.com/cosmos/cosmos-sdk/client/tx" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" + authclient "github.com/cosmos/cosmos-sdk/x/auth/client" + authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" ) func GetValidateSignaturesCommand() *cobra.Command { cmd := &cobra.Command{ - Use: "validate-signatures [file]", + Use: "validate-signatures ", Short: "validate transactions signatures", Long: `Print the addresses that must sign the transaction, those who have already signed it, and make sure that signatures are in the correct order. diff --git a/x/auth/client/testutil/helpers.go b/x/auth/client/testutil/helpers.go index 69d0b6ff380f..092b061a83c2 100644 --- a/x/auth/client/testutil/helpers.go +++ b/x/auth/client/testutil/helpers.go @@ -4,13 +4,12 @@ import ( "fmt" "strings" - "cosmossdk.io/x/auth/client/cli" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/testutil" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + "github.com/cosmos/cosmos-sdk/x/auth/client/cli" ) func TxSignExec(clientCtx client.Context, from fmt.Stringer, filename string, extraArgs ...string) (testutil.BufferWriter, error) { diff --git a/x/auth/client/tx.go b/x/auth/client/tx.go index ce0800eaf88f..5904a25e1579 100644 --- a/x/auth/client/tx.go +++ b/x/auth/client/tx.go @@ -63,7 +63,7 @@ func SignTx(txFactory tx.Factory, clientCtx client.Context, name string, txBuild } } - return tx.Sign(clientCtx.CmdContext, txFactory, name, txBuilder, overwriteSig) + return tx.Sign(clientCtx, txFactory, name, txBuilder, overwriteSig) } // SignTxWithSignerAddress attaches a signature to a transaction. @@ -86,7 +86,7 @@ func SignTxWithSignerAddress(txFactory tx.Factory, clientCtx client.Context, add } } - return tx.Sign(clientCtx.CmdContext, txFactory, name, txBuilder, overwrite) + return tx.Sign(clientCtx, txFactory, name, txBuilder, overwrite) } // ReadTxFromFile read and decode a StdTx from the given filename. Can pass "-" to read from stdin. diff --git a/x/auth/client/tx_test.go b/x/auth/client/tx_test.go index 61ab3349a094..18ee2cd5a4d2 100644 --- a/x/auth/client/tx_test.go +++ b/x/auth/client/tx_test.go @@ -7,15 +7,14 @@ import ( "github.com/stretchr/testify/require" - "cosmossdk.io/x/auth" - authclient "cosmossdk.io/x/auth/client" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/auth" + authclient "github.com/cosmos/cosmos-sdk/x/auth/client" ) func TestParseQueryResponse(t *testing.T) { diff --git a/x/auth/depinject.go b/x/auth/depinject.go index 834912a4de30..0b1daedf7586 100644 --- a/x/auth/depinject.go +++ b/x/auth/depinject.go @@ -6,12 +6,13 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/depinject" "cosmossdk.io/depinject/appconfig" - "cosmossdk.io/x/auth/keeper" - "cosmossdk.io/x/auth/simulation" - "cosmossdk.io/x/auth/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + "github.com/cosmos/cosmos-sdk/x/auth/keeper" + "github.com/cosmos/cosmos-sdk/x/auth/simulation" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) var _ depinject.OnePerModuleType = AppModule{} @@ -36,6 +37,8 @@ type ModuleInputs struct { AddressCodec address.Codec RandomGenesisAccountsFn types.RandomGenesisAccountsFn `optional:"true"` AccountI func() sdk.AccountI `optional:"true"` + + ExtensionOptionChecker ante.ExtensionOptionChecker `optional:"true"` } type ModuleOutputs struct { @@ -71,7 +74,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { } k := keeper.NewAccountKeeper(in.Environment, in.Cdc, in.AccountI, in.AccountsModKeeper, maccPerms, in.AddressCodec, in.Config.Bech32Prefix, auth) - m := NewAppModule(in.Cdc, k, in.AccountsModKeeper, in.RandomGenesisAccountsFn) + m := NewAppModule(in.Cdc, k, in.AccountsModKeeper, in.RandomGenesisAccountsFn, in.ExtensionOptionChecker) return ModuleOutputs{AccountKeeper: k, Module: m} } diff --git a/x/auth/go.mod b/x/auth/go.mod deleted file mode 100644 index 2d99179f6bee..000000000000 --- a/x/auth/go.mod +++ /dev/null @@ -1,185 +0,0 @@ -module cosmossdk.io/x/auth - -go 1.22.2 - -require ( - cosmossdk.io/api v0.7.5 - cosmossdk.io/collections v0.4.0 - cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 - cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 - cosmossdk.io/depinject v1.0.0 - cosmossdk.io/errors v1.0.1 - cosmossdk.io/math v1.3.0 - cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc - cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 - cosmossdk.io/x/tx v0.13.3 - github.com/cometbft/cometbft v1.0.0-rc1 - github.com/cometbft/cometbft/api v1.0.0-rc.1 - github.com/cosmos/cosmos-proto v1.0.0-beta.5 - github.com/cosmos/cosmos-sdk v0.53.0 - github.com/cosmos/gogoproto v1.7.0 - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 - github.com/golang/mock v1.6.0 - github.com/golang/protobuf v1.5.4 - github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/spf13/cobra v1.8.1 - github.com/spf13/viper v1.19.0 - github.com/stretchr/testify v1.9.0 - golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 - google.golang.org/grpc v1.65.0 - google.golang.org/protobuf v1.34.2 - gotest.tools/v3 v3.5.1 - pgregory.net/rapid v1.1.0 - sigs.k8s.io/yaml v1.4.0 -) - -require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect - cosmossdk.io/log v1.4.0 // indirect - cosmossdk.io/schema v0.1.1 // indirect - cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect - cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect - filippo.io/edwards25519 v1.1.0 // indirect - github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect - github.com/99designs/keyring v1.2.2 // indirect - github.com/DataDog/datadog-go v4.8.3+incompatible // indirect - github.com/DataDog/zstd v1.5.5 // indirect - github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/beorn7/perks v1.0.1 // indirect - github.com/bgentry/speakeasy v0.2.0 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect - github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/cockroachdb/errors v1.11.1 // indirect - github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect - github.com/cockroachdb/pebble v1.1.0 // indirect - github.com/cockroachdb/redact v1.1.5 // indirect - github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect - github.com/cometbft/cometbft-db v0.12.0 // indirect - github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-db v1.0.2 // indirect - github.com/cosmos/crypto v0.1.2 // indirect - github.com/cosmos/go-bip39 v1.0.0 // indirect - github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect - github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect - github.com/danieljoos/wincred v1.2.1 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/dgraph-io/badger/v4 v4.2.0 // indirect - github.com/dgraph-io/ristretto v0.1.1 // indirect - github.com/dustin/go-humanize v1.0.1 // indirect - github.com/dvsekhvalnov/jose2go v1.6.0 // indirect - github.com/emicklei/dot v1.6.2 // indirect - github.com/fatih/color v1.17.0 // indirect - github.com/felixge/httpsnoop v1.0.4 // indirect - github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/getsentry/sentry-go v0.27.0 // indirect - github.com/go-kit/kit v0.13.0 // indirect - github.com/go-kit/log v0.2.1 // indirect - github.com/go-logfmt/logfmt v0.6.0 // indirect - github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect - github.com/gofrs/uuid v4.4.0+incompatible // indirect - github.com/gogo/googleapis v1.4.1 // indirect - github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/glog v1.2.1 // indirect - github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/snappy v0.0.4 // indirect - github.com/google/btree v1.1.2 // indirect - github.com/google/flatbuffers v2.0.8+incompatible // indirect - github.com/google/go-cmp v0.6.0 // indirect - github.com/google/orderedcode v0.0.1 // indirect - github.com/gorilla/handlers v1.5.2 // indirect - github.com/gorilla/mux v1.8.1 // indirect - github.com/gorilla/websocket v1.5.3 // indirect - github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect - github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect - github.com/hashicorp/go-hclog v1.6.3 // indirect - github.com/hashicorp/go-immutable-radix v1.3.1 // indirect - github.com/hashicorp/go-metrics v0.5.3 // indirect - github.com/hashicorp/go-plugin v1.6.1 // indirect - github.com/hashicorp/golang-lru v1.0.2 // indirect - github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect - github.com/hashicorp/hcl v1.0.0 // indirect - github.com/hashicorp/yamux v0.1.1 // indirect - github.com/hdevalence/ed25519consensus v0.2.0 // indirect - github.com/huandu/skiplist v1.2.0 // indirect - github.com/iancoleman/strcase v0.3.0 // indirect - github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.8 // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/kr/text v0.2.0 // indirect - github.com/lib/pq v1.10.9 // indirect - github.com/libp2p/go-buffer-pool v0.1.0 // indirect - github.com/linxGnu/grocksdb v1.8.14 // indirect - github.com/magiconair/properties v1.8.7 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.20 // indirect - github.com/minio/highwayhash v1.0.2 // indirect - github.com/mitchellh/go-testing-interface v1.14.1 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/mtibben/percent v0.2.1 // indirect - github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect - github.com/oklog/run v1.1.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect - github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect - github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect - github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect - github.com/prometheus/procfs v0.15.1 // indirect - github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect - github.com/rogpeppe/go-internal v1.12.0 // indirect - github.com/rs/cors v1.11.0 // indirect - github.com/rs/zerolog v1.33.0 // indirect - github.com/sagikazarmark/locafero v0.4.0 // indirect - github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/sasha-s/go-deadlock v0.3.1 // indirect - github.com/sourcegraph/conc v0.3.0 // indirect - github.com/spf13/afero v1.11.0 // indirect - github.com/spf13/cast v1.7.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/subosito/gotenv v1.6.0 // indirect - github.com/supranational/blst v0.3.12 // indirect - github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect - github.com/tendermint/go-amino v0.16.0 // indirect - github.com/tidwall/btree v1.7.0 // indirect - github.com/zondax/hid v0.9.2 // indirect - github.com/zondax/ledger-go v0.14.3 // indirect - gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect - gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect - go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect - go.opencensus.io v0.24.0 // indirect - go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.26.0 // indirect - golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.28.0 // indirect - golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.24.0 // indirect - golang.org/x/term v0.23.0 // indirect - golang.org/x/text v0.17.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect - google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect - gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) - -replace github.com/cosmos/cosmos-sdk => ../../. - -// TODO remove post spinning out all modules -replace ( - cosmossdk.io/api => ../../api - cosmossdk.io/collections => ../../collections - cosmossdk.io/core => ../../core - cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/x/accounts => ../accounts - cosmossdk.io/x/bank => ../bank - cosmossdk.io/x/consensus => ../consensus - cosmossdk.io/x/staking => ../staking - cosmossdk.io/x/tx => ../tx -) diff --git a/x/auth/go.sum b/x/auth/go.sum deleted file mode 100644 index 91cd863d3b91..000000000000 --- a/x/auth/go.sum +++ /dev/null @@ -1,702 +0,0 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= -cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= -cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= -cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= -cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= -cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= -cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc h1:R9O9d75e0qZYUsVV0zzi+D7cNLnX2JrUOQNoIPaF0Bg= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc/go.mod h1:amTTatOUV3u1PsKmNb87z6/galCxrRbz9kRdJkL0DyU= -filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= -filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= -github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= -github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= -github.com/99designs/keyring v1.2.2 h1:pZd3neh/EmUzWONb35LxQfvuY7kiSXAq3HQd97+XBn0= -github.com/99designs/keyring v1.2.2/go.mod h1:wes/FrByc8j7lFOAGLGSNEg8f/PaI3cgTBqhFkHUrPk= -github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= -github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= -github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= -github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= -github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= -github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= -github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= -github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= -github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/adlio/schema v1.3.6 h1:k1/zc2jNfeiZBA5aFTRy37jlBIuCkXCm0XmvpzCKI9I= -github.com/adlio/schema v1.3.6/go.mod h1:qkxwLgPBd1FgLRHYVCmQT/rrBr3JH38J9LjmVzWNudg= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/speakeasy v0.2.0 h1:tgObeVOf8WAvtuAX6DhJ4xks4CFNwPDZiqzGqIHE51E= -github.com/bgentry/speakeasy v0.2.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0= -github.com/btcsuite/btcd/btcec/v2 v2.3.3/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= -github.com/btcsuite/btcd/btcutil v1.1.5 h1:+wER79R5670vs/ZusMTF1yTcRYE5GUsFbdjdisflzM8= -github.com/btcsuite/btcd/btcutil v1.1.5/go.mod h1:PSZZ4UitpLBWzxGd5VGOrLnmOjtPP/a6HaFo12zMs00= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= -github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= -github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= -github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= -github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= -github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= -github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= -github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= -github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= -github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= -github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= -github.com/cockroachdb/pebble v1.1.0 h1:pcFh8CdCIt2kmEpK0OIatq67Ln9uGDYY3d5XnE0LJG4= -github.com/cockroachdb/pebble v1.1.0/go.mod h1:sEHm5NOXxyiAoKWhoFxT8xMgd/f3RA6qUqQ1BXKrh2E= -github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= -github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= -github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= -github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= -github.com/cometbft/cometbft v1.0.0-rc1 h1:pYCXw0rKILceyOzHwd+/fGLag8VYemwLUIX6N7V2REw= -github.com/cometbft/cometbft v1.0.0-rc1/go.mod h1:64cB2wvltmK5plHlJFLYOZYGsaTKNW2EZgcHBisHP7o= -github.com/cometbft/cometbft-db v0.12.0 h1:v77/z0VyfSU7k682IzZeZPFZrQAKiQwkqGN0QzAjMi0= -github.com/cometbft/cometbft-db v0.12.0/go.mod h1:aX2NbCrjNVd2ZajYxt1BsiFf/Z+TQ2MN0VxdicheYuw= -github.com/cometbft/cometbft/api v1.0.0-rc.1 h1:GtdXwDGlqwHYs16A4egjwylfYOMYyEacLBrs3Zvpt7g= -github.com/cometbft/cometbft/api v1.0.0-rc.1/go.mod h1:NDFKiBBD8HJC6QQLAoUI99YhsiRZtg2+FJWfk6A6m6o= -github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= -github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= -github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= -github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= -github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= -github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= -github.com/cosmos/crypto v0.1.2 h1:Yn500sPY+9sKVdhiPUSDtt8JOpBGMB515dOmla4zfls= -github.com/cosmos/crypto v0.1.2/go.mod h1:b6VWz3HczIpBaQPvI7KrbQeF3pXHh0al3T5e0uwMBQw= -github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= -github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= -github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= -github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= -github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= -github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= -github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= -github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= -github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= -github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/danieljoos/wincred v1.2.1 h1:dl9cBrupW8+r5250DYkYxocLeZ1Y4vB1kxgtjxw8GQs= -github.com/danieljoos/wincred v1.2.1/go.mod h1:uGaFL9fDn3OLTvzCGulzE+SzjEe5NGlh5FdCcyfPwps= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= -github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= -github.com/dgraph-io/badger/v4 v4.2.0 h1:kJrlajbXXL9DFTNuhhu9yCx7JJa4qpYWxtE8BzuWsEs= -github.com/dgraph-io/badger/v4 v4.2.0/go.mod h1:qfCqhPoWDFJRx1gp5QwwyGo8xk1lbHUxvK9nK0OGAak= -github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= -github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= -github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= -github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= -github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= -github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= -github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/dvsekhvalnov/jose2go v1.6.0 h1:Y9gnSnP4qEI0+/uQkHvFXeD2PLPJeXEL+ySMEA2EjTY= -github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= -github.com/emicklei/dot v1.6.2 h1:08GN+DD79cy/tzN6uLCT84+2Wk9u+wvqP+Hkx/dIR8A= -github.com/emicklei/dot v1.6.2/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= -github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= -github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= -github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= -github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= -github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= -github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= -github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= -github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= -github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.13.0 h1:OoneCcHKHQ03LfBpoQCUfCluwd2Vt3ohz+kvbJneZAU= -github.com/go-kit/kit v0.13.0/go.mod h1:phqEHMMUbyrCFCTgH48JueqrM3md2HcAZ8N3XE4FKDg= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= -github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= -github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= -github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= -github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= -github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= -github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.2.1 h1:OptwRhECazUx5ix5TTWC3EZhsZEHWcYWY4FQHTIubm4= -github.com/golang/glog v1.2.1/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= -github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= -github.com/google/flatbuffers v2.0.8+incompatible h1:ivUb1cGomAB101ZM1T0nOiWz9pSrTMoa9+EiY7igmkM= -github.com/google/flatbuffers v2.0.8+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= -github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= -github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= -github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= -github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= -github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= -github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= -github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= -github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= -github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= -github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= -github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= -github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= -github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= -github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-metrics v0.5.3 h1:M5uADWMOGCTUNU1YuC4hfknOeHNaX54LDm4oYSucoNE= -github.com/hashicorp/go-metrics v0.5.3/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= -github.com/hashicorp/go-plugin v1.6.1 h1:P7MR2UP6gNKGPp+y7EZw2kOiq4IR9WiqLvp0XOsVdwI= -github.com/hashicorp/go-plugin v1.6.1/go.mod h1:XPHFku2tFo3o3QKFgSYo+cghcUhw1NA1hZyMK0PWAw0= -github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= -github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= -github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= -github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= -github.com/hdevalence/ed25519consensus v0.2.0 h1:37ICyZqdyj0lAZ8P4D1d1id3HqbbG1N3iBb1Tb4rdcU= -github.com/hdevalence/ed25519consensus v0.2.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= -github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= -github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw= -github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= -github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= -github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= -github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= -github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= -github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= -github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= -github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= -github.com/linxGnu/grocksdb v1.8.14 h1:HTgyYalNwBSG/1qCQUIott44wU5b2Y9Kr3z7SK5OfGQ= -github.com/linxGnu/grocksdb v1.8.14/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= -github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= -github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= -github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= -github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= -github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= -github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= -github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= -github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q= -github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= -github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= -github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= -github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= -github.com/onsi/gomega v1.28.1 h1:MijcGUbfYuznzK/5R4CPNoUP/9Xvuo20sXfEm6XxoTA= -github.com/onsi/gomega v1.28.1/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= -github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= -github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= -github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= -github.com/opencontainers/runc v1.1.12 h1:BOIssBaW1La0/qbNZHXOOa71dZfZEQOzW7dqQf3phss= -github.com/opencontainers/runc v1.1.12/go.mod h1:S+lQwSfncpBha7XTy/5lBwWgm5+y5Ma/O44Ekby9FK8= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= -github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= -github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= -github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= -github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba h1:3jPgmsFGBID1wFfU2AbYocNcN4wqU68UaHSdMjiw/7U= -github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= -github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= -github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= -github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= -github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= -github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= -github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= -github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po= -github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= -github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= -github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= -github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= -github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= -github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= -github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= -github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= -github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= -github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= -github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= -github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= -github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= -github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= -github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= -github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -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/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= -github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/supranational/blst v0.3.12 h1:Vfas2U2CFHhniv2QkUm2OVa1+pGTdqtpqm9NnhUUbZ8= -github.com/supranational/blst v0.3.12/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= -github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= -github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= -github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= -github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= -github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= -github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= -github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= -github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= -github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= -gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= -gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= -gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= -gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= -go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 h1:qxen9oVGzDdIRP6ejyAJc760RwW4SnVDiTYTzwnXuxo= -go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5/go.mod h1:eW0HG9/oHQhvRCvb1/pIXW4cOvtDqeQK+XSi3TnwaXY= -go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= -go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= -go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= -golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc h1:O9NuF4s+E/PvMIy+9IUZB9znFwUIXEWSstNjek6VpVg= -golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= -golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/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-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= -golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -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.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= -golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= -golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= -google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= -google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= -google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= -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= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= -gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -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.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= -gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= -pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= -sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= -sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/x/auth/keeper/deterministic_test.go b/x/auth/keeper/deterministic_test.go index d20d5dff5794..eabf22bf8aa2 100644 --- a/x/auth/keeper/deterministic_test.go +++ b/x/auth/keeper/deterministic_test.go @@ -15,11 +15,6 @@ import ( "cosmossdk.io/core/header" coretesting "cosmossdk.io/core/testing" storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/auth" - authcodec "cosmossdk.io/x/auth/codec" - "cosmossdk.io/x/auth/keeper" - authtestutil "cosmossdk.io/x/auth/testutil" - "cosmossdk.io/x/auth/types" "github.com/cosmos/cosmos-sdk/baseapp" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" @@ -29,6 +24,11 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/auth" + authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" + "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtestutil "github.com/cosmos/cosmos-sdk/x/auth/testutil" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) type DeterministicTestSuite struct { diff --git a/x/auth/keeper/genesis.go b/x/auth/keeper/genesis.go index 7bed1523912c..8db9431ea6e5 100644 --- a/x/auth/keeper/genesis.go +++ b/x/auth/keeper/genesis.go @@ -4,9 +4,8 @@ import ( "context" "fmt" - "cosmossdk.io/x/auth/types" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) // InitGenesis - Init store state from genesis data diff --git a/x/auth/keeper/grpc_query.go b/x/auth/keeper/grpc_query.go index 6025b6f932b3..402eb6b0a149 100644 --- a/x/auth/keeper/grpc_query.go +++ b/x/auth/keeper/grpc_query.go @@ -9,11 +9,10 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "cosmossdk.io/x/auth/types" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) var _ types.QueryServer = queryServer{} @@ -86,7 +85,7 @@ func (s queryServer) Account(ctx context.Context, req *types.QueryAccountRequest any, err := codectypes.NewAnyWithValue(account) if err != nil { - return nil, status.Errorf(codes.Internal, err.Error()) + return nil, status.Error(codes.Internal, err.Error()) } return &types.QueryAccountResponse{Account: any}, nil @@ -124,7 +123,7 @@ func (s queryServer) ModuleAccounts(ctx context.Context, req *types.QueryModuleA } any, err := codectypes.NewAnyWithValue(account) if err != nil { - return nil, status.Errorf(codes.Internal, err.Error()) + return nil, status.Error(codes.Internal, err.Error()) } modAccounts = append(modAccounts, any) } @@ -150,7 +149,7 @@ func (s queryServer) ModuleAccountByName(ctx context.Context, req *types.QueryMo } any, err := codectypes.NewAnyWithValue(account) if err != nil { - return nil, status.Errorf(codes.Internal, err.Error()) + return nil, status.Error(codes.Internal, err.Error()) } return &types.QueryModuleAccountByNameResponse{Account: any}, nil @@ -234,7 +233,7 @@ func (s queryServer) AccountInfo(ctx context.Context, req *types.QueryAccountInf if pubKey != nil { pkAny, err = codectypes.NewAnyWithValue(account.GetPubKey()) if err != nil { - return nil, status.Errorf(codes.Internal, err.Error()) + return nil, status.Error(codes.Internal, err.Error()) } } diff --git a/x/auth/keeper/grpc_query_test.go b/x/auth/keeper/grpc_query_test.go index 3908455383f4..82e9cfe573fc 100644 --- a/x/auth/keeper/grpc_query_test.go +++ b/x/auth/keeper/grpc_query_test.go @@ -9,10 +9,9 @@ import ( "github.com/cosmos/gogoproto/proto" - "cosmossdk.io/x/auth/types" - "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) const addrStr = "cosmos13c3d4wq2t22dl0dstraf8jc3f902e3fsy9n3wv" diff --git a/x/auth/keeper/keeper.go b/x/auth/keeper/keeper.go index 00240e8f9a65..973f9b4b81f9 100644 --- a/x/auth/keeper/keeper.go +++ b/x/auth/keeper/keeper.go @@ -10,13 +10,13 @@ import ( "cosmossdk.io/core/address" "cosmossdk.io/core/appmodule" errorsmod "cosmossdk.io/errors" - "cosmossdk.io/x/auth/types" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) // AccountKeeperI is the interface contract that x/auth's keeper implements. @@ -315,7 +315,7 @@ func (ak AccountKeeper) NonAtomicMsgsExec(ctx context.Context, signer sdk.AccAdd } if err := ak.BranchService.Execute(ctx, func(ctx context.Context) error { - result, err := ak.AccountsModKeeper.SendModuleMessageUntyped(ctx, signer, msg) + result, err := ak.AccountsModKeeper.SendModuleMessage(ctx, signer, msg) if err != nil { // If an error occurs during message execution, append error response response := &types.NonAtomicExecResult{Resp: nil, Error: err.Error()} diff --git a/x/auth/keeper/keeper_test.go b/x/auth/keeper/keeper_test.go index f3f0fcd13cbf..cf7b4e4d0135 100644 --- a/x/auth/keeper/keeper_test.go +++ b/x/auth/keeper/keeper_test.go @@ -2,6 +2,7 @@ package keeper_test import ( "context" + "encoding/binary" "testing" "github.com/golang/mock/gomock" @@ -11,11 +12,6 @@ import ( "cosmossdk.io/core/header" coretesting "cosmossdk.io/core/testing" storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/auth" - authcodec "cosmossdk.io/x/auth/codec" - "cosmossdk.io/x/auth/keeper" - authtestutil "cosmossdk.io/x/auth/testutil" - "cosmossdk.io/x/auth/types" "github.com/cosmos/cosmos-sdk/baseapp" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" @@ -25,6 +21,11 @@ import ( "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/auth" + authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" + "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtestutil "github.com/cosmos/cosmos-sdk/x/auth/testutil" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) const ( @@ -250,3 +251,32 @@ func (suite *KeeperTestSuite) TestInitGenesis() { // we expect nextNum to be 2 because we initialize fee_collector as account number 1 suite.Require().Equal(2, int(nextNum)) } + +func (suite *KeeperTestSuite) TestMigrateAccountNumberUnsafe() { + suite.SetupTest() // reset + + legacyAccNum := uint64(10) + val := make([]byte, 8) + binary.LittleEndian.PutUint64(val, legacyAccNum) + + // Set value for legacy account number + store := suite.accountKeeper.KVStoreService.OpenKVStore(suite.ctx) + err := store.Set(types.GlobalAccountNumberKey.Bytes(), val) + require.NoError(suite.T(), err) + + // check if value is set + val, err = store.Get(types.GlobalAccountNumberKey.Bytes()) + require.NoError(suite.T(), err) + require.NotEmpty(suite.T(), val) + + suite.acctsModKeeper.EXPECT().InitAccountNumberSeqUnsafe(gomock.Any(), gomock.Any()).AnyTimes().DoAndReturn(func(ctx context.Context, accNum uint64) (uint64, error) { + return legacyAccNum, nil + }) + + err = keeper.MigrateAccountNumberUnsafe(suite.ctx, &suite.accountKeeper) + require.NoError(suite.T(), err) + + val, err = store.Get(types.GlobalAccountNumberKey.Bytes()) + require.NoError(suite.T(), err) + require.Empty(suite.T(), val) +} diff --git a/x/auth/keeper/migrations.go b/x/auth/keeper/migrations.go index c858e7e9551a..e621f5cf1cb0 100644 --- a/x/auth/keeper/migrations.go +++ b/x/auth/keeper/migrations.go @@ -3,10 +3,9 @@ package keeper import ( "context" - v5 "cosmossdk.io/x/auth/migrations/v5" - "cosmossdk.io/x/auth/types" - sdk "github.com/cosmos/cosmos-sdk/types" + v5 "github.com/cosmos/cosmos-sdk/x/auth/migrations/v5" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) // Migrator is a struct for handling in-place store migrations. diff --git a/x/auth/keeper/msg_server.go b/x/auth/keeper/msg_server.go index 50e3a65b5c39..84155981bb0b 100644 --- a/x/auth/keeper/msg_server.go +++ b/x/auth/keeper/msg_server.go @@ -5,9 +5,8 @@ import ( "errors" "fmt" - "cosmossdk.io/x/auth/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) var _ types.MsgServer = msgServer{} @@ -23,7 +22,7 @@ func NewMsgServerImpl(ak AccountKeeper) types.MsgServer { } } -func (ms msgServer) NonAtomicExec(goCtx context.Context, msg *types.MsgNonAtomicExec) (*types.MsgNonAtomicExecResponse, error) { +func (ms msgServer) NonAtomicExec(ctx context.Context, msg *types.MsgNonAtomicExec) (*types.MsgNonAtomicExecResponse, error) { if msg.Signer == "" { return nil, errors.New("empty signer address string is not allowed") } @@ -42,7 +41,7 @@ func (ms msgServer) NonAtomicExec(goCtx context.Context, msg *types.MsgNonAtomic return nil, err } - results, err := ms.ak.NonAtomicMsgsExec(goCtx, signer, msgs) + results, err := ms.ak.NonAtomicMsgsExec(ctx, signer, msgs) if err != nil { return nil, err } diff --git a/x/auth/keeper/msg_server_test.go b/x/auth/keeper/msg_server_test.go index b1decd0b3800..f65334ea5f1c 100644 --- a/x/auth/keeper/msg_server_test.go +++ b/x/auth/keeper/msg_server_test.go @@ -1,7 +1,16 @@ package keeper_test import ( - "cosmossdk.io/x/auth/types" + "context" + + "github.com/cosmos/gogoproto/proto" + any "github.com/cosmos/gogoproto/types/any" + "github.com/golang/mock/gomock" + "google.golang.org/protobuf/runtime/protoiface" + + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/testutil/testdata" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) func (s *KeeperTestSuite) TestUpdateParams() { @@ -94,6 +103,20 @@ func (s *KeeperTestSuite) TestUpdateParams() { expectErr: true, expErrMsg: "invalid SECK256k1 signature verification cost", }, + { + name: "valid transaction", + req: &types.MsgUpdateParams{ + Authority: s.accountKeeper.GetAuthority(), + Params: types.Params{ + MaxMemoCharacters: 140, + TxSigLimit: 9, + TxSizeCostPerByte: 5, + SigVerifyCostED25519: 694, + SigVerifyCostSecp256k1: 511, + }, + }, + expectErr: false, + }, } for _, tc := range testCases { @@ -109,3 +132,73 @@ func (s *KeeperTestSuite) TestUpdateParams() { }) } } + +func (s *KeeperTestSuite) TestNonAtomicExec() { + _, _, addr := testdata.KeyTestPubAddr() + + msgUpdateParams := &types.MsgUpdateParams{} + + msgAny, err := codectypes.NewAnyWithValue(msgUpdateParams) + s.Require().NoError(err) + + testCases := []struct { + name string + req *types.MsgNonAtomicExec + expectErr bool + expErrMsg string + }{ + { + name: "error: empty signer", + req: &types.MsgNonAtomicExec{ + Signer: "", + Msgs: []*any.Any{}, + }, + expectErr: true, + expErrMsg: "empty signer address string is not allowed", + }, + { + name: "error: invalid signer", + req: &types.MsgNonAtomicExec{ + Signer: "invalid_signer", + Msgs: []*any.Any{}, + }, + expectErr: true, + expErrMsg: "invalid signer address", + }, + { + name: "error: empty messages", + req: &types.MsgNonAtomicExec{ + Signer: addr.String(), + Msgs: []*any.Any{}, + }, + expectErr: true, + expErrMsg: "messages cannot be empty", + }, + { + name: "valid transaction", + req: &types.MsgNonAtomicExec{ + Signer: addr.String(), + Msgs: []*any.Any{msgAny}, + }, + expectErr: false, + }, + } + + s.acctsModKeeper.EXPECT().SendModuleMessage(gomock.Any(), gomock.Any(), gomock.Any()). + DoAndReturn(func(_ context.Context, sender []byte, msg proto.Message) (protoiface.MessageV1, error) { + return msg, nil + }).AnyTimes() + + for _, tc := range testCases { + tc := tc + s.Run(tc.name, func() { + _, err := s.msgServer.NonAtomicExec(s.ctx, tc.req) + if tc.expectErr { + s.Require().Error(err) + s.Require().Contains(err.Error(), tc.expErrMsg) + } else { + s.Require().NoError(err) + } + }) + } +} diff --git a/x/auth/migrations/legacytx/stdsig_test.go b/x/auth/migrations/legacytx/stdsig_test.go index e28738cf1290..b64949af14db 100644 --- a/x/auth/migrations/legacytx/stdsig_test.go +++ b/x/auth/migrations/legacytx/stdsig_test.go @@ -6,9 +6,8 @@ import ( "github.com/stretchr/testify/require" - "cosmossdk.io/x/auth/migrations/legacytx" - "github.com/cosmos/cosmos-sdk/testutil/testdata" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) func TestStdSignatureMarshalYAML(t *testing.T) { diff --git a/x/auth/module.go b/x/auth/module.go index ae028ab5fcda..9cd8d0f79a5e 100644 --- a/x/auth/module.go +++ b/x/auth/module.go @@ -13,16 +13,16 @@ import ( "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" "cosmossdk.io/core/transaction" - "cosmossdk.io/x/auth/ante" - "cosmossdk.io/x/auth/keeper" - "cosmossdk.io/x/auth/simulation" - "cosmossdk.io/x/auth/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + "github.com/cosmos/cosmos-sdk/x/auth/keeper" + "github.com/cosmos/cosmos-sdk/x/auth/simulation" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) // ConsensusVersion defines the current x/auth module consensus version. @@ -45,23 +45,26 @@ type AppModule struct { randGenAccountsFn types.RandomGenesisAccountsFn accountsModKeeper types.AccountsModKeeper cdc codec.Codec + extOptChecker ante.ExtensionOptionChecker } // IsAppModule implements the appmodule.AppModule interface. func (am AppModule) IsAppModule() {} -// NewAppModule creates a new AppModule object +// NewAppModule creates a new AppModule object. func NewAppModule( cdc codec.Codec, accountKeeper keeper.AccountKeeper, ak types.AccountsModKeeper, randGenAccountsFn types.RandomGenesisAccountsFn, + extOptChecker ante.ExtensionOptionChecker, ) AppModule { return AppModule{ accountKeeper: accountKeeper, randGenAccountsFn: randGenAccountsFn, accountsModKeeper: ak, cdc: cdc, + extOptChecker: extOptChecker, } } @@ -159,6 +162,7 @@ func (am AppModule) TxValidator(ctx context.Context, tx transaction.Tx) error { ante.NewValidateMemoDecorator(am.accountKeeper), ante.NewConsumeGasForTxSizeDecorator(am.accountKeeper), ante.NewValidateSigCountDecorator(am.accountKeeper), + ante.NewExtensionOptionsDecorator(am.extOptChecker), } sdkTx, ok := tx.(sdk.Tx) diff --git a/x/auth/proto/cosmos/auth/module/v1/module.proto b/x/auth/proto/cosmos/auth/module/v1/module.proto index 8d6c578f11aa..dbe46a157c72 100644 --- a/x/auth/proto/cosmos/auth/module/v1/module.proto +++ b/x/auth/proto/cosmos/auth/module/v1/module.proto @@ -7,7 +7,7 @@ import "cosmos/app/v1alpha1/module.proto"; // Module is the config object for the auth module. message Module { option (cosmos.app.v1alpha1.module) = { - go_import: "cosmossdk.io/x/auth" + go_import: "github.com/cosmos/cosmos-sdk/x/auth" }; // bech32_prefix is the bech32 account prefix for the app. diff --git a/x/auth/proto/cosmos/auth/v1beta1/auth.proto b/x/auth/proto/cosmos/auth/v1beta1/auth.proto index da918041ef16..c67ac69d3eed 100644 --- a/x/auth/proto/cosmos/auth/v1beta1/auth.proto +++ b/x/auth/proto/cosmos/auth/v1beta1/auth.proto @@ -6,7 +6,7 @@ import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; -option go_package = "cosmossdk.io/x/auth/types"; +option go_package = "github.com/cosmos/cosmos-sdk/x/auth/types"; // BaseAccount defines a base account type. It contains all the necessary fields // for basic account functionality. Any custom account type should extend this diff --git a/x/auth/proto/cosmos/auth/v1beta1/genesis.proto b/x/auth/proto/cosmos/auth/v1beta1/genesis.proto index dd71df80e92f..d1aa66e4626f 100644 --- a/x/auth/proto/cosmos/auth/v1beta1/genesis.proto +++ b/x/auth/proto/cosmos/auth/v1beta1/genesis.proto @@ -6,7 +6,7 @@ import "gogoproto/gogo.proto"; import "cosmos/auth/v1beta1/auth.proto"; import "amino/amino.proto"; -option go_package = "cosmossdk.io/x/auth/types"; +option go_package = "github.com/cosmos/cosmos-sdk/x/auth/types"; // GenesisState defines the auth module's genesis state. message GenesisState { diff --git a/x/auth/proto/cosmos/auth/v1beta1/query.proto b/x/auth/proto/cosmos/auth/v1beta1/query.proto index bcf8e87e4360..c2f14e8be736 100644 --- a/x/auth/proto/cosmos/auth/v1beta1/query.proto +++ b/x/auth/proto/cosmos/auth/v1beta1/query.proto @@ -9,7 +9,7 @@ import "cosmos/auth/v1beta1/auth.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/query/v1/query.proto"; -option go_package = "cosmossdk.io/x/auth/types"; +option go_package = "github.com/cosmos/cosmos-sdk/x/auth/types"; // Query defines the gRPC querier service. service Query { diff --git a/x/auth/proto/cosmos/auth/v1beta1/tx.proto b/x/auth/proto/cosmos/auth/v1beta1/tx.proto index e6e798496000..bdfac0f171d3 100644 --- a/x/auth/proto/cosmos/auth/v1beta1/tx.proto +++ b/x/auth/proto/cosmos/auth/v1beta1/tx.proto @@ -8,7 +8,7 @@ import "cosmos/msg/v1/msg.proto"; import "amino/amino.proto"; import "cosmos/auth/v1beta1/auth.proto"; -option go_package = "cosmossdk.io/x/auth/types"; +option go_package = "github.com/cosmos/cosmos-sdk/x/auth/types"; // Msg defines the x/auth Msg service. service Msg { diff --git a/x/auth/signing/adapter_test.go b/x/auth/signing/adapter_test.go index 432a0194ba77..af163ac0160b 100644 --- a/x/auth/signing/adapter_test.go +++ b/x/auth/signing/adapter_test.go @@ -6,12 +6,11 @@ import ( "github.com/stretchr/testify/require" - authsign "cosmossdk.io/x/auth/signing" - codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" "github.com/cosmos/cosmos-sdk/testutil/testdata" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" "github.com/cosmos/cosmos-sdk/types/tx/signing" + authsign "github.com/cosmos/cosmos-sdk/x/auth/signing" ) func TestGetSignBytesAdapterNoPublicKey(t *testing.T) { diff --git a/x/auth/simulation/genesis.go b/x/auth/simulation/genesis.go index 87b5cb2a61a2..c6984cc355e8 100644 --- a/x/auth/simulation/genesis.go +++ b/x/auth/simulation/genesis.go @@ -5,12 +5,11 @@ import ( "fmt" "math/rand" - "cosmossdk.io/x/auth/types" - vestingtypes "cosmossdk.io/x/auth/vesting/types" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/auth/types" + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" ) // Simulation parameter constants diff --git a/x/auth/simulation/genesis_test.go b/x/auth/simulation/genesis_test.go index 2d6a63e4882c..44a2482149c8 100644 --- a/x/auth/simulation/genesis_test.go +++ b/x/auth/simulation/genesis_test.go @@ -8,14 +8,14 @@ import ( "github.com/stretchr/testify/require" sdkmath "cosmossdk.io/math" - "cosmossdk.io/x/auth/simulation" - "cosmossdk.io/x/auth/types" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/testutil" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/auth/simulation" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) // TestRandomizedGenState tests the normal scenario of applying RandomizedGenState. diff --git a/x/auth/simulation/proposals.go b/x/auth/simulation/proposals.go index 78a5c09e2f86..930d9153fd88 100644 --- a/x/auth/simulation/proposals.go +++ b/x/auth/simulation/proposals.go @@ -5,11 +5,11 @@ import ( "math/rand" coreaddress "cosmossdk.io/core/address" - "cosmossdk.io/x/auth/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/simulation" ) diff --git a/x/auth/simulation/proposals_test.go b/x/auth/simulation/proposals_test.go index b5fc4cf8aa5d..f43e105d3056 100644 --- a/x/auth/simulation/proposals_test.go +++ b/x/auth/simulation/proposals_test.go @@ -6,13 +6,12 @@ import ( "gotest.tools/v3/assert" - "cosmossdk.io/x/auth/simulation" - "cosmossdk.io/x/auth/types" - codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/auth/simulation" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestProposalMsgs(t *testing.T) { diff --git a/x/auth/testutil/expected_keepers_mocks.go b/x/auth/testutil/expected_keepers_mocks.go index a53fb9b61b85..348a1740378a 100644 --- a/x/auth/testutil/expected_keepers_mocks.go +++ b/x/auth/testutil/expected_keepers_mocks.go @@ -8,9 +8,9 @@ import ( context "context" reflect "reflect" + transaction "cosmossdk.io/core/transaction" types "github.com/cosmos/cosmos-sdk/types" gomock "github.com/golang/mock/gomock" - protoiface "google.golang.org/protobuf/runtime/protoiface" ) // MockBankKeeper is a mock of BankKeeper interface. @@ -149,17 +149,17 @@ func (mr *MockAccountsModKeeperMockRecorder) NextAccountNumber(ctx interface{}) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NextAccountNumber", reflect.TypeOf((*MockAccountsModKeeper)(nil).NextAccountNumber), ctx) } -// SendModuleMessageUntyped mocks base method. -func (m *MockAccountsModKeeper) SendModuleMessageUntyped(ctx context.Context, sender []byte, msg protoiface.MessageV1) (protoiface.MessageV1, error) { +// SendModuleMessage mocks base method. +func (m *MockAccountsModKeeper) SendModuleMessage(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SendModuleMessageUntyped", ctx, sender, msg) - ret0, _ := ret[0].(protoiface.MessageV1) + ret := m.ctrl.Call(m, "SendModuleMessage", ctx, sender, msg) + ret0, _ := ret[0].(transaction.Msg) ret1, _ := ret[1].(error) return ret0, ret1 } -// SendModuleMessageUntyped indicates an expected call of SendModuleMessageUntyped. -func (mr *MockAccountsModKeeperMockRecorder) SendModuleMessageUntyped(ctx, sender, msg interface{}) *gomock.Call { +// SendModuleMessage indicates an expected call of SendModuleMessage. +func (mr *MockAccountsModKeeperMockRecorder) SendModuleMessage(ctx, sender, msg interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendModuleMessageUntyped", reflect.TypeOf((*MockAccountsModKeeper)(nil).SendModuleMessageUntyped), ctx, sender, msg) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendModuleMessage", reflect.TypeOf((*MockAccountsModKeeper)(nil).SendModuleMessage), ctx, sender, msg) } diff --git a/x/auth/tx/README.md b/x/auth/tx/README.md index 4fba6e3f7c3d..981f375dc0de 100644 --- a/x/auth/tx/README.md +++ b/x/auth/tx/README.md @@ -17,12 +17,15 @@ This document specifies the `x/auth/tx` package of the Cosmos SDK. This package represents the Cosmos SDK implementation of the `client.TxConfig`, `client.TxBuilder`, `client.TxEncoder` and `client.TxDecoder` interfaces. +It contains as well a depinject module and app module the registration of ante/post handler via `runtime` and tx validator via `runtime/v2`. + ## Contents * [Transactions](#transactions) * [`TxConfig`](#txconfig) * [`TxBuilder`](#txbuilder) * [`TxEncoder`/ `TxDecoder`](#txencoder-txdecoder) +* [Depinject \& App Module](#depinject--app-module) * [Client](#client) * [CLI](#cli) * [gRPC](#grpc) @@ -57,6 +60,13 @@ A `client.TxBuilder` can be accessed with `TxConfig.NewTxBuilder()`. More information about `TxEncoder` and `TxDecoder` can be found [here](https://docs.cosmos.network/main/core/encoding#transaction-encoding). +## Depinject & App Module + +The `x/auth/tx/config` contains a depinject module and app module. +The depinject module is there to setup ante/post handlers on an runtime app (via baseapp options) and the tx validator on the runtime/v2 app (via app module). It as well outputs the `TxConfig` and `TxConfigOptions` for the app. + +The app module is purely there for registering tx validators, due to the design of tx validators (tx validator belong to modules). + ## Client ### CLI diff --git a/x/auth/tx/aux_test.go b/x/auth/tx/aux_test.go index 4d1ae10b3271..f1e8dca0879b 100644 --- a/x/auth/tx/aux_test.go +++ b/x/auth/tx/aux_test.go @@ -6,8 +6,6 @@ import ( "github.com/stretchr/testify/require" - authsigning "cosmossdk.io/x/auth/signing" - clienttx "github.com/cosmos/cosmos-sdk/client/tx" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -16,6 +14,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" "github.com/cosmos/cosmos-sdk/types/tx/signing" + authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" ) var ( diff --git a/x/auth/tx/builder.go b/x/auth/tx/builder.go index af97b2e3c02a..423bca3a0870 100644 --- a/x/auth/tx/builder.go +++ b/x/auth/tx/builder.go @@ -14,7 +14,6 @@ import ( signingv1beta1 "cosmossdk.io/api/cosmos/tx/signing/v1beta1" txv1beta1 "cosmossdk.io/api/cosmos/tx/v1beta1" "cosmossdk.io/core/address" - authsign "cosmossdk.io/x/auth/signing" "cosmossdk.io/x/tx/decode" "github.com/cosmos/cosmos-sdk/client" @@ -24,6 +23,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/tx" "github.com/cosmos/cosmos-sdk/types/tx/signing" + authsign "github.com/cosmos/cosmos-sdk/x/auth/signing" ) var ( diff --git a/x/auth/tx/config.go b/x/auth/tx/config.go index bd9811a76c55..24cec22034cd 100644 --- a/x/auth/tx/config.go +++ b/x/auth/tx/config.go @@ -94,11 +94,11 @@ func NewTxConfig(protoCodec codec.Codec, addressCodec, validatorAddressCodec add // NewSigningOptions returns signing options used by x/tx. This includes account and // validator address prefix enabled codecs. -func NewSigningOptions(addressCodec, validatorAddressCodec address.Codec) (*txsigning.Options, error) { +func NewSigningOptions(addressCodec, validatorAddressCodec address.Codec) *txsigning.Options { return &txsigning.Options{ AddressCodec: addressCodec, ValidatorAddressCodec: validatorAddressCodec, - }, nil + } } // NewSigningHandlerMap returns a new txsigning.HandlerMap using the provided ConfigOptions. diff --git a/x/auth/tx/config/depinject.go b/x/auth/tx/config/depinject.go index d85c2921fc8c..7bd438c6767d 100644 --- a/x/auth/tx/config/depinject.go +++ b/x/auth/tx/config/depinject.go @@ -6,6 +6,7 @@ import ( "fmt" gogoproto "github.com/cosmos/gogoproto/proto" + "github.com/spf13/viper" "google.golang.org/grpc" "google.golang.org/grpc/codes" grpcstatus "google.golang.org/grpc/status" @@ -14,13 +15,10 @@ import ( bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" txconfigv1 "cosmossdk.io/api/cosmos/tx/config/v1" "cosmossdk.io/core/address" - "cosmossdk.io/core/appmodule" + appmodulev2 "cosmossdk.io/core/appmodule/v2" + "cosmossdk.io/core/transaction" "cosmossdk.io/depinject" "cosmossdk.io/depinject/appconfig" - "cosmossdk.io/x/auth/ante" - "cosmossdk.io/x/auth/posthandler" - "cosmossdk.io/x/auth/tx" - authtypes "cosmossdk.io/x/auth/types" txsigning "cosmossdk.io/x/tx/signing" "cosmossdk.io/x/tx/signing/textual" @@ -30,8 +28,16 @@ import ( "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + "github.com/cosmos/cosmos-sdk/x/auth/ante/unorderedtx" + "github.com/cosmos/cosmos-sdk/x/auth/posthandler" + "github.com/cosmos/cosmos-sdk/x/auth/tx" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) +// flagMinGasPricesV2 is the flag name for the minimum gas prices in the main server v2 component. +const flagMinGasPricesV2 = "server.minimum-gas-prices" + func init() { appconfig.RegisterModule(&txconfigv1.Config{}, appconfig.Provide(ProvideModule), @@ -47,22 +53,28 @@ type ModuleInputs struct { ValidatorAddressCodec address.ValidatorAddressCodec Codec codec.Codec ProtoFileResolver txsigning.ProtoFileResolver - Environment appmodule.Environment - // BankKeeper is the expected bank keeper to be passed to AnteHandlers - BankKeeper authtypes.BankKeeper `optional:"true"` - MetadataBankKeeper BankKeeper `optional:"true"` - AccountKeeper ante.AccountKeeper `optional:"true"` - FeeGrantKeeper ante.FeegrantKeeper `optional:"true"` - CustomSignModeHandlers func() []txsigning.SignModeHandler `optional:"true"` - CustomGetSigners []txsigning.CustomGetSigner `optional:"true"` + Environment appmodulev2.Environment + // BankKeeper is the expected bank keeper to be passed to AnteHandlers / Tx Validators + BankKeeper authtypes.BankKeeper `optional:"true"` + MetadataBankKeeper BankKeeper `optional:"true"` + AccountKeeper ante.AccountKeeper `optional:"true"` + FeeGrantKeeper ante.FeegrantKeeper `optional:"true"` + AccountAbstractionKeeper ante.AccountAbstractionKeeper `optional:"true"` + CustomSignModeHandlers func() []txsigning.SignModeHandler `optional:"true"` + CustomGetSigners []txsigning.CustomGetSigner `optional:"true"` + ExtraTxValidators []appmodulev2.TxValidator[transaction.Tx] `optional:"true"` + UnorderedTxManager *unorderedtx.Manager `optional:"true"` + TxFeeChecker ante.TxFeeChecker `optional:"true"` + Viper *viper.Viper `optional:"true"` // server v2 } type ModuleOutputs struct { depinject.Out + Module appmodulev2.AppModule // This is only useful for chains using server/v2. It setup tx validators that don't belong to other modules. + BaseAppOption runtime.BaseAppOption // This is only useful for chains using baseapp. Server/v2 chains use TxValidator. TxConfig client.TxConfig TxConfigOptions tx.ConfigOptions - BaseAppOption runtime.BaseAppOption // This is only useful for chains using baseapp. Server/v2 chains use TxValidator. } func ProvideProtoRegistry() txsigning.ProtoFileResolver { @@ -101,7 +113,45 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { panic(err) } - baseAppOption := func(app *baseapp.BaseApp) { + svd := ante.NewSigVerificationDecorator( + in.AccountKeeper, + txConfig.SignModeHandler(), + ante.DefaultSigVerificationGasConsumer, + in.AccountAbstractionKeeper, + ) + + var ( + minGasPrices sdk.DecCoins + feeTxValidator *ante.DeductFeeDecorator + unorderedTxValidator *ante.UnorderedTxDecorator + ) + if in.AccountKeeper != nil && in.BankKeeper != nil && in.Viper != nil { + minGasPricesStr := in.Viper.GetString(flagMinGasPricesV2) + minGasPrices, err = sdk.ParseDecCoins(minGasPricesStr) + if err != nil { + panic(fmt.Sprintf("invalid minimum gas prices: %v", err)) + } + + feeTxValidator = ante.NewDeductFeeDecorator(in.AccountKeeper, in.BankKeeper, in.FeeGrantKeeper, in.TxFeeChecker) + feeTxValidator.SetMinGasPrices(minGasPrices) // set min gas price in deduct fee decorator + } + + if in.UnorderedTxManager != nil { + unorderedTxValidator = ante.NewUnorderedTxDecorator(unorderedtx.DefaultMaxTimeoutDuration, in.UnorderedTxManager, in.Environment, ante.DefaultSha256Cost) + } + + return ModuleOutputs{ + Module: NewAppModule(svd, feeTxValidator, unorderedTxValidator, in.ExtraTxValidators...), + BaseAppOption: newBaseAppOption(txConfig, in), + TxConfig: txConfig, + TxConfigOptions: txConfigOptions, + } +} + +// newBaseAppOption returns baseapp option that sets the ante handler and post handler +// and set the tx encoder and decoder on baseapp. +func newBaseAppOption(txConfig client.TxConfig, in ModuleInputs) func(app *baseapp.BaseApp) { + return func(app *baseapp.BaseApp) { // AnteHandlers if !in.Config.SkipAnteHandler { anteHandler, err := newAnteHandler(txConfig, in) @@ -139,8 +189,6 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { app.SetTxDecoder(txConfig.TxDecoder()) app.SetTxEncoder(txConfig.TxEncoder()) } - - return ModuleOutputs{TxConfig: txConfig, TxConfigOptions: txConfigOptions, BaseAppOption: baseAppOption} } func newAnteHandler(txConfig client.TxConfig, in ModuleInputs) (sdk.AnteHandler, error) { @@ -150,12 +198,13 @@ func newAnteHandler(txConfig client.TxConfig, in ModuleInputs) (sdk.AnteHandler, anteHandler, err := ante.NewAnteHandler( ante.HandlerOptions{ - AccountKeeper: in.AccountKeeper, - BankKeeper: in.BankKeeper, - SignModeHandler: txConfig.SignModeHandler(), - FeegrantKeeper: in.FeeGrantKeeper, - SigGasConsumer: ante.DefaultSigVerificationGasConsumer, - Environment: in.Environment, + Environment: in.Environment, + AccountKeeper: in.AccountKeeper, + BankKeeper: in.BankKeeper, + SignModeHandler: txConfig.SignModeHandler(), + FeegrantKeeper: in.FeeGrantKeeper, + SigGasConsumer: ante.DefaultSigVerificationGasConsumer, + UnorderedTxManager: in.UnorderedTxManager, }, ) if err != nil { diff --git a/x/auth/tx/config/module.go b/x/auth/tx/config/module.go new file mode 100644 index 000000000000..2529f36bc8e3 --- /dev/null +++ b/x/auth/tx/config/module.go @@ -0,0 +1,71 @@ +package tx + +import ( + "context" + + appmodulev2 "cosmossdk.io/core/appmodule/v2" + "cosmossdk.io/core/transaction" + + "github.com/cosmos/cosmos-sdk/x/auth/ante" +) + +var ( + _ appmodulev2.AppModule = AppModule{} + _ appmodulev2.HasTxValidator[transaction.Tx] = AppModule{} +) + +// AppModule is a module that only implements tx validators. +// The goal of this module is to allow extensible registration of tx validators provided by chains without requiring a new modules. +// Additionally, it registers tx validators that do not really have a place in other modules. +// This module is only useful for chains using server/v2. Ante/Post handlers are setup via baseapp options in depinject. +type AppModule struct { + sigVerification ante.SigVerificationDecorator + feeTxValidator *ante.DeductFeeDecorator + unorderTxValidator *ante.UnorderedTxDecorator + // txValidators contains tx validator that can be injected into the module via depinject. + // tx validators should be module based, but it can happen that you do not want to create a new module + // and simply depinject-it. + txValidators []appmodulev2.TxValidator[transaction.Tx] +} + +// NewAppModule creates a new AppModule object. +func NewAppModule( + sigVerification ante.SigVerificationDecorator, + feeTxValidator *ante.DeductFeeDecorator, + unorderTxValidator *ante.UnorderedTxDecorator, + txValidators ...appmodulev2.TxValidator[transaction.Tx], +) AppModule { + return AppModule{ + sigVerification: sigVerification, + feeTxValidator: feeTxValidator, + unorderTxValidator: unorderTxValidator, + txValidators: txValidators, + } +} + +// IsAppModule implements appmodule.AppModule. +func (a AppModule) IsAppModule() {} + +// IsOnePerModuleType implements appmodule.AppModule. +func (a AppModule) IsOnePerModuleType() {} + +// TxValidator implements appmodule.HasTxValidator. +func (a AppModule) TxValidator(ctx context.Context, tx transaction.Tx) error { + for _, txValidator := range a.txValidators { + if err := txValidator.ValidateTx(ctx, tx); err != nil { + return err + } + } + + if err := a.feeTxValidator.ValidateTx(ctx, tx); err != nil { + return err + } + + if a.unorderTxValidator != nil { + if err := a.unorderTxValidator.ValidateTx(ctx, tx); err != nil { + return err + } + } + + return a.sigVerification.ValidateTx(ctx, tx) +} diff --git a/x/auth/tx/config_test.go b/x/auth/tx/config_test.go index 05d63eb2ae1c..5b6afe223efc 100644 --- a/x/auth/tx/config_test.go +++ b/x/auth/tx/config_test.go @@ -8,14 +8,14 @@ import ( _ "cosmossdk.io/api/cosmos/crypto/secp256k1" coretransaction "cosmossdk.io/core/transaction" - "cosmossdk.io/x/auth/tx" - txtestutil "cosmossdk.io/x/auth/tx/testutil" "cosmossdk.io/x/tx/signing" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/testutil" "github.com/cosmos/cosmos-sdk/std" "github.com/cosmos/cosmos-sdk/testutil/testdata" + "github.com/cosmos/cosmos-sdk/x/auth/tx" + txtestutil "github.com/cosmos/cosmos-sdk/x/auth/tx/testutil" ) func TestGenerator(t *testing.T) { diff --git a/x/auth/tx/gogotx.go b/x/auth/tx/gogotx.go index 36d124206b03..aa424f1c991f 100644 --- a/x/auth/tx/gogotx.go +++ b/x/auth/tx/gogotx.go @@ -13,8 +13,6 @@ import ( "cosmossdk.io/core/address" errorsmod "cosmossdk.io/errors" "cosmossdk.io/math" - "cosmossdk.io/x/auth/ante" - authsigning "cosmossdk.io/x/auth/signing" "cosmossdk.io/x/tx/decode" txsigning "cosmossdk.io/x/tx/signing" @@ -26,6 +24,8 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" txtypes "github.com/cosmos/cosmos-sdk/types/tx" "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" ) func newWrapperFromDecodedTx( diff --git a/x/auth/tx/legacy_amino_json.go b/x/auth/tx/legacy_amino_json.go index 0844a7b8f95b..ab2f30246a77 100644 --- a/x/auth/tx/legacy_amino_json.go +++ b/x/auth/tx/legacy_amino_json.go @@ -4,12 +4,12 @@ import ( "fmt" errorsmod "cosmossdk.io/errors" - "cosmossdk.io/x/auth/migrations/legacytx" - "cosmossdk.io/x/auth/signing" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" + "github.com/cosmos/cosmos-sdk/x/auth/signing" ) const aminoNonCriticalFieldsError = "protobuf transaction contains unknown non-critical fields. This is a transaction malleability issue and SIGN_MODE_LEGACY_AMINO_JSON cannot be used." diff --git a/x/auth/tx/service.go b/x/auth/tx/service.go index e84d96b24521..94c9314f5dbf 100644 --- a/x/auth/tx/service.go +++ b/x/auth/tx/service.go @@ -10,8 +10,6 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "cosmossdk.io/x/auth/migrations/legacytx" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -19,6 +17,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" txtypes "github.com/cosmos/cosmos-sdk/types/tx" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) // baseAppSimulateFn is the signature of the Baseapp#Simulate function. diff --git a/x/auth/tx/testutil/suite.go b/x/auth/tx/testutil/suite.go index 6ac4b25608c6..af7da0f1f96e 100644 --- a/x/auth/tx/testutil/suite.go +++ b/x/auth/tx/testutil/suite.go @@ -9,7 +9,6 @@ import ( signingv1beta1 "cosmossdk.io/api/cosmos/tx/signing/v1beta1" "cosmossdk.io/math" - "cosmossdk.io/x/auth/signing" "github.com/cosmos/cosmos-sdk/client" kmultisig "github.com/cosmos/cosmos-sdk/crypto/keys/multisig" @@ -18,6 +17,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/signing" ) // TxConfigTestSuite provides a test suite that can be used to test that a TxConfig implementation is correct. diff --git a/x/auth/types/account_retriever.go b/x/auth/types/account_retriever.go index 020252aa939e..c46d4330653f 100644 --- a/x/auth/types/account_retriever.go +++ b/x/auth/types/account_retriever.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "strconv" + "strings" "google.golang.org/grpc" "google.golang.org/grpc/codes" @@ -75,7 +76,8 @@ func (ar AccountRetriever) EnsureExists(clientCtx client.Context, addr sdk.AccAd func (ar AccountRetriever) GetAccountNumberSequence(clientCtx client.Context, addr sdk.AccAddress) (uint64, uint64, error) { acc, err := ar.GetAccount(clientCtx, addr) if err != nil { - if status.Code(err) == codes.NotFound { + // the error might come wrapped from CometBFT, so we check with the string too + if status.Code(err) == codes.NotFound || strings.Contains(err.Error(), "code = NotFound") { return 0, 0, nil } return 0, 0, err diff --git a/x/auth/types/account_test.go b/x/auth/types/account_test.go index 3a4c16e8c462..b4fadfa391a7 100644 --- a/x/auth/types/account_test.go +++ b/x/auth/types/account_test.go @@ -8,11 +8,10 @@ import ( "github.com/stretchr/testify/require" - "cosmossdk.io/x/auth/types" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestBaseAddressPubKey(t *testing.T) { diff --git a/x/auth/types/auth.pb.go b/x/auth/types/auth.pb.go index 4682b8fd043d..d1802682a134 100644 --- a/x/auth/types/auth.pb.go +++ b/x/auth/types/auth.pb.go @@ -252,54 +252,54 @@ func init() { func init() { proto.RegisterFile("cosmos/auth/v1beta1/auth.proto", fileDescriptor_7e1f7e915d020d2d) } var fileDescriptor_7e1f7e915d020d2d = []byte{ - // 737 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x54, 0xc1, 0x4e, 0xf3, 0x46, - 0x10, 0x8e, 0x93, 0x94, 0xbf, 0x6c, 0xf8, 0xa1, 0x98, 0x94, 0x9a, 0xa8, 0x8a, 0x4d, 0xa4, 0x8a, - 0x08, 0x35, 0x0e, 0x09, 0xa5, 0x15, 0xb9, 0x91, 0xb4, 0xaa, 0x10, 0x85, 0x22, 0x47, 0xe5, 0xc0, - 0xc5, 0x5a, 0xdb, 0x8b, 0x59, 0x25, 0xf6, 0xba, 0xde, 0x35, 0x8a, 0x79, 0x02, 0xd4, 0x53, 0xd5, - 0x4b, 0xaf, 0xb4, 0x4f, 0xc0, 0x81, 0x87, 0xa8, 0x7a, 0x42, 0x5c, 0xda, 0x53, 0x54, 0x85, 0x03, - 0xa8, 0xea, 0x43, 0x54, 0xde, 0x75, 0x48, 0x82, 0x72, 0x89, 0x3c, 0xdf, 0xf7, 0xcd, 0xcc, 0x37, - 0x93, 0xb1, 0x41, 0xd9, 0x26, 0xd4, 0x23, 0xb4, 0x0e, 0x23, 0x76, 0x59, 0xbf, 0x6a, 0x58, 0x88, - 0xc1, 0x06, 0x0f, 0xf4, 0x20, 0x24, 0x8c, 0xc8, 0x6b, 0x82, 0xd7, 0x39, 0x94, 0xf2, 0xa5, 0x55, - 0xe8, 0x61, 0x9f, 0xd4, 0xf9, 0xaf, 0xd0, 0x95, 0x36, 0x84, 0xce, 0xe4, 0x51, 0x3d, 0x4d, 0x12, - 0x54, 0xd1, 0x25, 0x2e, 0x11, 0x78, 0xf2, 0x34, 0x4e, 0x70, 0x09, 0x71, 0xfb, 0xa8, 0xce, 0x23, - 0x2b, 0xba, 0xa8, 0x43, 0x3f, 0x16, 0x54, 0xe5, 0xb7, 0x2c, 0x28, 0xb4, 0x21, 0x45, 0x07, 0xb6, - 0x4d, 0x22, 0x9f, 0xc9, 0x4d, 0xf0, 0x0e, 0x3a, 0x4e, 0x88, 0x28, 0x55, 0x24, 0x4d, 0xaa, 0x2e, - 0xb6, 0x95, 0xc7, 0xfb, 0x5a, 0x31, 0xed, 0x71, 0x20, 0x98, 0x2e, 0x0b, 0xb1, 0xef, 0x1a, 0x63, - 0xa1, 0x7c, 0x06, 0xde, 0x05, 0x91, 0x65, 0xf6, 0x50, 0xac, 0x64, 0x35, 0xa9, 0x5a, 0x68, 0x16, - 0x75, 0xd1, 0x50, 0x1f, 0x37, 0xd4, 0x0f, 0xfc, 0xb8, 0xbd, 0xf5, 0xef, 0x50, 0x2d, 0x06, 0x91, - 0xd5, 0xc7, 0x76, 0xa2, 0xfd, 0x9c, 0x78, 0x98, 0x21, 0x2f, 0x60, 0xf1, 0xef, 0xcf, 0x77, 0xdb, - 0x60, 0x42, 0x18, 0x0b, 0x41, 0x64, 0x1d, 0xa1, 0x58, 0xfe, 0x0c, 0x2c, 0x43, 0x61, 0xcb, 0xf4, - 0x23, 0xcf, 0x42, 0xa1, 0x92, 0xd3, 0xa4, 0x6a, 0xde, 0x78, 0x9f, 0xa2, 0x27, 0x1c, 0x94, 0x4b, - 0xe0, 0x43, 0x8a, 0x7e, 0x8c, 0x90, 0x6f, 0x23, 0x25, 0xcf, 0x05, 0xaf, 0x71, 0xab, 0x73, 0x73, - 0xab, 0x66, 0x5e, 0x6e, 0xd5, 0xcc, 0x9f, 0xf7, 0xb5, 0x4f, 0xe7, 0xac, 0x57, 0x4f, 0xe7, 0x3e, - 0xfc, 0xe9, 0xf9, 0x6e, 0x7b, 0x5d, 0x08, 0x6a, 0xd4, 0xe9, 0xd5, 0xa7, 0x76, 0x52, 0xf9, 0x4f, - 0x02, 0xef, 0x8f, 0x89, 0x13, 0xf5, 0x5f, 0xb7, 0x74, 0x08, 0x96, 0x2c, 0x48, 0x91, 0x99, 0x1a, - 0xe1, 0xab, 0x2a, 0x34, 0x35, 0x7d, 0x5e, 0x87, 0xa9, 0x4a, 0xed, 0xfc, 0xc3, 0x50, 0x95, 0x8c, - 0x82, 0x35, 0xb5, 0x70, 0x19, 0xe4, 0x7d, 0xe8, 0x21, 0xbe, 0xb9, 0x45, 0x83, 0x3f, 0xcb, 0x1a, - 0x28, 0x04, 0x28, 0xf4, 0x30, 0xa5, 0x98, 0xf8, 0x54, 0xc9, 0x69, 0xb9, 0xea, 0xa2, 0x31, 0x0d, - 0xb5, 0xce, 0x6f, 0xc4, 0x4c, 0x95, 0x79, 0x1d, 0x67, 0xbc, 0xf2, 0xc9, 0x94, 0xa9, 0xc9, 0x66, - 0xd8, 0x5f, 0x9e, 0xef, 0xb6, 0x97, 0x3d, 0x8e, 0x8c, 0x87, 0xa9, 0xfc, 0x2a, 0x81, 0x8f, 0x84, - 0xa8, 0x13, 0x22, 0x07, 0xf9, 0x0c, 0xc3, 0xbe, 0xac, 0x82, 0x42, 0x2a, 0xe3, 0x6e, 0xf9, 0x6d, - 0x18, 0x40, 0x40, 0x27, 0x89, 0xe7, 0x2d, 0xb0, 0xe2, 0xa0, 0x10, 0x5f, 0x41, 0x86, 0x89, 0x9f, - 0xfc, 0x8d, 0x54, 0xc9, 0x6a, 0xb9, 0xea, 0x92, 0xb1, 0x3c, 0x81, 0x8f, 0x50, 0x4c, 0x5b, 0xfb, - 0x8f, 0xf7, 0xb5, 0x95, 0x89, 0x1f, 0x6d, 0x47, 0xff, 0xe2, 0xab, 0xc4, 0xe3, 0xe6, 0x94, 0xc7, - 0x6f, 0x43, 0x12, 0x05, 0xa9, 0xc5, 0x89, 0x89, 0xca, 0x5f, 0x59, 0xb0, 0x70, 0x0a, 0x43, 0xe8, - 0x51, 0x59, 0x07, 0x6b, 0x1e, 0x1c, 0x98, 0x1e, 0xf2, 0x88, 0x69, 0x5f, 0xc2, 0x10, 0xda, 0x0c, - 0x85, 0xe2, 0x66, 0xf3, 0xc6, 0xaa, 0x07, 0x07, 0xc7, 0xc8, 0x23, 0x9d, 0x57, 0x42, 0xd6, 0xc0, - 0x12, 0x1b, 0x98, 0x14, 0xbb, 0x66, 0x1f, 0x7b, 0x98, 0xf1, 0x75, 0xe7, 0x0d, 0xc0, 0x06, 0x5d, - 0xec, 0x7e, 0x97, 0x20, 0xf2, 0x0e, 0xf8, 0x98, 0x2b, 0xae, 0x91, 0x69, 0x13, 0xca, 0xcc, 0x00, - 0x85, 0xa6, 0x15, 0x33, 0x94, 0x1e, 0xdd, 0x6a, 0x22, 0xbd, 0x46, 0x1d, 0x42, 0xd9, 0x29, 0x0a, - 0xdb, 0x31, 0x43, 0xf2, 0xf7, 0xe0, 0x93, 0xa4, 0xe0, 0x15, 0x0a, 0xf1, 0x45, 0x2c, 0x92, 0x90, - 0xd3, 0xdc, 0xdb, 0x6b, 0xec, 0x8b, 0x3b, 0x6c, 0x2b, 0xa3, 0xa1, 0x5a, 0xec, 0x62, 0xf7, 0x8c, - 0x2b, 0x92, 0xd4, 0x6f, 0xbe, 0xe6, 0xbc, 0x51, 0xa4, 0x33, 0xa8, 0xc8, 0x92, 0x7f, 0x00, 0x1b, - 0x6f, 0x0b, 0x52, 0x64, 0x07, 0xcd, 0xbd, 0x2f, 0x7b, 0x0d, 0xe5, 0x03, 0x5e, 0xb2, 0x34, 0x1a, - 0xaa, 0xeb, 0x33, 0x25, 0xbb, 0x63, 0x85, 0xb1, 0x4e, 0xe7, 0xe2, 0xad, 0xcd, 0x97, 0x5b, 0x55, - 0x7a, 0x7b, 0x06, 0x03, 0xf1, 0x19, 0x12, 0xeb, 0x6c, 0xef, 0xfe, 0x31, 0x2a, 0x4b, 0x0f, 0xa3, - 0xb2, 0xf4, 0xcf, 0xa8, 0x2c, 0xfd, 0xfc, 0x54, 0xce, 0x3c, 0x3c, 0x95, 0x33, 0x7f, 0x3f, 0x95, - 0x33, 0xe7, 0xe9, 0xc7, 0x86, 0x3a, 0x3d, 0x1d, 0x93, 0x71, 0x16, 0x8b, 0x03, 0x44, 0xad, 0x05, - 0xfe, 0x7a, 0xef, 0xfe, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xa4, 0x84, 0x7c, 0x64, 0xd8, 0x04, 0x00, - 0x00, + // 745 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x54, 0x41, 0x6f, 0xe3, 0x44, + 0x14, 0x8e, 0x93, 0xd0, 0xa5, 0x93, 0x6e, 0x97, 0x7a, 0x43, 0xf1, 0x46, 0x28, 0xf6, 0x46, 0x42, + 0x1b, 0x2a, 0x62, 0x6f, 0x02, 0x05, 0x35, 0xb7, 0x26, 0x20, 0x54, 0x95, 0x96, 0xca, 0x11, 0x3d, + 0xf4, 0x62, 0x8d, 0x9d, 0xa9, 0x3b, 0x6a, 0xc6, 0x63, 0x3c, 0xe3, 0x2a, 0xee, 0x2f, 0xa8, 0x38, + 0x21, 0x2e, 0x5c, 0x0b, 0xbf, 0xa0, 0x87, 0xfe, 0x08, 0xc4, 0xa9, 0xea, 0x05, 0x4e, 0x11, 0x4a, + 0x0f, 0xad, 0x10, 0x3f, 0x02, 0x79, 0xc6, 0x69, 0x92, 0x6e, 0x2e, 0x91, 0xdf, 0xf7, 0x7d, 0xef, + 0xbd, 0xef, 0xbd, 0x3c, 0x1b, 0x54, 0x3d, 0xca, 0x08, 0x65, 0x16, 0x8c, 0xf9, 0x89, 0x75, 0xd6, + 0x74, 0x11, 0x87, 0x4d, 0x11, 0x98, 0x61, 0x44, 0x39, 0x55, 0x5f, 0x4a, 0xde, 0x14, 0x50, 0xc6, + 0x57, 0xd6, 0x20, 0xc1, 0x01, 0xb5, 0xc4, 0xaf, 0xd4, 0x55, 0x5e, 0x49, 0x9d, 0x23, 0x22, 0x2b, + 0x4b, 0x92, 0x54, 0xd9, 0xa7, 0x3e, 0x95, 0x78, 0xfa, 0x34, 0x49, 0xf0, 0x29, 0xf5, 0x07, 0xc8, + 0x12, 0x91, 0x1b, 0x1f, 0x5b, 0x30, 0x48, 0x24, 0x55, 0xfb, 0x2d, 0x0f, 0x4a, 0x1d, 0xc8, 0xd0, + 0xb6, 0xe7, 0xd1, 0x38, 0xe0, 0x6a, 0x0b, 0x3c, 0x83, 0xfd, 0x7e, 0x84, 0x18, 0xd3, 0x14, 0x43, + 0xa9, 0x2f, 0x77, 0xb4, 0xdb, 0xeb, 0x46, 0x39, 0xeb, 0xb1, 0x2d, 0x99, 0x1e, 0x8f, 0x70, 0xe0, + 0xdb, 0x13, 0xa1, 0x7a, 0x08, 0x9e, 0x85, 0xb1, 0xeb, 0x9c, 0xa2, 0x44, 0xcb, 0x1b, 0x4a, 0xbd, + 0xd4, 0x2a, 0x9b, 0xb2, 0xa1, 0x39, 0x69, 0x68, 0x6e, 0x07, 0x49, 0xe7, 0xcd, 0xbf, 0x23, 0xbd, + 0x1c, 0xc6, 0xee, 0x00, 0x7b, 0xa9, 0xf6, 0x33, 0x4a, 0x30, 0x47, 0x24, 0xe4, 0xc9, 0xef, 0xf7, + 0x57, 0x1b, 0x60, 0x4a, 0xd8, 0x4b, 0x61, 0xec, 0xee, 0xa2, 0x44, 0xfd, 0x04, 0xac, 0x42, 0x69, + 0xcb, 0x09, 0x62, 0xe2, 0xa2, 0x48, 0x2b, 0x18, 0x4a, 0xbd, 0x68, 0x3f, 0xcf, 0xd0, 0x7d, 0x01, + 0xaa, 0x15, 0xf0, 0x3e, 0x43, 0x3f, 0xc6, 0x28, 0xf0, 0x90, 0x56, 0x14, 0x82, 0xc7, 0xb8, 0xdd, + 0xbd, 0xb8, 0xd4, 0x73, 0x0f, 0x97, 0x7a, 0xee, 0xcf, 0xeb, 0xc6, 0xc7, 0x0b, 0xd6, 0x6b, 0x66, + 0x73, 0xef, 0xfc, 0x74, 0x7f, 0xb5, 0xb1, 0x2e, 0x05, 0x0d, 0xd6, 0x3f, 0xb5, 0x66, 0x76, 0x52, + 0xfb, 0x4f, 0x01, 0xcf, 0xf7, 0x68, 0x3f, 0x1e, 0x3c, 0x6e, 0x69, 0x07, 0xac, 0xb8, 0x90, 0x21, + 0x27, 0x33, 0x22, 0x56, 0x55, 0x6a, 0x19, 0xe6, 0xa2, 0x0e, 0x33, 0x95, 0x3a, 0xc5, 0x9b, 0x91, + 0xae, 0xd8, 0x25, 0x77, 0x66, 0xe1, 0x2a, 0x28, 0x06, 0x90, 0x20, 0xb1, 0xb9, 0x65, 0x5b, 0x3c, + 0xab, 0x06, 0x28, 0x85, 0x28, 0x22, 0x98, 0x31, 0x4c, 0x03, 0xa6, 0x15, 0x8c, 0x42, 0x7d, 0xd9, + 0x9e, 0x85, 0xda, 0x47, 0x17, 0x72, 0xa6, 0xda, 0xa2, 0x8e, 0x73, 0x5e, 0xc5, 0x64, 0xda, 0xcc, + 0x64, 0x73, 0xec, 0x2f, 0xf7, 0x57, 0x1b, 0xab, 0x44, 0x20, 0x93, 0x61, 0x6a, 0xbf, 0x2a, 0xe0, + 0x03, 0x29, 0xea, 0x46, 0xa8, 0x8f, 0x02, 0x8e, 0xe1, 0x40, 0xd5, 0x41, 0x29, 0x93, 0x09, 0xb7, + 0xe2, 0x36, 0x6c, 0x20, 0xa1, 0xfd, 0xd4, 0xf3, 0x1b, 0xf0, 0xa2, 0x8f, 0x22, 0x7c, 0x06, 0x39, + 0xa6, 0x41, 0xfa, 0x37, 0x32, 0x2d, 0x6f, 0x14, 0xea, 0x2b, 0xf6, 0xea, 0x14, 0xde, 0x45, 0x09, + 0x6b, 0x6f, 0xdd, 0x5e, 0x37, 0x5e, 0x4c, 0xfd, 0x18, 0x6f, 0xcd, 0x2f, 0xbe, 0x4a, 0x3d, 0xbe, + 0x9e, 0xf1, 0xf8, 0x6d, 0x44, 0xe3, 0x30, 0xb3, 0x38, 0x35, 0x51, 0xfb, 0x2b, 0x0f, 0x96, 0x0e, + 0x60, 0x04, 0x09, 0x53, 0x4d, 0xf0, 0x92, 0xc0, 0xa1, 0x43, 0x10, 0xa1, 0x8e, 0x77, 0x02, 0x23, + 0xe8, 0x71, 0x14, 0xc9, 0x9b, 0x2d, 0xda, 0x6b, 0x04, 0x0e, 0xf7, 0x10, 0xa1, 0xdd, 0x47, 0x42, + 0x35, 0xc0, 0x0a, 0x1f, 0x3a, 0x0c, 0xfb, 0xce, 0x00, 0x13, 0xcc, 0xc5, 0xba, 0x8b, 0x36, 0xe0, + 0xc3, 0x1e, 0xf6, 0xbf, 0x4b, 0x11, 0xf5, 0x2d, 0xf8, 0x50, 0x28, 0xce, 0x91, 0xe3, 0x51, 0xc6, + 0x9d, 0x10, 0x45, 0x8e, 0x9b, 0x70, 0x94, 0x1d, 0xdd, 0x5a, 0x2a, 0x3d, 0x47, 0x5d, 0xca, 0xf8, + 0x01, 0x8a, 0x3a, 0x09, 0x47, 0xea, 0xf7, 0xe0, 0xa3, 0xb4, 0xe0, 0x19, 0x8a, 0xf0, 0x71, 0x22, + 0x93, 0x50, 0xbf, 0xb5, 0xb9, 0xd9, 0xdc, 0x92, 0x77, 0xd8, 0xd1, 0xc6, 0x23, 0xbd, 0xdc, 0xc3, + 0xfe, 0xa1, 0x50, 0xa4, 0xa9, 0xdf, 0x7c, 0x2d, 0x78, 0xbb, 0xcc, 0xe6, 0x50, 0x99, 0xa5, 0xfe, + 0x00, 0x5e, 0x3d, 0x2d, 0xc8, 0x90, 0x17, 0xb6, 0x36, 0xbf, 0x3c, 0x6d, 0x6a, 0xef, 0x89, 0x92, + 0x95, 0xf1, 0x48, 0x5f, 0x9f, 0x2b, 0xd9, 0x9b, 0x28, 0xec, 0x75, 0xb6, 0x10, 0x6f, 0xbf, 0x7e, + 0xb8, 0xd4, 0x95, 0xa7, 0x67, 0x30, 0x94, 0x9f, 0x21, 0xb9, 0xce, 0x4e, 0xf7, 0x8f, 0x71, 0x55, + 0xb9, 0x19, 0x57, 0x95, 0x7f, 0xc6, 0x55, 0xe5, 0xe7, 0xbb, 0x6a, 0xee, 0xe6, 0xae, 0x9a, 0xfb, + 0xfb, 0xae, 0x9a, 0x3b, 0xfa, 0xd4, 0xc7, 0xfc, 0x24, 0x76, 0x4d, 0x8f, 0x92, 0xec, 0x53, 0x63, + 0xbd, 0x5b, 0x85, 0x27, 0x21, 0x62, 0xee, 0x92, 0x78, 0xdd, 0x3f, 0xff, 0x3f, 0x00, 0x00, 0xff, + 0xff, 0x8c, 0x05, 0x77, 0x9c, 0xe8, 0x04, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { diff --git a/x/auth/types/codec.go b/x/auth/types/codec.go index 473e3d94ab21..5cff5c407948 100644 --- a/x/auth/types/codec.go +++ b/x/auth/types/codec.go @@ -4,11 +4,11 @@ import ( corelegacy "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" coretransaction "cosmossdk.io/core/transaction" - "cosmossdk.io/x/auth/migrations/legacytx" "github.com/cosmos/cosmos-sdk/codec/legacy" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) // RegisterLegacyAminoCodec registers the account interfaces and concrete types on the diff --git a/x/auth/types/credentials_test.go b/x/auth/types/credentials_test.go index 12ddf0a24fd5..3fb30311f022 100644 --- a/x/auth/types/credentials_test.go +++ b/x/auth/types/credentials_test.go @@ -5,10 +5,9 @@ import ( "github.com/stretchr/testify/require" - authtypes "cosmossdk.io/x/auth/types" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestNewModuleCrendentials(t *testing.T) { diff --git a/x/auth/types/expected_keepers.go b/x/auth/types/expected_keepers.go index 401988a7d00d..7fb82e89ed8a 100644 --- a/x/auth/types/expected_keepers.go +++ b/x/auth/types/expected_keepers.go @@ -3,7 +3,7 @@ package types import ( "context" - "google.golang.org/protobuf/runtime/protoiface" + "cosmossdk.io/core/transaction" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -17,7 +17,7 @@ type BankKeeper interface { // AccountsModKeeper defines the contract for x/accounts APIs type AccountsModKeeper interface { - SendModuleMessageUntyped(ctx context.Context, sender []byte, msg protoiface.MessageV1) (protoiface.MessageV1, error) + SendModuleMessage(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) IsAccountsModuleAccount(ctx context.Context, accountAddr []byte) bool NextAccountNumber(ctx context.Context) (accNum uint64, err error) diff --git a/x/auth/types/genesis.pb.go b/x/auth/types/genesis.pb.go index c7bd41ddb544..533149395e2f 100644 --- a/x/auth/types/genesis.pb.go +++ b/x/auth/types/genesis.pb.go @@ -87,7 +87,7 @@ func init() { func init() { proto.RegisterFile("cosmos/auth/v1beta1/genesis.proto", fileDescriptor_d897ccbce9822332) } var fileDescriptor_d897ccbce9822332 = []byte{ - // 258 bytes of a gzipped FileDescriptorProto + // 269 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4c, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0x4f, 0x2c, 0x2d, 0xc9, 0xd0, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, @@ -100,11 +100,11 @@ var fileDescriptor_d897ccbce9822332 = []byte{ 0x71, 0xe2, 0x3c, 0x71, 0x4f, 0x9e, 0x61, 0xc5, 0xf3, 0x0d, 0x5a, 0x8c, 0x41, 0x50, 0x5d, 0x42, 0x06, 0x5c, 0x1c, 0x89, 0xc9, 0xc9, 0xf9, 0xa5, 0x79, 0x25, 0xc5, 0x12, 0x4c, 0x0a, 0xcc, 0x1a, 0xdc, 0x46, 0x22, 0x7a, 0x10, 0x7f, 0xe8, 0xc1, 0xfc, 0xa1, 0xe7, 0x98, 0x57, 0x19, 0x04, 0x57, - 0xe5, 0x64, 0x7c, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, - 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x92, 0x10, 0xab, - 0x8b, 0x53, 0xb2, 0xf5, 0x32, 0xf3, 0xf5, 0x2b, 0x20, 0xfe, 0x2a, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, - 0x62, 0x03, 0x1b, 0x66, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x6c, 0x57, 0x9c, 0xf7, 0x5c, 0x01, - 0x00, 0x00, + 0xe5, 0xe4, 0x7c, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, + 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x9a, 0xe9, 0x99, + 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x50, 0xaf, 0x41, 0x28, 0xdd, 0xe2, 0x94, + 0x6c, 0xfd, 0x0a, 0x88, 0x3f, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x86, 0x1b, 0x03, + 0x02, 0x00, 0x00, 0xff, 0xff, 0xf5, 0x70, 0x8d, 0xea, 0x6c, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/auth/types/genesis_test.go b/x/auth/types/genesis_test.go index b4aa361cfb8f..16545c39f726 100644 --- a/x/auth/types/genesis_test.go +++ b/x/auth/types/genesis_test.go @@ -7,14 +7,13 @@ import ( "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/require" - "cosmossdk.io/x/auth" - "cosmossdk.io/x/auth/types" - codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/auth" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestSanitize(t *testing.T) { diff --git a/x/auth/types/params_test.go b/x/auth/types/params_test.go index 8f6684403297..587778e1f3d9 100644 --- a/x/auth/types/params_test.go +++ b/x/auth/types/params_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" - "cosmossdk.io/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestParamsEqual(t *testing.T) { diff --git a/x/auth/types/query.pb.go b/x/auth/types/query.pb.go index cec5068645cc..b127caf89b2a 100644 --- a/x/auth/types/query.pb.go +++ b/x/auth/types/query.pb.go @@ -958,79 +958,79 @@ func init() { func init() { proto.RegisterFile("cosmos/auth/v1beta1/query.proto", fileDescriptor_c451370b3929a27c) } var fileDescriptor_c451370b3929a27c = []byte{ - // 1143 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0xcd, 0x6f, 0x1b, 0x45, - 0x14, 0xf7, 0xa6, 0xa1, 0x49, 0x5f, 0xd2, 0x54, 0x8c, 0x5d, 0x11, 0x36, 0xa9, 0x6d, 0x6d, 0x21, - 0x5f, 0xd4, 0xbb, 0xf5, 0x47, 0x53, 0x88, 0xc4, 0x21, 0x2b, 0xd4, 0x2a, 0x42, 0x20, 0x77, 0x5b, - 0x41, 0xe9, 0xc5, 0x5a, 0x67, 0xd7, 0xce, 0xaa, 0xf5, 0xae, 0xeb, 0x5d, 0xa3, 0x9a, 0xc8, 0x02, - 0x21, 0x21, 0xf5, 0xc0, 0x01, 0x09, 0x6e, 0x5c, 0xf2, 0x27, 0x70, 0xb0, 0xc4, 0x01, 0x6e, 0x70, - 0x28, 0x39, 0x55, 0xe1, 0x82, 0x38, 0x20, 0x94, 0x20, 0xc1, 0x9f, 0x81, 0x3c, 0xf3, 0xf6, 0xc3, - 0xf1, 0xd8, 0xde, 0xb4, 0xb7, 0xf5, 0xcc, 0x7b, 0xbf, 0xf7, 0xfb, 0xbd, 0x79, 0xf3, 0xde, 0x18, - 0x32, 0xbb, 0x8e, 0xdb, 0x70, 0x5c, 0x45, 0x6f, 0x7b, 0x7b, 0xca, 0xa7, 0xf9, 0xaa, 0xe9, 0xe9, - 0x79, 0xe5, 0x71, 0xdb, 0x6c, 0x75, 0xe4, 0x66, 0xcb, 0xf1, 0x1c, 0x92, 0x64, 0x06, 0x72, 0xdf, - 0x40, 0x46, 0x03, 0x71, 0x03, 0xbd, 0xaa, 0xba, 0x6b, 0x32, 0xeb, 0xc0, 0xb7, 0xa9, 0xd7, 0x2d, - 0x5b, 0xf7, 0x2c, 0xc7, 0x66, 0x00, 0x62, 0xaa, 0xee, 0xd4, 0x1d, 0xfa, 0xa9, 0xf4, 0xbf, 0x70, - 0xf5, 0xf5, 0xba, 0xe3, 0xd4, 0x1f, 0x99, 0x0a, 0xfd, 0x55, 0x6d, 0xd7, 0x14, 0xdd, 0xc6, 0x88, - 0xe2, 0x32, 0x6e, 0xe9, 0x4d, 0x4b, 0xd1, 0x6d, 0xdb, 0xf1, 0x28, 0x9a, 0x8b, 0xbb, 0x69, 0x1e, - 0x61, 0x4a, 0x0e, 0x81, 0xd9, 0x7e, 0x85, 0x45, 0x44, 0xf2, 0x6c, 0x6b, 0x09, 0x5d, 0x7d, 0xc2, - 0x51, 0x9d, 0x92, 0x0b, 0xa9, 0x3b, 0xfd, 0x9f, 0xdb, 0xbb, 0xbb, 0x4e, 0xdb, 0xf6, 0x5c, 0xcd, - 0x7c, 0xdc, 0x36, 0x5d, 0x8f, 0xdc, 0x02, 0x08, 0x25, 0x2d, 0x0a, 0x59, 0x61, 0x6d, 0xae, 0xb0, - 0x22, 0x23, 0x6e, 0x5f, 0xbf, 0xcc, 0x50, 0x90, 0x8a, 0x5c, 0xd6, 0xeb, 0x26, 0xfa, 0x6a, 0x11, - 0xcf, 0xad, 0xe4, 0x51, 0x2f, 0x77, 0x89, 0xb9, 0xe5, 0x5c, 0xe3, 0x61, 0xf6, 0xba, 0x5c, 0x2a, - 0x4a, 0xbf, 0x09, 0x70, 0xf9, 0x54, 0x54, 0xb7, 0xe9, 0xd8, 0xae, 0x49, 0x34, 0x98, 0xd5, 0x71, - 0x6d, 0x51, 0xc8, 0x9e, 0x5b, 0x9b, 0x2b, 0xa4, 0x64, 0x96, 0x17, 0xd9, 0x4f, 0x99, 0xbc, 0x6d, - 0x77, 0xd4, 0xec, 0x61, 0x2f, 0xb7, 0xcc, 0x39, 0x22, 0x19, 0x11, 0x77, 0xb4, 0x00, 0x87, 0xdc, - 0x1e, 0x90, 0x32, 0x45, 0xa5, 0xac, 0x4e, 0x94, 0xc2, 0x08, 0x4d, 0xd2, 0x72, 0x53, 0xba, 0x0b, - 0xc9, 0xa8, 0x14, 0x3f, 0x7f, 0x05, 0x98, 0xd1, 0x0d, 0xa3, 0x65, 0xba, 0x2e, 0x4d, 0xde, 0x05, - 0x75, 0xf1, 0xa8, 0x97, 0x4b, 0x61, 0xd0, 0x6d, 0xb6, 0x73, 0xd7, 0x6b, 0x59, 0x76, 0x5d, 0xf3, - 0x0d, 0xb7, 0x66, 0x9f, 0x1e, 0x64, 0x12, 0xff, 0x1d, 0x64, 0x12, 0xd2, 0xde, 0xe0, 0xa9, 0x04, - 0xe9, 0x29, 0xc3, 0x0c, 0xca, 0xc2, 0x23, 0x79, 0xd1, 0xec, 0xf8, 0x30, 0x52, 0x0a, 0x08, 0x8d, - 0x54, 0xd6, 0x5b, 0x7a, 0xc3, 0x3f, 0x7d, 0xa9, 0x8c, 0xa2, 0xfc, 0x55, 0x0c, 0xff, 0x0e, 0x9c, - 0x6f, 0xd2, 0x15, 0x8c, 0xbe, 0x24, 0xf3, 0x82, 0x30, 0x27, 0x75, 0xfa, 0xd9, 0x5f, 0x99, 0x84, - 0x86, 0x0e, 0x52, 0x1e, 0x44, 0x8a, 0xf8, 0x81, 0x63, 0xb4, 0x1f, 0x99, 0xa7, 0xaa, 0x8d, 0x97, - 0xd9, 0x4d, 0xe9, 0x6b, 0x01, 0x96, 0xb8, 0x3e, 0xc8, 0xe6, 0x7e, 0xcc, 0x5a, 0x59, 0x39, 0xec, - 0xe5, 0x24, 0x1e, 0xd1, 0x01, 0xdc, 0x48, 0xc5, 0xf0, 0xe9, 0xdc, 0x80, 0xcc, 0x30, 0x1b, 0xb5, - 0xf3, 0xa1, 0xde, 0xf0, 0x0b, 0x9f, 0x10, 0x98, 0xb6, 0xf5, 0x86, 0xc9, 0x4e, 0x5c, 0xa3, 0xdf, - 0xd2, 0x67, 0x90, 0x1d, 0xed, 0x86, 0x4a, 0x3e, 0x8a, 0x77, 0xac, 0x71, 0x85, 0x04, 0x87, 0xbb, - 0x01, 0x49, 0xd5, 0xdc, 0xdd, 0x2b, 0x16, 0xca, 0x2d, 0xb3, 0x66, 0x3d, 0x19, 0x9b, 0xed, 0x32, - 0xa4, 0x06, 0x6d, 0x91, 0xdb, 0x55, 0xb8, 0x58, 0xa5, 0xeb, 0x95, 0x26, 0xdd, 0x40, 0x71, 0xf3, - 0xd5, 0x88, 0x31, 0x1f, 0xf1, 0x63, 0x58, 0xc2, 0x42, 0x57, 0x3b, 0x9e, 0xe9, 0xde, 0x73, 0xb0, - 0xde, 0x31, 0x59, 0x57, 0xe1, 0x22, 0x16, 0x7e, 0xa5, 0xda, 0xdf, 0xa7, 0xc0, 0xf3, 0xda, 0xbc, - 0x1e, 0xf1, 0xe1, 0x03, 0x3f, 0x80, 0x65, 0x3e, 0x30, 0x52, 0x7e, 0x13, 0x16, 0x7c, 0x64, 0x97, - 0xee, 0x20, 0x67, 0x3f, 0x1e, 0x33, 0xe7, 0x63, 0x7f, 0x12, 0x90, 0x66, 0x56, 0xf7, 0x1c, 0x1a, - 0xc3, 0x27, 0xfd, 0x32, 0xd0, 0xf7, 0x03, 0xda, 0xa7, 0xa0, 0xc3, 0x4c, 0xbf, 0x60, 0x42, 0x3e, - 0x87, 0x74, 0xb4, 0x5d, 0x04, 0xc9, 0xd9, 0x79, 0x2f, 0xac, 0xcc, 0x29, 0xcb, 0xa0, 0x80, 0xe7, - 0xd4, 0xa9, 0x45, 0x41, 0x9b, 0xb2, 0x0c, 0x52, 0x00, 0xc0, 0x42, 0xa9, 0x58, 0x06, 0xed, 0x8b, - 0xd3, 0x6a, 0xf2, 0xcf, 0xe1, 0x16, 0xa7, 0x5d, 0x40, 0xb3, 0x1d, 0x63, 0xeb, 0xf2, 0x51, 0x2f, - 0xf7, 0xea, 0xa9, 0xf0, 0x72, 0x41, 0xda, 0xc7, 0xbb, 0xc1, 0x23, 0x80, 0xea, 0xb6, 0xe1, 0x92, - 0x1f, 0x2d, 0x6e, 0x63, 0x5c, 0xd0, 0x07, 0xe0, 0x46, 0x05, 0xaf, 0xc2, 0x6b, 0xd1, 0xe0, 0x3b, - 0x76, 0xcd, 0x79, 0x99, 0x2e, 0xcc, 0xed, 0xf2, 0x26, 0x2c, 0x0e, 0xc7, 0x40, 0x65, 0x25, 0x98, - 0xb6, 0xec, 0x9a, 0x83, 0x57, 0x37, 0xcb, 0xed, 0x89, 0xaa, 0xee, 0xfa, 0xf7, 0x53, 0xa3, 0xd6, - 0xdc, 0x30, 0x85, 0x2f, 0x16, 0xe0, 0x15, 0x1a, 0x87, 0x1c, 0x08, 0x30, 0xeb, 0x77, 0x3c, 0xb2, - 0xce, 0xc5, 0xe4, 0xcd, 0x6d, 0x71, 0x23, 0x8e, 0x29, 0x23, 0x2e, 0xbd, 0x7b, 0x38, 0x3c, 0x9b, - 0x9f, 0xfe, 0xfb, 0xc3, 0x86, 0xf0, 0xe5, 0xef, 0xff, 0x7c, 0x3b, 0x95, 0x21, 0x57, 0x14, 0xee, - 0xa3, 0xc3, 0x67, 0xf5, 0x9d, 0x00, 0x33, 0x88, 0x49, 0xd6, 0x26, 0x86, 0xf5, 0x09, 0xae, 0xc7, - 0xb0, 0x44, 0x7e, 0xa5, 0x90, 0xcc, 0x3a, 0x59, 0x1d, 0x4b, 0x46, 0xd9, 0xc7, 0xe3, 0xeb, 0x92, - 0x23, 0x01, 0xc8, 0x70, 0x1d, 0x92, 0xe2, 0xc4, 0xb8, 0xc3, 0xd7, 0x46, 0x2c, 0x9d, 0xcd, 0x09, - 0x79, 0xdf, 0x39, 0xe4, 0xd5, 0x69, 0x28, 0x26, 0x4f, 0x14, 0xbe, 0x98, 0xe0, 0xf6, 0x57, 0x2c, - 0x43, 0xd9, 0x0f, 0x2f, 0x67, 0x97, 0x7c, 0x25, 0xc0, 0x79, 0x36, 0x57, 0xc9, 0xea, 0x68, 0x4e, - 0x03, 0x43, 0x5c, 0x5c, 0x9b, 0x6c, 0x88, 0x84, 0xd7, 0x42, 0x6e, 0x57, 0xc8, 0x12, 0x97, 0x1b, - 0x1b, 0xe3, 0xe4, 0x27, 0x01, 0x16, 0x06, 0xc7, 0x31, 0x51, 0x46, 0x87, 0xe1, 0x0e, 0x7b, 0xf1, - 0x7a, 0x7c, 0x07, 0xe4, 0x77, 0x6b, 0x42, 0x42, 0x57, 0xc8, 0x1b, 0x5c, 0xd2, 0x0d, 0x0a, 0x57, - 0x09, 0x2a, 0xf6, 0x67, 0x01, 0x92, 0x9c, 0x39, 0x4c, 0x4a, 0x31, 0x19, 0x0d, 0x4c, 0x7b, 0xf1, - 0xc6, 0x19, 0xbd, 0x50, 0xcc, 0xdb, 0x21, 0xef, 0x1c, 0x79, 0x2b, 0x0e, 0x6f, 0x65, 0xbf, 0xff, - 0x92, 0xe8, 0x92, 0xef, 0x05, 0x98, 0x8f, 0xce, 0xe8, 0x11, 0xb7, 0x8e, 0x33, 0xf2, 0x47, 0xdc, - 0x3a, 0xde, 0xc0, 0x97, 0x36, 0x87, 0xbb, 0xc2, 0xe6, 0xd8, 0xd2, 0x60, 0x2f, 0x01, 0xf2, 0x8b, - 0x00, 0x29, 0xde, 0x58, 0x26, 0xfc, 0xf3, 0x1e, 0xf3, 0x34, 0x10, 0xf3, 0x67, 0xf0, 0x88, 0x94, - 0x08, 0x97, 0xf5, 0xa8, 0x1c, 0x33, 0xd6, 0x41, 0xdf, 0x60, 0x23, 0xb7, 0x4b, 0x7e, 0x0d, 0x55, - 0x0c, 0x4c, 0xe9, 0xf1, 0x2a, 0x78, 0x6f, 0x85, 0xf1, 0x2a, 0xb8, 0x4f, 0x00, 0xe9, 0xf6, 0x28, - 0x15, 0x32, 0xb9, 0x16, 0x4b, 0x05, 0x7b, 0x94, 0x74, 0xc9, 0x8f, 0x02, 0xcc, 0x45, 0x66, 0x15, - 0xb9, 0x36, 0xb1, 0x91, 0x45, 0xc6, 0xa6, 0x98, 0x8b, 0x69, 0x8d, 0xac, 0xdf, 0x1f, 0x66, 0x7d, - 0x73, 0x72, 0x91, 0x07, 0xed, 0xcd, 0xae, 0x39, 0x61, 0xfb, 0x56, 0x8b, 0xcf, 0x8e, 0xd3, 0xc2, - 0xf3, 0xe3, 0xb4, 0xf0, 0xf7, 0x71, 0x5a, 0xf8, 0xe6, 0x24, 0x9d, 0x78, 0x7e, 0x92, 0x4e, 0xfc, - 0x71, 0x92, 0x4e, 0x3c, 0xc0, 0xbf, 0xb8, 0xae, 0xf1, 0x50, 0xb6, 0x1c, 0xe5, 0x09, 0x43, 0xf3, - 0x3a, 0x4d, 0xd3, 0xad, 0x9e, 0xa7, 0xef, 0xe4, 0xe2, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf9, - 0xa5, 0x31, 0xbf, 0xd7, 0x0f, 0x00, 0x00, + // 1148 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xf6, 0xa6, 0xa1, 0x49, 0x5f, 0xd2, 0x54, 0x8c, 0x5d, 0x11, 0xd6, 0xa9, 0x6d, 0x6d, 0x21, + 0x71, 0x42, 0xbd, 0x5b, 0x3b, 0x6e, 0x0a, 0x91, 0x38, 0x64, 0x41, 0xad, 0x22, 0x04, 0x72, 0xb7, + 0x15, 0x94, 0x5e, 0xac, 0xb5, 0xbd, 0x76, 0x56, 0xd4, 0xbb, 0xae, 0x77, 0x8d, 0x6a, 0x22, 0x0b, + 0x84, 0x84, 0xd4, 0x03, 0x07, 0x24, 0xb8, 0x71, 0xc9, 0x9f, 0xc0, 0xc1, 0x12, 0x07, 0xb8, 0xc1, + 0xa1, 0xe4, 0x54, 0x85, 0x0b, 0xe2, 0x80, 0x50, 0x82, 0x04, 0x7f, 0x06, 0xf2, 0xcc, 0xdb, 0x1f, + 0x8e, 0xc7, 0xf6, 0xa6, 0xbd, 0xed, 0xce, 0xbc, 0xf7, 0xbd, 0xef, 0x7b, 0xf3, 0xe6, 0xbd, 0x81, + 0x74, 0xd5, 0x76, 0x9a, 0xb6, 0xa3, 0xe8, 0x1d, 0x77, 0x4f, 0xf9, 0x34, 0x5f, 0x31, 0x5c, 0x3d, + 0xaf, 0x3c, 0xea, 0x18, 0xed, 0xae, 0xdc, 0x6a, 0xdb, 0xae, 0x4d, 0xe2, 0xcc, 0x40, 0x1e, 0x18, + 0xc8, 0x68, 0x20, 0x6e, 0xa0, 0x57, 0x45, 0x77, 0x0c, 0x66, 0xed, 0xfb, 0xb6, 0xf4, 0x86, 0x69, + 0xe9, 0xae, 0x69, 0x5b, 0x0c, 0x40, 0x4c, 0x34, 0xec, 0x86, 0x4d, 0x3f, 0x95, 0xc1, 0x17, 0xae, + 0xbe, 0xda, 0xb0, 0xed, 0xc6, 0x43, 0x43, 0xa1, 0x7f, 0x95, 0x4e, 0x5d, 0xd1, 0x2d, 0x8c, 0x28, + 0xae, 0xe0, 0x96, 0xde, 0x32, 0x15, 0xdd, 0xb2, 0x6c, 0x97, 0xa2, 0x39, 0xb8, 0x9b, 0xe2, 0x11, + 0xa6, 0xe4, 0x10, 0x98, 0xed, 0x97, 0x59, 0x44, 0x24, 0xcf, 0xb6, 0x92, 0xe8, 0xea, 0x11, 0x0e, + 0xeb, 0x94, 0x1c, 0x48, 0xdc, 0x19, 0xfc, 0xee, 0x54, 0xab, 0x76, 0xc7, 0x72, 0x1d, 0xcd, 0x78, + 0xd4, 0x31, 0x1c, 0x97, 0xdc, 0x02, 0x08, 0x24, 0x2d, 0x0b, 0x19, 0x21, 0xbb, 0x50, 0x58, 0x95, + 0x11, 0x77, 0xa0, 0x5f, 0x66, 0x28, 0x48, 0x45, 0x2e, 0xe9, 0x0d, 0x03, 0x7d, 0xb5, 0x90, 0xe7, + 0x76, 0xfc, 0xa8, 0x9f, 0xbb, 0xc4, 0xdc, 0x72, 0x4e, 0xed, 0x93, 0xcc, 0x75, 0xb9, 0xb8, 0x29, + 0xfd, 0x26, 0xc0, 0xe5, 0x53, 0x51, 0x9d, 0x96, 0x6d, 0x39, 0x06, 0xd1, 0x60, 0x5e, 0xc7, 0xb5, + 0x65, 0x21, 0x73, 0x2e, 0xbb, 0x50, 0x48, 0xc8, 0x2c, 0x2f, 0xb2, 0x97, 0x32, 0x79, 0xc7, 0xea, + 0xaa, 0x99, 0xc3, 0x7e, 0x6e, 0x85, 0x73, 0x44, 0x32, 0x22, 0xee, 0x6a, 0x3e, 0x0e, 0xb9, 0x3d, + 0x24, 0x65, 0x86, 0x4a, 0x59, 0x9b, 0x2a, 0x85, 0x11, 0x9a, 0xa6, 0xe5, 0xa6, 0x74, 0x17, 0xe2, + 0x61, 0x29, 0x5e, 0xfe, 0x0a, 0x30, 0xa7, 0xd7, 0x6a, 0x6d, 0xc3, 0x71, 0x68, 0xf2, 0x2e, 0xa8, + 0xcb, 0x47, 0xfd, 0x5c, 0x02, 0x83, 0xee, 0xb0, 0x9d, 0xbb, 0x6e, 0xdb, 0xb4, 0x1a, 0x9a, 0x67, + 0xb8, 0x3d, 0xff, 0xe4, 0x20, 0x1d, 0xfb, 0xef, 0x20, 0x1d, 0x93, 0xf6, 0x86, 0x4f, 0xc5, 0x4f, + 0x4f, 0x09, 0xe6, 0x50, 0x16, 0x1e, 0xc9, 0xf3, 0x66, 0xc7, 0x83, 0x91, 0x12, 0x40, 0x68, 0xa4, + 0x92, 0xde, 0xd6, 0x9b, 0xde, 0xe9, 0x4b, 0x25, 0x14, 0xe5, 0xad, 0x62, 0xf8, 0xb7, 0xe0, 0x7c, + 0x8b, 0xae, 0x60, 0xf4, 0xa4, 0xcc, 0x0b, 0xc2, 0x9c, 0xd4, 0xd9, 0xa7, 0x7f, 0xa5, 0x63, 0x1a, + 0x3a, 0x48, 0x79, 0x10, 0x29, 0xe2, 0xfb, 0x76, 0xad, 0xf3, 0xd0, 0x38, 0x55, 0x6d, 0xbc, 0xcc, + 0x6e, 0x49, 0x5f, 0x0b, 0x90, 0xe4, 0xfa, 0x20, 0x9b, 0xfb, 0x11, 0x6b, 0x65, 0xf5, 0xb0, 0x9f, + 0x93, 0x78, 0x44, 0x87, 0x70, 0x43, 0x15, 0xc3, 0xa7, 0x73, 0x03, 0xd2, 0xa3, 0x6c, 0xd4, 0xee, + 0x07, 0x7a, 0xd3, 0x2b, 0x7c, 0x42, 0x60, 0xd6, 0xd2, 0x9b, 0x06, 0x3b, 0x71, 0x8d, 0x7e, 0x4b, + 0x9f, 0x41, 0x66, 0xbc, 0x1b, 0x2a, 0xf9, 0x30, 0xda, 0xb1, 0x46, 0x15, 0xe2, 0x1f, 0xee, 0x06, + 0xc4, 0x55, 0xa3, 0xba, 0xb7, 0x59, 0x28, 0xb5, 0x8d, 0xba, 0xf9, 0x78, 0x62, 0xb6, 0x4b, 0x90, + 0x18, 0xb6, 0x45, 0x6e, 0x57, 0xe1, 0x62, 0x85, 0xae, 0x97, 0x5b, 0x74, 0x03, 0xc5, 0x2d, 0x56, + 0x42, 0xc6, 0x7c, 0xc4, 0x8f, 0x20, 0x89, 0x85, 0xae, 0x76, 0x5d, 0xc3, 0xb9, 0x67, 0x63, 0xbd, + 0x63, 0xb2, 0xae, 0xc2, 0x45, 0x2c, 0xfc, 0x72, 0x65, 0xb0, 0x4f, 0x81, 0x17, 0xb5, 0x45, 0x3d, + 0xe4, 0xc3, 0x07, 0x7e, 0x00, 0x2b, 0x7c, 0x60, 0xa4, 0xfc, 0x3a, 0x2c, 0x79, 0xc8, 0x0e, 0xdd, + 0x41, 0xce, 0x5e, 0x3c, 0x66, 0xce, 0xc7, 0xfe, 0xd8, 0x27, 0xcd, 0xac, 0xee, 0xd9, 0x34, 0x86, + 0x47, 0xfa, 0x45, 0xa0, 0xef, 0xfb, 0xb4, 0x4f, 0x41, 0x07, 0x99, 0x7e, 0xce, 0x84, 0x7c, 0x0e, + 0xa9, 0x70, 0xbb, 0xf0, 0x93, 0xb3, 0xfb, 0x6e, 0x50, 0x99, 0x33, 0x66, 0x8d, 0x02, 0x9e, 0x53, + 0x67, 0x96, 0x05, 0x6d, 0xc6, 0xac, 0x91, 0x02, 0x00, 0x16, 0x4a, 0xd9, 0xac, 0xd1, 0xbe, 0x38, + 0xab, 0xc6, 0xff, 0x1c, 0x6d, 0x71, 0xda, 0x05, 0x34, 0xdb, 0xad, 0x6d, 0x5f, 0x3e, 0xea, 0xe7, + 0x5e, 0x3e, 0x15, 0x5e, 0x2e, 0x48, 0xfb, 0x78, 0x37, 0x78, 0x04, 0x50, 0xdd, 0x0e, 0x5c, 0xf2, + 0xa2, 0x45, 0x6d, 0x8c, 0x4b, 0xfa, 0x10, 0xdc, 0xb8, 0xe0, 0x15, 0x78, 0x25, 0x1c, 0x7c, 0xd7, + 0xaa, 0xdb, 0x2f, 0xd2, 0x85, 0xb9, 0x5d, 0xde, 0x80, 0xe5, 0xd1, 0x18, 0xa8, 0xac, 0x08, 0xb3, + 0xa6, 0x55, 0xb7, 0xf1, 0xea, 0x66, 0xb8, 0x3d, 0x51, 0xd5, 0x1d, 0xef, 0x7e, 0x6a, 0xd4, 0x9a, + 0x1b, 0xa6, 0xf0, 0xc5, 0x12, 0xbc, 0x44, 0xe3, 0x90, 0x03, 0x01, 0xe6, 0xbd, 0x8e, 0x47, 0xd6, + 0xb9, 0x98, 0xbc, 0xb9, 0x2d, 0x6e, 0x44, 0x31, 0x65, 0xc4, 0xa5, 0xb7, 0x0f, 0x47, 0x67, 0xf3, + 0x93, 0x7f, 0x7f, 0xd8, 0x10, 0xbe, 0xfc, 0xfd, 0x9f, 0x6f, 0x67, 0xd2, 0xe4, 0x8a, 0xc2, 0x7d, + 0x74, 0x78, 0xac, 0xbe, 0x13, 0x60, 0x0e, 0x31, 0x49, 0x76, 0x6a, 0x58, 0x8f, 0xe0, 0x7a, 0x04, + 0x4b, 0xe4, 0x57, 0x0c, 0xc8, 0xac, 0x93, 0xb5, 0x89, 0x64, 0x94, 0x7d, 0x3c, 0xbe, 0x1e, 0x39, + 0x12, 0x80, 0x8c, 0xd6, 0x21, 0xd9, 0x9c, 0x1a, 0x77, 0xf4, 0xda, 0x88, 0xc5, 0xb3, 0x39, 0x21, + 0xef, 0x3b, 0x87, 0xbc, 0x3a, 0x0d, 0xc4, 0xe4, 0x89, 0xc2, 0x17, 0xe3, 0xdf, 0xfe, 0xb2, 0x59, + 0x53, 0xf6, 0x83, 0xcb, 0xd9, 0x23, 0x5f, 0x09, 0x70, 0x9e, 0xcd, 0x55, 0xb2, 0x36, 0x9e, 0xd3, + 0xd0, 0x10, 0x17, 0xb3, 0xd3, 0x0d, 0x91, 0x70, 0x36, 0xe0, 0x76, 0x85, 0x24, 0xb9, 0xdc, 0xd8, + 0x18, 0x27, 0x3f, 0x09, 0xb0, 0x34, 0x3c, 0x8e, 0x89, 0x32, 0x3e, 0x0c, 0x77, 0xd8, 0x8b, 0xd7, + 0xa3, 0x3b, 0x20, 0xbf, 0x5b, 0x53, 0x12, 0xba, 0x4a, 0x5e, 0xe3, 0x92, 0x6e, 0x52, 0xb8, 0xb2, + 0x5f, 0xb1, 0x3f, 0x0b, 0x10, 0xe7, 0xcc, 0x61, 0x52, 0x8c, 0xc8, 0x68, 0x68, 0xda, 0x8b, 0x37, + 0xce, 0xe8, 0x85, 0x62, 0xde, 0x0c, 0x78, 0xe7, 0xc8, 0x1b, 0x51, 0x78, 0x2b, 0xfb, 0x83, 0x97, + 0x44, 0x8f, 0x7c, 0x2f, 0xc0, 0x62, 0x78, 0x46, 0x8f, 0xb9, 0x75, 0x9c, 0x91, 0x3f, 0xe6, 0xd6, + 0xf1, 0x06, 0xbe, 0xb4, 0x35, 0xda, 0x15, 0xb6, 0x26, 0x96, 0x06, 0x7b, 0x09, 0x90, 0x5f, 0x04, + 0x48, 0xf0, 0xc6, 0x32, 0xe1, 0x9f, 0xf7, 0x84, 0xa7, 0x81, 0x98, 0x3f, 0x83, 0x47, 0xa8, 0x44, + 0xb8, 0xac, 0xc7, 0xe5, 0x98, 0xb1, 0xf6, 0xfb, 0x06, 0x1b, 0xb9, 0x3d, 0xf2, 0x6b, 0xa0, 0x62, + 0x68, 0x4a, 0x4f, 0x56, 0xc1, 0x7b, 0x2b, 0x4c, 0x56, 0xc1, 0x7d, 0x02, 0x48, 0xb7, 0xc7, 0xa9, + 0x90, 0xc9, 0xb5, 0x48, 0x2a, 0xd8, 0xa3, 0xa4, 0x47, 0x7e, 0x14, 0x60, 0x21, 0x34, 0xab, 0xc8, + 0xb5, 0xa9, 0x8d, 0x2c, 0x34, 0x36, 0xc5, 0x5c, 0x44, 0x6b, 0x64, 0xfd, 0xde, 0x28, 0xeb, 0x9b, + 0xd3, 0x8b, 0xdc, 0x6f, 0x6f, 0x56, 0xdd, 0x0e, 0xda, 0xb7, 0xfa, 0xce, 0xd3, 0xe3, 0x94, 0xf0, + 0xec, 0x38, 0x25, 0xfc, 0x7d, 0x9c, 0x12, 0xbe, 0x39, 0x49, 0xc5, 0x9e, 0x9d, 0xa4, 0x62, 0x7f, + 0x9c, 0xa4, 0x62, 0x0f, 0xd6, 0x1b, 0xa6, 0xbb, 0xd7, 0xa9, 0xc8, 0x55, 0xbb, 0xe9, 0x01, 0x06, + 0x41, 0x95, 0xc7, 0x0c, 0xdd, 0xed, 0xb6, 0x0c, 0xa7, 0x72, 0x9e, 0xbe, 0x9b, 0x37, 0xff, 0x0f, + 0x00, 0x00, 0xff, 0xff, 0xa8, 0x40, 0x30, 0xd4, 0xe7, 0x0f, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/auth/types/tx.pb.go b/x/auth/types/tx.pb.go index 353ef8999a3a..ac7597d04746 100644 --- a/x/auth/types/tx.pb.go +++ b/x/auth/types/tx.pb.go @@ -290,41 +290,42 @@ func init() { func init() { proto.RegisterFile("cosmos/auth/v1beta1/tx.proto", fileDescriptor_c2d62bd9c4c212e5) } var fileDescriptor_c2d62bd9c4c212e5 = []byte{ - // 542 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x41, 0x8f, 0xd2, 0x40, - 0x14, 0x66, 0xdc, 0x5d, 0x0c, 0x83, 0x66, 0xb5, 0x90, 0x2c, 0xb2, 0xa6, 0x62, 0xa3, 0x09, 0x21, - 0x32, 0x5d, 0x58, 0xa3, 0x09, 0x07, 0x13, 0x48, 0x36, 0x9e, 0x30, 0xa6, 0x66, 0x2f, 0x1e, 0x34, - 0x05, 0xc6, 0xb1, 0xd9, 0x6d, 0xa7, 0xe9, 0x1b, 0x56, 0xb8, 0x19, 0x8f, 0x9e, 0x3c, 0xfa, 0x13, - 0x3c, 0x72, 0xe0, 0x47, 0x6c, 0xf6, 0xb4, 0xe1, 0xe4, 0xc9, 0x18, 0x38, 0x70, 0xf1, 0x47, 0x98, - 0xce, 0x4c, 0x25, 0x60, 0x8d, 0x7b, 0x69, 0x3b, 0xf3, 0x7d, 0xef, 0xbd, 0xef, 0xbd, 0xef, 0x15, - 0xdf, 0xed, 0x73, 0xf0, 0x39, 0xd8, 0xee, 0x50, 0xbc, 0xb7, 0xcf, 0x1a, 0x3d, 0x2a, 0xdc, 0x86, - 0x2d, 0x46, 0x24, 0x8c, 0xb8, 0xe0, 0x46, 0x41, 0xa1, 0x24, 0x46, 0x89, 0x46, 0xcb, 0x45, 0xc6, - 0x19, 0x97, 0xb8, 0x1d, 0x7f, 0x29, 0x6a, 0xf9, 0x0e, 0xe3, 0x9c, 0x9d, 0x52, 0x5b, 0x9e, 0x7a, - 0xc3, 0x77, 0xb6, 0x1b, 0x8c, 0x13, 0x48, 0x65, 0x79, 0xab, 0x62, 0x74, 0x4a, 0x05, 0xed, 0xe9, - 0xf2, 0x3e, 0x30, 0xfb, 0xac, 0x11, 0xbf, 0x34, 0x70, 0xdb, 0xf5, 0xbd, 0x80, 0xdb, 0xf2, 0xa9, - 0xaf, 0xcc, 0x34, 0xa9, 0x52, 0x99, 0xc4, 0xad, 0x19, 0xc2, 0xbb, 0x5d, 0x60, 0xc7, 0xe1, 0xc0, - 0x15, 0xf4, 0xa5, 0x1b, 0xb9, 0x3e, 0x18, 0x4f, 0x70, 0x2e, 0x66, 0xf0, 0xc8, 0x13, 0xe3, 0x12, - 0xaa, 0xa0, 0x6a, 0xae, 0x53, 0x9a, 0x4d, 0xeb, 0x45, 0x2d, 0xa2, 0x3d, 0x18, 0x44, 0x14, 0xe0, - 0x95, 0x88, 0xbc, 0x80, 0x39, 0x2b, 0xaa, 0xf1, 0x0c, 0x67, 0x43, 0x99, 0xa1, 0x74, 0xad, 0x82, - 0xaa, 0xf9, 0xe6, 0x3e, 0x49, 0x99, 0x04, 0x51, 0x45, 0x3a, 0xb9, 0xf3, 0x1f, 0xf7, 0x32, 0xdf, - 0x96, 0x93, 0x1a, 0x72, 0x74, 0x54, 0xeb, 0xf9, 0x6c, 0x5a, 0xdf, 0x55, 0x21, 0x75, 0x18, 0x9c, - 0x54, 0x0e, 0xc8, 0xe3, 0xa7, 0x9f, 0x96, 0x93, 0xda, 0xaa, 0xc4, 0xe7, 0xe5, 0xa4, 0x76, 0x7f, - 0xc5, 0xb0, 0x47, 0xaa, 0xaf, 0x8d, 0x06, 0x2c, 0x82, 0xf7, 0x36, 0xae, 0x1c, 0x0a, 0x21, 0x0f, - 0x80, 0xb6, 0x0a, 0x29, 0x35, 0xac, 0xaf, 0x08, 0xdf, 0xea, 0x02, 0x7b, 0xc1, 0x83, 0xb6, 0xe0, - 0xbe, 0xd7, 0x3f, 0x1a, 0xd1, 0xbe, 0x71, 0x80, 0xb3, 0xe0, 0xb1, 0x80, 0x46, 0xff, 0x1d, 0x81, - 0xe6, 0x19, 0x47, 0x78, 0xdb, 0x07, 0x16, 0x77, 0xbf, 0x55, 0xcd, 0x37, 0x8b, 0x44, 0x99, 0x4b, - 0x12, 0x73, 0x49, 0x3b, 0x18, 0x77, 0xf6, 0x2f, 0xa6, 0x75, 0xed, 0x1f, 0xe9, 0xb9, 0x40, 0xff, - 0x8c, 0xa5, 0x0b, 0xcc, 0x91, 0xe1, 0xad, 0x7c, 0xdc, 0xb3, 0xce, 0x69, 0x1d, 0xe3, 0xc2, 0x9a, - 0x2c, 0x87, 0xc2, 0xf0, 0x54, 0x18, 0x45, 0xbc, 0x43, 0xa3, 0x88, 0x6b, 0x6d, 0x8e, 0x3a, 0x18, - 0x55, 0xbc, 0x1d, 0x51, 0x08, 0xf5, 0xf8, 0x53, 0x05, 0x38, 0x92, 0x61, 0xbd, 0xc1, 0xa5, 0xcd, - 0x86, 0x93, 0x11, 0x19, 0x1d, 0x7c, 0x3d, 0x92, 0x55, 0xa0, 0x84, 0x64, 0x27, 0xd5, 0x54, 0x1f, - 0x53, 0x64, 0x39, 0x49, 0x60, 0xf3, 0x17, 0xc2, 0x5b, 0x5d, 0x60, 0xc6, 0x07, 0x7c, 0x63, 0x6d, - 0xb5, 0x1e, 0xa4, 0xa6, 0xda, 0x30, 0xab, 0xfc, 0xe8, 0x2a, 0xac, 0x44, 0xaf, 0x55, 0xb8, 0xf8, - 0xdb, 0x52, 0x83, 0xe2, 0x9b, 0xeb, 0x76, 0x3e, 0xfc, 0x57, 0xce, 0x35, 0x5a, 0xb9, 0x7e, 0x25, - 0x5a, 0x52, 0xbb, 0xbc, 0xf3, 0x31, 0xde, 0xe0, 0xce, 0xe1, 0xf9, 0xdc, 0x44, 0x97, 0x73, 0x13, - 0xfd, 0x9c, 0x9b, 0xe8, 0xcb, 0xc2, 0xcc, 0x5c, 0x2e, 0xcc, 0xcc, 0xf7, 0x85, 0x99, 0x79, 0xad, - 0x7f, 0x63, 0x18, 0x9c, 0x10, 0x8f, 0x27, 0xfb, 0x2a, 0xc6, 0x21, 0x85, 0x5e, 0x56, 0xfa, 0x72, - 0xf8, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xfe, 0x89, 0xaa, 0x66, 0x4e, 0x04, 0x00, 0x00, + // 548 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xcf, 0x8f, 0xd2, 0x40, + 0x14, 0x66, 0xdc, 0x1f, 0x86, 0x41, 0xb3, 0x5a, 0x48, 0x16, 0x59, 0x53, 0xb1, 0xd1, 0x04, 0x89, + 0x4c, 0x17, 0x34, 0x9a, 0x70, 0x30, 0x01, 0xb3, 0xf1, 0x84, 0x31, 0x35, 0x7b, 0xf1, 0xa0, 0x29, + 0x30, 0xce, 0x36, 0x6e, 0x3b, 0x4d, 0xdf, 0xb0, 0xc2, 0xcd, 0x78, 0xf4, 0xe4, 0xd1, 0x3f, 0xc1, + 0x23, 0x07, 0xfe, 0x88, 0xcd, 0x9e, 0x36, 0x9c, 0x3c, 0x19, 0x03, 0x07, 0x2e, 0xfe, 0x11, 0xa6, + 0x33, 0x53, 0x09, 0x6c, 0x8d, 0x7b, 0x69, 0x3b, 0xf3, 0x7d, 0xef, 0xbd, 0xef, 0xbd, 0xef, 0x15, + 0xdf, 0xee, 0x71, 0xf0, 0x39, 0xd8, 0xee, 0x40, 0x1c, 0xd9, 0x27, 0xf5, 0x2e, 0x15, 0x6e, 0xdd, + 0x16, 0x43, 0x12, 0x46, 0x5c, 0x70, 0x23, 0xaf, 0x50, 0x12, 0xa3, 0x44, 0xa3, 0xa5, 0x02, 0xe3, + 0x8c, 0x4b, 0xdc, 0x8e, 0xbf, 0x14, 0xb5, 0x74, 0x8b, 0x71, 0xce, 0x8e, 0xa9, 0x2d, 0x4f, 0xdd, + 0xc1, 0x7b, 0xdb, 0x0d, 0x46, 0x09, 0xa4, 0xb2, 0xbc, 0x53, 0x31, 0x3a, 0xa5, 0x82, 0x76, 0x75, + 0x79, 0x1f, 0x98, 0x7d, 0x52, 0x8f, 0x5f, 0x1a, 0xb8, 0xe9, 0xfa, 0x5e, 0xc0, 0x6d, 0xf9, 0xd4, + 0x57, 0x66, 0x9a, 0x54, 0xa9, 0x4c, 0xe2, 0xd6, 0x14, 0xe1, 0x9d, 0x0e, 0xb0, 0xc3, 0xb0, 0xef, + 0x0a, 0xfa, 0xca, 0x8d, 0x5c, 0x1f, 0x8c, 0x27, 0x38, 0x1b, 0x33, 0x78, 0xe4, 0x89, 0x51, 0x11, + 0x95, 0x51, 0x25, 0xdb, 0x2e, 0x4e, 0x27, 0xb5, 0x82, 0x16, 0xd1, 0xea, 0xf7, 0x23, 0x0a, 0xf0, + 0x5a, 0x44, 0x5e, 0xc0, 0x9c, 0x25, 0xd5, 0x78, 0x86, 0xb7, 0x43, 0x99, 0xa1, 0x78, 0xa5, 0x8c, + 0x2a, 0xb9, 0xc6, 0x1e, 0x49, 0x99, 0x04, 0x51, 0x45, 0xda, 0xd9, 0xd3, 0x9f, 0x77, 0x32, 0xdf, + 0x17, 0xe3, 0x2a, 0x72, 0x74, 0x54, 0xf3, 0xc5, 0x74, 0x52, 0xdb, 0x51, 0x21, 0x35, 0xe8, 0x7f, + 0x28, 0xef, 0x93, 0xc7, 0x4f, 0x3f, 0x2f, 0xc6, 0xd5, 0x65, 0x89, 0x2f, 0x8b, 0x71, 0xf5, 0xee, + 0x92, 0x61, 0x0f, 0x55, 0x5f, 0x6b, 0x0d, 0x58, 0x04, 0xef, 0xae, 0x5d, 0x39, 0x14, 0x42, 0x1e, + 0x00, 0x6d, 0xe6, 0x53, 0x6a, 0x58, 0xdf, 0x10, 0xbe, 0xd1, 0x01, 0xf6, 0x92, 0x07, 0x2d, 0xc1, + 0x7d, 0xaf, 0x77, 0x30, 0xa4, 0x3d, 0x63, 0x1f, 0x6f, 0x83, 0xc7, 0x02, 0x1a, 0xfd, 0x77, 0x04, + 0x9a, 0x67, 0x1c, 0xe0, 0x4d, 0x1f, 0x58, 0xdc, 0xfd, 0x46, 0x25, 0xd7, 0x28, 0x10, 0x65, 0x2e, + 0x49, 0xcc, 0x25, 0xad, 0x60, 0xd4, 0xde, 0x3b, 0x9b, 0xd4, 0xb4, 0x7f, 0xa4, 0xeb, 0x02, 0xfd, + 0x3b, 0x96, 0x0e, 0x30, 0x47, 0x86, 0x37, 0x73, 0x71, 0xcf, 0x3a, 0xa7, 0x75, 0x88, 0xf3, 0x2b, + 0xb2, 0x1c, 0x0a, 0x83, 0x63, 0x61, 0x14, 0xf0, 0x16, 0x8d, 0x22, 0xae, 0xb5, 0x39, 0xea, 0x60, + 0x54, 0xf0, 0x66, 0x44, 0x21, 0xd4, 0xe3, 0x4f, 0x15, 0xe0, 0x48, 0x86, 0xf5, 0x16, 0x17, 0xd7, + 0x1b, 0x4e, 0x46, 0x64, 0xb4, 0xf1, 0xd5, 0x48, 0x56, 0x81, 0x22, 0x92, 0x9d, 0x54, 0x52, 0x7d, + 0x4c, 0x91, 0xe5, 0x24, 0x81, 0x8d, 0xdf, 0x08, 0x6f, 0x74, 0x80, 0x19, 0x1f, 0xf1, 0xb5, 0x95, + 0xd5, 0xba, 0x97, 0x9a, 0x6a, 0xcd, 0xac, 0xd2, 0xc3, 0xcb, 0xb0, 0x12, 0xbd, 0x56, 0xfe, 0xec, + 0xa2, 0xa5, 0x06, 0xc5, 0xd7, 0x57, 0xed, 0xbc, 0xff, 0xaf, 0x9c, 0x2b, 0xb4, 0x52, 0xed, 0x52, + 0xb4, 0xa4, 0x76, 0x69, 0xeb, 0x53, 0xbc, 0xc1, 0xed, 0xe7, 0xa7, 0x33, 0x13, 0x9d, 0xcf, 0x4c, + 0xf4, 0x6b, 0x66, 0xa2, 0xaf, 0x73, 0x33, 0x73, 0x3e, 0x37, 0x33, 0x3f, 0xe6, 0x66, 0xe6, 0xcd, + 0x03, 0xe6, 0x89, 0xa3, 0x41, 0x97, 0xf4, 0xb8, 0xaf, 0x7f, 0x62, 0xfb, 0xe2, 0xfe, 0x8a, 0x51, + 0x48, 0xa1, 0xbb, 0x2d, 0x7d, 0x7a, 0xf4, 0x27, 0x00, 0x00, 0xff, 0xff, 0x4a, 0xdf, 0x75, 0x60, + 0x5e, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/auth/vesting/README.md b/x/auth/vesting/README.md index 7c8e6208fb38..199c4175a981 100644 --- a/x/auth/vesting/README.md +++ b/x/auth/vesting/README.md @@ -582,42 +582,3 @@ according to a custom vesting schedule. Coins in this account can still be used for delegating and for governance votes even while locked. -## CLI - -A user can query and interact with the `vesting` module using the CLI. - -### Transactions - -The `tx` commands allow users to interact with the `vesting` module. - -```bash -simd tx vesting --help -``` - -#### create-periodic-vesting-account - -The `create-periodic-vesting-account` command creates a new vesting account funded with an allocation of tokens, where a sequence of coins and period length in seconds. Periods are sequential, in that the duration of a period only starts at the end of the previous period. The duration of the first period starts upon account creation. - -```bash -simd tx vesting create-periodic-vesting-account [to_address] [periods_json_file] [flags] -``` - -Example: - -```bash -simd tx vesting create-periodic-vesting-account cosmos1.. periods.json -``` - -#### create-vesting-account - -The `create-vesting-account` command creates a new vesting account funded with an allocation of tokens. The account can either be a delayed or continuous vesting account, which is determined by the '--delayed' flag. All vesting accounts created will have their start time set by the committed block's time. The end_time must be provided as a UNIX epoch timestamp. - -```bash -simd tx vesting create-vesting-account [to_address] [amount] [end_time] [flags] -``` - -Example: - -```bash -simd tx vesting create-vesting-account cosmos1.. 100stake 2592000 -``` diff --git a/x/auth/vesting/depinject.go b/x/auth/vesting/depinject.go index c2f346f03207..07812df88145 100644 --- a/x/auth/vesting/depinject.go +++ b/x/auth/vesting/depinject.go @@ -5,8 +5,9 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/depinject" "cosmossdk.io/depinject/appconfig" - "cosmossdk.io/x/auth/keeper" - "cosmossdk.io/x/auth/vesting/types" + + "github.com/cosmos/cosmos-sdk/x/auth/keeper" + "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" ) var _ depinject.OnePerModuleType = AppModule{} diff --git a/x/auth/vesting/module.go b/x/auth/vesting/module.go index fc85b46f9654..5c79520e1857 100644 --- a/x/auth/vesting/module.go +++ b/x/auth/vesting/module.go @@ -4,8 +4,9 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" - "cosmossdk.io/x/auth/keeper" - "cosmossdk.io/x/auth/vesting/types" + + "github.com/cosmos/cosmos-sdk/x/auth/keeper" + "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" ) var _ appmodule.AppModule = AppModule{} diff --git a/x/auth/vesting/proto/cosmos/vesting/module/v1/module.proto b/x/auth/vesting/proto/cosmos/vesting/module/v1/module.proto index c3f406d7a7a5..9de4ee8077ba 100644 --- a/x/auth/vesting/proto/cosmos/vesting/module/v1/module.proto +++ b/x/auth/vesting/proto/cosmos/vesting/module/v1/module.proto @@ -7,6 +7,6 @@ import "cosmos/app/v1alpha1/module.proto"; // Module is the config object of the vesting module. message Module { option (cosmos.app.v1alpha1.module) = { - go_import: "cosmossdk.io/x/auth/vesting" + go_import: "github.com/cosmos/cosmos-sdk/x/auth/vesting" }; -} \ No newline at end of file +} diff --git a/x/auth/vesting/proto/cosmos/vesting/v1beta1/vesting.proto b/x/auth/vesting/proto/cosmos/vesting/v1beta1/vesting.proto index 41249b20461c..64b75641c495 100644 --- a/x/auth/vesting/proto/cosmos/vesting/v1beta1/vesting.proto +++ b/x/auth/vesting/proto/cosmos/vesting/v1beta1/vesting.proto @@ -6,7 +6,7 @@ import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; import "cosmos/auth/v1beta1/auth.proto"; -option go_package = "cosmossdk.io/x/auth/vesting/types"; +option go_package = "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"; // BaseVestingAccount implements the VestingAccount interface. It contains all // the necessary fields needed for any vesting account implementation. diff --git a/x/auth/vesting/testutil/expected_keepers_mocks.go b/x/auth/vesting/testutil/expected_keepers_mocks.go index 3446770eceae..7612d81e200b 100644 --- a/x/auth/vesting/testutil/expected_keepers_mocks.go +++ b/x/auth/vesting/testutil/expected_keepers_mocks.go @@ -8,9 +8,9 @@ import ( context "context" reflect "reflect" + transaction "cosmossdk.io/core/transaction" types "github.com/cosmos/cosmos-sdk/types" gomock "github.com/golang/mock/gomock" - protoiface "google.golang.org/protobuf/runtime/protoiface" ) // MockBankKeeper is a mock of BankKeeper interface. @@ -149,17 +149,17 @@ func (mr *MockAccountsModKeeperMockRecorder) NextAccountNumber(ctx interface{}) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NextAccountNumber", reflect.TypeOf((*MockAccountsModKeeper)(nil).NextAccountNumber), ctx) } -// SendModuleMessageUntyped mocks base method. -func (m *MockAccountsModKeeper) SendModuleMessageUntyped(ctx context.Context, sender []byte, msg protoiface.MessageV1) (protoiface.MessageV1, error) { +// SendModuleMessage mocks base method. +func (m *MockAccountsModKeeper) SendModuleMessage(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SendModuleMessageUntyped", ctx, sender, msg) - ret0, _ := ret[0].(protoiface.MessageV1) + ret := m.ctrl.Call(m, "SendModuleMessage", ctx, sender, msg) + ret0, _ := ret[0].(transaction.Msg) ret1, _ := ret[1].(error) return ret0, ret1 } -// SendModuleMessageUntyped indicates an expected call of SendModuleMessageUntyped. -func (mr *MockAccountsModKeeperMockRecorder) SendModuleMessageUntyped(ctx, sender, msg interface{}) *gomock.Call { +// SendModuleMessage indicates an expected call of SendModuleMessage. +func (mr *MockAccountsModKeeperMockRecorder) SendModuleMessage(ctx, sender, msg interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendModuleMessageUntyped", reflect.TypeOf((*MockAccountsModKeeper)(nil).SendModuleMessageUntyped), ctx, sender, msg) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendModuleMessage", reflect.TypeOf((*MockAccountsModKeeper)(nil).SendModuleMessage), ctx, sender, msg) } diff --git a/x/auth/vesting/types/codec.go b/x/auth/vesting/types/codec.go index 9ebc5a2c46a9..e263124bfd00 100644 --- a/x/auth/vesting/types/codec.go +++ b/x/auth/vesting/types/codec.go @@ -3,13 +3,10 @@ package types import ( corelegacy "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" - coretransaction "cosmossdk.io/core/transaction" - authtypes "cosmossdk.io/x/auth/types" - "cosmossdk.io/x/auth/vesting/exported" - "github.com/cosmos/cosmos-sdk/codec/legacy" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported" ) // RegisterLegacyAminoCodec registers the vesting interfaces and concrete types on the @@ -21,9 +18,6 @@ func RegisterLegacyAminoCodec(cdc corelegacy.Amino) { cdc.RegisterConcrete(&DelayedVestingAccount{}, "cosmos-sdk/DelayedVestingAccount") cdc.RegisterConcrete(&PeriodicVestingAccount{}, "cosmos-sdk/PeriodicVestingAccount") cdc.RegisterConcrete(&PermanentLockedAccount{}, "cosmos-sdk/PermanentLockedAccount") - legacy.RegisterAminoMsg(cdc, &MsgCreateVestingAccount{}, "cosmos-sdk/MsgCreateVestingAccount") - legacy.RegisterAminoMsg(cdc, &MsgCreatePermanentLockedAccount{}, "cosmos-sdk/MsgCreatePermLockedAccount") - legacy.RegisterAminoMsg(cdc, &MsgCreatePeriodicVestingAccount{}, "cosmos-sdk/MsgCreatePeriodVestAccount") } // RegisterInterfaces associates protoName with AccountI and VestingAccount @@ -55,12 +49,4 @@ func RegisterInterfaces(registrar registry.InterfaceRegistrar) { &PeriodicVestingAccount{}, &PermanentLockedAccount{}, ) - - registrar.RegisterImplementations( - (*coretransaction.Msg)(nil), - &MsgCreateVestingAccount{}, - &MsgCreatePermanentLockedAccount{}, - ) - - msgservice.RegisterMsgServiceDesc(registrar, &_Msg_serviceDesc) } diff --git a/x/auth/vesting/types/expected_keepers.go b/x/auth/vesting/types/expected_keepers.go index 59118b466a69..3d8815385d10 100644 --- a/x/auth/vesting/types/expected_keepers.go +++ b/x/auth/vesting/types/expected_keepers.go @@ -3,9 +3,8 @@ package types import ( "context" - "cosmossdk.io/x/auth/types" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) // BankKeeper defines the expected interface contract the vesting module requires diff --git a/x/auth/vesting/types/genesis_test.go b/x/auth/vesting/types/genesis_test.go index 94e9d492fe51..31971396dd8f 100644 --- a/x/auth/vesting/types/genesis_test.go +++ b/x/auth/vesting/types/genesis_test.go @@ -5,10 +5,9 @@ import ( "github.com/stretchr/testify/require" - authtypes "cosmossdk.io/x/auth/types" - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var ( diff --git a/x/auth/vesting/types/msgs.go b/x/auth/vesting/types/msgs.go deleted file mode 100644 index a718bd04e996..000000000000 --- a/x/auth/vesting/types/msgs.go +++ /dev/null @@ -1,43 +0,0 @@ -package types - -import ( - coretransaction "cosmossdk.io/core/transaction" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var ( - _ coretransaction.Msg = &MsgCreateVestingAccount{} - _ coretransaction.Msg = &MsgCreatePermanentLockedAccount{} - _ coretransaction.Msg = &MsgCreatePeriodicVestingAccount{} -) - -// NewMsgCreateVestingAccount returns a reference to a new MsgCreateVestingAccount. -func NewMsgCreateVestingAccount(fromAddr, toAddr sdk.AccAddress, amount sdk.Coins, endTime int64, delayed bool) *MsgCreateVestingAccount { - return &MsgCreateVestingAccount{ - FromAddress: fromAddr.String(), - ToAddress: toAddr.String(), - Amount: amount, - EndTime: endTime, - Delayed: delayed, - } -} - -// NewMsgCreatePermanentLockedAccount returns a reference to a new MsgCreatePermanentLockedAccount. -func NewMsgCreatePermanentLockedAccount(fromAddr, toAddr sdk.AccAddress, amount sdk.Coins) *MsgCreatePermanentLockedAccount { - return &MsgCreatePermanentLockedAccount{ - FromAddress: fromAddr.String(), - ToAddress: toAddr.String(), - Amount: amount, - } -} - -// NewMsgCreatePeriodicVestingAccount returns a reference to a new MsgCreatePeriodicVestingAccount. -func NewMsgCreatePeriodicVestingAccount(fromAddr, toAddr sdk.AccAddress, startTime int64, periods []Period) *MsgCreatePeriodicVestingAccount { - return &MsgCreatePeriodicVestingAccount{ - FromAddress: fromAddr.String(), - ToAddress: toAddr.String(), - StartTime: startTime, - VestingPeriods: periods, - } -} diff --git a/x/auth/vesting/types/tx.pb.go b/x/auth/vesting/types/tx.pb.go deleted file mode 100644 index ec54c961ec33..000000000000 --- a/x/auth/vesting/types/tx.pb.go +++ /dev/null @@ -1,1819 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/vesting/v1beta1/tx.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/cosmos-sdk/types/msgservice" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" - _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// MsgCreateVestingAccount defines a message that enables creating a vesting -// account. -type MsgCreateVestingAccount struct { - FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` - ToAddress string `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty"` - Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` - // end of vesting as unix time (in seconds). - EndTime int64 `protobuf:"varint,4,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` - Delayed bool `protobuf:"varint,5,opt,name=delayed,proto3" json:"delayed,omitempty"` - // start of vesting as unix time (in seconds). - // - // Since 0.51.x - StartTime int64 `protobuf:"varint,6,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` -} - -func (m *MsgCreateVestingAccount) Reset() { *m = MsgCreateVestingAccount{} } -func (m *MsgCreateVestingAccount) String() string { return proto.CompactTextString(m) } -func (*MsgCreateVestingAccount) ProtoMessage() {} -func (*MsgCreateVestingAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_5338ca97811f9792, []int{0} -} -func (m *MsgCreateVestingAccount) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateVestingAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateVestingAccount.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 *MsgCreateVestingAccount) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateVestingAccount.Merge(m, src) -} -func (m *MsgCreateVestingAccount) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateVestingAccount) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateVestingAccount.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateVestingAccount proto.InternalMessageInfo - -func (m *MsgCreateVestingAccount) GetFromAddress() string { - if m != nil { - return m.FromAddress - } - return "" -} - -func (m *MsgCreateVestingAccount) GetToAddress() string { - if m != nil { - return m.ToAddress - } - return "" -} - -func (m *MsgCreateVestingAccount) GetAmount() github_com_cosmos_cosmos_sdk_types.Coins { - if m != nil { - return m.Amount - } - return nil -} - -func (m *MsgCreateVestingAccount) GetEndTime() int64 { - if m != nil { - return m.EndTime - } - return 0 -} - -func (m *MsgCreateVestingAccount) GetDelayed() bool { - if m != nil { - return m.Delayed - } - return false -} - -func (m *MsgCreateVestingAccount) GetStartTime() int64 { - if m != nil { - return m.StartTime - } - return 0 -} - -// MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. -type MsgCreateVestingAccountResponse struct { -} - -func (m *MsgCreateVestingAccountResponse) Reset() { *m = MsgCreateVestingAccountResponse{} } -func (m *MsgCreateVestingAccountResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCreateVestingAccountResponse) ProtoMessage() {} -func (*MsgCreateVestingAccountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5338ca97811f9792, []int{1} -} -func (m *MsgCreateVestingAccountResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateVestingAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateVestingAccountResponse.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 *MsgCreateVestingAccountResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateVestingAccountResponse.Merge(m, src) -} -func (m *MsgCreateVestingAccountResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateVestingAccountResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateVestingAccountResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateVestingAccountResponse proto.InternalMessageInfo - -// MsgCreatePermanentLockedAccount defines a message that enables creating a permanent -// locked account. -// -// Since: cosmos-sdk 0.46 -type MsgCreatePermanentLockedAccount struct { - FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty" yaml:"from_address"` - ToAddress string `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty" yaml:"to_address"` - Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` -} - -func (m *MsgCreatePermanentLockedAccount) Reset() { *m = MsgCreatePermanentLockedAccount{} } -func (m *MsgCreatePermanentLockedAccount) String() string { return proto.CompactTextString(m) } -func (*MsgCreatePermanentLockedAccount) ProtoMessage() {} -func (*MsgCreatePermanentLockedAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_5338ca97811f9792, []int{2} -} -func (m *MsgCreatePermanentLockedAccount) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreatePermanentLockedAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreatePermanentLockedAccount.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 *MsgCreatePermanentLockedAccount) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreatePermanentLockedAccount.Merge(m, src) -} -func (m *MsgCreatePermanentLockedAccount) XXX_Size() int { - return m.Size() -} -func (m *MsgCreatePermanentLockedAccount) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreatePermanentLockedAccount.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreatePermanentLockedAccount proto.InternalMessageInfo - -func (m *MsgCreatePermanentLockedAccount) GetFromAddress() string { - if m != nil { - return m.FromAddress - } - return "" -} - -func (m *MsgCreatePermanentLockedAccount) GetToAddress() string { - if m != nil { - return m.ToAddress - } - return "" -} - -func (m *MsgCreatePermanentLockedAccount) GetAmount() github_com_cosmos_cosmos_sdk_types.Coins { - if m != nil { - return m.Amount - } - return nil -} - -// MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. -// -// Since: cosmos-sdk 0.46 -type MsgCreatePermanentLockedAccountResponse struct { -} - -func (m *MsgCreatePermanentLockedAccountResponse) Reset() { - *m = MsgCreatePermanentLockedAccountResponse{} -} -func (m *MsgCreatePermanentLockedAccountResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCreatePermanentLockedAccountResponse) ProtoMessage() {} -func (*MsgCreatePermanentLockedAccountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5338ca97811f9792, []int{3} -} -func (m *MsgCreatePermanentLockedAccountResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreatePermanentLockedAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreatePermanentLockedAccountResponse.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 *MsgCreatePermanentLockedAccountResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreatePermanentLockedAccountResponse.Merge(m, src) -} -func (m *MsgCreatePermanentLockedAccountResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgCreatePermanentLockedAccountResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreatePermanentLockedAccountResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreatePermanentLockedAccountResponse proto.InternalMessageInfo - -// MsgCreateVestingAccount defines a message that enables creating a vesting -// account. -// -// Since: cosmos-sdk 0.46 -type MsgCreatePeriodicVestingAccount struct { - FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` - ToAddress string `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty"` - // start of vesting as unix time (in seconds). - StartTime int64 `protobuf:"varint,3,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` - VestingPeriods []Period `protobuf:"bytes,4,rep,name=vesting_periods,json=vestingPeriods,proto3" json:"vesting_periods"` -} - -func (m *MsgCreatePeriodicVestingAccount) Reset() { *m = MsgCreatePeriodicVestingAccount{} } -func (m *MsgCreatePeriodicVestingAccount) String() string { return proto.CompactTextString(m) } -func (*MsgCreatePeriodicVestingAccount) ProtoMessage() {} -func (*MsgCreatePeriodicVestingAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_5338ca97811f9792, []int{4} -} -func (m *MsgCreatePeriodicVestingAccount) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreatePeriodicVestingAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreatePeriodicVestingAccount.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 *MsgCreatePeriodicVestingAccount) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreatePeriodicVestingAccount.Merge(m, src) -} -func (m *MsgCreatePeriodicVestingAccount) XXX_Size() int { - return m.Size() -} -func (m *MsgCreatePeriodicVestingAccount) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreatePeriodicVestingAccount.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreatePeriodicVestingAccount proto.InternalMessageInfo - -func (m *MsgCreatePeriodicVestingAccount) GetFromAddress() string { - if m != nil { - return m.FromAddress - } - return "" -} - -func (m *MsgCreatePeriodicVestingAccount) GetToAddress() string { - if m != nil { - return m.ToAddress - } - return "" -} - -func (m *MsgCreatePeriodicVestingAccount) GetStartTime() int64 { - if m != nil { - return m.StartTime - } - return 0 -} - -func (m *MsgCreatePeriodicVestingAccount) GetVestingPeriods() []Period { - if m != nil { - return m.VestingPeriods - } - return nil -} - -// MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount -// response type. -// -// Since: cosmos-sdk 0.46 -type MsgCreatePeriodicVestingAccountResponse struct { -} - -func (m *MsgCreatePeriodicVestingAccountResponse) Reset() { - *m = MsgCreatePeriodicVestingAccountResponse{} -} -func (m *MsgCreatePeriodicVestingAccountResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCreatePeriodicVestingAccountResponse) ProtoMessage() {} -func (*MsgCreatePeriodicVestingAccountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5338ca97811f9792, []int{5} -} -func (m *MsgCreatePeriodicVestingAccountResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreatePeriodicVestingAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreatePeriodicVestingAccountResponse.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 *MsgCreatePeriodicVestingAccountResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreatePeriodicVestingAccountResponse.Merge(m, src) -} -func (m *MsgCreatePeriodicVestingAccountResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgCreatePeriodicVestingAccountResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreatePeriodicVestingAccountResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreatePeriodicVestingAccountResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgCreateVestingAccount)(nil), "cosmos.vesting.v1beta1.MsgCreateVestingAccount") - proto.RegisterType((*MsgCreateVestingAccountResponse)(nil), "cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse") - proto.RegisterType((*MsgCreatePermanentLockedAccount)(nil), "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount") - proto.RegisterType((*MsgCreatePermanentLockedAccountResponse)(nil), "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse") - proto.RegisterType((*MsgCreatePeriodicVestingAccount)(nil), "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount") - proto.RegisterType((*MsgCreatePeriodicVestingAccountResponse)(nil), "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse") -} - -func init() { proto.RegisterFile("cosmos/vesting/v1beta1/tx.proto", fileDescriptor_5338ca97811f9792) } - -var fileDescriptor_5338ca97811f9792 = []byte{ - // 680 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x95, 0xcf, 0x4f, 0xd4, 0x40, - 0x14, 0xc7, 0xb7, 0x94, 0x5f, 0x3b, 0x10, 0x0d, 0x15, 0xa5, 0x6c, 0xa4, 0x5d, 0x1a, 0x8d, 0x2b, - 0x09, 0x6d, 0x40, 0x13, 0x92, 0xc5, 0x84, 0xb0, 0x24, 0x9e, 0x24, 0x31, 0xd5, 0x78, 0xf0, 0xb2, - 0x99, 0x6d, 0xc7, 0x32, 0x81, 0x76, 0x36, 0x9d, 0x81, 0xb0, 0x37, 0xe2, 0xd1, 0x93, 0x37, 0x8d, - 0xf1, 0xe0, 0xd1, 0x78, 0xe2, 0xe0, 0xbf, 0x60, 0xc2, 0x4d, 0xe2, 0xc9, 0x13, 0x1a, 0x38, 0xe0, - 0x99, 0xbf, 0xc0, 0x4c, 0x67, 0xba, 0xee, 0xae, 0x2d, 0x0b, 0x9e, 0xbc, 0x50, 0x76, 0xde, 0xf7, - 0xfb, 0xde, 0xeb, 0xe7, 0xcd, 0x4c, 0x81, 0xe9, 0x11, 0x1a, 0x12, 0xea, 0xec, 0x20, 0xca, 0x70, - 0x14, 0x38, 0x3b, 0x0b, 0x0d, 0xc4, 0xe0, 0x82, 0xc3, 0x76, 0xed, 0x66, 0x4c, 0x18, 0xd1, 0x6e, - 0x08, 0x81, 0x2d, 0x05, 0xb6, 0x14, 0x94, 0x26, 0x03, 0x12, 0x90, 0x44, 0xe2, 0xf0, 0xff, 0x84, - 0xba, 0x64, 0xc8, 0x74, 0x0d, 0x48, 0x51, 0x3b, 0x97, 0x47, 0x70, 0x24, 0xe3, 0xd3, 0x22, 0x5e, - 0x17, 0x46, 0x99, 0x5a, 0x84, 0x6e, 0xe5, 0x74, 0x92, 0x16, 0x16, 0xaa, 0x29, 0xa9, 0x0a, 0x29, - 0x57, 0xf0, 0x87, 0x0c, 0x4c, 0xc0, 0x10, 0x47, 0xc4, 0x49, 0xfe, 0x8a, 0x25, 0xeb, 0xbd, 0x0a, - 0xa6, 0xd6, 0x69, 0xb0, 0x16, 0x23, 0xc8, 0xd0, 0x33, 0x91, 0x66, 0xd5, 0xf3, 0xc8, 0x76, 0xc4, - 0xb4, 0x65, 0x30, 0xfe, 0x22, 0x26, 0x61, 0x1d, 0xfa, 0x7e, 0x8c, 0x28, 0xd5, 0x95, 0xb2, 0x52, - 0x29, 0xd6, 0xf4, 0x6f, 0x9f, 0xe7, 0x27, 0x65, 0x57, 0xab, 0x22, 0xf2, 0x84, 0xc5, 0x38, 0x0a, - 0xdc, 0x31, 0xae, 0x96, 0x4b, 0xda, 0x12, 0x00, 0x8c, 0xb4, 0xad, 0x03, 0x7d, 0xac, 0x45, 0x46, - 0x52, 0x63, 0x0b, 0x0c, 0xc3, 0x90, 0xd7, 0xd7, 0xd5, 0xb2, 0x5a, 0x19, 0x5b, 0x9c, 0xb6, 0xa5, - 0x83, 0xf3, 0x4a, 0xd1, 0xda, 0x6b, 0x04, 0x47, 0xb5, 0x87, 0x07, 0x47, 0x66, 0xe1, 0xd3, 0x0f, - 0xb3, 0x12, 0x60, 0xb6, 0xb1, 0xdd, 0xb0, 0x3d, 0x12, 0x4a, 0x5e, 0xf2, 0x31, 0x4f, 0xfd, 0x4d, - 0x87, 0xb5, 0x9a, 0x88, 0x26, 0x06, 0xfa, 0xee, 0x74, 0x7f, 0x6e, 0x7c, 0x0b, 0x05, 0xd0, 0x6b, - 0xd5, 0x39, 0x71, 0xfa, 0xf1, 0x74, 0x7f, 0x4e, 0x71, 0x65, 0x41, 0x6d, 0x1a, 0x8c, 0xa2, 0xc8, - 0xaf, 0x33, 0x1c, 0x22, 0x7d, 0xb0, 0xac, 0x54, 0x54, 0x77, 0x04, 0x45, 0xfe, 0x53, 0x1c, 0x22, - 0x4d, 0x07, 0x23, 0x3e, 0xda, 0x82, 0x2d, 0xe4, 0xeb, 0x43, 0x65, 0xa5, 0x32, 0xea, 0xa6, 0x3f, - 0xb5, 0x19, 0x00, 0x28, 0x83, 0x31, 0x13, 0xb6, 0xe1, 0xc4, 0x56, 0x4c, 0x56, 0xb8, 0xb1, 0xfa, - 0xe0, 0xd7, 0x07, 0x53, 0x79, 0xc9, 0xeb, 0x76, 0xb2, 0x7c, 0x75, 0xba, 0x3f, 0x67, 0x75, 0xf4, - 0x98, 0x33, 0x02, 0x6b, 0x16, 0x98, 0x39, 0x21, 0x17, 0xd1, 0x26, 0x89, 0x28, 0xb2, 0xbe, 0x0e, - 0x74, 0x68, 0x1e, 0xa3, 0x38, 0x84, 0x11, 0x8a, 0xd8, 0x23, 0xe2, 0x6d, 0x22, 0x3f, 0x9d, 0x64, - 0x35, 0x73, 0x92, 0x53, 0x67, 0x47, 0xe6, 0xb5, 0x16, 0x0c, 0xb7, 0xaa, 0x56, 0x67, 0xd4, 0xea, - 0x1e, 0xe4, 0xfd, 0x8c, 0x41, 0x5e, 0x3f, 0x3b, 0x32, 0x27, 0x84, 0xf3, 0x4f, 0xcc, 0xfa, 0x3f, - 0xa6, 0x58, 0x5d, 0xc9, 0x25, 0x7e, 0x3b, 0x8b, 0x38, 0x47, 0xd6, 0x45, 0xcb, 0xba, 0x0b, 0xee, - 0xf4, 0x01, 0xda, 0x86, 0xff, 0xa6, 0x07, 0x3e, 0x26, 0x3e, 0xf6, 0x7a, 0x8e, 0xd1, 0x6c, 0x16, - 0xfc, 0x6e, 0xc6, 0x33, 0x7f, 0x33, 0xee, 0x84, 0xd9, 0xbd, 0xc5, 0xd4, 0x9e, 0x2d, 0xa6, 0xb9, - 0xe0, 0xaa, 0xbc, 0x00, 0xea, 0xcd, 0xa4, 0x05, 0xaa, 0x0f, 0x26, 0xd0, 0x0d, 0x3b, 0xfb, 0x62, - 0xb2, 0x45, 0xa7, 0xb5, 0x22, 0x27, 0x2f, 0xe0, 0x5d, 0x91, 0x12, 0x11, 0xa1, 0x09, 0xc4, 0xc2, - 0xa5, 0x20, 0x62, 0xe2, 0xf3, 0x17, 0xcf, 0x81, 0x98, 0x01, 0x26, 0x85, 0xb8, 0xf8, 0x45, 0x05, - 0xea, 0x3a, 0x0d, 0xb4, 0x3d, 0x05, 0x4c, 0x66, 0x5e, 0x44, 0x4e, 0xde, 0x7b, 0xe4, 0x9c, 0x8d, - 0xd2, 0xd2, 0x25, 0x0d, 0x69, 0x2b, 0xda, 0x5b, 0x05, 0xdc, 0x3c, 0xf7, 0x24, 0xf5, 0xcf, 0x9c, - 0x6d, 0x2c, 0xad, 0xfc, 0xa3, 0x31, 0xbb, 0xb5, 0xac, 0x7d, 0x76, 0xa1, 0xd6, 0x32, 0x8c, 0x17, - 0x6b, 0xed, 0x9c, 0x01, 0x96, 0x86, 0xf6, 0xf8, 0x1e, 0xaa, 0x2d, 0x1f, 0x1c, 0x1b, 0xca, 0xe1, - 0xb1, 0xa1, 0xfc, 0x3c, 0x36, 0x94, 0xd7, 0x27, 0x46, 0xe1, 0xf0, 0xc4, 0x28, 0x7c, 0x3f, 0x31, - 0x0a, 0xcf, 0x67, 0x45, 0x01, 0xea, 0x6f, 0xda, 0x98, 0x38, 0xbb, 0x0e, 0xdc, 0x66, 0x1b, 0xed, - 0x8f, 0x58, 0x72, 0xb2, 0x1b, 0xc3, 0xc9, 0xf7, 0xe8, 0xde, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x59, 0xc3, 0x58, 0xdb, 0x6d, 0x07, 0x00, 0x00, -} - -func (this *MsgCreateVestingAccount) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*MsgCreateVestingAccount) - if !ok { - that2, ok := that.(MsgCreateVestingAccount) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.FromAddress != that1.FromAddress { - return false - } - if this.ToAddress != that1.ToAddress { - return false - } - if len(this.Amount) != len(that1.Amount) { - return false - } - for i := range this.Amount { - if !this.Amount[i].Equal(&that1.Amount[i]) { - return false - } - } - if this.EndTime != that1.EndTime { - return false - } - if this.Delayed != that1.Delayed { - return false - } - if this.StartTime != that1.StartTime { - return false - } - return true -} -func (this *MsgCreatePermanentLockedAccount) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*MsgCreatePermanentLockedAccount) - if !ok { - that2, ok := that.(MsgCreatePermanentLockedAccount) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.FromAddress != that1.FromAddress { - return false - } - if this.ToAddress != that1.ToAddress { - return false - } - if len(this.Amount) != len(that1.Amount) { - return false - } - for i := range this.Amount { - if !this.Amount[i].Equal(&that1.Amount[i]) { - return false - } - } - return true -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// MsgClient is the client API for Msg service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type MsgClient interface { - // CreateVestingAccount defines a method that enables creating a vesting - // account. - CreateVestingAccount(ctx context.Context, in *MsgCreateVestingAccount, opts ...grpc.CallOption) (*MsgCreateVestingAccountResponse, error) - // CreatePermanentLockedAccount defines a method that enables creating a permanent - // locked account. - // - // Since: cosmos-sdk 0.46 - CreatePermanentLockedAccount(ctx context.Context, in *MsgCreatePermanentLockedAccount, opts ...grpc.CallOption) (*MsgCreatePermanentLockedAccountResponse, error) - // CreatePeriodicVestingAccount defines a method that enables creating a - // periodic vesting account. - // - // Since: cosmos-sdk 0.46 - CreatePeriodicVestingAccount(ctx context.Context, in *MsgCreatePeriodicVestingAccount, opts ...grpc.CallOption) (*MsgCreatePeriodicVestingAccountResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) CreateVestingAccount(ctx context.Context, in *MsgCreateVestingAccount, opts ...grpc.CallOption) (*MsgCreateVestingAccountResponse, error) { - out := new(MsgCreateVestingAccountResponse) - err := c.cc.Invoke(ctx, "/cosmos.vesting.v1beta1.Msg/CreateVestingAccount", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) CreatePermanentLockedAccount(ctx context.Context, in *MsgCreatePermanentLockedAccount, opts ...grpc.CallOption) (*MsgCreatePermanentLockedAccountResponse, error) { - out := new(MsgCreatePermanentLockedAccountResponse) - err := c.cc.Invoke(ctx, "/cosmos.vesting.v1beta1.Msg/CreatePermanentLockedAccount", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) CreatePeriodicVestingAccount(ctx context.Context, in *MsgCreatePeriodicVestingAccount, opts ...grpc.CallOption) (*MsgCreatePeriodicVestingAccountResponse, error) { - out := new(MsgCreatePeriodicVestingAccountResponse) - err := c.cc.Invoke(ctx, "/cosmos.vesting.v1beta1.Msg/CreatePeriodicVestingAccount", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - // CreateVestingAccount defines a method that enables creating a vesting - // account. - CreateVestingAccount(context.Context, *MsgCreateVestingAccount) (*MsgCreateVestingAccountResponse, error) - // CreatePermanentLockedAccount defines a method that enables creating a permanent - // locked account. - // - // Since: cosmos-sdk 0.46 - CreatePermanentLockedAccount(context.Context, *MsgCreatePermanentLockedAccount) (*MsgCreatePermanentLockedAccountResponse, error) - // CreatePeriodicVestingAccount defines a method that enables creating a - // periodic vesting account. - // - // Since: cosmos-sdk 0.46 - CreatePeriodicVestingAccount(context.Context, *MsgCreatePeriodicVestingAccount) (*MsgCreatePeriodicVestingAccountResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) CreateVestingAccount(ctx context.Context, req *MsgCreateVestingAccount) (*MsgCreateVestingAccountResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateVestingAccount not implemented") -} -func (*UnimplementedMsgServer) CreatePermanentLockedAccount(ctx context.Context, req *MsgCreatePermanentLockedAccount) (*MsgCreatePermanentLockedAccountResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreatePermanentLockedAccount not implemented") -} -func (*UnimplementedMsgServer) CreatePeriodicVestingAccount(ctx context.Context, req *MsgCreatePeriodicVestingAccount) (*MsgCreatePeriodicVestingAccountResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreatePeriodicVestingAccount not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_CreateVestingAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCreateVestingAccount) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).CreateVestingAccount(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.vesting.v1beta1.Msg/CreateVestingAccount", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CreateVestingAccount(ctx, req.(*MsgCreateVestingAccount)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_CreatePermanentLockedAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCreatePermanentLockedAccount) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).CreatePermanentLockedAccount(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.vesting.v1beta1.Msg/CreatePermanentLockedAccount", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CreatePermanentLockedAccount(ctx, req.(*MsgCreatePermanentLockedAccount)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_CreatePeriodicVestingAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCreatePeriodicVestingAccount) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).CreatePeriodicVestingAccount(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.vesting.v1beta1.Msg/CreatePeriodicVestingAccount", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CreatePeriodicVestingAccount(ctx, req.(*MsgCreatePeriodicVestingAccount)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosmos.vesting.v1beta1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateVestingAccount", - Handler: _Msg_CreateVestingAccount_Handler, - }, - { - MethodName: "CreatePermanentLockedAccount", - Handler: _Msg_CreatePermanentLockedAccount_Handler, - }, - { - MethodName: "CreatePeriodicVestingAccount", - Handler: _Msg_CreatePeriodicVestingAccount_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "cosmos/vesting/v1beta1/tx.proto", -} - -func (m *MsgCreateVestingAccount) 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 *MsgCreateVestingAccount) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.StartTime != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.StartTime)) - i-- - dAtA[i] = 0x30 - } - if m.Delayed { - i-- - if m.Delayed { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } - if m.EndTime != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.EndTime)) - i-- - dAtA[i] = 0x20 - } - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.ToAddress) > 0 { - i -= len(m.ToAddress) - copy(dAtA[i:], m.ToAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ToAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.FromAddress) > 0 { - i -= len(m.FromAddress) - copy(dAtA[i:], m.FromAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.FromAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgCreateVestingAccountResponse) 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 *MsgCreateVestingAccountResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateVestingAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgCreatePermanentLockedAccount) 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 *MsgCreatePermanentLockedAccount) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreatePermanentLockedAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.ToAddress) > 0 { - i -= len(m.ToAddress) - copy(dAtA[i:], m.ToAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ToAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.FromAddress) > 0 { - i -= len(m.FromAddress) - copy(dAtA[i:], m.FromAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.FromAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgCreatePermanentLockedAccountResponse) 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 *MsgCreatePermanentLockedAccountResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreatePermanentLockedAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgCreatePeriodicVestingAccount) 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 *MsgCreatePeriodicVestingAccount) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreatePeriodicVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.VestingPeriods) > 0 { - for iNdEx := len(m.VestingPeriods) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.VestingPeriods[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if m.StartTime != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.StartTime)) - i-- - dAtA[i] = 0x18 - } - if len(m.ToAddress) > 0 { - i -= len(m.ToAddress) - copy(dAtA[i:], m.ToAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ToAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.FromAddress) > 0 { - i -= len(m.FromAddress) - copy(dAtA[i:], m.FromAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.FromAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgCreatePeriodicVestingAccountResponse) 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 *MsgCreatePeriodicVestingAccountResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreatePeriodicVestingAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgCreateVestingAccount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FromAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ToAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - if m.EndTime != 0 { - n += 1 + sovTx(uint64(m.EndTime)) - } - if m.Delayed { - n += 2 - } - if m.StartTime != 0 { - n += 1 + sovTx(uint64(m.StartTime)) - } - return n -} - -func (m *MsgCreateVestingAccountResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgCreatePermanentLockedAccount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FromAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ToAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgCreatePermanentLockedAccountResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgCreatePeriodicVestingAccount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FromAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ToAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.StartTime != 0 { - n += 1 + sovTx(uint64(m.StartTime)) - } - if len(m.VestingPeriods) > 0 { - for _, e := range m.VestingPeriods { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgCreatePeriodicVestingAccountResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgCreateVestingAccount) 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 ErrIntOverflowTx - } - 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: MsgCreateVestingAccount: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateVestingAccount: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FromAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ToAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ToAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EndTime", wireType) - } - m.EndTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.EndTime |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Delayed", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Delayed = bool(v != 0) - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) - } - m.StartTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartTime |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgCreateVestingAccountResponse) 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 ErrIntOverflowTx - } - 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: MsgCreateVestingAccountResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateVestingAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgCreatePermanentLockedAccount) 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 ErrIntOverflowTx - } - 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: MsgCreatePermanentLockedAccount: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreatePermanentLockedAccount: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FromAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ToAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ToAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgCreatePermanentLockedAccountResponse) 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 ErrIntOverflowTx - } - 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: MsgCreatePermanentLockedAccountResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreatePermanentLockedAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgCreatePeriodicVestingAccount) 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 ErrIntOverflowTx - } - 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: MsgCreatePeriodicVestingAccount: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreatePeriodicVestingAccount: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FromAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ToAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ToAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) - } - m.StartTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartTime |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VestingPeriods", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.VestingPeriods = append(m.VestingPeriods, Period{}) - if err := m.VestingPeriods[len(m.VestingPeriods)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgCreatePeriodicVestingAccountResponse) 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 ErrIntOverflowTx - } - 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: MsgCreatePeriodicVestingAccountResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreatePeriodicVestingAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTx(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTx - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTx - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTx - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/auth/vesting/types/vesting.pb.go b/x/auth/vesting/types/vesting.pb.go index 8914d2985dc0..c5c2a54a8295 100644 --- a/x/auth/vesting/types/vesting.pb.go +++ b/x/auth/vesting/types/vesting.pb.go @@ -4,7 +4,7 @@ package types import ( - types "cosmossdk.io/x/auth/types" + types "github.com/cosmos/cosmos-sdk/x/auth/types" fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types1 "github.com/cosmos/cosmos-sdk/types" diff --git a/x/auth/vesting/types/vesting_account.go b/x/auth/vesting/types/vesting_account.go index e2b8fd40dd9b..868dc49588e7 100644 --- a/x/auth/vesting/types/vesting_account.go +++ b/x/auth/vesting/types/vesting_account.go @@ -6,10 +6,10 @@ import ( "time" "cosmossdk.io/math" - authtypes "cosmossdk.io/x/auth/types" - vestexported "cosmossdk.io/x/auth/vesting/exported" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + vestexported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported" ) // Compile-time type assertions diff --git a/x/auth/vesting/types/vesting_account_test.go b/x/auth/vesting/types/vesting_account_test.go index 502ce29c4ce0..54330978d127 100644 --- a/x/auth/vesting/types/vesting_account_test.go +++ b/x/auth/vesting/types/vesting_account_test.go @@ -11,12 +11,6 @@ import ( "cosmossdk.io/core/header" coretesting "cosmossdk.io/core/testing" storetypes "cosmossdk.io/store/types" - authcodec "cosmossdk.io/x/auth/codec" - "cosmossdk.io/x/auth/keeper" - authtypes "cosmossdk.io/x/auth/types" - "cosmossdk.io/x/auth/vesting" - vestingtestutil "cosmossdk.io/x/auth/vesting/testutil" - "cosmossdk.io/x/auth/vesting/types" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" @@ -25,6 +19,12 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" + "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/auth/vesting" + vestingtestutil "github.com/cosmos/cosmos-sdk/x/auth/vesting/testutil" + "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" ) var ( diff --git a/x/authz/CHANGELOG.md b/x/authz/CHANGELOG.md index cf61dc2da57b..db05ded12f05 100644 --- a/x/authz/CHANGELOG.md +++ b/x/authz/CHANGELOG.md @@ -37,6 +37,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### API Breaking Changes +* [#21044](https://github.com/cosmos/cosmos-sdk/pull/21044) `k.DispatchActions` returns a slice of byte slices of proto marshaled anys instead of a slice of byte slices of `sdk.Result.Data`. * [#20502](https://github.com/cosmos/cosmos-sdk/pull/20502) `Accept` on the `Authorization` interface now expects the authz environment in the `context.Context`. This is already done when `Accept` is called by `k.DispatchActions`, but should be done manually if `Accept` is called directly. * [#19783](https://github.com/cosmos/cosmos-sdk/pull/19783) Removes the use of Accounts String() method * `NewMsgExec`, `NewMsgGrant` and `NewMsgRevoke` now takes strings as arguments instead of `sdk.AccAddress`. diff --git a/x/authz/client/cli/tx.go b/x/authz/client/cli/tx.go index e90d9a5b28b5..370069052f47 100644 --- a/x/authz/client/cli/tx.go +++ b/x/authz/client/cli/tx.go @@ -8,7 +8,6 @@ import ( "github.com/spf13/cobra" - authclient "cosmossdk.io/x/auth/client" "cosmossdk.io/x/authz" bank "cosmossdk.io/x/bank/types" staking "cosmossdk.io/x/staking/types" @@ -18,6 +17,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" + authclient "github.com/cosmos/cosmos-sdk/x/auth/client" ) // Flag names and values @@ -58,7 +58,7 @@ func GetTxCmd() *cobra.Command { // but it will be removed in future versions. func NewCmdExecAuthorization() *cobra.Command { cmd := &cobra.Command{ - Use: "legacy-exec [tx-json-file] --from [grantee]", + Use: "legacy-exec --from ", Short: "Execute tx on behalf of granter account. Deprecated, use exec instead.", Example: fmt.Sprintf("$ %s tx authz exec tx.json --from grantee\n $ %[1]s tx bank send [granter] [recipient] [amount] --generate-only tx.json && %[1]s tx authz exec tx.json --from grantee", version.AppName), Args: cobra.ExactArgs(1), @@ -95,7 +95,7 @@ func NewCmdExecAuthorization() *cobra.Command { // Migrating this command to AutoCLI is possible but would be CLI breaking. func NewCmdGrantAuthorization() *cobra.Command { cmd := &cobra.Command{ - Use: "grant [grantee] --from [granter]", + Use: "grant --from ", Short: "Grant authorization to an address", Long: fmt.Sprintf(`create a new grant authorization to an address to execute a transaction on your behalf: Examples: diff --git a/x/authz/go.mod b/x/authz/go.mod index 118005d446ca..d9a1d264ecdd 100644 --- a/x/authz/go.mod +++ b/x/authz/go.mod @@ -1,10 +1,10 @@ module cosmossdk.io/x/authz -go 1.22.2 +go 1.23 require ( cosmossdk.io/api v0.7.5 - cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 + cosmossdk.io/core v1.0.0 cosmossdk.io/depinject v1.0.0 cosmossdk.io/errors v1.0.1 cosmossdk.io/math v1.3.0 @@ -22,8 +22,8 @@ require ( github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 - google.golang.org/grpc v1.65.0 + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 + google.golang.org/grpc v1.66.0 google.golang.org/protobuf v1.34.2 ) @@ -31,7 +31,6 @@ require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 - cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect @@ -50,12 +49,12 @@ require ( github.com/cometbft/cometbft-db v0.12.0 // indirect github.com/cometbft/cometbft/api v1.0.0-rc.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-db v1.0.2 // indirect + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 // indirect github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -101,7 +100,7 @@ require ( github.com/iancoleman/strcase v0.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect @@ -116,13 +115,13 @@ require ( github.com/mtibben/percent v0.2.1 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -158,7 +157,7 @@ require ( golang.org/x/text v0.17.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect @@ -166,16 +165,18 @@ require ( sigs.k8s.io/yaml v1.4.0 // indirect ) -require cosmossdk.io/log v1.4.0 +require cosmossdk.io/log v1.4.1 require ( buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect - cosmossdk.io/schema v0.1.1 // indirect + cosmossdk.io/schema v0.2.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect ) replace github.com/cosmos/cosmos-sdk => ../../. +replace github.com/cosmos/iavl => github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e + // TODO remove post spinning out all modules replace ( cosmossdk.io/api => ../../api @@ -183,8 +184,6 @@ replace ( cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing cosmossdk.io/store => ../../store - cosmossdk.io/x/accounts => ../accounts - cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank cosmossdk.io/x/consensus => ../consensus cosmossdk.io/x/staking => ../staking diff --git a/x/authz/go.sum b/x/authz/go.sum index cbbf5697fba5..7c1f771aabec 100644 --- a/x/authz/go.sum +++ b/x/authz/go.sum @@ -8,12 +8,12 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= -cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= +cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk= +cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= @@ -98,8 +98,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/crypto v0.1.2 h1:Yn500sPY+9sKVdhiPUSDtt8JOpBGMB515dOmla4zfls= @@ -111,10 +111,10 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e h1:LEii0v/FxtXa/F7mRn+tijZ0zaXBPn2ZkKwb6Qm4rqE= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e/go.mod h1:3ywr0wDnWeD7MUH6qu50wZ5bxuKH3LBrGG4/lZX8lVY= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -307,8 +307,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -318,6 +318,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -383,8 +385,8 @@ github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4 github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba h1:3jPgmsFGBID1wFfU2AbYocNcN4wqU68UaHSdMjiw/7U= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= @@ -401,8 +403,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -411,8 +413,8 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -468,7 +470,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -500,6 +501,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= @@ -635,10 +638,10 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEY google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -649,8 +652,8 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/x/authz/keeper/grpc_query.go b/x/authz/keeper/grpc_query.go index 4d73afac4e6c..89cb8ac67d65 100644 --- a/x/authz/keeper/grpc_query.go +++ b/x/authz/keeper/grpc_query.go @@ -48,7 +48,7 @@ func (k Keeper) Grants(ctx context.Context, req *authz.QueryGrantsRequest) (*aut authorizationAny, err := codectypes.NewAnyWithValue(authorization) if err != nil { - return nil, status.Errorf(codes.Internal, err.Error()) + return nil, status.Error(codes.Internal, err.Error()) } return &authz.QueryGrantsResponse{ Grants: []*authz.Grant{{ @@ -70,7 +70,7 @@ func (k Keeper) Grants(ctx context.Context, req *authz.QueryGrantsRequest) (*aut authorizationAny, err := codectypes.NewAnyWithValue(auth1) if err != nil { - return nil, status.Errorf(codes.Internal, err.Error()) + return nil, status.Error(codes.Internal, err.Error()) } return &authz.Grant{ Authorization: authorizationAny, @@ -111,7 +111,7 @@ func (k Keeper) GranterGrants(ctx context.Context, req *authz.QueryGranterGrants any, err := codectypes.NewAnyWithValue(auth1) if err != nil { - return nil, status.Errorf(codes.Internal, err.Error()) + return nil, status.Error(codes.Internal, err.Error()) } grantee := firstAddressFromGrantStoreKey(key) @@ -166,7 +166,7 @@ func (k Keeper) GranteeGrants(ctx context.Context, req *authz.QueryGranteeGrants authorizationAny, err := codectypes.NewAnyWithValue(auth1) if err != nil { - return nil, status.Errorf(codes.Internal, err.Error()) + return nil, status.Error(codes.Internal, err.Error()) } granterAddr, err := k.authKeeper.AddressCodec().BytesToString(granter) diff --git a/x/authz/keeper/keeper.go b/x/authz/keeper/keeper.go index 4818ca9506f3..ecfed97ee7cf 100644 --- a/x/authz/keeper/keeper.go +++ b/x/authz/keeper/keeper.go @@ -7,6 +7,7 @@ import ( "time" gogoproto "github.com/cosmos/gogoproto/proto" + gogoprotoany "github.com/cosmos/gogoproto/types/any" "cosmossdk.io/core/appmodule" corecontext "cosmossdk.io/core/context" @@ -145,10 +146,20 @@ func (k Keeper) DispatchActions(ctx context.Context, grantee sdk.AccAddress, msg } // no need to use the branch service here, as if the transaction fails, the transaction will be reverted - _, err = k.MsgRouterService.InvokeUntyped(ctx, msg) + resp, err := k.MsgRouterService.Invoke(ctx, msg) if err != nil { return nil, fmt.Errorf("failed to execute message %d; message %v: %w", i, msg, err) } + + msgRespAny, err := gogoprotoany.NewAnyWithCacheWithValue(resp) + if err != nil { + return nil, fmt.Errorf("failed to create any for response %d; message %s: %w", i, gogoproto.MessageName(msg), err) + } + + results[i], err = gogoproto.Marshal(msgRespAny) + if err != nil { + return nil, fmt.Errorf("failed to marshal response %d; message %s: %w", i, gogoproto.MessageName(msg), err) + } } return results, nil @@ -279,8 +290,14 @@ func (k Keeper) DeleteAllGrants(ctx context.Context, granter sdk.AccAddress) err return err } } + + grantAddr, err := k.authKeeper.AddressCodec().BytesToString(granter) + if err != nil { + return err + } + return k.EventService.EventManager(ctx).Emit(&authz.EventRevokeAll{ - Granter: granter.String(), + Granter: grantAddr, }) } diff --git a/x/authz/keeper/keeper_test.go b/x/authz/keeper/keeper_test.go index 72bd049b1c79..dcfd710fc264 100644 --- a/x/authz/keeper/keeper_test.go +++ b/x/authz/keeper/keeper_test.go @@ -4,6 +4,8 @@ import ( "testing" "time" + gogoproto "github.com/cosmos/gogoproto/proto" + gogoprotoany "github.com/cosmos/gogoproto/types/any" "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" @@ -245,12 +247,13 @@ func (s *TestSuite) TestDispatchAction() { a := banktypes.NewSendAuthorization(coins100, nil, s.accountKeeper.AddressCodec()) testCases := []struct { - name string - req authz.MsgExec - expectErr bool - errMsg string - preRun func() sdk.Context - postRun func() + name string + req authz.MsgExec + expectErr bool + errMsg string + expectResp string + preRun func() sdk.Context + postRun func() }{ { "expect error authorization not found", @@ -263,6 +266,7 @@ func (s *TestSuite) TestDispatchAction() { }), true, "authorization not found", + "", func() sdk.Context { // remove any existing authorizations err := s.authzKeeper.DeleteGrant(s.ctx, granteeAddr, granterAddr, bankSendAuthMsgType) @@ -282,6 +286,7 @@ func (s *TestSuite) TestDispatchAction() { }), true, "authorization expired", + "", func() sdk.Context { e := now.AddDate(0, 0, 1) err := s.authzKeeper.SaveGrant(s.ctx, granteeAddr, granterAddr, a, &e) @@ -301,6 +306,7 @@ func (s *TestSuite) TestDispatchAction() { }), true, "requested amount is more than spend limit", + "", func() sdk.Context { e := now.AddDate(0, 1, 0) err := s.authzKeeper.SaveGrant(s.ctx, granteeAddr, granterAddr, a, &e) @@ -320,6 +326,7 @@ func (s *TestSuite) TestDispatchAction() { }), false, "", + "/cosmos.bank.v1beta1.MsgSendResponse", func() sdk.Context { e := now.AddDate(0, 1, 0) err := s.authzKeeper.SaveGrant(s.ctx, granteeAddr, granterAddr, a, &e) @@ -346,6 +353,7 @@ func (s *TestSuite) TestDispatchAction() { }), false, "", + "/cosmos.bank.v1beta1.MsgSendResponse", func() sdk.Context { e := now.AddDate(0, 1, 0) err := s.authzKeeper.SaveGrant(s.ctx, granteeAddr, granterAddr, a, &e) @@ -372,7 +380,15 @@ func (s *TestSuite) TestDispatchAction() { require.Contains(err.Error(), tc.errMsg) } else { require.NoError(err) - require.NotNil(result) + require.NotEmpty(result) + // unmarshal the result + for _, res := range result { + var msgRes gogoprotoany.Any + err := gogoproto.Unmarshal(res, &msgRes) + require.NoError(err) + require.NotNil(msgRes) + require.Equal(msgRes.TypeUrl, tc.expectResp) + } } tc.postRun() }) diff --git a/x/authz/keeper/msg_server_test.go b/x/authz/keeper/msg_server_test.go index ccce5a6f097b..2958e45a9915 100644 --- a/x/authz/keeper/msg_server_test.go +++ b/x/authz/keeper/msg_server_test.go @@ -7,13 +7,13 @@ import ( "cosmossdk.io/core/header" sdkmath "cosmossdk.io/math" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/authz" banktypes "cosmossdk.io/x/bank/types" "github.com/cosmos/cosmos-sdk/codec/address" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) func (suite *TestSuite) createAccounts() []sdk.AccAddress { diff --git a/x/authz/module/abci_test.go b/x/authz/module/abci_test.go index 00fda78e2a53..58811ba6294e 100644 --- a/x/authz/module/abci_test.go +++ b/x/authz/module/abci_test.go @@ -11,7 +11,6 @@ import ( coretesting "cosmossdk.io/core/testing" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/authz" "cosmossdk.io/x/authz/keeper" authzmodule "cosmossdk.io/x/authz/module" @@ -26,6 +25,7 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestExpiredGrantsQueue(t *testing.T) { diff --git a/x/authz/module/autocli.go b/x/authz/module/autocli.go index 9ead5006c1aa..7f68728963fb 100644 --- a/x/authz/module/autocli.go +++ b/x/authz/module/autocli.go @@ -30,7 +30,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "GranterGrants", - Use: "grants-by-granter [granter-addr]", + Use: "grants-by-granter ", Short: "Query authorization grants granted by granter", PositionalArgs: []*autocliv1.PositionalArgDescriptor{ {ProtoField: "granter"}, @@ -38,7 +38,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "GranteeGrants", - Use: "grants-by-grantee [grantee-addr]", + Use: "grants-by-grantee ", Short: "Query authorization grants granted to a grantee", PositionalArgs: []*autocliv1.PositionalArgDescriptor{ {ProtoField: "grantee"}, @@ -52,7 +52,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { RpcMethod: "Exec", - Use: "exec [msg-json-file] --from [grantee]", + Use: "exec --from ", Short: "Execute tx on behalf of granter account", Example: fmt.Sprintf("$ %s tx authz exec msg.json --from grantee\n $ %[1]s tx bank send [granter] [recipient] [amount] --generate-only | jq .body.messages > msg.json && %[1]s tx authz exec msg.json --from grantee", version.AppName), PositionalArgs: []*autocliv1.PositionalArgDescriptor{ @@ -61,7 +61,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "Revoke", - Use: "revoke [grantee] [msg-type-url] --from [granter]", + Use: "revoke --from ", Short: `Revoke authorization from a granter to a grantee`, Example: fmt.Sprintf(`%s tx authz revoke cosmos1skj.. %s --from=cosmos1skj..`, version.AppName, bank.SendAuthorization{}.MsgTypeURL()), @@ -72,13 +72,13 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "RevokeAll", - Use: "revoke-all --from [signer]", + Use: "revoke-all --from ", Short: "Revoke all authorizations from the signer", Example: fmt.Sprintf("%s tx authz revoke-all --from=cosmos1skj..", version.AppName), }, { RpcMethod: "PruneExpiredGrants", - Use: "prune-grants --from [granter]", + Use: "prune-grants --from ", Short: "Prune expired grants", Long: "Prune up to 75 expired grants in order to reduce the size of the store when the number of expired grants is large.", Example: fmt.Sprintf(`$ %s tx authz prune-grants --from [mykey]`, version.AppName), diff --git a/x/authz/msgs_test.go b/x/authz/msgs_test.go index 8675683b5526..0ec52a5ed176 100644 --- a/x/authz/msgs_test.go +++ b/x/authz/msgs_test.go @@ -12,7 +12,6 @@ import ( txv1beta1 "cosmossdk.io/api/cosmos/tx/v1beta1" sdkmath "cosmossdk.io/math" - "cosmossdk.io/x/auth/migrations/legacytx" "cosmossdk.io/x/authz" banktypes "cosmossdk.io/x/bank/types" stakingtypes "cosmossdk.io/x/staking/types" @@ -23,6 +22,7 @@ import ( codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) func TestMsgGrantGetAuthorization(t *testing.T) { diff --git a/x/bank/autocli.go b/x/bank/autocli.go index ead3aa80d811..cb3fc3cd9a48 100644 --- a/x/bank/autocli.go +++ b/x/bank/autocli.go @@ -18,26 +18,26 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { RpcMethod: "Balance", - Use: "balance [address] [denom]", + Use: "balance
", Short: "Query an account balance by address and denom", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}, {ProtoField: "denom"}}, }, { RpcMethod: "AllBalances", - Use: "balances [address]", + Use: "balances
", Short: "Query for account balances by address", Long: "Query the total balance of an account or of a specific denomination.", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}}, }, { RpcMethod: "SpendableBalances", - Use: "spendable-balances [address]", + Use: "spendable-balances
", Short: "Query for account spendable balances by address", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}}, }, { RpcMethod: "SpendableBalanceByDenom", - Use: "spendable-balance [address] [denom]", + Use: "spendable-balance
", Short: "Query the spendable balance of a single denom for a single account.", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}, {ProtoField: "denom"}}, }, @@ -50,7 +50,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "SupplyOf", - Use: "total-supply-of [denom]", + Use: "total-supply-of ", Short: "Query the supply of a single coin denom", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "denom"}}, }, @@ -61,7 +61,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "DenomMetadata", - Use: "denom-metadata [denom]", + Use: "denom-metadata ", Short: "Query the client metadata of a given coin denomination", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "denom"}}, }, @@ -72,13 +72,13 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "DenomOwners", - Use: "denom-owners [denom]", + Use: "denom-owners ", Short: "Query for all account addresses that own a particular token denomination.", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "denom"}}, }, { RpcMethod: "SendEnabled", - Use: "send-enabled [denom1 ...]", + Use: "send-enabled ...", Short: "Query for send enabled entries", Long: strings.TrimSpace(`Query for send enabled entries that have been specifically set. @@ -95,7 +95,7 @@ To look up all denoms, do not provide any arguments.`, RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { RpcMethod: "Send", - Use: "send [from_key_or_address] [to_address] [amount ...]", + Use: "send ...", Short: "Send funds from one account to another.", Long: `Send funds from one account to another. Note, the '--from' flag is ignored as it is implied from [from_key_or_address]. @@ -105,13 +105,13 @@ Note: multiple coins can be send by space separated.`, }, { RpcMethod: "Burn", - Use: "burn [from_key_or_address] [amount]", + Use: "burn ", Short: "Burns the amount specified from the given account.", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "from_address"}, {ProtoField: "amount", Varargs: true}}, }, { RpcMethod: "UpdateParams", - Use: "update-params-proposal [params]", + Use: "update-params-proposal ", Short: "Submit a proposal to update bank module params. Note: the entire params must be provided.", Example: fmt.Sprintf(`%s tx bank update-params-proposal '{ "default_send_enabled": true }'`, version.AppName), PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "params"}}, @@ -119,7 +119,7 @@ Note: multiple coins can be send by space separated.`, }, { RpcMethod: "SetSendEnabled", - Use: "set-send-enabled-proposal [send_enabled]", + Use: "set-send-enabled-proposal ", Short: "Submit a proposal to set/update/delete send enabled entries", Example: fmt.Sprintf(`%s tx bank set-send-enabled-proposal '{"denom":"stake","enabled":true}'`, version.AppName), PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "send_enabled", Varargs: true}}, diff --git a/x/bank/client/cli/tx.go b/x/bank/client/cli/tx.go index 1e86b92f7564..3d537522ebcf 100644 --- a/x/bank/client/cli/tx.go +++ b/x/bank/client/cli/tx.go @@ -39,7 +39,7 @@ func NewTxCmd() *cobra.Command { // For a better UX this command is limited to send funds from one account to two or more accounts. func NewMultiSendTxCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "multi-send [from_key_or_address] [to_address_1 to_address_2 ...] [amount]", + Use: "multi-send ... ", Short: "Send funds from one account to two or more accounts.", Long: `Send funds from one account to two or more accounts. By default, sends the [amount] to each address of the list. diff --git a/x/bank/depinject.go b/x/bank/depinject.go index 1d6f7dd3e533..b17a0cbf7557 100644 --- a/x/bank/depinject.go +++ b/x/bank/depinject.go @@ -2,19 +2,19 @@ package bank import ( "fmt" + "maps" + "slices" "sort" - "golang.org/x/exp/maps" - modulev1 "cosmossdk.io/api/cosmos/bank/module/v1" "cosmossdk.io/core/appmodule" "cosmossdk.io/depinject" "cosmossdk.io/depinject/appconfig" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/bank/keeper" "cosmossdk.io/x/bank/types" "github.com/cosmos/cosmos-sdk/codec" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var _ depinject.OnePerModuleType = AppModule{} @@ -103,7 +103,7 @@ func InvokeSetSendRestrictions( return nil } - modules := maps.Keys(restrictions) + modules := slices.Collect(maps.Keys(restrictions)) order := config.RestrictionsOrder if len(order) == 0 { order = modules diff --git a/x/bank/go.mod b/x/bank/go.mod index 7ca5c89fec13..93876be9f17f 100644 --- a/x/bank/go.mod +++ b/x/bank/go.mod @@ -1,14 +1,14 @@ module cosmossdk.io/x/bank -go 1.22.2 +go 1.23 require ( cosmossdk.io/api v0.7.5 cosmossdk.io/collections v0.4.0 - cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 + cosmossdk.io/core v1.0.0 cosmossdk.io/depinject v1.0.0 cosmossdk.io/errors v1.0.1 - cosmossdk.io/log v1.4.0 // indirect + cosmossdk.io/log v1.4.1 // indirect cosmossdk.io/math v1.3.0 cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect @@ -22,15 +22,14 @@ require ( github.com/hashicorp/go-metrics v0.5.3 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 - google.golang.org/grpc v1.65.0 + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 + google.golang.org/grpc v1.66.0 gotest.tools/v3 v3.5.1 ) require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect - cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/tx v0.13.3 // indirect @@ -51,12 +50,12 @@ require ( github.com/cometbft/cometbft-db v0.12.0 // indirect github.com/cometbft/cometbft/api v1.0.0-rc.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-db v1.0.2 // indirect + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 // indirect github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -101,7 +100,7 @@ require ( github.com/iancoleman/strcase v0.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect @@ -116,13 +115,13 @@ require ( github.com/mtibben/percent v0.2.1 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -149,7 +148,7 @@ require ( go.opencensus.io v0.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.26.0 // indirect - golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc + golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sync v0.8.0 // indirect @@ -158,7 +157,7 @@ require ( golang.org/x/text v0.17.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -169,20 +168,21 @@ require ( require cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 require ( - cosmossdk.io/schema v0.1.1 // indirect + cosmossdk.io/schema v0.2.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect ) replace github.com/cosmos/cosmos-sdk => ../../. +replace github.com/cosmos/iavl => github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e + // TODO remove post spinning out all modules replace ( cosmossdk.io/api => ../../api cosmossdk.io/collections => ../../collections cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/x/accounts => ../accounts - cosmossdk.io/x/auth => ../auth + cosmossdk.io/store => ../../store cosmossdk.io/x/consensus => ../consensus cosmossdk.io/x/staking => ../staking cosmossdk.io/x/tx => ../tx diff --git a/x/bank/go.sum b/x/bank/go.sum index 91cd863d3b91..7c1f771aabec 100644 --- a/x/bank/go.sum +++ b/x/bank/go.sum @@ -8,14 +8,12 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= -cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc h1:R9O9d75e0qZYUsVV0zzi+D7cNLnX2JrUOQNoIPaF0Bg= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc/go.mod h1:amTTatOUV3u1PsKmNb87z6/galCxrRbz9kRdJkL0DyU= +cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk= +cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= @@ -100,8 +98,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/crypto v0.1.2 h1:Yn500sPY+9sKVdhiPUSDtt8JOpBGMB515dOmla4zfls= @@ -113,10 +111,10 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e h1:LEii0v/FxtXa/F7mRn+tijZ0zaXBPn2ZkKwb6Qm4rqE= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e/go.mod h1:3ywr0wDnWeD7MUH6qu50wZ5bxuKH3LBrGG4/lZX8lVY= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -309,8 +307,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -320,6 +318,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -385,8 +385,8 @@ github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4 github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba h1:3jPgmsFGBID1wFfU2AbYocNcN4wqU68UaHSdMjiw/7U= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= @@ -403,8 +403,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -413,8 +413,8 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -470,7 +470,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -502,6 +501,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= @@ -637,10 +638,10 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEY google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -651,8 +652,8 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/x/bank/keeper/collections_test.go b/x/bank/keeper/collections_test.go index b97cf02b95d3..3e6d470b380a 100644 --- a/x/bank/keeper/collections_test.go +++ b/x/bank/keeper/collections_test.go @@ -12,7 +12,6 @@ import ( coretesting "cosmossdk.io/core/testing" "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/bank/keeper" banktestutil "cosmossdk.io/x/bank/testutil" banktypes "cosmossdk.io/x/bank/types" @@ -23,6 +22,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestBankStateCompatibility(t *testing.T) { diff --git a/x/bank/keeper/genesis_test.go b/x/bank/keeper/genesis_test.go index 0432d1b0fd94..cd08a1178dcb 100644 --- a/x/bank/keeper/genesis_test.go +++ b/x/bank/keeper/genesis_test.go @@ -4,7 +4,6 @@ import ( sdkmath "cosmossdk.io/math" "cosmossdk.io/x/bank/types" - codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" ) @@ -50,25 +49,14 @@ func (suite *KeeperTestSuite) TestExportGenesis() { } func (suite *KeeperTestSuite) getTestBalancesAndSupply() ([]types.Balance, sdk.Coins) { - ac := codectestutil.CodecOptions{}.GetAddressCodec() - addr2, err := suite.authKeeper.AddressCodec().StringToBytes("cosmos1f9xjhxm0plzrh9cskf4qee4pc2xwp0n0556gh0") - suite.Require().NoError(err) - addr1, _ := suite.authKeeper.AddressCodec().StringToBytes("cosmos1t5u0jfg3ljsjrh2m9e47d4ny2hea7eehxrzdgd") - suite.Require().NoError(err) addr1Balance := sdk.Coins{sdk.NewInt64Coin("testcoin3", 10)} addr2Balance := sdk.Coins{sdk.NewInt64Coin("testcoin1", 32), sdk.NewInt64Coin("testcoin2", 34)} - totalSupply := addr1Balance - totalSupply = totalSupply.Add(addr2Balance...) - - addr2Str, err := ac.BytesToString(addr2) - suite.Require().NoError(err) - addr1Str, err := ac.BytesToString(addr1) - suite.Require().NoError(err) + totalSupply := addr1Balance.Add(addr2Balance...) return []types.Balance{ - {Address: addr2Str, Coins: addr2Balance}, - {Address: addr1Str, Coins: addr1Balance}, + {Address: "cosmos1f9xjhxm0plzrh9cskf4qee4pc2xwp0n0556gh0", Coins: addr2Balance}, + {Address: "cosmos1t5u0jfg3ljsjrh2m9e47d4ny2hea7eehxrzdgd", Coins: addr1Balance}, }, totalSupply } diff --git a/x/bank/keeper/grpc_query_test.go b/x/bank/keeper/grpc_query_test.go index a5b4e352c88c..c563e4b60f66 100644 --- a/x/bank/keeper/grpc_query_test.go +++ b/x/bank/keeper/grpc_query_test.go @@ -5,23 +5,23 @@ import ( "fmt" "time" + v1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" "cosmossdk.io/core/header" - authtypes "cosmossdk.io/x/auth/types" - vestingtypes "cosmossdk.io/x/auth/vesting/types" "cosmossdk.io/x/bank/testutil" "cosmossdk.io/x/bank/types" - codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" ) func (suite *KeeperTestSuite) TestQueryBalance() { ctx, queryClient := suite.ctx, suite.queryClient _, _, addr := testdata.KeyTestPubAddr() - addrStr, err := codectestutil.CodecOptions{}.GetAddressCodec().BytesToString(addr) + addrStr, err := suite.authKeeper.AddressCodec().BytesToString(addr) suite.Require().NoError(err) origCoins := sdk.NewCoins(newBarCoin(30)) @@ -107,7 +107,7 @@ func (suite *KeeperTestSuite) TestQueryAllBalances() { _, err := queryClient.AllBalances(gocontext.Background(), &types.QueryAllBalancesRequest{}) suite.Require().Error(err) - addrStr, err := codectestutil.CodecOptions{}.GetAddressCodec().BytesToString(addr) + addrStr, err := suite.authKeeper.AddressCodec().BytesToString(addr) suite.Require().NoError(err) pageReq := &query.PageRequest{ @@ -180,7 +180,7 @@ func (suite *KeeperTestSuite) TestQueryAllBalances() { func (suite *KeeperTestSuite) TestSpendableBalances() { _, _, addr := testdata.KeyTestPubAddr() - addrStr, err := codectestutil.CodecOptions{}.GetAddressCodec().BytesToString(addr) + addrStr, err := suite.authKeeper.AddressCodec().BytesToString(addr) suite.Require().NoError(err) ctx := sdk.UnwrapSDKContext(suite.ctx) @@ -598,6 +598,100 @@ func (suite *KeeperTestSuite) TestQueryDenomMetadataByQueryStringRequest() { } } +func (suite *KeeperTestSuite) TestGRPCDenomMetadataV2() { + var ( + req *v1beta1.QueryDenomMetadataRequest + metadata = types.Metadata{ + Description: "The native staking token of the Cosmos Hub.", + DenomUnits: []*types.DenomUnit{ + { + Denom: "uatom", + Exponent: 0, + Aliases: []string{"microatom"}, + }, + { + Denom: "atom", + Exponent: 6, + Aliases: []string{"ATOM"}, + }, + }, + Base: "uatom", + Display: "atom", + } + expMetadata = &v1beta1.Metadata{} + ) + + testCases := []struct { + msg string + malleate func() + expPass bool + }{ + { + "empty denom", + func() { + req = &v1beta1.QueryDenomMetadataRequest{} + }, + false, + }, + { + "not found denom", + func() { + req = &v1beta1.QueryDenomMetadataRequest{ + Denom: "foo", + } + }, + false, + }, + { + "success", + func() { + expMetadata = &v1beta1.Metadata{ + Description: metadata.Description, + DenomUnits: []*v1beta1.DenomUnit{ + { + Denom: metadata.DenomUnits[0].Denom, + Exponent: metadata.DenomUnits[0].Exponent, + Aliases: metadata.DenomUnits[0].Aliases, + }, + { + Denom: metadata.DenomUnits[1].Denom, + Exponent: metadata.DenomUnits[1].Exponent, + Aliases: metadata.DenomUnits[1].Aliases, + }, + }, + Base: metadata.Base, + Display: metadata.Display, + } + + suite.bankKeeper.SetDenomMetaData(suite.ctx, metadata) + req = &v1beta1.QueryDenomMetadataRequest{ + Denom: expMetadata.Base, + } + }, + true, + }, + } + + for _, tc := range testCases { + suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { + suite.SetupTest() // reset + + tc.malleate() + ctx := suite.ctx + + res, err := suite.bankKeeper.DenomMetadataV2(ctx, req) + + if tc.expPass { + suite.Require().NoError(err) + suite.Require().NotNil(res) + suite.Require().Equal(expMetadata, res.Metadata) + } else { + suite.Require().Error(err) + } + }) + } +} + func (suite *KeeperTestSuite) TestGRPCDenomOwners() { ctx := suite.ctx diff --git a/x/bank/keeper/keeper.go b/x/bank/keeper/keeper.go index fee164f6d965..ba7ee06976e8 100644 --- a/x/bank/keeper/keeper.go +++ b/x/bank/keeper/keeper.go @@ -8,13 +8,13 @@ import ( "cosmossdk.io/core/event" errorsmod "cosmossdk.io/errors" "cosmossdk.io/math" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/bank/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var _ Keeper = (*BaseKeeper)(nil) diff --git a/x/bank/keeper/keeper_test.go b/x/bank/keeper/keeper_test.go index 2c4eb43ff312..a5680bfb43ba 100644 --- a/x/bank/keeper/keeper_test.go +++ b/x/bank/keeper/keeper_test.go @@ -19,8 +19,6 @@ import ( errorsmod "cosmossdk.io/errors" "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" - authtypes "cosmossdk.io/x/auth/types" - vesting "cosmossdk.io/x/auth/vesting/types" "cosmossdk.io/x/bank/keeper" banktestutil "cosmossdk.io/x/bank/testutil" banktypes "cosmossdk.io/x/bank/types" @@ -34,6 +32,8 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" "github.com/cosmos/cosmos-sdk/types/query" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + vesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" ) const ( @@ -1468,10 +1468,10 @@ func (suite *KeeperTestSuite) TestMsgMultiSendEvents() { event1.Attributes = append( event1.Attributes, coreevent.Attribute{Key: banktypes.AttributeKeyRecipient, Value: acc2StrAddr}, + coreevent.Attribute{Key: sdk.AttributeKeySender, Value: acc0StrAddr}, + coreevent.Attribute{Key: sdk.AttributeKeyAmount, Value: newCoins.String()}, ) - event1.Attributes = append( - event1.Attributes, - coreevent.Attribute{Key: sdk.AttributeKeyAmount, Value: newCoins.String()}) + event2 := coreevent.Event{ Type: banktypes.EventTypeTransfer, Attributes: []coreevent.Attribute{}, @@ -1479,9 +1479,7 @@ func (suite *KeeperTestSuite) TestMsgMultiSendEvents() { event2.Attributes = append( event2.Attributes, coreevent.Attribute{Key: banktypes.AttributeKeyRecipient, Value: acc3StrAddr}, - ) - event2.Attributes = append( - event2.Attributes, + coreevent.Attribute{Key: sdk.AttributeKeySender, Value: acc0StrAddr}, coreevent.Attribute{Key: sdk.AttributeKeyAmount, Value: newCoins2.String()}, ) // events are shifted due to the funding account events diff --git a/x/bank/keeper/msg_server_test.go b/x/bank/keeper/msg_server_test.go index ea27bbcbf1fc..ecc09f79ba78 100644 --- a/x/bank/keeper/msg_server_test.go +++ b/x/bank/keeper/msg_server_test.go @@ -1,10 +1,10 @@ package keeper_test import ( - authtypes "cosmossdk.io/x/auth/types" banktypes "cosmossdk.io/x/bank/types" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var govAcc = authtypes.NewEmptyModuleAccount(banktypes.GovModuleName, authtypes.Minter) diff --git a/x/bank/keeper/send.go b/x/bank/keeper/send.go index 31354c1b8566..063417b6ca03 100644 --- a/x/bank/keeper/send.go +++ b/x/bank/keeper/send.go @@ -172,6 +172,7 @@ func (k BaseSendKeeper) InputOutputCoins(ctx context.Context, input types.Input, if err := k.EventService.EventManager(ctx).EmitKV( types.EventTypeTransfer, event.NewAttribute(types.AttributeKeyRecipient, out.Address), + event.NewAttribute(types.AttributeKeySender, input.Address), event.NewAttribute(sdk.AttributeKeyAmount, out.Coins.String()), ); err != nil { return err diff --git a/x/bank/simulation/proposals.go b/x/bank/simulation/proposals.go index ec9f637240d9..5b07bdc7a9fb 100644 --- a/x/bank/simulation/proposals.go +++ b/x/bank/simulation/proposals.go @@ -34,7 +34,7 @@ func ProposalMsgs() []simtypes.WeightedProposalMsg { // SimulateMsgUpdateParams returns a random MsgUpdateParams func SimulateMsgUpdateParams(_ context.Context, r *rand.Rand, _ []simtypes.Account, ac coreaddress.Codec) (sdk.Msg, error) { // use the default gov module account address as authority - authority, err := ac.BytesToString(address.Module("gov")) + authority, err := ac.BytesToString(address.Module(types.GovModuleName)) if err != nil { return nil, err } diff --git a/x/bank/simulation/proposals_test.go b/x/bank/simulation/proposals_test.go index 50d7fc0ad5d3..95d450dce711 100644 --- a/x/bank/simulation/proposals_test.go +++ b/x/bank/simulation/proposals_test.go @@ -39,7 +39,7 @@ func TestProposalMsgs(t *testing.T) { msgUpdateParams, ok := msg.(*types.MsgUpdateParams) assert.Assert(t, ok) - authority, err := ac.BytesToString(address.Module("gov")) + authority, err := ac.BytesToString(address.Module(types.GovModuleName)) assert.NilError(t, err) assert.Equal(t, authority, msgUpdateParams.Authority) assert.Assert(t, len(msgUpdateParams.Params.SendEnabled) == 0) //nolint:staticcheck // we're testing the old way here diff --git a/x/bank/testutil/expected_keepers_mocks.go b/x/bank/testutil/expected_keepers_mocks.go index 058c4e2d7e36..aeddace241f3 100644 --- a/x/bank/testutil/expected_keepers_mocks.go +++ b/x/bank/testutil/expected_keepers_mocks.go @@ -9,8 +9,8 @@ import ( reflect "reflect" address "cosmossdk.io/core/address" - types "cosmossdk.io/x/auth/types" - types0 "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + types0 "github.com/cosmos/cosmos-sdk/x/auth/types" gomock "github.com/golang/mock/gomock" ) @@ -52,10 +52,10 @@ func (mr *MockAccountKeeperMockRecorder) AddressCodec() *gomock.Call { } // GetAccount mocks base method. -func (m *MockAccountKeeper) GetAccount(ctx context.Context, addr types0.AccAddress) types0.AccountI { +func (m *MockAccountKeeper) GetAccount(ctx context.Context, addr types.AccAddress) types.AccountI { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetAccount", ctx, addr) - ret0, _ := ret[0].(types0.AccountI) + ret0, _ := ret[0].(types.AccountI) return ret0 } @@ -66,10 +66,10 @@ func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr interface{}) *gomo } // GetModuleAccount mocks base method. -func (m *MockAccountKeeper) GetModuleAccount(ctx context.Context, moduleName string) types0.ModuleAccountI { +func (m *MockAccountKeeper) GetModuleAccount(ctx context.Context, moduleName string) types.ModuleAccountI { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetModuleAccount", ctx, moduleName) - ret0, _ := ret[0].(types0.ModuleAccountI) + ret0, _ := ret[0].(types.ModuleAccountI) return ret0 } @@ -80,10 +80,10 @@ func (mr *MockAccountKeeperMockRecorder) GetModuleAccount(ctx, moduleName interf } // GetModuleAccountAndPermissions mocks base method. -func (m *MockAccountKeeper) GetModuleAccountAndPermissions(ctx context.Context, moduleName string) (types0.ModuleAccountI, []string) { +func (m *MockAccountKeeper) GetModuleAccountAndPermissions(ctx context.Context, moduleName string) (types.ModuleAccountI, []string) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetModuleAccountAndPermissions", ctx, moduleName) - ret0, _ := ret[0].(types0.ModuleAccountI) + ret0, _ := ret[0].(types.ModuleAccountI) ret1, _ := ret[1].([]string) return ret0, ret1 } @@ -95,10 +95,10 @@ func (mr *MockAccountKeeperMockRecorder) GetModuleAccountAndPermissions(ctx, mod } // GetModuleAddress mocks base method. -func (m *MockAccountKeeper) GetModuleAddress(moduleName string) types0.AccAddress { +func (m *MockAccountKeeper) GetModuleAddress(moduleName string) types.AccAddress { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetModuleAddress", moduleName) - ret0, _ := ret[0].(types0.AccAddress) + ret0, _ := ret[0].(types.AccAddress) return ret0 } @@ -109,10 +109,10 @@ func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(moduleName interface{} } // GetModuleAddressAndPermissions mocks base method. -func (m *MockAccountKeeper) GetModuleAddressAndPermissions(moduleName string) (types0.AccAddress, []string) { +func (m *MockAccountKeeper) GetModuleAddressAndPermissions(moduleName string) (types.AccAddress, []string) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetModuleAddressAndPermissions", moduleName) - ret0, _ := ret[0].(types0.AccAddress) + ret0, _ := ret[0].(types.AccAddress) ret1, _ := ret[1].([]string) return ret0, ret1 } @@ -124,10 +124,10 @@ func (mr *MockAccountKeeperMockRecorder) GetModuleAddressAndPermissions(moduleNa } // GetModulePermissions mocks base method. -func (m *MockAccountKeeper) GetModulePermissions() map[string]types.PermissionsForAddress { +func (m *MockAccountKeeper) GetModulePermissions() map[string]types0.PermissionsForAddress { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetModulePermissions") - ret0, _ := ret[0].(map[string]types.PermissionsForAddress) + ret0, _ := ret[0].(map[string]types0.PermissionsForAddress) return ret0 } @@ -138,7 +138,7 @@ func (mr *MockAccountKeeperMockRecorder) GetModulePermissions() *gomock.Call { } // HasAccount mocks base method. -func (m *MockAccountKeeper) HasAccount(ctx context.Context, addr types0.AccAddress) bool { +func (m *MockAccountKeeper) HasAccount(ctx context.Context, addr types.AccAddress) bool { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "HasAccount", ctx, addr) ret0, _ := ret[0].(bool) @@ -152,10 +152,10 @@ func (mr *MockAccountKeeperMockRecorder) HasAccount(ctx, addr interface{}) *gomo } // NewAccount mocks base method. -func (m *MockAccountKeeper) NewAccount(arg0 context.Context, arg1 types0.AccountI) types0.AccountI { +func (m *MockAccountKeeper) NewAccount(arg0 context.Context, arg1 types.AccountI) types.AccountI { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "NewAccount", arg0, arg1) - ret0, _ := ret[0].(types0.AccountI) + ret0, _ := ret[0].(types.AccountI) return ret0 } @@ -166,10 +166,10 @@ func (mr *MockAccountKeeperMockRecorder) NewAccount(arg0, arg1 interface{}) *gom } // NewAccountWithAddress mocks base method. -func (m *MockAccountKeeper) NewAccountWithAddress(ctx context.Context, addr types0.AccAddress) types0.AccountI { +func (m *MockAccountKeeper) NewAccountWithAddress(ctx context.Context, addr types.AccAddress) types.AccountI { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "NewAccountWithAddress", ctx, addr) - ret0, _ := ret[0].(types0.AccountI) + ret0, _ := ret[0].(types.AccountI) return ret0 } @@ -180,7 +180,7 @@ func (mr *MockAccountKeeperMockRecorder) NewAccountWithAddress(ctx, addr interfa } // SetAccount mocks base method. -func (m *MockAccountKeeper) SetAccount(ctx context.Context, acc types0.AccountI) { +func (m *MockAccountKeeper) SetAccount(ctx context.Context, acc types.AccountI) { m.ctrl.T.Helper() m.ctrl.Call(m, "SetAccount", ctx, acc) } @@ -192,7 +192,7 @@ func (mr *MockAccountKeeperMockRecorder) SetAccount(ctx, acc interface{}) *gomoc } // SetModuleAccount mocks base method. -func (m *MockAccountKeeper) SetModuleAccount(ctx context.Context, macc types0.ModuleAccountI) { +func (m *MockAccountKeeper) SetModuleAccount(ctx context.Context, macc types.ModuleAccountI) { m.ctrl.T.Helper() m.ctrl.Call(m, "SetModuleAccount", ctx, macc) } @@ -204,7 +204,7 @@ func (mr *MockAccountKeeperMockRecorder) SetModuleAccount(ctx, macc interface{}) } // ValidatePermissions mocks base method. -func (m *MockAccountKeeper) ValidatePermissions(macc types0.ModuleAccountI) error { +func (m *MockAccountKeeper) ValidatePermissions(macc types.ModuleAccountI) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ValidatePermissions", macc) ret0, _ := ret[0].(error) diff --git a/x/bank/types/expected_keepers.go b/x/bank/types/expected_keepers.go index d49bf4cc4b98..013530f8116e 100644 --- a/x/bank/types/expected_keepers.go +++ b/x/bank/types/expected_keepers.go @@ -4,9 +4,9 @@ import ( "context" "cosmossdk.io/core/address" - "cosmossdk.io/x/auth/types" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) // AccountKeeper defines the account contract that must be fulfilled when diff --git a/x/bank/types/send_authorization.go b/x/bank/types/send_authorization.go index 9aefd18dddf6..405cdcae390d 100644 --- a/x/bank/types/send_authorization.go +++ b/x/bank/types/send_authorization.go @@ -4,7 +4,7 @@ import ( "context" "cosmossdk.io/core/address" - "cosmossdk.io/core/appmodule/v2" + appmodulev2 "cosmossdk.io/core/appmodule/v2" corecontext "cosmossdk.io/core/context" sdk "github.com/cosmos/cosmos-sdk/types" @@ -42,7 +42,7 @@ func (a SendAuthorization) Accept(ctx context.Context, msg sdk.Msg) (authz.Accep return authz.AcceptResponse{}, sdkerrors.ErrInsufficientFunds.Wrapf("requested amount is more than spend limit") } - authzEnv, ok := ctx.Value(corecontext.EnvironmentContextKey).(appmodule.Environment) + authzEnv, ok := ctx.Value(corecontext.EnvironmentContextKey).(appmodulev2.Environment) if !ok { return authz.AcceptResponse{}, sdkerrors.ErrUnauthorized.Wrap("environment not set") } diff --git a/x/bank/types/send_authorization_test.go b/x/bank/types/send_authorization_test.go index 7c9473c50138..bb12f5d2a5f7 100644 --- a/x/bank/types/send_authorization_test.go +++ b/x/bank/types/send_authorization_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/require" - "cosmossdk.io/core/appmodule/v2" + appmodulev2 "cosmossdk.io/core/appmodule/v2" corecontext "cosmossdk.io/core/context" coregas "cosmossdk.io/core/gas" coreheader "cosmossdk.io/core/header" @@ -54,7 +54,7 @@ func (m mockGasMeter) Consume(amount coregas.Gas, descriptor string) error { func TestSendAuthorization(t *testing.T) { ac := codectestutil.CodecOptions{}.GetAddressCodec() sdkCtx := testutil.DefaultContextWithDB(t, storetypes.NewKVStoreKey(types.StoreKey), storetypes.NewTransientStoreKey("transient_test")).Ctx.WithHeaderInfo(coreheader.Info{}) - ctx := context.WithValue(sdkCtx.Context(), corecontext.EnvironmentContextKey, appmodule.Environment{ + ctx := context.WithValue(sdkCtx.Context(), corecontext.EnvironmentContextKey, appmodulev2.Environment{ HeaderService: headerService{}, GasService: mockGasService{}, }) diff --git a/x/circuit/README.md b/x/circuit/README.md index 25843ed2033a..0a8d3ee95547 100644 --- a/x/circuit/README.md +++ b/x/circuit/README.md @@ -19,7 +19,7 @@ https://github.com/cosmos/cosmos-sdk/blob/x/circuit/v0.1.0/x/circuit/ante/circui * With a [message router check](https://docs.cosmos.network/main/learn/advanced/baseapp#msg-service-router): ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.1/baseapp/msg_service_router.go#L104-L115 +https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/baseapp/msg_service_router.go#L123-L133 ``` :::note @@ -101,7 +101,7 @@ Reset is called by an authorized account to enable execution for a specific msgU ### MsgAuthorizeCircuitBreaker ```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/main/x/circuit/proto/cosmos/circuit/v1/tx.proto#L25-L40 +https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/circuit/proto/cosmos/circuit/v1/tx.proto#L25-L40 ``` This message is expected to fail if: @@ -111,7 +111,7 @@ This message is expected to fail if: ### MsgTripCircuitBreaker ```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/main/x/circuit/proto/cosmos/circuit/v1/tx.proto#L47-L60 +https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/circuit/proto/cosmos/circuit/v1/tx.proto#L47-L60 ``` This message is expected to fail if: @@ -121,7 +121,7 @@ This message is expected to fail if: ### MsgResetCircuitBreaker ```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/main/x/circuit/proto/cosmos/circuit/v1/tx.proto#L67-L78 +https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/circuit/proto/cosmos/circuit/v1/tx.proto#L67-L78 ``` This message is expected to fail if: diff --git a/x/circuit/ante/circuit.go b/x/circuit/ante/circuit.go index 9d3ea0a49f4b..67ce0021dfb7 100644 --- a/x/circuit/ante/circuit.go +++ b/x/circuit/ante/circuit.go @@ -4,6 +4,8 @@ import ( "context" "errors" + "cosmossdk.io/core/transaction" + sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -28,17 +30,29 @@ func NewCircuitBreakerDecorator(ck CircuitBreaker) CircuitBreakerDecorator { // - or error early if a nested authz grant is found. // The circuit AnteHandler handles this with baseapp's service router: https://github.com/cosmos/cosmos-sdk/issues/18632. func (cbd CircuitBreakerDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { + if err := cbd.ValidateTx(ctx, tx); err != nil { + return ctx, err + } + + return next(ctx, tx, simulate) +} + +func (cbd CircuitBreakerDecorator) ValidateTx(ctx context.Context, tx transaction.Tx) error { // loop through all the messages and check if the message type is allowed - for _, msg := range tx.GetMsgs() { + msgs, err := tx.GetMessages() + if err != nil { + return err + } + + for _, msg := range msgs { isAllowed, err := cbd.circuitKeeper.IsAllowed(ctx, sdk.MsgTypeURL(msg)) if err != nil { - return ctx, err + return err } if !isAllowed { - return ctx, errors.New("tx type not allowed") + return errors.New("tx type not allowed") } } - - return next(ctx, tx, simulate) + return nil } diff --git a/x/circuit/ante/circuit_test.go b/x/circuit/ante/circuit_test.go index 9bf328a3466c..e88b96b5ee51 100644 --- a/x/circuit/ante/circuit_test.go +++ b/x/circuit/ante/circuit_test.go @@ -7,7 +7,6 @@ import ( "github.com/stretchr/testify/require" storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/auth" "cosmossdk.io/x/circuit/ante" cbtypes "cosmossdk.io/x/circuit/types" @@ -17,6 +16,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/auth" ) type fixture struct { @@ -31,7 +31,7 @@ type MockCircuitBreaker struct { isAllowed bool } -func (m MockCircuitBreaker) IsAllowed(ctx context.Context, typeURL string) (bool, error) { +func (m MockCircuitBreaker) IsAllowed(_ context.Context, typeURL string) (bool, error) { return typeURL == "/cosmos.circuit.v1.MsgAuthorizeCircuitBreaker", nil } diff --git a/x/circuit/autocli.go b/x/circuit/autocli.go index de72b3dc28b5..e9055caf5185 100644 --- a/x/circuit/autocli.go +++ b/x/circuit/autocli.go @@ -16,7 +16,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { RpcMethod: "Account", - Use: "account [address]", + Use: "account
", Short: "Query a specific account's permissions", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}}, }, @@ -37,7 +37,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { RpcMethod: "AuthorizeCircuitBreaker", - Use: "authorize [grantee] [permissions_json] --from [granter]", + Use: "authorize --from ", Short: "Authorize an account to trip the circuit breaker.", Long: `Authorize an account to trip the circuit breaker. "SOME_MSGS" = 1, @@ -51,7 +51,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "TripCircuitBreaker", - Use: "disable [msg_type_urls]", + Use: "disable ", Short: "Disable a message from being executed", Example: fmt.Sprintf(`%s circuit disable "cosmos.bank.v1beta1.MsgSend cosmos.bank.v1beta1.MsgMultiSend"`, version.AppName), PositionalArgs: []*autocliv1.PositionalArgDescriptor{ @@ -60,7 +60,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "ResetCircuitBreaker", - Use: "reset [msg_type_urls]", + Use: "reset ", Short: "Enable a message to be executed", Example: fmt.Sprintf(`%s circuit reset "cosmos.bank.v1beta1.MsgSend cosmos.bank.v1beta1.MsgMultiSend"`, version.AppName), PositionalArgs: []*autocliv1.PositionalArgDescriptor{ diff --git a/x/circuit/depinject.go b/x/circuit/depinject.go index c8e4a085ede2..37410272c6fa 100644 --- a/x/circuit/depinject.go +++ b/x/circuit/depinject.go @@ -6,12 +6,13 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/depinject" "cosmossdk.io/depinject/appconfig" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/circuit/keeper" + "cosmossdk.io/x/circuit/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/runtime" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var _ depinject.OnePerModuleType = AppModule{} @@ -46,7 +47,7 @@ type ModuleOutputs struct { func ProvideModule(in ModuleInputs) ModuleOutputs { // default to governance authority if not provided - authority := authtypes.NewModuleAddress("gov") + authority := authtypes.NewModuleAddress(types.GovModuleName) if in.Config.Authority != "" { authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) } diff --git a/x/circuit/go.mod b/x/circuit/go.mod index 8aa8c86b775f..a8912d61cf0a 100644 --- a/x/circuit/go.mod +++ b/x/circuit/go.mod @@ -1,31 +1,30 @@ module cosmossdk.io/x/circuit -go 1.22.2 +go 1.23 require ( cosmossdk.io/api v0.7.5 cosmossdk.io/collections v0.4.0 - cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 + cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 cosmossdk.io/depinject v1.0.0 cosmossdk.io/errors v1.0.1 cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc - cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/stretchr/testify v1.9.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 - google.golang.org/grpc v1.65.0 + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 + google.golang.org/grpc v1.66.0 ) require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect - cosmossdk.io/log v1.4.0 // indirect + cosmossdk.io/log v1.4.1 // indirect cosmossdk.io/math v1.3.0 // indirect - cosmossdk.io/schema v0.1.1 // indirect + cosmossdk.io/schema v0.2.0 // indirect cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect @@ -49,13 +48,13 @@ require ( github.com/cometbft/cometbft-db v0.12.0 // indirect github.com/cometbft/cometbft/api v1.0.0-rc.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-db v1.0.2 // indirect + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 // indirect github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -102,7 +101,7 @@ require ( github.com/iancoleman/strcase v0.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect @@ -118,13 +117,13 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -161,7 +160,7 @@ require ( golang.org/x/text v0.17.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -172,13 +171,14 @@ require ( replace github.com/cosmos/cosmos-sdk => ../../. +replace github.com/cosmos/iavl => github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e + // TODO remove post spinning out all modules replace ( cosmossdk.io/api => ../../api cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/x/accounts => ../accounts - cosmossdk.io/x/auth => ../auth + cosmossdk.io/store => ../../store cosmossdk.io/x/bank => ../bank cosmossdk.io/x/consensus => ../consensus cosmossdk.io/x/staking => ../staking diff --git a/x/circuit/go.sum b/x/circuit/go.sum index 67a156e09346..9f481099c659 100644 --- a/x/circuit/go.sum +++ b/x/circuit/go.sum @@ -10,14 +10,12 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= -cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc h1:R9O9d75e0qZYUsVV0zzi+D7cNLnX2JrUOQNoIPaF0Bg= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc/go.mod h1:amTTatOUV3u1PsKmNb87z6/galCxrRbz9kRdJkL0DyU= +cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk= +cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= @@ -102,8 +100,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/crypto v0.1.2 h1:Yn500sPY+9sKVdhiPUSDtt8JOpBGMB515dOmla4zfls= @@ -115,10 +113,10 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e h1:LEii0v/FxtXa/F7mRn+tijZ0zaXBPn2ZkKwb6Qm4rqE= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e/go.mod h1:3ywr0wDnWeD7MUH6qu50wZ5bxuKH3LBrGG4/lZX8lVY= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -311,8 +309,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -322,6 +320,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -387,8 +387,8 @@ github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4 github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba h1:3jPgmsFGBID1wFfU2AbYocNcN4wqU68UaHSdMjiw/7U= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= @@ -405,8 +405,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -415,8 +415,8 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -472,7 +472,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -504,6 +503,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= @@ -639,10 +640,10 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEY google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -653,8 +654,8 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/x/circuit/keeper/genesis_test.go b/x/circuit/keeper/genesis_test.go index 493e28f7b5dd..aa6f1fcfa145 100644 --- a/x/circuit/keeper/genesis_test.go +++ b/x/circuit/keeper/genesis_test.go @@ -8,7 +8,6 @@ import ( coretesting "cosmossdk.io/core/testing" storetypes "cosmossdk.io/store/types" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/circuit" "cosmossdk.io/x/circuit/keeper" "cosmossdk.io/x/circuit/types" @@ -19,6 +18,7 @@ import ( "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/testutil" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) type GenesisTestSuite struct { @@ -44,7 +44,7 @@ func (s *GenesisTestSuite) SetupTest() { s.cdc = codec.NewProtoCodec(encCfg.InterfaceRegistry) ac := addresscodec.NewBech32Codec("cosmos") - authority, err := ac.BytesToString(authtypes.NewModuleAddress("gov")) + authority, err := ac.BytesToString(authtypes.NewModuleAddress(types.GovModuleName)) s.Require().NoError(err) bz, err := ac.StringToBytes(authority) diff --git a/x/circuit/keeper/keeper_test.go b/x/circuit/keeper/keeper_test.go index f6f3c177dce8..b232ae0944c4 100644 --- a/x/circuit/keeper/keeper_test.go +++ b/x/circuit/keeper/keeper_test.go @@ -10,7 +10,6 @@ import ( "cosmossdk.io/core/address" coretesting "cosmossdk.io/core/testing" storetypes "cosmossdk.io/store/types" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/circuit" "cosmossdk.io/x/circuit/keeper" "cosmossdk.io/x/circuit/types" @@ -20,6 +19,7 @@ import ( "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/testutil" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var addresses = []string{ @@ -46,7 +46,7 @@ func initFixture(t *testing.T) *fixture { mockStoreKey := storetypes.NewKVStoreKey("test") env := runtime.NewEnvironment(runtime.NewKVStoreService(mockStoreKey), coretesting.NewNopLogger()) - authority, err := ac.BytesToString(authtypes.NewModuleAddress("gov")) + authority, err := ac.BytesToString(authtypes.NewModuleAddress(types.GovModuleName)) require.NoError(t, err) k := keeper.NewKeeper(env, encCfg.Codec, authority, ac) @@ -166,3 +166,41 @@ func TestIterateDisabledList(t *testing.T) { require.Equal(t, mockMsgs[1], returnedDisabled[0]) require.Equal(t, mockMsgs[2], returnedDisabled[1]) } + +func TestIsAllowed(t *testing.T) { + t.Parallel() + f := initFixture(t) + + testCases := []struct { + name string + msgURL string + setDisabled bool + expected bool + }{ + { + name: "allowed message", + msgURL: "test_allowed", + setDisabled: false, + expected: true, + }, + { + name: "disabled message", + msgURL: "test_disabled", + setDisabled: true, + expected: false, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + if tc.setDisabled { + err := f.keeper.DisableList.Set(f.ctx, tc.msgURL) + require.NoError(t, err) + } + + allowed, err := f.keeper.IsAllowed(f.ctx, tc.msgURL) + require.NoError(t, err) + require.Equal(t, tc.expected, allowed) + }) + } +} diff --git a/x/circuit/module.go b/x/circuit/module.go index 3f2d74fa3d7e..91645aaee6cc 100644 --- a/x/circuit/module.go +++ b/x/circuit/module.go @@ -9,7 +9,10 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" + appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/registry" + "cosmossdk.io/core/transaction" + "cosmossdk.io/x/circuit/ante" "cosmossdk.io/x/circuit/keeper" "cosmossdk.io/x/circuit/types" @@ -24,9 +27,10 @@ const ConsensusVersion = 1 var ( _ module.HasGRPCGateway = AppModule{} - _ appmodule.AppModule = AppModule{} - _ appmodule.HasGenesis = AppModule{} - _ appmodule.HasRegisterInterfaces = AppModule{} + _ appmodule.AppModule = AppModule{} + _ appmodule.HasGenesis = AppModule{} + _ appmodule.HasRegisterInterfaces = AppModule{} + _ appmodulev2.HasTxValidator[transaction.Tx] = AppModule{} ) // AppModule implements an application module for the circuit module. @@ -107,3 +111,9 @@ func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) } return am.cdc.MarshalJSON(gs) } + +// TxValidator implements appmodule.HasTxValidator. +func (am AppModule) TxValidator(ctx context.Context, tx transaction.Tx) error { + validator := ante.NewCircuitBreakerDecorator(&am.keeper) + return validator.ValidateTx(ctx, tx) +} diff --git a/x/circuit/types/keys.go b/x/circuit/types/keys.go index 5a63f2b5b08b..c9307c9632ba 100644 --- a/x/circuit/types/keys.go +++ b/x/circuit/types/keys.go @@ -8,6 +8,11 @@ const ( // StoreKey defines the primary module store key StoreKey = ModuleName + + // GovModuleName duplicates the gov module's name to avoid a cyclic dependency with x/gov. + // It should be synced with the gov module's name if it is ever changed. + // See: https://github.com/cosmos/cosmos-sdk/blob/b62a28aac041829da5ded4aeacfcd7a42873d1c8/x/gov/types/keys.go#L9 + GovModuleName = "gov" ) // KVStore keys diff --git a/x/consensus/README.md b/x/consensus/README.md index 492d58ea9b7a..2af97a6a32db 100644 --- a/x/consensus/README.md +++ b/x/consensus/README.md @@ -31,7 +31,7 @@ it can be updated with governance or the address with authority. * Params: `0x05 | ProtocolBuffer(cometbft.ConsensusParams)` ```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/381de6452693a9338371223c232fba0c42773a4b/proto/cosmos/consensus/v1/consensus.proto#L11-L18 +https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/consensus/proto/cosmos/consensus/v1/consensus.proto#L9-L15 ``` ## Keepers @@ -45,7 +45,7 @@ The consensus module provides methods to Set and Get consensus params. It is rec Update consensus params. ```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/381de6452693a9338371223c232fba0c42773a4b/proto/cosmos/consensus/v1/tx.proto#L12-L47 +https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/consensus/proto/cosmos/consensus/v1/tx.proto#L23-L44 ``` The message will fail under the following conditions: @@ -53,14 +53,6 @@ The message will fail under the following conditions: * The signer is not the set authority * Not all values are set -## Consensus Messages - -The consensus module has a consensus message that is used to set the consensus params when the chain initializes. It is similar to the `UpdateParams` message but it is only used once at the start of the chain. - -```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/381de6452693a9338371223c232fba0c42773a4b/proto/cosmos/consensus/v1/consensus.proto#L9-L24 -``` - ## Events The consensus module emits the following events: diff --git a/x/consensus/autocli.go b/x/consensus/autocli.go index 14784dced7f4..e9c89ca63f4c 100644 --- a/x/consensus/autocli.go +++ b/x/consensus/autocli.go @@ -31,7 +31,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { RpcMethod: "UpdateParams", - Use: "update-params-proposal [params]", + Use: "update-params-proposal ", Short: "Submit a proposal to update consensus module params. Note: the entire params must be provided.", Example: fmt.Sprintf(`%s tx consensus update-params-proposal '{ params }'`, version.AppName), PositionalArgs: []*autocliv1.PositionalArgDescriptor{ diff --git a/x/consensus/exported/exported.go b/x/consensus/exported/exported.go index c3bf5804f90c..91dfabb451e2 100644 --- a/x/consensus/exported/exported.go +++ b/x/consensus/exported/exported.go @@ -6,13 +6,10 @@ import ( cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" ) -type ( - - // ConsensusParamSetter defines the interface fulfilled by BaseApp's - // ParamStore which allows setting its appVersion field. - ConsensusParamSetter interface { - Get(ctx context.Context) (cmtproto.ConsensusParams, error) - Has(ctx context.Context) (bool, error) - Set(ctx context.Context, cp cmtproto.ConsensusParams) error - } -) +// ConsensusParamSetter defines the interface fulfilled by BaseApp's +// ParamStore which allows setting its appVersion field. +type ConsensusParamSetter interface { + Get(ctx context.Context) (cmtproto.ConsensusParams, error) + Has(ctx context.Context) (bool, error) + Set(ctx context.Context, cp cmtproto.ConsensusParams) error +} diff --git a/x/consensus/go.mod b/x/consensus/go.mod index 097d2265c15c..3858a8eab620 100644 --- a/x/consensus/go.mod +++ b/x/consensus/go.mod @@ -1,11 +1,11 @@ module cosmossdk.io/x/consensus -go 1.22.2 +go 1.23 require ( cosmossdk.io/api v0.7.5 cosmossdk.io/collections v0.4.0 - cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 + cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 cosmossdk.io/depinject v1.0.0 cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc @@ -17,18 +17,17 @@ require ( github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/stretchr/testify v1.9.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 - google.golang.org/grpc v1.65.0 + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 + google.golang.org/grpc v1.66.0 ) require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect cosmossdk.io/errors v1.0.1 // indirect - cosmossdk.io/log v1.4.0 // indirect + cosmossdk.io/log v1.4.1 // indirect cosmossdk.io/math v1.3.0 // indirect - cosmossdk.io/schema v0.1.1 // indirect - cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 // indirect + cosmossdk.io/schema v0.2.0 // indirect cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/tx v0.13.3 // indirect @@ -49,12 +48,12 @@ require ( github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/cometbft/cometbft-db v0.12.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-db v1.0.2 // indirect + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 // indirect github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -100,7 +99,7 @@ require ( github.com/iancoleman/strcase v0.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect @@ -116,13 +115,13 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -159,7 +158,7 @@ require ( golang.org/x/text v0.17.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -170,12 +169,13 @@ require ( replace github.com/cosmos/cosmos-sdk => ../../. +replace github.com/cosmos/iavl => github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e + replace ( cosmossdk.io/api => ../../api cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/x/accounts => ../accounts - cosmossdk.io/x/auth => ../auth + cosmossdk.io/store => ../../store cosmossdk.io/x/bank => ../bank cosmossdk.io/x/staking => ../staking cosmossdk.io/x/tx => ../tx diff --git a/x/consensus/go.sum b/x/consensus/go.sum index a79bc0458f82..cf2518382fe5 100644 --- a/x/consensus/go.sum +++ b/x/consensus/go.sum @@ -10,14 +10,12 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= -cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc h1:R9O9d75e0qZYUsVV0zzi+D7cNLnX2JrUOQNoIPaF0Bg= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc/go.mod h1:amTTatOUV3u1PsKmNb87z6/galCxrRbz9kRdJkL0DyU= +cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk= +cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= @@ -102,8 +100,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/crypto v0.1.2 h1:Yn500sPY+9sKVdhiPUSDtt8JOpBGMB515dOmla4zfls= @@ -115,10 +113,10 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e h1:LEii0v/FxtXa/F7mRn+tijZ0zaXBPn2ZkKwb6Qm4rqE= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e/go.mod h1:3ywr0wDnWeD7MUH6qu50wZ5bxuKH3LBrGG4/lZX8lVY= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -311,8 +309,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -322,6 +320,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -387,8 +387,8 @@ github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4 github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba h1:3jPgmsFGBID1wFfU2AbYocNcN4wqU68UaHSdMjiw/7U= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= @@ -405,8 +405,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -415,8 +415,8 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -472,7 +472,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -503,6 +502,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= @@ -635,10 +636,10 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEY google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -649,8 +650,8 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/x/consensus/keeper/keeper.go b/x/consensus/keeper/keeper.go index 548bf61d9337..76f74ffbaebf 100644 --- a/x/consensus/keeper/keeper.go +++ b/x/consensus/keeper/keeper.go @@ -29,6 +29,7 @@ type Keeper struct { var _ exported.ConsensusParamSetter = Keeper{}.ParamsStore +// NewKeeper creates a new Keeper instance. func NewKeeper(cdc codec.BinaryCodec, env appmodule.Environment, authority string) Keeper { sb := collections.NewSchemaBuilder(env.KVStoreService) return Keeper{ @@ -38,21 +39,19 @@ func NewKeeper(cdc codec.BinaryCodec, env appmodule.Environment, authority strin } } +// GetAuthority returns the authority address for the consensus module. +// This address has the permission to update consensus parameters. func (k *Keeper) GetAuthority() string { return k.authority } // InitGenesis initializes the initial state of the module func (k *Keeper) InitGenesis(ctx context.Context) error { - value, ok := ctx.Value(corecontext.InitInfoKey).(*types.MsgUpdateParams) - if !ok { + value, ok := ctx.Value(corecontext.CometParamsInitInfoKey).(*types.MsgUpdateParams) + if !ok || value == nil { // no error for appv1 and appv2 return nil } - if value == nil { - // no error for appv1 - return nil - } consensusParams, err := value.ToProtoConsensusParams() if err != nil { @@ -85,6 +84,7 @@ func (k Keeper) Params(ctx context.Context, _ *types.QueryParamsRequest) (*types var _ types.MsgServer = Keeper{} +// UpdateParams updates the consensus parameters. func (k Keeper) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { if k.GetAuthority() != msg.Authority { return nil, fmt.Errorf("invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) @@ -116,17 +116,19 @@ func (k Keeper) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (* // paramCheck validates the consensus params func (k Keeper) paramCheck(ctx context.Context, consensusParams cmtproto.ConsensusParams) (*cmttypes.ConsensusParams, error) { - paramsProto, err := k.ParamsStore.Get(ctx) - var params cmttypes.ConsensusParams - if err != nil { - if errors.Is(err, collections.ErrNotFound) { - params = cmttypes.ConsensusParams{} - } else { - return nil, err + + paramsProto, err := k.ParamsStore.Get(ctx) + if err == nil { + // initialize version params with zero value if not set + if paramsProto.Version == nil { + paramsProto.Version = &cmtproto.VersionParams{} } - } else { params = cmttypes.ConsensusParamsFromProto(paramsProto) + } else if errors.Is(err, collections.ErrNotFound) { + params = cmttypes.ConsensusParams{} + } else { + return nil, err } nextParams := params.Update(&consensusParams) diff --git a/x/consensus/keeper/keeper_test.go b/x/consensus/keeper/keeper_test.go index ed2bee648a70..1fb534674ba4 100644 --- a/x/consensus/keeper/keeper_test.go +++ b/x/consensus/keeper/keeper_test.go @@ -152,8 +152,6 @@ func (s *KeeperTestSuite) TestGRPCQueryConsensusParams() { } for _, tc := range testCases { - tc := tc - s.Run(tc.msg, func() { s.SetupTest(false) // reset @@ -189,8 +187,6 @@ func (s *KeeperTestSuite) TestUpdateParams() { Validator: defaultConsensusParams.Validator, Evidence: defaultConsensusParams.Evidence, }, - expErr: false, - expErrMsg: "", }, { name: "invalid params", @@ -258,8 +254,6 @@ func (s *KeeperTestSuite) TestUpdateParams() { VoteExtensionsEnableHeight: &gogotypes.Int64Value{Value: 300}, }, }, - expErr: false, - expErrMsg: "", }, { name: "valid Feature update - pbts", @@ -272,8 +266,6 @@ func (s *KeeperTestSuite) TestUpdateParams() { PbtsEnableHeight: &gogotypes.Int64Value{Value: 150}, }, }, - expErr: false, - expErrMsg: "", }, { name: "valid Feature update - vote extensions + pbts", @@ -287,8 +279,6 @@ func (s *KeeperTestSuite) TestUpdateParams() { PbtsEnableHeight: &gogotypes.Int64Value{Value: 110}, }, }, - expErr: false, - expErrMsg: "", }, { name: "valid noop Feature update - vote extensions + pbts (enabled feature)", @@ -303,8 +293,6 @@ func (s *KeeperTestSuite) TestUpdateParams() { PbtsEnableHeight: &gogotypes.Int64Value{Value: 5}, }, }, - expErr: false, - expErrMsg: "", }, { name: "valid (deprecated) ABCI update", @@ -317,8 +305,6 @@ func (s *KeeperTestSuite) TestUpdateParams() { VoteExtensionsEnableHeight: 90, }, }, - expErr: false, - expErrMsg: "", }, { name: "invalid Feature + (deprecated) ABCI vote extensions update", @@ -462,8 +448,6 @@ func (s *KeeperTestSuite) TestUpdateParams() { Precision: getDuration(3 * time.Second), }, }, - expErr: false, - expErrMsg: "", }, { name: "valid Synchrony update - delay", @@ -476,8 +460,6 @@ func (s *KeeperTestSuite) TestUpdateParams() { MessageDelay: getDuration(10 * time.Second), }, }, - expErr: false, - expErrMsg: "", }, { name: "valid Synchrony update - precision + delay", @@ -491,8 +473,6 @@ func (s *KeeperTestSuite) TestUpdateParams() { MessageDelay: getDuration(11 * time.Second), }, }, - expErr: false, - expErrMsg: "", }, { name: "valid Synchrony update - 0 precision", @@ -505,8 +485,6 @@ func (s *KeeperTestSuite) TestUpdateParams() { Precision: getDuration(0), }, }, - expErr: false, - expErrMsg: "", }, { name: "valid Synchrony update - 0 delay", @@ -519,8 +497,6 @@ func (s *KeeperTestSuite) TestUpdateParams() { MessageDelay: getDuration(0), }, }, - expErr: false, - expErrMsg: "", }, { name: "invalid Synchrony update - 0 precision with PBTS set", @@ -559,7 +535,6 @@ func (s *KeeperTestSuite) TestUpdateParams() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { s.SetupTest(tc.enabledFeatures) _, err := s.consensusParamsKeeper.UpdateParams(s.ctx, tc.input) diff --git a/x/consensus/types/codec.go b/x/consensus/types/codec.go index 2573b41d4beb..e814aedef617 100644 --- a/x/consensus/types/codec.go +++ b/x/consensus/types/codec.go @@ -9,6 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/msgservice" ) +// RegisterInterfaces registers the interfaces types with the interface registry. func RegisterInterfaces(registrar registry.InterfaceRegistrar) { registrar.RegisterImplementations( (*coretransaction.Msg)(nil), diff --git a/x/consensus/types/msgs.go b/x/consensus/types/msgs.go index 832658049d2c..f6556cc28dbb 100644 --- a/x/consensus/types/msgs.go +++ b/x/consensus/types/msgs.go @@ -8,6 +8,9 @@ import ( "github.com/cosmos/gogoproto/types" ) +// ToProtoConsensusParams converts MsgUpdateParams to cmtproto.ConsensusParams. +// It returns an error if any required parameters are missing or if there's a conflict +// between ABCI and Feature parameters. func (msg MsgUpdateParams) ToProtoConsensusParams() (cmtproto.ConsensusParams, error) { if msg.Evidence == nil || msg.Block == nil || msg.Validator == nil { return cmtproto.ConsensusParams{}, errors.New("all parameters must be present") diff --git a/x/consensus/types/query.pb.go b/x/consensus/types/query.pb.go index eda58630274f..8c344063a082 100644 --- a/x/consensus/types/query.pb.go +++ b/x/consensus/types/query.pb.go @@ -122,25 +122,24 @@ func init() { func init() { proto.RegisterFile("cosmos/consensus/v1/query.proto", fileDescriptor_bf54d1e5df04cee9) } var fileDescriptor_bf54d1e5df04cee9 = []byte{ - // 278 bytes of a gzipped FileDescriptorProto + // 271 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0x4f, 0xce, 0xcf, 0x2b, 0x4e, 0xcd, 0x2b, 0x2e, 0x2d, 0xd6, 0x2f, 0x33, 0xd4, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0x28, 0xd0, 0x83, 0x2b, 0xd0, 0x2b, 0x33, 0x94, 0x92, 0x49, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, 0x4f, 0x2c, 0xc8, 0xd4, 0x4f, 0xcc, 0xcb, 0xcb, 0x2f, 0x49, 0x2c, 0xc9, 0xcc, 0xcf, 0x2b, 0x86, 0x68, 0x91, 0x92, 0x4b, 0xce, 0xcf, 0x4d, 0x2d, 0x49, 0x4a, 0x2b, 0xd1, 0x2f, 0xa9, 0x2c, 0x48, 0x05, 0x9b, - 0x58, 0x90, 0x58, 0x94, 0x98, 0x0b, 0x93, 0x57, 0xc6, 0x66, 0x27, 0xc2, 0x7c, 0xb0, 0x22, 0x25, - 0x11, 0x2e, 0xa1, 0x40, 0x90, 0x33, 0x02, 0xc0, 0x3a, 0x83, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, - 0x94, 0x02, 0xb9, 0x84, 0x51, 0x44, 0x8b, 0x0b, 0x40, 0xda, 0x84, 0xac, 0xb8, 0xd8, 0x20, 0x36, - 0x48, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x1b, 0x29, 0xe9, 0xc1, 0x9c, 0xa0, 0x07, 0x76, 0x82, 0x5e, - 0x99, 0xa1, 0x9e, 0x33, 0xcc, 0x02, 0xa8, 0x5e, 0xa8, 0x0e, 0xa3, 0x2e, 0x46, 0x2e, 0x56, 0xb0, - 0x99, 0x42, 0x0d, 0x8c, 0x5c, 0x6c, 0x10, 0x49, 0x21, 0x75, 0x3d, 0x2c, 0xde, 0xd6, 0xc3, 0x74, - 0x90, 0x94, 0x06, 0x61, 0x85, 0x10, 0x37, 0x2a, 0x29, 0x37, 0x5d, 0x7e, 0x32, 0x99, 0x49, 0x56, - 0x48, 0x5a, 0x1f, 0x9b, 0xf7, 0x21, 0x8e, 0x71, 0xb2, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, - 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, - 0x63, 0x39, 0x86, 0x28, 0x39, 0x88, 0xae, 0xe2, 0x94, 0x6c, 0xbd, 0xcc, 0x7c, 0xfd, 0x0a, 0x24, - 0xdd, 0x60, 0x1f, 0x26, 0xb1, 0x81, 0x83, 0xcd, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xc3, 0xb9, - 0xf1, 0x10, 0xd1, 0x01, 0x00, 0x00, + 0x58, 0x90, 0x58, 0x94, 0x98, 0x0b, 0x95, 0x57, 0x12, 0xe1, 0x12, 0x0a, 0x04, 0xd9, 0x10, 0x00, + 0x16, 0x0c, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0x51, 0x0a, 0xe4, 0x12, 0x46, 0x11, 0x2d, 0x2e, + 0x00, 0xd9, 0x28, 0x64, 0xc5, 0xc5, 0x06, 0xd1, 0x2c, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x6d, 0xa4, + 0xa4, 0x07, 0x33, 0x5d, 0x0f, 0x6c, 0xba, 0x5e, 0x99, 0xa1, 0x9e, 0x33, 0xcc, 0x6d, 0x50, 0xbd, + 0x50, 0x1d, 0x46, 0x5d, 0x8c, 0x5c, 0xac, 0x60, 0x33, 0x85, 0x1a, 0x18, 0xb9, 0xd8, 0x20, 0x92, + 0x42, 0xea, 0x7a, 0x58, 0x7c, 0xa4, 0x87, 0xe9, 0x20, 0x29, 0x0d, 0xc2, 0x0a, 0x21, 0x6e, 0x54, + 0x52, 0x6e, 0xba, 0xfc, 0x64, 0x32, 0x93, 0xac, 0x90, 0xb4, 0x3e, 0xb6, 0xd0, 0x84, 0x38, 0xc6, + 0xc9, 0xe2, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, + 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0xe4, 0x20, 0xba, 0x8a, + 0x53, 0xb2, 0xf5, 0x32, 0xf3, 0xf5, 0x2b, 0x90, 0x74, 0x83, 0x7d, 0x98, 0xc4, 0x06, 0x0e, 0x36, + 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x63, 0xcb, 0xf0, 0x2b, 0xac, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/consensus/types/tx.pb.go b/x/consensus/types/tx.pb.go index 33f9d9a38eb6..ee6f9cab31a0 100644 --- a/x/consensus/types/tx.pb.go +++ b/x/consensus/types/tx.pb.go @@ -6,7 +6,6 @@ package types import ( context "context" fmt "fmt" - _ "github.com/cometbft/cometbft/api/cometbft/abci/v1" v1 "github.com/cometbft/cometbft/api/cometbft/types/v1" _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/msgservice" @@ -178,39 +177,38 @@ func init() { func init() { proto.RegisterFile("cosmos/consensus/v1/tx.proto", fileDescriptor_2135c60575ab504d) } var fileDescriptor_2135c60575ab504d = []byte{ - // 506 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x4f, 0x6b, 0x13, 0x41, - 0x18, 0xc6, 0xb3, 0x36, 0x69, 0xcd, 0x28, 0x14, 0x27, 0x4a, 0xa7, 0xa1, 0x0e, 0x31, 0x88, 0x94, - 0x60, 0x66, 0x9b, 0x58, 0xff, 0x82, 0x60, 0x23, 0x8a, 0x1e, 0x8a, 0xb2, 0xa5, 0x1e, 0xbc, 0xc8, - 0x64, 0x77, 0xba, 0x5d, 0xd2, 0xdd, 0x59, 0x76, 0x26, 0x6b, 0x73, 0x13, 0xc1, 0x8b, 0x27, 0xbf, - 0x88, 0x90, 0x43, 0x3f, 0x84, 0x78, 0x2a, 0x9e, 0xc4, 0x93, 0x24, 0x87, 0x7c, 0x0d, 0xd9, 0x99, - 0xdd, 0xac, 0x8d, 0xab, 0x78, 0x09, 0x64, 0x9f, 0xe7, 0xf7, 0x3c, 0x33, 0xef, 0xbe, 0x0b, 0x36, - 0x6c, 0x2e, 0x7c, 0x2e, 0x4c, 0x9b, 0x07, 0x82, 0x05, 0x62, 0x28, 0xcc, 0xb8, 0x63, 0xca, 0x63, - 0x12, 0x46, 0x5c, 0x72, 0x58, 0xd3, 0x2a, 0x99, 0xab, 0x24, 0xee, 0xd4, 0x2f, 0x51, 0xdf, 0x0b, - 0xb8, 0xa9, 0x7e, 0xb5, 0xaf, 0xbe, 0xae, 0x7d, 0x6f, 0xd4, 0x3f, 0x33, 0x85, 0xb4, 0xb4, 0x96, - 0x16, 0xf8, 0xc2, 0x4d, 0xa2, 0x7d, 0xe1, 0xa6, 0x02, 0xb6, 0xb9, 0xcf, 0x64, 0xff, 0x40, 0x9a, - 0x72, 0x14, 0x32, 0xd5, 0x1b, 0xd2, 0x88, 0xfa, 0x19, 0xb8, 0x31, 0xd7, 0x69, 0xdf, 0xf6, 0xd4, - 0xb1, 0x12, 0x9f, 0x56, 0x9b, 0x9f, 0xcb, 0x60, 0x75, 0x57, 0xb8, 0xfb, 0xa1, 0x43, 0x25, 0x7b, - 0xa9, 0x38, 0x78, 0x07, 0x54, 0xe9, 0x50, 0x1e, 0xf2, 0xc8, 0x93, 0x23, 0x64, 0x34, 0x8c, 0xcd, - 0x6a, 0x0f, 0x7d, 0x3b, 0x69, 0x5f, 0x4e, 0xcf, 0xb3, 0xe3, 0x38, 0x11, 0x13, 0x62, 0x4f, 0x46, - 0x5e, 0xe0, 0x5a, 0xb9, 0x15, 0x6e, 0x83, 0x4a, 0xff, 0x88, 0xdb, 0x03, 0x74, 0xae, 0x61, 0x6c, - 0x5e, 0xe8, 0x62, 0x92, 0x35, 0x13, 0xdd, 0x18, 0x77, 0x48, 0x2f, 0xd1, 0x75, 0x8d, 0xa5, 0xcd, - 0xf0, 0x21, 0x38, 0xcf, 0x62, 0xcf, 0x61, 0x81, 0xcd, 0xd0, 0x92, 0x02, 0xaf, 0x15, 0x80, 0x4f, - 0x52, 0x4b, 0xca, 0xce, 0x11, 0xf8, 0x08, 0x54, 0x63, 0x7a, 0xe4, 0x39, 0x54, 0xf2, 0x08, 0x95, - 0x15, 0xdf, 0x2c, 0xe0, 0x5f, 0x65, 0x9e, 0x34, 0x20, 0x87, 0xe0, 0x33, 0x50, 0x4e, 0x26, 0x83, - 0x2a, 0x0a, 0xbe, 0x5a, 0x00, 0xef, 0xf4, 0x1e, 0x3f, 0xd7, 0x5c, 0xef, 0xca, 0x8f, 0x93, 0xf6, - 0xaa, 0x1e, 0x44, 0x5b, 0x38, 0x83, 0xc6, 0x16, 0xb9, 0xbd, 0x85, 0x0c, 0x4b, 0x25, 0xc0, 0x7d, - 0x50, 0x15, 0xa3, 0xc0, 0x3e, 0x8c, 0x78, 0x30, 0x42, 0xcb, 0x7f, 0x3d, 0xcb, 0x5e, 0xe6, 0x49, - 0x33, 0x6b, 0x7f, 0x66, 0x76, 0xad, 0x3c, 0x09, 0xbe, 0x00, 0x2b, 0x07, 0x8c, 0xca, 0x61, 0xc4, - 0xd0, 0x8a, 0x0a, 0x6d, 0x14, 0x84, 0x3e, 0xd5, 0x8e, 0x7f, 0x45, 0x66, 0x29, 0x0f, 0xee, 0xbf, - 0x9f, 0x8d, 0x5b, 0xf9, 0x8b, 0xfb, 0x38, 0x1b, 0xb7, 0x6e, 0xe4, 0x66, 0xf3, 0xf8, 0xb7, 0x2d, - 0x5e, 0xd8, 0x8d, 0xe6, 0x3a, 0x58, 0x5b, 0x78, 0x64, 0x31, 0x11, 0x26, 0xf6, 0xee, 0x07, 0x03, - 0x2c, 0xed, 0x0a, 0x17, 0xbe, 0x05, 0x17, 0xcf, 0xac, 0xd3, 0x75, 0x52, 0xb0, 0xfd, 0x64, 0x21, - 0xa5, 0x7e, 0xf3, 0x7f, 0x5c, 0x59, 0x57, 0xb3, 0xf6, 0x75, 0xf1, 0x7e, 0xdb, 0x77, 0xeb, 0x95, - 0x77, 0xb3, 0x71, 0xcb, 0xe8, 0xdd, 0xfb, 0x32, 0xc1, 0xc6, 0xe9, 0x04, 0x1b, 0x3f, 0x27, 0xd8, - 0xf8, 0x34, 0xc5, 0xa5, 0xd3, 0x29, 0x2e, 0x7d, 0x9f, 0xe2, 0xd2, 0x6b, 0xac, 0x09, 0xe1, 0x0c, - 0x88, 0xc7, 0xcf, 0x5c, 0x53, 0x8d, 0xb1, 0xbf, 0xac, 0xbe, 0x89, 0x5b, 0xbf, 0x02, 0x00, 0x00, - 0xff, 0xff, 0x84, 0xf1, 0x97, 0xc0, 0xcd, 0x03, 0x00, 0x00, + // 496 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x4f, 0x8b, 0xd3, 0x40, + 0x18, 0xc6, 0x1b, 0xb7, 0xdd, 0xb5, 0xa3, 0xb0, 0x98, 0x2a, 0x3b, 0x5b, 0x74, 0xa8, 0x45, 0x64, + 0x29, 0x76, 0xb2, 0xad, 0xeb, 0x5f, 0x10, 0xdc, 0x88, 0xa2, 0x87, 0x45, 0xc9, 0xb2, 0x1e, 0xbc, + 0xc8, 0x34, 0x99, 0xcd, 0x86, 0x6e, 0x32, 0x21, 0x33, 0x8d, 0xdb, 0x9b, 0x08, 0x5e, 0x3c, 0xf9, + 0x45, 0x84, 0x1e, 0xf6, 0x43, 0x88, 0xa7, 0xc5, 0x93, 0x78, 0x92, 0xf6, 0xd0, 0xaf, 0x21, 0x9d, + 0x99, 0x6c, 0x6c, 0x8d, 0xb2, 0x97, 0x40, 0xf2, 0x3c, 0xbf, 0xe7, 0xc9, 0xbc, 0x79, 0x03, 0xae, + 0xba, 0x8c, 0x87, 0x8c, 0x5b, 0x2e, 0x8b, 0x38, 0x8d, 0xf8, 0x80, 0x5b, 0x69, 0xc7, 0x12, 0x47, + 0x38, 0x4e, 0x98, 0x60, 0x66, 0x4d, 0xa9, 0xf8, 0x54, 0xc5, 0x69, 0xa7, 0x7e, 0x89, 0x84, 0x41, + 0xc4, 0x2c, 0x79, 0x55, 0xbe, 0xfa, 0xba, 0xf2, 0xbd, 0x95, 0x77, 0x96, 0x86, 0x94, 0xb4, 0xa6, + 0x0b, 0x42, 0xee, 0xcf, 0xa2, 0x43, 0xee, 0x6b, 0x01, 0xb9, 0x2c, 0xa4, 0xa2, 0xb7, 0x2f, 0x2c, + 0x31, 0x8c, 0xa9, 0xec, 0x8d, 0x49, 0x42, 0x42, 0x0d, 0x36, 0xbf, 0x94, 0xc1, 0xea, 0x0e, 0xf7, + 0xf7, 0x62, 0x8f, 0x08, 0xfa, 0x4a, 0x2a, 0xe6, 0x5d, 0x50, 0x25, 0x03, 0x71, 0xc0, 0x92, 0x40, + 0x0c, 0xa1, 0xd1, 0x30, 0x36, 0xaa, 0x36, 0xfc, 0x7e, 0xdc, 0xbe, 0xac, 0x1b, 0xb7, 0x3d, 0x2f, + 0xa1, 0x9c, 0xef, 0x8a, 0x24, 0x88, 0x7c, 0x27, 0xb7, 0x9a, 0x5b, 0xa0, 0xd2, 0x3b, 0x64, 0x6e, + 0x1f, 0x9e, 0x6b, 0x18, 0x1b, 0x17, 0xba, 0x08, 0x67, 0xdd, 0x58, 0x76, 0xe3, 0xb4, 0x83, 0xed, + 0x99, 0xae, 0x6a, 0x1c, 0x65, 0x36, 0x1f, 0x81, 0xf3, 0x34, 0x0d, 0x3c, 0x1a, 0xb9, 0x14, 0x2e, + 0x49, 0xf0, 0x7a, 0x01, 0xf8, 0x54, 0x5b, 0x34, 0x7b, 0x8a, 0x98, 0x8f, 0x41, 0x35, 0x25, 0x87, + 0x81, 0x47, 0x04, 0x4b, 0x60, 0x59, 0xf2, 0xcd, 0x02, 0xfe, 0x75, 0xe6, 0xd1, 0x01, 0x39, 0x64, + 0x3e, 0x07, 0x65, 0xd2, 0x73, 0x03, 0x58, 0x91, 0xf0, 0xb5, 0x02, 0x78, 0xdb, 0x7e, 0xf2, 0x42, + 0x71, 0xf6, 0x95, 0x9f, 0xc7, 0xed, 0x55, 0x35, 0x88, 0x36, 0xf7, 0xfa, 0x8d, 0x4d, 0x7c, 0x67, + 0x13, 0x1a, 0x8e, 0x4c, 0x30, 0xf7, 0x40, 0x95, 0x0f, 0x23, 0xf7, 0x20, 0x61, 0xd1, 0x10, 0x2e, + 0xff, 0xf3, 0x5d, 0x76, 0x33, 0x8f, 0xce, 0xac, 0xfd, 0x9d, 0xd9, 0x75, 0xf2, 0x24, 0xf3, 0x25, + 0x58, 0xd9, 0xa7, 0x44, 0x0c, 0x12, 0x0a, 0x57, 0x64, 0x68, 0xa3, 0x20, 0xf4, 0x99, 0x72, 0xfc, + 0x2f, 0x32, 0x4b, 0x79, 0xf8, 0xe0, 0xc3, 0x74, 0xd4, 0xca, 0x3f, 0xdc, 0xa7, 0xe9, 0xa8, 0x75, + 0x33, 0x37, 0x5b, 0x47, 0x7f, 0xec, 0xe9, 0xc2, 0x6e, 0x34, 0xd7, 0xc1, 0xda, 0xc2, 0x23, 0x87, + 0xf2, 0x78, 0x66, 0xef, 0x7e, 0x34, 0xc0, 0xd2, 0x0e, 0xf7, 0xcd, 0x77, 0xe0, 0xe2, 0xdc, 0x3a, + 0xdd, 0xc0, 0x05, 0xfb, 0x8d, 0x17, 0x52, 0xea, 0xb7, 0xce, 0xe2, 0xca, 0xba, 0x9a, 0xb5, 0x6f, + 0x8b, 0xe7, 0xdb, 0xba, 0x57, 0xaf, 0xbc, 0x9f, 0x8e, 0x5a, 0x86, 0x7d, 0xff, 0xeb, 0x18, 0x19, + 0x27, 0x63, 0x64, 0xfc, 0x1a, 0x23, 0xe3, 0xf3, 0x04, 0x95, 0x4e, 0x26, 0xa8, 0xf4, 0x63, 0x82, + 0x4a, 0x6f, 0x90, 0x22, 0xb8, 0xd7, 0xc7, 0x01, 0x9b, 0x3b, 0xa6, 0x1c, 0x63, 0x6f, 0x59, 0xfe, + 0x13, 0xb7, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x3b, 0x57, 0xe6, 0xfa, 0xaf, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/distribution/README.md b/x/distribution/README.md index 03e1e5baff21..d49b309f50fe 100644 --- a/x/distribution/README.md +++ b/x/distribution/README.md @@ -186,7 +186,7 @@ it can be updated with governance or the address with authority. * Params: `0x09 | ProtocolBuffer(Params)` ```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/distribution/v1beta1/distribution.proto#L12-L42 +https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/distribution/proto/cosmos/distribution/v1beta1/distribution.proto#L12-L44 ``` ## Begin Block @@ -272,7 +272,7 @@ The withdraw address cannot be any of the module accounts. These accounts are bl Response: ```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/distribution/v1beta1/tx.proto#L49-L60 +https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/distribution/proto/cosmos/distribution/v1beta1/tx.proto#L62-L73 ``` ```go @@ -324,7 +324,7 @@ The final calculated stake is equivalent to the actual staked coins in the deleg Response: ```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/distribution/v1beta1/tx.proto#L66-L77 +https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/distribution/proto/cosmos/distribution/v1beta1/tx.proto#L79-L90 ``` ### WithdrawValidatorCommission @@ -368,7 +368,7 @@ func (k Keeper) initializeDelegation(ctx context.Context, val sdk.ValAddress, de Distribution module params can be updated through `MsgUpdateParams`, which can be done using governance proposal and the signer will always be gov module account address. ```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/distribution/v1beta1/tx.proto#L133-L147 +https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/distribution/proto/cosmos/distribution/v1beta1/tx.proto#L159:L172 ``` The message handling can fail if: diff --git a/x/distribution/autocli.go b/x/distribution/autocli.go index c53abc4eda4e..d793f2626df5 100644 --- a/x/distribution/autocli.go +++ b/x/distribution/autocli.go @@ -22,7 +22,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "ValidatorDistributionInfo", - Use: "validator-distribution-info [validator]", + Use: "validator-distribution-info ", Short: "Query validator distribution info", Example: fmt.Sprintf(`Example: $ %s query distribution validator-distribution-info [validator-address]`, version.AppName), @@ -32,7 +32,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "ValidatorOutstandingRewards", - Use: "validator-outstanding-rewards [validator]", + Use: "validator-outstanding-rewards ", Short: "Query distribution outstanding (un-withdrawn) rewards for a validator and all their delegations", Example: fmt.Sprintf(`$ %s query distribution validator-outstanding-rewards [validator-address]`, version.AppName), PositionalArgs: []*autocliv1.PositionalArgDescriptor{ @@ -41,7 +41,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "ValidatorCommission", - Use: "commission [validator]", + Use: "commission ", Short: "Query distribution validator commission", Example: fmt.Sprintf(`$ %s query distribution commission [validator-address]`, version.AppName), PositionalArgs: []*autocliv1.PositionalArgDescriptor{ @@ -50,7 +50,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "ValidatorSlashes", - Use: "slashes [validator] [start-height] [end-height]", + Use: "slashes ", Short: "Query distribution validator slashes", Example: fmt.Sprintf(`$ %s query distribution slashes [validator-address] 0 100`, version.AppName), PositionalArgs: []*autocliv1.PositionalArgDescriptor{ @@ -61,7 +61,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "DelegationRewards", - Use: "rewards-by-validator [delegator-addr] [validator-addr]", + Use: "rewards-by-validator ", Short: "Query all distribution delegator from a particular validator", Example: fmt.Sprintf("$ %s query distribution rewards [delegator-address] [validator-address]", version.AppName), PositionalArgs: []*autocliv1.PositionalArgDescriptor{ @@ -71,7 +71,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "DelegationTotalRewards", - Use: "rewards [delegator-addr]", + Use: "rewards ", Short: "Query all distribution delegator rewards", Long: "Query all rewards earned by a delegator", Example: fmt.Sprintf("$ %s query distribution rewards [delegator-address]", version.AppName), @@ -92,7 +92,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { RpcMethod: "SetWithdrawAddress", - Use: "set-withdraw-addr [withdraw-addr]", + Use: "set-withdraw-addr ", Short: "Change the default withdraw address for rewards associated with an address", Example: fmt.Sprintf("%s tx distribution set-withdraw-addr cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p --from mykey", version.AppName), PositionalArgs: []*autocliv1.PositionalArgDescriptor{ @@ -101,7 +101,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "WithdrawDelegatorReward", - Use: "withdraw-rewards [validator-addr]", + Use: "withdraw-rewards ", Short: "Withdraw rewards from a given delegation address", PositionalArgs: []*autocliv1.PositionalArgDescriptor{ {ProtoField: "validator_address"}, @@ -109,7 +109,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "WithdrawValidatorCommission", - Use: "withdraw-validator-commission [validator-addr]", + Use: "withdraw-validator-commission ", Short: "Withdraw commissions from a validator address (must be a validator operator)", PositionalArgs: []*autocliv1.PositionalArgDescriptor{ {ProtoField: "validator_address"}, @@ -117,7 +117,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "DepositValidatorRewardsPool", - Use: "fund-validator-rewards-pool [validator-addr] [amount]", + Use: "fund-validator-rewards-pool ", Short: "Fund the validator rewards pool with the specified amount", Example: fmt.Sprintf("%s tx distribution fund-validator-rewards-pool cosmosvaloper1x20lytyf6zkcrv5edpkfkn8sz578qg5sqfyqnp 100uatom --from mykey", version.AppName), PositionalArgs: []*autocliv1.PositionalArgDescriptor{ @@ -128,7 +128,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { { RpcMethod: "FundCommunityPool", Deprecated: fmt.Sprintf("Use %s tx protocolpool fund-community-pool", version.AppName), - Use: "fund-community-pool [amount]", + Use: "fund-community-pool ", Short: "Funds the community pool with the specified amount", Example: fmt.Sprintf(`$ %s tx distribution fund-community-pool 100uatom --from mykey`, version.AppName), PositionalArgs: []*autocliv1.PositionalArgDescriptor{ @@ -137,7 +137,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "UpdateParams", - Use: "update-params-proposal [params]", + Use: "update-params-proposal ", Short: "Submit a proposal to update distribution module params. Note: the entire params must be provided.", Example: fmt.Sprintf(`%s tx distribution update-params-proposal '{ "community_tax": "20000", "base_proposer_reward": "0", "bonus_proposer_reward": "0", "withdraw_addr_enabled": true }'`, version.AppName), PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "params"}}, diff --git a/x/distribution/depinject.go b/x/distribution/depinject.go index 07e63548efac..1701e88b8bf2 100644 --- a/x/distribution/depinject.go +++ b/x/distribution/depinject.go @@ -6,12 +6,12 @@ import ( "cosmossdk.io/core/comet" "cosmossdk.io/depinject" "cosmossdk.io/depinject/appconfig" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/distribution/keeper" "cosmossdk.io/x/distribution/types" staking "cosmossdk.io/x/staking/types" "github.com/cosmos/cosmos-sdk/codec" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var _ depinject.OnePerModuleType = AppModule{} diff --git a/x/distribution/go.mod b/x/distribution/go.mod index 733717fe7166..da87df43aa09 100644 --- a/x/distribution/go.mod +++ b/x/distribution/go.mod @@ -1,15 +1,15 @@ module cosmossdk.io/x/distribution -go 1.22.2 +go 1.23 require ( cosmossdk.io/api v0.7.5 cosmossdk.io/collections v0.4.0 - cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 + cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 cosmossdk.io/depinject v1.0.0 cosmossdk.io/errors v1.0.1 - cosmossdk.io/log v1.4.0 + cosmossdk.io/log v1.4.1 cosmossdk.io/math v1.3.0 cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 @@ -25,22 +25,15 @@ require ( github.com/pkg/errors v0.9.1 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 - google.golang.org/grpc v1.65.0 + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 + google.golang.org/grpc v1.66.0 gotest.tools/v3 v3.5.1 ) -require ( - cosmossdk.io/schema v0.1.1 // indirect - github.com/cockroachdb/errors v1.11.1 // indirect - github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect - github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect -) - require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect - cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 + cosmossdk.io/schema v0.2.0 // indirect cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/tx v0.13.3 // indirect filippo.io/edwards25519 v1.1.0 // indirect @@ -53,6 +46,7 @@ require ( github.com/bgentry/speakeasy v0.2.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/cockroachdb/errors v1.11.1 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect github.com/cockroachdb/pebble v1.1.0 // indirect github.com/cockroachdb/redact v1.1.5 // indirect @@ -61,12 +55,12 @@ require ( github.com/cometbft/cometbft-db v0.12.0 // indirect github.com/cometbft/cometbft/api v1.0.0-rc.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-db v1.0.2 // indirect + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 // indirect github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -103,6 +97,7 @@ require ( github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-plugin v1.6.1 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect + github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/yamux v0.1.1 // indirect github.com/hdevalence/ed25519consensus v0.2.0 // indirect @@ -110,7 +105,7 @@ require ( github.com/iancoleman/strcase v0.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect @@ -123,14 +118,15 @@ require ( github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mtibben/percent v0.2.1 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -166,7 +162,7 @@ require ( golang.org/x/text v0.17.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -176,14 +172,15 @@ require ( replace github.com/cosmos/cosmos-sdk => ../../. +replace github.com/cosmos/iavl => github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e + // TODO remove post spinning out all modules replace ( cosmossdk.io/api => ../../api cosmossdk.io/collections => ../../collections cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/x/accounts => ../accounts - cosmossdk.io/x/auth => ../auth + cosmossdk.io/store => ../../store cosmossdk.io/x/bank => ../bank cosmossdk.io/x/consensus => ../consensus cosmossdk.io/x/protocolpool => ../protocolpool diff --git a/x/distribution/go.sum b/x/distribution/go.sum index 91cd863d3b91..7c1f771aabec 100644 --- a/x/distribution/go.sum +++ b/x/distribution/go.sum @@ -8,14 +8,12 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= -cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc h1:R9O9d75e0qZYUsVV0zzi+D7cNLnX2JrUOQNoIPaF0Bg= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc/go.mod h1:amTTatOUV3u1PsKmNb87z6/galCxrRbz9kRdJkL0DyU= +cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk= +cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= @@ -100,8 +98,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/crypto v0.1.2 h1:Yn500sPY+9sKVdhiPUSDtt8JOpBGMB515dOmla4zfls= @@ -113,10 +111,10 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e h1:LEii0v/FxtXa/F7mRn+tijZ0zaXBPn2ZkKwb6Qm4rqE= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e/go.mod h1:3ywr0wDnWeD7MUH6qu50wZ5bxuKH3LBrGG4/lZX8lVY= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -309,8 +307,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -320,6 +318,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -385,8 +385,8 @@ github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4 github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba h1:3jPgmsFGBID1wFfU2AbYocNcN4wqU68UaHSdMjiw/7U= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= @@ -403,8 +403,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -413,8 +413,8 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -470,7 +470,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -502,6 +501,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= @@ -637,10 +638,10 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEY google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -651,8 +652,8 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/x/distribution/keeper/allocation_test.go b/x/distribution/keeper/allocation_test.go index f319ad456cbe..703840f15e1b 100644 --- a/x/distribution/keeper/allocation_test.go +++ b/x/distribution/keeper/allocation_test.go @@ -14,7 +14,6 @@ import ( coretesting "cosmossdk.io/core/testing" "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/distribution" "cosmossdk.io/x/distribution/keeper" distrtestutil "cosmossdk.io/x/distribution/testutil" @@ -27,6 +26,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var _ comet.Service = (*emptyCometService)(nil) @@ -375,3 +375,131 @@ func TestAllocateTokensTruncation(t *testing.T) { require.NoError(t, err) require.True(t, val2OutstandingRewards.Rewards.IsValid()) } + +func TestAllocateTokensToValidatorWithoutCommission(t *testing.T) { + ctrl := gomock.NewController(t) + key := storetypes.NewKVStoreKey(disttypes.StoreKey) + testCtx := testutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test")) + cdcOpts := codectestutil.CodecOptions{} + encCfg := moduletestutil.MakeTestEncodingConfig(cdcOpts, distribution.AppModule{}) + ctx := testCtx.Ctx.WithHeaderInfo(header.Info{Time: time.Now()}) + + bankKeeper := distrtestutil.NewMockBankKeeper(ctrl) + stakingKeeper := distrtestutil.NewMockStakingKeeper(ctrl) + accountKeeper := distrtestutil.NewMockAccountKeeper(ctrl) + + env := runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()) + + valCodec := address.NewBech32Codec("cosmosvaloper") + + accountKeeper.EXPECT().GetModuleAddress("distribution").Return(distrAcc.GetAddress()) + stakingKeeper.EXPECT().ValidatorAddressCodec().Return(valCodec).AnyTimes() + + authorityAddr, err := cdcOpts.GetAddressCodec().BytesToString(authtypes.NewModuleAddress("gov")) + require.NoError(t, err) + + distrKeeper := keeper.NewKeeper( + encCfg.Codec, + env, + accountKeeper, + bankKeeper, + stakingKeeper, + testCometService, + "fee_collector", + authorityAddr, + ) + + // create validator with 0% commission + operatorAddr, err := stakingKeeper.ValidatorAddressCodec().BytesToString(valConsPk0.Address()) + require.NoError(t, err) + val, err := distrtestutil.CreateValidator(valConsPk0, operatorAddr, math.NewInt(100)) + require.NoError(t, err) + val.Commission = stakingtypes.NewCommission(math.LegacyNewDec(0), math.LegacyNewDec(0), math.LegacyNewDec(0)) + stakingKeeper.EXPECT().ValidatorByConsAddr(gomock.Any(), sdk.GetConsAddress(valConsPk0)).Return(val, nil).AnyTimes() + + // allocate tokens + tokens := sdk.DecCoins{ + {Denom: sdk.DefaultBondDenom, Amount: math.LegacyNewDec(10)}, + } + require.NoError(t, distrKeeper.AllocateTokensToValidator(ctx, val, tokens)) + + // check commission + var expectedCommission sdk.DecCoins = nil + + valBz, err := valCodec.StringToBytes(val.GetOperator()) + require.NoError(t, err) + + valCommission, err := distrKeeper.ValidatorsAccumulatedCommission.Get(ctx, valBz) + require.NoError(t, err) + require.Equal(t, expectedCommission, valCommission.Commission) + + // check current rewards + expectedRewards := tokens + + currentRewards, err := distrKeeper.ValidatorCurrentRewards.Get(ctx, valBz) + require.NoError(t, err) + require.Equal(t, expectedRewards, currentRewards.Rewards) +} + +func TestAllocateTokensWithZeroTokens(t *testing.T) { + ctrl := gomock.NewController(t) + defer ctrl.Finish() + + key := storetypes.NewKVStoreKey(disttypes.StoreKey) + testCtx := testutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test")) + cdcOpts := codectestutil.CodecOptions{} + encCfg := moduletestutil.MakeTestEncodingConfig(cdcOpts, distribution.AppModule{}) + ctx := testCtx.Ctx.WithHeaderInfo(header.Info{Time: time.Now()}) + + bankKeeper := distrtestutil.NewMockBankKeeper(ctrl) + stakingKeeper := distrtestutil.NewMockStakingKeeper(ctrl) + accountKeeper := distrtestutil.NewMockAccountKeeper(ctrl) + + env := runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()) + + valCodec := address.NewBech32Codec("cosmosvaloper") + + accountKeeper.EXPECT().GetModuleAddress("distribution").Return(distrAcc.GetAddress()) + stakingKeeper.EXPECT().ValidatorAddressCodec().Return(valCodec).AnyTimes() + + authorityAddr, err := cdcOpts.GetAddressCodec().BytesToString(authtypes.NewModuleAddress("gov")) + require.NoError(t, err) + + distrKeeper := keeper.NewKeeper( + encCfg.Codec, + env, + accountKeeper, + bankKeeper, + stakingKeeper, + testCometService, + "fee_collector", + authorityAddr, + ) + + // create validator with 50% commission + operatorAddr, err := stakingKeeper.ValidatorAddressCodec().BytesToString(valConsPk0.Address()) + require.NoError(t, err) + val, err := distrtestutil.CreateValidator(valConsPk0, operatorAddr, math.NewInt(100)) + require.NoError(t, err) + val.Commission = stakingtypes.NewCommission(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDec(0)) + stakingKeeper.EXPECT().ValidatorByConsAddr(gomock.Any(), sdk.GetConsAddress(valConsPk0)).Return(val, nil).AnyTimes() + + // allocate zero tokens + tokens := sdk.DecCoins{} + require.NoError(t, distrKeeper.AllocateTokensToValidator(ctx, val, tokens)) + + // check commission + var expected sdk.DecCoins = nil + + valBz, err := valCodec.StringToBytes(val.GetOperator()) + require.NoError(t, err) + + valCommission, err := distrKeeper.ValidatorsAccumulatedCommission.Get(ctx, valBz) + require.NoError(t, err) + require.Equal(t, expected, valCommission.Commission) + + // check current rewards + currentRewards, err := distrKeeper.ValidatorCurrentRewards.Get(ctx, valBz) + require.NoError(t, err) + require.Equal(t, expected, currentRewards.Rewards) +} diff --git a/x/distribution/keeper/common_test.go b/x/distribution/keeper/common_test.go index 47445e4a0850..5451c73d4490 100644 --- a/x/distribution/keeper/common_test.go +++ b/x/distribution/keeper/common_test.go @@ -1,11 +1,11 @@ package keeper_test import ( - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/distribution/types" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var ( diff --git a/x/distribution/keeper/delegation_test.go b/x/distribution/keeper/delegation_test.go index 31419b10e082..8ee03d5f3f3b 100644 --- a/x/distribution/keeper/delegation_test.go +++ b/x/distribution/keeper/delegation_test.go @@ -11,7 +11,6 @@ import ( coretesting "cosmossdk.io/core/testing" "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/distribution" "cosmossdk.io/x/distribution/keeper" distrtestutil "cosmossdk.io/x/distribution/testutil" @@ -24,6 +23,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestCalculateRewardsBasic(t *testing.T) { diff --git a/x/distribution/keeper/grpc_query.go b/x/distribution/keeper/grpc_query.go index de8657276fbe..5337ec58c342 100644 --- a/x/distribution/keeper/grpc_query.go +++ b/x/distribution/keeper/grpc_query.go @@ -119,7 +119,7 @@ func (k Querier) ValidatorOutstandingRewards(ctx context.Context, req *types.Que } if validator == nil { - return nil, errors.Wrapf(types.ErrNoValidatorExists, req.ValidatorAddress) + return nil, errors.Wrap(types.ErrNoValidatorExists, req.ValidatorAddress) } rewards, err := k.Keeper.ValidatorOutstandingRewards.Get(ctx, valAdr) @@ -151,7 +151,7 @@ func (k Querier) ValidatorCommission(ctx context.Context, req *types.QueryValida } if validator == nil { - return nil, errors.Wrapf(types.ErrNoValidatorExists, req.ValidatorAddress) + return nil, errors.Wrap(types.ErrNoValidatorExists, req.ValidatorAddress) } commission, err := k.ValidatorsAccumulatedCommission.Get(ctx, valAdr) if err != nil && !errors.IsOf(err, collections.ErrNotFound) { diff --git a/x/distribution/keeper/grpc_query_test.go b/x/distribution/keeper/grpc_query_test.go index affc16b392b1..84fa95def6cc 100644 --- a/x/distribution/keeper/grpc_query_test.go +++ b/x/distribution/keeper/grpc_query_test.go @@ -7,7 +7,6 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/math" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/distribution/keeper" distrtestutil "cosmossdk.io/x/distribution/testutil" "cosmossdk.io/x/distribution/types" @@ -15,6 +14,7 @@ import ( codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestQueryParams(t *testing.T) { diff --git a/x/distribution/keeper/keeper.go b/x/distribution/keeper/keeper.go index 0c3238353eba..0ded047e93d6 100644 --- a/x/distribution/keeper/keeper.go +++ b/x/distribution/keeper/keeper.go @@ -46,7 +46,7 @@ type Keeper struct { DelegatorStartingInfo collections.Map[collections.Pair[sdk.ValAddress, sdk.AccAddress], types.DelegatorStartingInfo] // ValidatorsAccumulatedCommission key: valAddr | value: ValidatorAccumulatedCommission ValidatorsAccumulatedCommission collections.Map[sdk.ValAddress, types.ValidatorAccumulatedCommission] - // ValidatorOutstandingRewards key: valAddr | value: ValidatorOustandingRewards + // ValidatorOutstandingRewards key: valAddr | value: ValidatorOutstandingRewards ValidatorOutstandingRewards collections.Map[sdk.ValAddress, types.ValidatorOutstandingRewards] // ValidatorHistoricalRewards key: valAddr+period | value: ValidatorHistoricalRewards ValidatorHistoricalRewards collections.Map[collections.Pair[sdk.ValAddress, uint64], types.ValidatorHistoricalRewards] diff --git a/x/distribution/keeper/keeper_test.go b/x/distribution/keeper/keeper_test.go index a3fdb44d797c..589b738a0b57 100644 --- a/x/distribution/keeper/keeper_test.go +++ b/x/distribution/keeper/keeper_test.go @@ -11,7 +11,6 @@ import ( coretesting "cosmossdk.io/core/testing" "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/distribution" "cosmossdk.io/x/distribution/keeper" distrtestutil "cosmossdk.io/x/distribution/testutil" @@ -24,6 +23,7 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) type dep struct { diff --git a/x/distribution/keeper/msg_server.go b/x/distribution/keeper/msg_server.go index 2b405f9b053a..0a4b9f32ca49 100644 --- a/x/distribution/keeper/msg_server.go +++ b/x/distribution/keeper/msg_server.go @@ -189,7 +189,7 @@ func (k msgServer) DepositValidatorRewardsPool(ctx context.Context, msg *types.M } if validator == nil { - return nil, errors.Wrapf(types.ErrNoValidatorExists, msg.ValidatorAddress) + return nil, errors.Wrap(types.ErrNoValidatorExists, msg.ValidatorAddress) } // Allocate tokens from the distribution module to the validator, which are diff --git a/x/distribution/keeper/msg_server_test.go b/x/distribution/keeper/msg_server_test.go index 59a21395de4c..03f4e8c88565 100644 --- a/x/distribution/keeper/msg_server_test.go +++ b/x/distribution/keeper/msg_server_test.go @@ -7,12 +7,12 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/math" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/distribution/keeper" "cosmossdk.io/x/distribution/types" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestMsgSetWithdrawAddress(t *testing.T) { diff --git a/x/distribution/keeper/validator.go b/x/distribution/keeper/validator.go index 812fbbe5086b..a533bc21714a 100644 --- a/x/distribution/keeper/validator.go +++ b/x/distribution/keeper/validator.go @@ -2,9 +2,10 @@ package keeper import ( "context" + "errors" "fmt" - "github.com/pkg/errors" + pkgerr "github.com/pkg/errors" "cosmossdk.io/collections" "cosmossdk.io/math" @@ -13,6 +14,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) +const ( + maxReferenceCount = 2 +) + // initialize rewards for a new validator func (k Keeper) initializeValidator(ctx context.Context, val sdk.ValidatorI) error { valBz, err := k.stakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) @@ -51,7 +56,7 @@ func (k Keeper) IncrementValidatorPeriod(ctx context.Context, val sdk.ValidatorI // fetch current rewards rewards, err := k.ValidatorCurrentRewards.Get(ctx, valBz) - if err != nil && !errors.Is(err, collections.ErrNotFound) { + if err != nil && !pkgerr.Is(err, collections.ErrNotFound) { return 0, err } @@ -67,7 +72,7 @@ func (k Keeper) IncrementValidatorPeriod(ctx context.Context, val sdk.ValidatorI } outstanding, err := k.ValidatorOutstandingRewards.Get(ctx, valBz) - if err != nil && !errors.Is(err, collections.ErrNotFound) { + if err != nil && !pkgerr.Is(err, collections.ErrNotFound) { return 0, err } @@ -126,8 +131,8 @@ func (k Keeper) incrementReferenceCount(ctx context.Context, valAddr sdk.ValAddr } historical.ReferenceCount++ - if historical.ReferenceCount > 2 { - panic("reference count should never exceed 2") + if historical.ReferenceCount > maxReferenceCount { + return fmt.Errorf("reference count should never exceed %d", maxReferenceCount) } return k.ValidatorHistoricalRewards.Set(ctx, collections.Join(valAddr, period), historical) } @@ -140,7 +145,7 @@ func (k Keeper) decrementReferenceCount(ctx context.Context, valAddr sdk.ValAddr } if historical.ReferenceCount == 0 { - panic("cannot set negative reference count") + return errors.New("cannot set negative reference count") } historical.ReferenceCount-- if historical.ReferenceCount == 0 { @@ -152,7 +157,7 @@ func (k Keeper) decrementReferenceCount(ctx context.Context, valAddr sdk.ValAddr func (k Keeper) updateValidatorSlashFraction(ctx context.Context, valAddr sdk.ValAddress, fraction math.LegacyDec) error { if fraction.GT(math.LegacyOneDec()) || fraction.IsNegative() { - panic(fmt.Sprintf("fraction must be >=0 and <=1, current fraction: %v", fraction)) + return fmt.Errorf("fraction must be >=0 and <=1, current fraction: %v", fraction) } headerinfo := k.HeaderService.HeaderInfo(ctx) diff --git a/x/distribution/migrations/v4/migrate.go b/x/distribution/migrations/v4/migrate.go index 783dc91218c7..1ecfd4a2d8f6 100644 --- a/x/distribution/migrations/v4/migrate.go +++ b/x/distribution/migrations/v4/migrate.go @@ -16,16 +16,16 @@ import ( var OldProposerKey = []byte{0x01} // MigrateStore removes the last proposer from store. -func MigrateStore(ctx context.Context, env appmodule.Environment, cdc codec.BinaryCodec) error { - store := env.KVStoreService.OpenKVStore(ctx) - return store.Delete(OldProposerKey) +func MigrateStore(ctx context.Context, env appmodule.Environment, _ codec.BinaryCodec) error { + kvStore := env.KVStoreService.OpenKVStore(ctx) + return kvStore.Delete(OldProposerKey) } // GetPreviousProposerConsAddr returns the proposer consensus address for the // current block. func GetPreviousProposerConsAddr(ctx context.Context, storeService store.KVStoreService, cdc codec.BinaryCodec) (sdk.ConsAddress, error) { - store := storeService.OpenKVStore(ctx) - bz, err := store.Get(OldProposerKey) + kvStore := storeService.OpenKVStore(ctx) + bz, err := kvStore.Get(OldProposerKey) if err != nil { return nil, err } @@ -43,9 +43,9 @@ func GetPreviousProposerConsAddr(ctx context.Context, storeService store.KVStore return addrValue.GetValue(), nil } -// set the proposer public key for this block +// SetPreviousProposerConsAddr set the proposer public key for this block. func SetPreviousProposerConsAddr(ctx context.Context, storeService store.KVStoreService, cdc codec.BinaryCodec, consAddr sdk.ConsAddress) error { - store := storeService.OpenKVStore(ctx) + kvStore := storeService.OpenKVStore(ctx) bz := cdc.MustMarshal(&gogotypes.BytesValue{Value: consAddr}) - return store.Set(OldProposerKey, bz) + return kvStore.Set(OldProposerKey, bz) } diff --git a/x/distribution/migrations/v4/migrate_funds_test.go b/x/distribution/migrations/v4/migrate_funds_test.go index 90f557e130c3..7186a4154f2d 100644 --- a/x/distribution/migrations/v4/migrate_funds_test.go +++ b/x/distribution/migrations/v4/migrate_funds_test.go @@ -10,10 +10,6 @@ import ( "cosmossdk.io/core/comet" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/auth" - authkeeper "cosmossdk.io/x/auth/keeper" - authtestutil "cosmossdk.io/x/auth/testutil" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/bank" bankkeeper "cosmossdk.io/x/bank/keeper" banktypes "cosmossdk.io/x/bank/types" @@ -30,6 +26,10 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/integration" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/auth" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtestutil "github.com/cosmos/cosmos-sdk/x/auth/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) type emptyCometService struct{} diff --git a/x/epochs/depinject.go b/x/epochs/depinject.go index f09f9f95d9f8..24640e7c641f 100644 --- a/x/epochs/depinject.go +++ b/x/epochs/depinject.go @@ -2,9 +2,8 @@ package epochs import ( "fmt" - "sort" - - "golang.org/x/exp/maps" + "maps" + "slices" modulev1 "cosmossdk.io/api/cosmos/epochs/module/v1" "cosmossdk.io/core/appmodule" @@ -56,12 +55,9 @@ func InvokeSetHooks(keeper *keeper.Keeper, hooks map[string]types.EpochHooksWrap // Default ordering is lexical by module name. // Explicit ordering can be added to the module config if required. - modNames := maps.Keys(hooks) - order := modNames - sort.Strings(order) - + modNames := slices.Sorted(maps.Keys(hooks)) var multiHooks types.MultiEpochHooks - for _, modName := range order { + for _, modName := range modNames { hook, ok := hooks[modName] if !ok { return fmt.Errorf("can't find epoch hooks for module %s", modName) diff --git a/x/epochs/go.mod b/x/epochs/go.mod index dc557da99f5a..5893ea726b56 100644 --- a/x/epochs/go.mod +++ b/x/epochs/go.mod @@ -1,11 +1,11 @@ module cosmossdk.io/x/epochs -go 1.22.2 +go 1.23 require ( cosmossdk.io/api v0.7.5 cosmossdk.io/collections v0.4.0 - cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 + cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 cosmossdk.io/depinject v1.0.0 cosmossdk.io/errors v1.0.1 @@ -16,15 +16,14 @@ require ( github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/stretchr/testify v1.9.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 - google.golang.org/grpc v1.65.0 + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 + google.golang.org/grpc v1.66.0 ) require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect cosmossdk.io/math v1.3.0 // indirect - cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/tx v0.13.3 // indirect @@ -47,12 +46,12 @@ require ( github.com/cometbft/cometbft-db v0.12.0 // indirect github.com/cometbft/cometbft/api v1.0.0-rc.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-db v1.0.2 // indirect + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 // indirect github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -97,7 +96,7 @@ require ( github.com/iancoleman/strcase v0.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect @@ -112,13 +111,13 @@ require ( github.com/mtibben/percent v0.2.1 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -146,7 +145,7 @@ require ( go.opencensus.io v0.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.26.0 // indirect - golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc + golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sync v0.8.0 // indirect @@ -155,7 +154,7 @@ require ( golang.org/x/text v0.17.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect google.golang.org/protobuf v1.34.2 gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -165,8 +164,8 @@ require ( ) require ( - cosmossdk.io/log v1.4.0 // indirect - cosmossdk.io/schema v0.1.1 // indirect + cosmossdk.io/log v1.4.1 // indirect + cosmossdk.io/schema v0.2.0 // indirect cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect @@ -174,13 +173,14 @@ require ( replace github.com/cosmos/cosmos-sdk => ../../. +replace github.com/cosmos/iavl => github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e + // TODO remove post spinning out all modules replace ( cosmossdk.io/api => ../../api cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/x/accounts => ../accounts - cosmossdk.io/x/auth => ../auth + cosmossdk.io/store => ../../store cosmossdk.io/x/bank => ../bank cosmossdk.io/x/consensus => ../consensus cosmossdk.io/x/staking => ../staking diff --git a/x/epochs/go.sum b/x/epochs/go.sum index a79bc0458f82..cf2518382fe5 100644 --- a/x/epochs/go.sum +++ b/x/epochs/go.sum @@ -10,14 +10,12 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= -cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc h1:R9O9d75e0qZYUsVV0zzi+D7cNLnX2JrUOQNoIPaF0Bg= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc/go.mod h1:amTTatOUV3u1PsKmNb87z6/galCxrRbz9kRdJkL0DyU= +cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk= +cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= @@ -102,8 +100,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/crypto v0.1.2 h1:Yn500sPY+9sKVdhiPUSDtt8JOpBGMB515dOmla4zfls= @@ -115,10 +113,10 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e h1:LEii0v/FxtXa/F7mRn+tijZ0zaXBPn2ZkKwb6Qm4rqE= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e/go.mod h1:3ywr0wDnWeD7MUH6qu50wZ5bxuKH3LBrGG4/lZX8lVY= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -311,8 +309,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -322,6 +320,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -387,8 +387,8 @@ github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4 github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba h1:3jPgmsFGBID1wFfU2AbYocNcN4wqU68UaHSdMjiw/7U= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= @@ -405,8 +405,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -415,8 +415,8 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -472,7 +472,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -503,6 +502,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= @@ -635,10 +636,10 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEY google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -649,8 +650,8 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/x/epochs/keeper/abci_test.go b/x/epochs/keeper/abci_test.go index e3d5f84ff55d..7a864d8ebf41 100644 --- a/x/epochs/keeper/abci_test.go +++ b/x/epochs/keeper/abci_test.go @@ -1,12 +1,12 @@ package keeper_test import ( - "sort" + "maps" + "slices" "testing" "time" "github.com/stretchr/testify/require" - "golang.org/x/exp/maps" "cosmossdk.io/core/header" "cosmossdk.io/x/epochs/types" @@ -89,9 +89,14 @@ func (suite *KeeperTestSuite) TestEpochInfoBeginBlockChanges() { suite.Require().NoError(err) // get sorted heights - heights := maps.Keys(test.blockHeightTimePairs) - sort.Slice(heights, func(i, j int) bool { return heights[i] < heights[j] }) - + heights := slices.SortedFunc(maps.Keys(test.blockHeightTimePairs), func(i, j int) int { + if test.blockHeightTimePairs[i].Before(test.blockHeightTimePairs[j]) { + return -1 + } else if test.blockHeightTimePairs[i].After(test.blockHeightTimePairs[j]) { + return 1 + } + return 0 + }) for _, h := range heights { // for each height in order, run begin block suite.Ctx = suite.Ctx.WithHeaderInfo(header.Info{Height: int64(h), Time: test.blockHeightTimePairs[h]}) diff --git a/x/evidence/autocli.go b/x/evidence/autocli.go index cd3fda9bce6e..4a239beb9d62 100644 --- a/x/evidence/autocli.go +++ b/x/evidence/autocli.go @@ -17,7 +17,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { RpcMethod: "Evidence", - Use: "evidence [hash]", + Use: "evidence ", Short: "Query for evidence by hash", Example: fmt.Sprintf("%s query evidence DF0C23E8634E480F84B9D5674A7CDC9816466DEC28A3358F73260F68D28D7660", version.AppName), PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "hash"}}, diff --git a/x/evidence/go.mod b/x/evidence/go.mod index f01d988c0334..a05eaac2cee2 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -1,11 +1,11 @@ module cosmossdk.io/x/evidence -go 1.22.2 +go 1.23 require ( cosmossdk.io/api v0.7.5 cosmossdk.io/collections v0.4.0 - cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 + cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 cosmossdk.io/depinject v1.0.0 cosmossdk.io/errors v1.0.1 @@ -20,17 +20,16 @@ require ( github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 - google.golang.org/grpc v1.65.0 + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 + google.golang.org/grpc v1.66.0 google.golang.org/protobuf v1.34.2 ) require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect - cosmossdk.io/log v1.4.0 // indirect - cosmossdk.io/schema v0.1.1 // indirect - cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 // indirect + cosmossdk.io/log v1.4.1 // indirect + cosmossdk.io/schema v0.2.0 // indirect cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/tx v0.13.3 // indirect @@ -53,12 +52,12 @@ require ( github.com/cometbft/cometbft-db v0.12.0 // indirect github.com/cometbft/cometbft/api v1.0.0-rc.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-db v1.0.2 // indirect + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 // indirect github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -104,7 +103,7 @@ require ( github.com/iancoleman/strcase v0.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect @@ -120,13 +119,13 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -162,7 +161,7 @@ require ( golang.org/x/text v0.17.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect @@ -172,13 +171,14 @@ require ( replace github.com/cosmos/cosmos-sdk => ../../. +replace github.com/cosmos/iavl => github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e + // TODO remove post spinning out all modules replace ( cosmossdk.io/api => ../../api cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/x/accounts => ../accounts - cosmossdk.io/x/auth => ../auth + cosmossdk.io/store => ../../store cosmossdk.io/x/bank => ../bank cosmossdk.io/x/consensus => ../consensus cosmossdk.io/x/staking => ../staking diff --git a/x/evidence/go.sum b/x/evidence/go.sum index 67a156e09346..9f481099c659 100644 --- a/x/evidence/go.sum +++ b/x/evidence/go.sum @@ -10,14 +10,12 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= -cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc h1:R9O9d75e0qZYUsVV0zzi+D7cNLnX2JrUOQNoIPaF0Bg= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc/go.mod h1:amTTatOUV3u1PsKmNb87z6/galCxrRbz9kRdJkL0DyU= +cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk= +cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= @@ -102,8 +100,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/crypto v0.1.2 h1:Yn500sPY+9sKVdhiPUSDtt8JOpBGMB515dOmla4zfls= @@ -115,10 +113,10 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e h1:LEii0v/FxtXa/F7mRn+tijZ0zaXBPn2ZkKwb6Qm4rqE= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e/go.mod h1:3ywr0wDnWeD7MUH6qu50wZ5bxuKH3LBrGG4/lZX8lVY= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -311,8 +309,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -322,6 +320,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -387,8 +387,8 @@ github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4 github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba h1:3jPgmsFGBID1wFfU2AbYocNcN4wqU68UaHSdMjiw/7U= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= @@ -405,8 +405,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -415,8 +415,8 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -472,7 +472,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -504,6 +503,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= @@ -639,10 +640,10 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEY google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -653,8 +654,8 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/x/evidence/keeper/grpc_query.go b/x/evidence/keeper/grpc_query.go index a665c820ce31..854dbbd33846 100644 --- a/x/evidence/keeper/grpc_query.go +++ b/x/evidence/keeper/grpc_query.go @@ -53,7 +53,7 @@ func (k Querier) Evidence(ctx context.Context, req *types.QueryEvidenceRequest) evidenceAny, err := codectypes.NewAnyWithValue(msg) if err != nil { - return nil, status.Errorf(codes.Internal, err.Error()) + return nil, status.Error(codes.Internal, err.Error()) } return &types.QueryEvidenceResponse{Evidence: evidenceAny}, nil diff --git a/x/evidence/keeper/infraction.go b/x/evidence/keeper/infraction.go index 713d21ad62b8..ac417aa6c664 100644 --- a/x/evidence/keeper/infraction.go +++ b/x/evidence/keeper/infraction.go @@ -73,10 +73,15 @@ func (k Keeper) handleEquivocationEvidence(ctx context.Context, evidence *types. // Reject evidence if the double-sign is too old. Evidence is considered stale // if the difference in time and number of blocks is greater than the allowed // parameters defined. - var res consensusv1.QueryParamsResponse - if err := k.QueryRouterService.InvokeTyped(ctx, &consensusv1.QueryParamsRequest{}, &res); err != nil { + resp, err := k.QueryRouterService.Invoke(ctx, &consensusv1.QueryParamsRequest{}) + if err != nil { return fmt.Errorf("failed to query consensus params: %w", err) } + res, ok := resp.(*consensusv1.QueryParamsResponse) + if !ok { + return fmt.Errorf("unexpected response type: %T", resp) + } + if res.Params.Evidence != nil { if ageDuration > res.Params.Evidence.MaxAgeDuration && ageBlocks > res.Params.Evidence.MaxAgeNumBlocks { k.Logger.Info( diff --git a/x/feegrant/CHANGELOG.md b/x/feegrant/CHANGELOG.md index 13d29accbc30..9f565f739cb0 100644 --- a/x/feegrant/CHANGELOG.md +++ b/x/feegrant/CHANGELOG.md @@ -31,12 +31,15 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### API Breaking Changes +* [#21377](https://github.com/cosmos/cosmos-sdk/pull/21377) Simulation API breaking changes: + * `SimulateMsgGrantAllowance` and `SimulateMsgRevokeAllowance` no longer require a `ProtoCodec` parameter. + * `WeightedOperations` functions no longer require `ProtoCodec`, `JSONCodec`, or `address.Codec` parameters. * [#20529](https://github.com/cosmos/cosmos-sdk/pull/20529) `Accept` on the `FeeAllowanceI` interface now expects the feegrant environment in the `context.Context`. * [#19450](https://github.com/cosmos/cosmos-sdk/pull/19450) Migrate module to use `appmodule.Environment` instead of passing individual services. ### Consensus Breaking Changes -* [#19188](https://github.com/cosmos/cosmos-sdk/pull/19188) Remove creation of `BaseAccount` when sending a message to an account that does not exist +* [#19188](https://github.com/cosmos/cosmos-sdk/pull/19188) Remove creation of `BaseAccount` when sending a message to an account that does not exist. ## [v0.1.1](https://github.com/cosmos/cosmos-sdk/releases/tag/x/feegrant/v0.1.1) - 2024-04-22 diff --git a/x/feegrant/README.md b/x/feegrant/README.md index 07524449a862..f60720a51ff4 100644 --- a/x/feegrant/README.md +++ b/x/feegrant/README.md @@ -35,13 +35,13 @@ This module allows accounts to grant fee allowances and to use fees from their a `Grant` is stored in the KVStore to record a grant with full context. Every grant will contain `granter`, `grantee` and what kind of `allowance` is granted. `granter` is an account address who is giving permission to `grantee` (the beneficiary account address) to pay for some or all of `grantee`'s transaction fees. `allowance` defines what kind of fee allowance (`BasicAllowance` or `PeriodicAllowance`, see below) is granted to `grantee`. `allowance` accepts an interface which implements `FeeAllowanceI`, encoded as `Any` type. There can be only one existing fee grant allowed for a `grantee` and `granter`, self grants are not allowed. ```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/feegrant/v1beta1/feegrant.proto#L83-L93 +https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/feegrant/proto/cosmos/feegrant/v1beta1/feegrant.proto#L86-L96 ``` `FeeAllowanceI` looks like: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/feegrant/fees.go#L9-L32 +https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/feegrant/fees.go#L10-L34 ``` ### Fee Allowance types @@ -57,7 +57,7 @@ There are two types of fee allowances present at the moment: `BasicAllowance` is permission for `grantee` to use fee from a `granter`'s account. If any of the `spend_limit` or `expiration` reaches its limit, the grant will be removed from the state. ```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/feegrant/v1beta1/feegrant.proto#L15-L28 +https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/feegrant/proto/cosmos/feegrant/v1beta1/feegrant.proto#L15-L33 ``` * `spend_limit` is the limit of coins that are allowed to be used from the `granter` account. If it is empty, it assumes there's no spend limit, `grantee` can use any number of available coins from `granter` account address before the expiration. @@ -71,7 +71,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/feegrant/v1be `PeriodicAllowance` is a repeating fee allowance for the mentioned period, we can mention when the grant can expire as well as when a period can reset. We can also define the maximum number of coins that can be used in a mentioned period of time. ```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/feegrant/v1beta1/feegrant.proto#L34-L68 +https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/feegrant/proto/cosmos/feegrant/v1beta1/feegrant.proto#L35-L71 ``` * `basic` is the instance of `BasicAllowance` which is optional for periodic fee allowance. If empty, the grant will have no `expiration` and no `spend_limit`. @@ -89,7 +89,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/feegrant/v1be `AllowedMsgAllowance` is a fee allowance, it can be any of `BasicFeeAllowance`, `PeriodicAllowance` but restricted only to the allowed messages mentioned by the granter. ```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/feegrant/v1beta1/feegrant.proto#L70-L81 +https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/feegrant/proto/cosmos/feegrant/v1beta1/feegrant.proto#L73-L84 ``` * `allowance` is either `BasicAllowance` or `PeriodicAllowance`. @@ -101,25 +101,25 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/feegrant/v1be `feegrant` module introduces a `FeeGranter` flag for CLI for the sake of executing transactions with fee granter. When this flag is set, `clientCtx` will append the granter account address for transactions generated through CLI. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/client/cmd.go#L249-L260 +https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/client/cmd.go#L256-L267 ``` ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/client/tx/tx.go#L109-L109 +https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/client/tx/tx.go#L129-L131 ``` ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/auth/tx/builder.go#L275-L284 +https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/auth/tx/builder.go#L208 ``` ```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/tx/v1beta1/tx.proto#L203-L224 +https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/proto/cosmos/tx/v1beta1/tx.proto#L216-L243 ``` Example cmd: -```go -./simd tx gov submit-proposal --title="Test Proposal" --description="My awesome proposal" --type="Text" --from validator-key --fee-granter=cosmos1xh44hxt7spr67hqaa7nyx5gnutrz5fraw6grxn --chain-id=testnet --fees="10stake" +```shell +simd tx gov submit-legacy-proposal --title="Test Proposal" --description="My awesome proposal" --type="Text" --from validator-key --fee-granter=cosmos1xh44hxt7spr67hqaa7nyx5gnutrz5fraw6grxn --chain-id=testnet --fees="10stake" ``` ### Granted Fee Deductions @@ -147,7 +147,7 @@ Fee allowance grants are stored in the state as follows: * Grant: `0x00 | grantee_addr_len (1 byte) | grantee_addr_bytes | granter_addr_len (1 byte) | granter_addr_bytes -> ProtocolBuffer(Grant)` ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/feegrant/feegrant.pb.go#L222-L230 +https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/feegrant/feegrant.pb.go#L222-L230 ``` ### FeeAllowanceQueue @@ -165,7 +165,7 @@ Fee allowance queue keys are stored in the state as follows: A fee allowance grant will be created with the `MsgGrantAllowance` message. ```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/feegrant/v1beta1/tx.proto#L25-L39 +https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/feegrant/proto/cosmos/feegrant/v1beta1/tx.proto#L30-L44 ``` ### Msg/RevokeAllowance @@ -173,7 +173,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/feegrant/v1be An allowed grant fee allowance can be removed with the `MsgRevokeAllowance` message. ```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/feegrant/v1beta1/tx.proto#L41-L54 +https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/feegrant/proto/cosmos/feegrant/v1beta1/tx.proto#L49-L62 ``` ## Events @@ -255,18 +255,49 @@ grantee: cosmos1.. granter: cosmos1.. ``` -##### grants +##### grants-by-grantee -The `grants` command allows users to query all grants for a given grantee. +The `grants-by-grantee ` command allows users to query all grants for a given grantee. ```shell -simd query feegrant grants [grantee] [flags] +simd query feegrant grants-by-grantee [grantee] [flags] ``` Example: ```shell -simd query feegrant grants cosmos1.. +simd query feegrant grants-by-grantee cosmos1.. +``` + +Example Output: + +```yml +allowances: +- allowance: + '@type': /cosmos.feegrant.v1beta1.BasicAllowance + expiration: null + spend_limit: + - amount: "100" + denom: stake + grantee: cosmos1.. + granter: cosmos1.. +pagination: + next_key: null + total: "0" +``` + +##### grants-by-granter + +The `grants-by-granter` command allows users to query all grants created by a given granter. + +```shell +simd query feegrant grants-by-granter [granter] [flags] +``` + +Example: + +```shell +simd query feegrant grants-by-granter cosmos1.. ``` Example Output: @@ -296,24 +327,46 @@ simd tx feegrant --help ##### grant -The `grant` command allows users to grant fee allowances to another account. The fee allowance can have an expiration date, a total spend limit, and/or a periodic spend limit. +The `grant` command allows users to grant fee allowances to another account. The fee allowance can have an expiration date, a total spend limit, a periodic spend limit, and/or allowed messages. ```shell simd tx feegrant grant [granter] [grantee] [flags] ``` -Example (one-time spend limit): +Examples: + +###### One-time spend limit ```shell simd tx feegrant grant cosmos1.. cosmos1.. --spend-limit 100stake ``` -Example (periodic spend limit): +###### Periodic spend limit ```shell -simd tx feegrant grant cosmos1.. cosmos1.. --period 3600 --period-limit 10stake +simd tx feegrant grant cosmos1.. cosmos1.. --spend-limit 100stake --period 3600 --period-limit 10stake ``` +###### With expiration + +```shell +simd tx feegrant grant cosmos1.. cosmos1.. --spend-limit 100stake --expiration 2024-10-31T15:04:05Z +``` + +###### With allowed messages + +```shell +simd tx feegrant grant cosmos1.. cosmos1.. --spend-limit 100stake --expiration 2024-10-31T15:04:05Z --allowed-messages "/cosmos.gov.v1beta1.MsgSubmitProposal,/cosmos.gov.v1beta1.MsgVote" +``` + +Available flags: + +- `--spend-limit`: The maximum amount of tokens the grantee can spend +- `--period`: The time duration in seconds for periodic allowance +- `--period-limit`: The maximum amount of tokens the grantee can spend within each period +- `--expiration`: The date and time when the grant expires (RFC3339 format) +- `--allowed-messages`: Comma-separated list of allowed message type URLs + ##### revoke The `revoke` command allows users to revoke a granted fee allowance. diff --git a/x/feegrant/basic_fee.go b/x/feegrant/basic_fee.go index 2100cd5be3b1..a495d8c3d57a 100644 --- a/x/feegrant/basic_fee.go +++ b/x/feegrant/basic_fee.go @@ -72,4 +72,4 @@ func (a BasicAllowance) ExpiresAt() (*time.Time, error) { } // UpdatePeriodReset BasicAllowance does not update "PeriodReset" -func (a BasicAllowance) UpdatePeriodReset(validTime time.Time) error { return nil } +func (a BasicAllowance) UpdatePeriodReset(_ time.Time) error { return nil } diff --git a/x/feegrant/basic_fee_test.go b/x/feegrant/basic_fee_test.go index 2ea7ad3008b7..cde6d2877e51 100644 --- a/x/feegrant/basic_fee_test.go +++ b/x/feegrant/basic_fee_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "cosmossdk.io/core/appmodule/v2" + appmodulev2 "cosmossdk.io/core/appmodule/v2" corecontext "cosmossdk.io/core/context" "cosmossdk.io/core/header" storetypes "cosmossdk.io/store/types" @@ -130,8 +130,7 @@ func TestBasicFeeValidAllow(t *testing.T) { }, } - for name, stc := range cases { - tc := stc // to make scopelint happy + for name, tc := range cases { t.Run(name, func(t *testing.T) { err := tc.allowance.UpdatePeriodReset(tc.blockTime) require.NoError(t, err) @@ -141,7 +140,7 @@ func TestBasicFeeValidAllow(t *testing.T) { ctx := testCtx.Ctx.WithHeaderInfo(header.Info{Time: tc.blockTime}) // now try to deduct - removed, err := tc.allowance.Accept(context.WithValue(ctx, corecontext.EnvironmentContextKey, appmodule.Environment{ + removed, err := tc.allowance.Accept(context.WithValue(ctx, corecontext.EnvironmentContextKey, appmodulev2.Environment{ HeaderService: mockHeaderService{}, GasService: mockGasService{}, }), tc.fee, []sdk.Msg{}) diff --git a/x/feegrant/client/cli/tx.go b/x/feegrant/client/cli/tx.go index 00c3339b15db..2ba342b21a5c 100644 --- a/x/feegrant/client/cli/tx.go +++ b/x/feegrant/client/cli/tx.go @@ -48,7 +48,7 @@ func GetTxCmd() *cobra.Command { // This command is more powerful than AutoCLI generated command as it allows a better input validation. func NewCmdFeeGrant() *cobra.Command { cmd := &cobra.Command{ - Use: "grant [granter_key_or_address] [grantee]", + Use: "grant ", Aliases: []string{"grant-allowance"}, Short: "Grant Fee allowance to an address", Long: strings.TrimSpace( diff --git a/x/feegrant/client/cli/tx_test.go b/x/feegrant/client/cli/tx_test.go index 61c32ea34e23..4d8c07e4b583 100644 --- a/x/feegrant/client/cli/tx_test.go +++ b/x/feegrant/client/cli/tx_test.go @@ -446,7 +446,7 @@ func (s *CLITestSuite) TestTxWithFeeGrant() { granterAddr, err := s.baseCtx.AddressCodec.BytesToString(granter) s.Require().NoError(err) - // creating an account manually (This account won't be exist in state) + // creating an account manually (This account won't exist in state) k, _, err := s.baseCtx.Keyring.NewMnemonic("grantee", keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1) s.Require().NoError(err) pub, err := k.GetPubKey() diff --git a/x/feegrant/fees.go b/x/feegrant/fees.go index d229512f9383..4675b0449e11 100644 --- a/x/feegrant/fees.go +++ b/x/feegrant/fees.go @@ -19,7 +19,7 @@ type FeeAllowanceI interface { // and will be saved again after an acceptance. // // If remove is true (regardless of the error), the FeeAllowance will be deleted from storage - // (eg. when it is used up). (See call to RevokeAllowance in Keeper.UseGrantedFees) + // (e.g. when it is used up). (See call to RevokeAllowance in Keeper.UseGrantedFees) Accept(ctx context.Context, fee sdk.Coins, msgs []sdk.Msg) (remove bool, err error) // ValidateBasic should evaluate this FeeAllowance for internal consistency. diff --git a/x/feegrant/filtered_fee.go b/x/feegrant/filtered_fee.go index 68e2fa681cfd..3005ec96466d 100644 --- a/x/feegrant/filtered_fee.go +++ b/x/feegrant/filtered_fee.go @@ -63,12 +63,13 @@ func (a *AllowedMsgAllowance) GetAllowance() (FeeAllowanceI, error) { // SetAllowance sets allowed fee allowance. func (a *AllowedMsgAllowance) SetAllowance(allowance FeeAllowanceI) error { - var err error - a.Allowance, err = types.NewAnyWithValue(allowance.(proto.Message)) + newAllowance, err := types.NewAnyWithValue(allowance.(proto.Message)) if err != nil { return errorsmod.Wrapf(sdkerrors.ErrPackAny, "cannot proto marshal %T", allowance) } + a.Allowance = newAllowance + return nil } @@ -96,8 +97,8 @@ func (a *AllowedMsgAllowance) Accept(ctx context.Context, fee sdk.Coins, msgs [] return remove, err } -func (a *AllowedMsgAllowance) allowedMsgsToMap(ctx context.Context) (map[string]bool, error) { - msgsMap := make(map[string]bool, len(a.AllowedMessages)) +func (a *AllowedMsgAllowance) allowedMsgsToMap(ctx context.Context) (map[string]struct{}, error) { + msgsMap := make(map[string]struct{}, len(a.AllowedMessages)) environment, ok := ctx.Value(corecontext.EnvironmentContextKey).(appmodule.Environment) if !ok { return nil, errors.New("environment not set") @@ -107,7 +108,7 @@ func (a *AllowedMsgAllowance) allowedMsgsToMap(ctx context.Context) (map[string] if err := gasMeter.Consume(gasCostPerIteration, "check msg"); err != nil { return nil, err } - msgsMap[msg] = true + msgsMap[msg] = struct{}{} } return msgsMap, nil @@ -127,7 +128,7 @@ func (a *AllowedMsgAllowance) allMsgTypesAllowed(ctx context.Context, msgs []sdk if err := gasMeter.Consume(gasCostPerIteration, "check msg"); err != nil { return false, err } - if !msgsMap[sdk.MsgTypeURL(msg)] { + if _, allowed := msgsMap[sdk.MsgTypeURL(msg)]; !allowed { return false, nil } } diff --git a/x/feegrant/filtered_fee_test.go b/x/feegrant/filtered_fee_test.go index f4ecf2dc1540..8d9b5c60e935 100644 --- a/x/feegrant/filtered_fee_test.go +++ b/x/feegrant/filtered_fee_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "cosmossdk.io/core/appmodule/v2" + appmodulev2 "cosmossdk.io/core/appmodule/v2" corecontext "cosmossdk.io/core/context" "cosmossdk.io/core/header" storetypes "cosmossdk.io/store/types" @@ -141,8 +141,7 @@ func TestFilteredFeeValidAllow(t *testing.T) { }, } - for name, stc := range cases { - tc := stc // to make scopelint happy + for name, tc := range cases { t.Run(name, func(t *testing.T) { err := tc.allowance.ValidateBasic() require.NoError(t, err) @@ -150,7 +149,7 @@ func TestFilteredFeeValidAllow(t *testing.T) { ctx := testCtx.Ctx.WithHeaderInfo(header.Info{Time: tc.blockTime}) // create grant - var granter, grantee sdk.AccAddress + granter, grantee := sdk.AccAddress("granter"), sdk.AccAddress("grantee") allowance, err := feegrant.NewAllowedMsgAllowance(tc.allowance, tc.msgs) require.NoError(t, err) granterStr, err := ac.BytesToString(granter) @@ -159,7 +158,7 @@ func TestFilteredFeeValidAllow(t *testing.T) { require.NoError(t, err) // now try to deduct - removed, err := allowance.Accept(context.WithValue(ctx, corecontext.EnvironmentContextKey, appmodule.Environment{ + removed, err := allowance.Accept(context.WithValue(ctx, corecontext.EnvironmentContextKey, appmodulev2.Environment{ HeaderService: mockHeaderService{}, GasService: mockGasService{}, }), tc.fee, []sdk.Msg{&call}) diff --git a/x/feegrant/go.mod b/x/feegrant/go.mod index a140e8e95e7a..ed2a840d427d 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -1,11 +1,11 @@ module cosmossdk.io/x/feegrant -go 1.22.2 +go 1.23 require ( cosmossdk.io/api v0.7.5 cosmossdk.io/collections v0.4.0 - cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 + cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 cosmossdk.io/depinject v1.0.0 cosmossdk.io/errors v1.0.1 @@ -22,8 +22,8 @@ require ( github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 - google.golang.org/grpc v1.65.0 + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 + google.golang.org/grpc v1.66.0 google.golang.org/protobuf v1.34.2 gotest.tools/v3 v3.5.1 ) @@ -31,9 +31,8 @@ require ( require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect - cosmossdk.io/log v1.4.0 // indirect - cosmossdk.io/schema v0.1.1 // indirect - cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 + cosmossdk.io/log v1.4.1 // indirect + cosmossdk.io/schema v0.2.0 // indirect cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect @@ -57,12 +56,12 @@ require ( github.com/cometbft/cometbft-db v0.12.0 // indirect github.com/cometbft/cometbft/api v1.0.0-rc.1 github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-db v1.0.2 // indirect + github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 // indirect github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -108,7 +107,7 @@ require ( github.com/iancoleman/strcase v0.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect @@ -125,13 +124,13 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -167,7 +166,7 @@ require ( golang.org/x/text v0.17.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect pgregory.net/rapid v1.1.0 // indirect @@ -176,14 +175,15 @@ require ( replace github.com/cosmos/cosmos-sdk => ../../. +replace github.com/cosmos/iavl => github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e + // TODO remove post spinning out all modules replace ( cosmossdk.io/api => ../../api cosmossdk.io/collections => ../../collections cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/x/accounts => ../accounts - cosmossdk.io/x/auth => ../auth + cosmossdk.io/store => ../../store cosmossdk.io/x/bank => ../bank cosmossdk.io/x/consensus => ../consensus cosmossdk.io/x/gov => ../gov diff --git a/x/feegrant/go.sum b/x/feegrant/go.sum index 98c33235c652..a19d6fbfa82b 100644 --- a/x/feegrant/go.sum +++ b/x/feegrant/go.sum @@ -8,14 +8,12 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= -cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= -cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc h1:R9O9d75e0qZYUsVV0zzi+D7cNLnX2JrUOQNoIPaF0Bg= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc/go.mod h1:amTTatOUV3u1PsKmNb87z6/galCxrRbz9kRdJkL0DyU= +cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk= +cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 h1:XQJj9Dv9Gtze0l2TF79BU5lkP6MkUveTUuKICmxoz+o= cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190/go.mod h1:7WUGupOvmlHJoIMBz1JbObQxeo6/TDiuDBxmtod8HRg= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= @@ -108,8 +106,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0= +github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/crypto v0.1.2 h1:Yn500sPY+9sKVdhiPUSDtt8JOpBGMB515dOmla4zfls= @@ -121,10 +119,10 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= -github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e h1:LEii0v/FxtXa/F7mRn+tijZ0zaXBPn2ZkKwb6Qm4rqE= +github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e/go.mod h1:3ywr0wDnWeD7MUH6qu50wZ5bxuKH3LBrGG4/lZX8lVY= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -317,8 +315,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -328,6 +326,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -395,8 +395,8 @@ github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4 github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba h1:3jPgmsFGBID1wFfU2AbYocNcN4wqU68UaHSdMjiw/7U= github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= @@ -413,8 +413,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -423,8 +423,8 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -480,7 +480,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -512,6 +511,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= @@ -649,10 +650,10 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEY google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -663,8 +664,8 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/x/feegrant/keeper/genesis_test.go b/x/feegrant/keeper/genesis_test.go index db7a39b67a22..61cb5cd14a0c 100644 --- a/x/feegrant/keeper/genesis_test.go +++ b/x/feegrant/keeper/genesis_test.go @@ -10,7 +10,6 @@ import ( coretesting "cosmossdk.io/core/testing" "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/feegrant" "cosmossdk.io/x/feegrant/keeper" "cosmossdk.io/x/feegrant/module" @@ -25,6 +24,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var ( diff --git a/x/feegrant/keeper/grpc_query.go b/x/feegrant/keeper/grpc_query.go index 0bc3db1839cc..f5ff7df04370 100644 --- a/x/feegrant/keeper/grpc_query.go +++ b/x/feegrant/keeper/grpc_query.go @@ -35,7 +35,7 @@ func (q Keeper) Allowance(ctx context.Context, req *feegrant.QueryAllowanceReque feeAllowance, err := q.GetAllowance(ctx, granterAddr, granteeAddr) if err != nil { - return nil, status.Errorf(codes.Internal, err.Error()) + return nil, status.Error(codes.Internal, err.Error()) } msg, ok := feeAllowance.(proto.Message) @@ -45,7 +45,7 @@ func (q Keeper) Allowance(ctx context.Context, req *feegrant.QueryAllowanceReque feeAllowanceAny, err := codectypes.NewAnyWithValue(msg) if err != nil { - return nil, status.Errorf(codes.Internal, err.Error()) + return nil, status.Error(codes.Internal, err.Error()) } return &feegrant.QueryAllowanceResponse{ diff --git a/x/feegrant/keeper/keeper.go b/x/feegrant/keeper/keeper.go index ad3f5d59c656..30e47ae36086 100644 --- a/x/feegrant/keeper/keeper.go +++ b/x/feegrant/keeper/keeper.go @@ -9,12 +9,12 @@ import ( corecontext "cosmossdk.io/core/context" "cosmossdk.io/core/event" errorsmod "cosmossdk.io/errors" - "cosmossdk.io/x/auth/ante" "cosmossdk.io/x/feegrant" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/ante" ) // Keeper manages state of all fee grants, as well as calculating approval. @@ -190,7 +190,7 @@ func (k Keeper) revokeAllowance(ctx context.Context, granter, grantee sdk.AccAdd } // GetAllowance returns the allowance between the granter and grantee. -// If there is none, it returns nil, nil. +// If there is none, it returns nil, collections.ErrNotFound. // Returns an error on parsing issues func (k Keeper) GetAllowance(ctx context.Context, granter, grantee sdk.AccAddress) (feegrant.FeeAllowanceI, error) { grant, err := k.FeeAllowance.Get(ctx, collections.Join(grantee, granter)) diff --git a/x/feegrant/keeper/keeper_test.go b/x/feegrant/keeper/keeper_test.go index 04c11eda9d1e..af5cde5dc663 100644 --- a/x/feegrant/keeper/keeper_test.go +++ b/x/feegrant/keeper/keeper_test.go @@ -10,7 +10,6 @@ import ( coretesting "cosmossdk.io/core/testing" sdkmath "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/feegrant" "cosmossdk.io/x/feegrant/keeper" "cosmossdk.io/x/feegrant/module" @@ -23,6 +22,7 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) type KeeperTestSuite struct { @@ -167,7 +167,6 @@ func (suite *KeeperTestSuite) TestKeeperCrud() { } for name, tc := range cases { - tc := tc suite.Run(name, func() { allow, _ := suite.feegrantKeeper.GetAllowance(suite.ctx, tc.granter, tc.grantee) @@ -261,7 +260,6 @@ func (suite *KeeperTestSuite) TestUseGrantedFee() { } for name, tc := range cases { - tc := tc suite.Run(name, func() { err := suite.feegrantKeeper.GrantAllowance(suite.ctx, tc.granter, tc.grantee, future) suite.Require().NoError(err) @@ -298,9 +296,9 @@ func (suite *KeeperTestSuite) TestUseGrantedFee() { suite.Contains(err.Error(), "fee allowance expired") // verify: feegrant is not revoked - // Because using the past feegrant will return err, data will be rolled back in actual scenarios. - // Only when the feegrant allowance used up in a certain transaction feegrant will revoked success due to err is nil - // abci's EndBlocker will remove the expired feegrant. + // The expired feegrant is not automatically revoked when attempting to use it. + // This is because the transaction using an expired feegrant would fail and be rolled back. + // Expired feegrants are typically cleaned up by the ABCI EndBlocker, not by failed usage attempts. _, err = suite.feegrantKeeper.GetAllowance(ctx, suite.addrs[0], suite.addrs[2]) suite.Require().NoError(err) } @@ -344,8 +342,6 @@ func (suite *KeeperTestSuite) TestPruneGrants() { grantee sdk.AccAddress allowance feegrant.FeeAllowanceI expErrMsg string - preRun func() - postRun func() }{ { name: "grant pruned from state after a block: error", @@ -412,11 +408,7 @@ func (suite *KeeperTestSuite) TestPruneGrants() { } for _, tc := range testCases { - tc := tc suite.Run(tc.name, func() { - if tc.preRun != nil { - tc.preRun() - } err := suite.feegrantKeeper.GrantAllowance(suite.ctx, tc.granter, tc.grantee, tc.allowance) suite.NoError(err) err = suite.feegrantKeeper.RemoveExpiredAllowances(tc.ctx, 5) @@ -430,10 +422,6 @@ func (suite *KeeperTestSuite) TestPruneGrants() { suite.NoError(err) suite.NotNil(grant) } - - if tc.postRun != nil { - tc.postRun() - } }) } } diff --git a/x/feegrant/keeper/msg_server_test.go b/x/feegrant/keeper/msg_server_test.go index 46bde3e93e2f..2e4e8f405c80 100644 --- a/x/feegrant/keeper/msg_server_test.go +++ b/x/feegrant/keeper/msg_server_test.go @@ -7,12 +7,12 @@ import ( "cosmossdk.io/collections" "cosmossdk.io/core/header" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/feegrant" codecaddress "github.com/cosmos/cosmos-sdk/codec/address" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) func (suite *KeeperTestSuite) TestGrantAllowance() { @@ -29,8 +29,8 @@ func (suite *KeeperTestSuite) TestGrantAllowance() { errMsg string }{ { - "invalid granter address", - func() *feegrant.MsgGrantAllowance { + name: "invalid granter address", + req: func() *feegrant.MsgGrantAllowance { any, err := codectypes.NewAnyWithValue(&feegrant.BasicAllowance{}) suite.Require().NoError(err) invalid := "invalid-granter" @@ -40,12 +40,12 @@ func (suite *KeeperTestSuite) TestGrantAllowance() { Allowance: any, } }, - true, - "decoding bech32 failed", + expectErr: true, + errMsg: "decoding bech32 failed", }, { - "invalid grantee address", - func() *feegrant.MsgGrantAllowance { + name: "invalid grantee address", + req: func() *feegrant.MsgGrantAllowance { any, err := codectypes.NewAnyWithValue(&feegrant.BasicAllowance{}) suite.Require().NoError(err) invalid := "invalid-grantee" @@ -55,12 +55,12 @@ func (suite *KeeperTestSuite) TestGrantAllowance() { Allowance: any, } }, - true, - "decoding bech32 failed", + expectErr: true, + errMsg: "decoding bech32 failed", }, { - "valid: grantee account doesn't exist", - func() *feegrant.MsgGrantAllowance { + name: "valid: grantee account doesn't exist", + req: func() *feegrant.MsgGrantAllowance { grantee := "cosmos139f7kncmglres2nf3h4hc4tade85ekfr8sulz5" granteeAccAddr, err := addressCodec.StringToBytes(grantee) suite.Require().NoError(err) @@ -85,12 +85,12 @@ func (suite *KeeperTestSuite) TestGrantAllowance() { Allowance: any, } }, - false, - "", + expectErr: false, + errMsg: "", }, { - "invalid: past expiry", - func() *feegrant.MsgGrantAllowance { + name: "invalid: past expiry", + req: func() *feegrant.MsgGrantAllowance { any, err := codectypes.NewAnyWithValue(&feegrant.BasicAllowance{ SpendLimit: suite.atom, Expiration: &yesterday, @@ -102,12 +102,12 @@ func (suite *KeeperTestSuite) TestGrantAllowance() { Allowance: any, } }, - true, - "expiration is before current block time", + expectErr: true, + errMsg: "expiration is before current block time", }, { - "valid: basic fee allowance", - func() *feegrant.MsgGrantAllowance { + name: "valid: basic fee allowance", + req: func() *feegrant.MsgGrantAllowance { any, err := codectypes.NewAnyWithValue(&feegrant.BasicAllowance{ SpendLimit: suite.atom, Expiration: &oneYear, @@ -119,12 +119,12 @@ func (suite *KeeperTestSuite) TestGrantAllowance() { Allowance: any, } }, - false, - "", + expectErr: false, + errMsg: "", }, { - "fail: fee allowance exists", - func() *feegrant.MsgGrantAllowance { + name: "fail: fee allowance exists", + req: func() *feegrant.MsgGrantAllowance { any, err := codectypes.NewAnyWithValue(&feegrant.BasicAllowance{ SpendLimit: suite.atom, Expiration: &oneYear, @@ -136,12 +136,12 @@ func (suite *KeeperTestSuite) TestGrantAllowance() { Allowance: any, } }, - true, - "fee allowance already exists", + expectErr: true, + errMsg: "fee allowance already exists", }, { - "valid: periodic fee allowance", - func() *feegrant.MsgGrantAllowance { + name: "valid: periodic fee allowance", + req: func() *feegrant.MsgGrantAllowance { any, err := codectypes.NewAnyWithValue(&feegrant.PeriodicAllowance{ Basic: feegrant.BasicAllowance{ SpendLimit: suite.atom, @@ -156,12 +156,12 @@ func (suite *KeeperTestSuite) TestGrantAllowance() { Allowance: any, } }, - false, - "", + expectErr: false, + errMsg: "", }, { - "valid: with period reset", - func() *feegrant.MsgGrantAllowance { + name: "valid: with period reset", + req: func() *feegrant.MsgGrantAllowance { any, err := codectypes.NewAnyWithValue(&feegrant.PeriodicAllowance{ Basic: feegrant.BasicAllowance{ SpendLimit: suite.atom, @@ -178,12 +178,12 @@ func (suite *KeeperTestSuite) TestGrantAllowance() { Allowance: any, } }, - false, - "", + expectErr: false, + errMsg: "", }, { - "error: fee allowance exists", - func() *feegrant.MsgGrantAllowance { + name: "error: fee allowance exists", + req: func() *feegrant.MsgGrantAllowance { any, err := codectypes.NewAnyWithValue(&feegrant.PeriodicAllowance{ Basic: feegrant.BasicAllowance{ SpendLimit: suite.atom, @@ -198,8 +198,8 @@ func (suite *KeeperTestSuite) TestGrantAllowance() { Allowance: any, } }, - true, - "fee allowance already exists", + expectErr: true, + errMsg: "fee allowance already exists", }, } for _, tc := range testCases { @@ -225,42 +225,42 @@ func (suite *KeeperTestSuite) TestRevokeAllowance() { errMsg string }{ { - "error: invalid granter", - &feegrant.MsgRevokeAllowance{ + name: "error: invalid granter", + request: &feegrant.MsgRevokeAllowance{ Granter: invalidGranter, Grantee: suite.encodedAddrs[1], }, - func() {}, - true, - "decoding bech32 failed", + preRun: func() {}, + expectErr: true, + errMsg: "decoding bech32 failed", }, { - "error: invalid grantee", - &feegrant.MsgRevokeAllowance{ + name: "error: invalid grantee", + request: &feegrant.MsgRevokeAllowance{ Granter: suite.encodedAddrs[0], Grantee: invalidGrantee, }, - func() {}, - true, - "decoding bech32 failed", + preRun: func() {}, + expectErr: true, + errMsg: "decoding bech32 failed", }, { - "error: fee allowance not found", - &feegrant.MsgRevokeAllowance{ + name: "error: fee allowance not found", + request: &feegrant.MsgRevokeAllowance{ Granter: suite.encodedAddrs[0], Grantee: suite.encodedAddrs[1], }, - func() {}, - true, - "not found", + preRun: func() {}, + expectErr: true, + errMsg: "not found", }, { - "success: revoke fee allowance", - &feegrant.MsgRevokeAllowance{ + name: "success: revoke fee allowance", + request: &feegrant.MsgRevokeAllowance{ Granter: suite.encodedAddrs[0], Grantee: suite.encodedAddrs[1], }, - func() { + preRun: func() { // removing fee allowance from previous tests if exists _, err := suite.msgSrvr.RevokeAllowance(suite.ctx, &feegrant.MsgRevokeAllowance{ Granter: suite.encodedAddrs[0], @@ -283,18 +283,18 @@ func (suite *KeeperTestSuite) TestRevokeAllowance() { _, err = suite.msgSrvr.GrantAllowance(suite.ctx, req) suite.Require().NoError(err) }, - false, - "", + expectErr: false, + errMsg: "", }, { - "error: check fee allowance revoked", - &feegrant.MsgRevokeAllowance{ + name: "error: check fee allowance revoked", + request: &feegrant.MsgRevokeAllowance{ Granter: suite.encodedAddrs[0], Grantee: suite.encodedAddrs[1], }, - func() {}, - true, - "not found", + preRun: func() {}, + expectErr: true, + errMsg: "not found", }, } diff --git a/x/feegrant/migrations/v2/store.go b/x/feegrant/migrations/v2/store.go index 82a76eacfe53..93551a4ed99e 100644 --- a/x/feegrant/migrations/v2/store.go +++ b/x/feegrant/migrations/v2/store.go @@ -19,8 +19,7 @@ func addAllowancesByExpTimeQueue(ctx context.Context, env appmodule.Environment, for ; iterator.Valid(); iterator.Next() { var grant feegrant.Grant - bz := iterator.Value() - if err := cdc.Unmarshal(bz, &grant); err != nil { + if err := cdc.Unmarshal(iterator.Value(), &grant); err != nil { return err } @@ -41,8 +40,7 @@ func addAllowancesByExpTimeQueue(ctx context.Context, env appmodule.Environment, prefixStore.Delete(key) } else { grantByExpTimeQueueKey := FeeAllowancePrefixQueue(exp, key) - err = store.Set(grantByExpTimeQueueKey, []byte{}) - if err != nil { + if err := store.Set(grantByExpTimeQueueKey, []byte{}); err != nil { return err } } diff --git a/x/feegrant/mock_test.go b/x/feegrant/mock_test.go index ae2f1f13b451..a999149b0412 100644 --- a/x/feegrant/mock_test.go +++ b/x/feegrant/mock_test.go @@ -19,7 +19,7 @@ type mockGasService struct { coregas.Service } -func (m mockGasService) GasMeter(ctx context.Context) coregas.Meter { +func (m mockGasService) GasMeter(_ context.Context) coregas.Meter { return mockGasMeter{} } @@ -27,6 +27,6 @@ type mockGasMeter struct { coregas.Meter } -func (m mockGasMeter) Consume(amount coregas.Gas, descriptor string) error { +func (m mockGasMeter) Consume(_ coregas.Gas, _ string) error { return nil } diff --git a/x/feegrant/module/abci_test.go b/x/feegrant/module/abci_test.go index feeead80a5f6..12f65c24c89f 100644 --- a/x/feegrant/module/abci_test.go +++ b/x/feegrant/module/abci_test.go @@ -10,7 +10,6 @@ import ( coretesting "cosmossdk.io/core/testing" sdkmath "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" - authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/feegrant" "cosmossdk.io/x/feegrant/keeper" "cosmossdk.io/x/feegrant/module" @@ -24,6 +23,7 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestFeegrantPruning(t *testing.T) { @@ -87,13 +87,20 @@ func TestFeegrantPruning(t *testing.T) { feegrant.RegisterQueryServer(queryHelper, feegrantKeeper) queryClient := feegrant.NewQueryClient(queryHelper) - require.NoError(t, module.EndBlocker(testCtx.Ctx, feegrantKeeper)) - granteeStr, err := ac.BytesToString(grantee) require.NoError(t, err) - res, err := queryClient.Allowances(testCtx.Ctx.Context(), &feegrant.QueryAllowancesRequest{ + queryRequest := &feegrant.QueryAllowancesRequest{ Grantee: granteeStr, - }) + } + + res, err := queryClient.Allowances(testCtx.Ctx.Context(), queryRequest) + require.NoError(t, err) + require.NotNil(t, res) + require.Len(t, res.Allowances, 3) + + require.NoError(t, module.EndBlocker(testCtx.Ctx, feegrantKeeper)) + + res, err = queryClient.Allowances(testCtx.Ctx.Context(), queryRequest) require.NoError(t, err) require.NotNil(t, res) require.Len(t, res.Allowances, 2) @@ -101,9 +108,7 @@ func TestFeegrantPruning(t *testing.T) { testCtx.Ctx = testCtx.Ctx.WithHeaderInfo(header.Info{Time: now.AddDate(0, 0, 2)}) require.NoError(t, module.EndBlocker(testCtx.Ctx, feegrantKeeper)) - res, err = queryClient.Allowances(testCtx.Ctx.Context(), &feegrant.QueryAllowancesRequest{ - Grantee: granteeStr, - }) + res, err = queryClient.Allowances(testCtx.Ctx.Context(), queryRequest) require.NoError(t, err) require.NotNil(t, res) require.Len(t, res.Allowances, 1) diff --git a/x/feegrant/module/autocli.go b/x/feegrant/module/autocli.go index f3bbd0597728..e8fe235fce20 100644 --- a/x/feegrant/module/autocli.go +++ b/x/feegrant/module/autocli.go @@ -16,7 +16,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { RpcMethod: "Allowance", - Use: "grant [granter] [grantee]", + Use: "grant ", Short: "Query details of a single grant", Long: "Query details for a grant. You can find the fee-grant of a granter and grantee.", Example: fmt.Sprintf(`$ %s query feegrant grant [granter] [grantee]`, version.AppName), @@ -27,7 +27,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "Allowances", - Use: "grants-by-grantee [grantee]", + Use: "grants-by-grantee ", Short: "Query all grants of a grantee", Long: "Queries all the grants for a grantee address.", Example: fmt.Sprintf(`$ %s query feegrant grants-by-grantee [grantee]`, version.AppName), @@ -37,7 +37,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "AllowancesByGranter", - Use: "grants-by-granter [granter]", + Use: "grants-by-granter ", Short: "Query all grants by a granter", Example: fmt.Sprintf(`$ %s query feegrant grants-by-granter [granter]`, version.AppName), PositionalArgs: []*autocliv1.PositionalArgDescriptor{ @@ -51,7 +51,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { RpcMethod: "RevokeAllowance", - Use: "revoke [granter] [grantee]", + Use: "revoke ", Short: "Revoke a fee grant", Long: "Revoke fee grant from a granter to a grantee. Note, the '--from' flag is ignored as it is implied from [granter]", Example: fmt.Sprintf(`$ %s tx feegrant revoke [granter] [grantee]`, version.AppName), diff --git a/x/feegrant/module/depinject.go b/x/feegrant/module/depinject.go index 3fb6afa68984..018b09d3d593 100644 --- a/x/feegrant/module/depinject.go +++ b/x/feegrant/module/depinject.go @@ -7,12 +7,9 @@ import ( "cosmossdk.io/depinject/appconfig" "cosmossdk.io/x/feegrant" "cosmossdk.io/x/feegrant/keeper" - "cosmossdk.io/x/feegrant/simulation" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" ) var _ depinject.OnePerModuleType = AppModule{} @@ -41,23 +38,3 @@ func ProvideModule(in FeegrantInputs) (keeper.Keeper, appmodule.AppModule) { m := NewAppModule(in.Cdc, in.AccountKeeper, in.BankKeeper, k, in.Registry) return k, m } - -// AppModuleSimulation functions - -// GenerateGenesisState creates a randomized GenState of the feegrant module. -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - simulation.RandomizedGenState(simState) -} - -// RegisterStoreDecoder registers a decoder for feegrant module's types -func (am AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) { - sdr[feegrant.StoreKey] = simulation.NewDecodeStore(am.cdc) -} - -// WeightedOperations returns all the feegrant module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - return simulation.WeightedOperations( - am.registry, simState.AppParams, simState.Cdc, simState.TxConfig, - am.accountKeeper, am.bankKeeper, am.keeper, am.accountKeeper.AddressCodec(), - ) -} diff --git a/x/feegrant/module/module.go b/x/feegrant/module/module.go index 134160422723..5fde472bdbf9 100644 --- a/x/feegrant/module/module.go +++ b/x/feegrant/module/module.go @@ -16,11 +16,13 @@ import ( "cosmossdk.io/x/feegrant" "cosmossdk.io/x/feegrant/client/cli" "cosmossdk.io/x/feegrant/keeper" + "cosmossdk.io/x/feegrant/simulation" sdkclient "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" ) var ( @@ -152,3 +154,23 @@ func (AppModule) ConsensusVersion() uint64 { return 2 } func (am AppModule) EndBlock(ctx context.Context) error { return EndBlocker(ctx, am.keeper) } + +// AppModuleSimulation functions + +// GenerateGenesisState creates a randomized GenState of the feegrant module. +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + simulation.RandomizedGenState(simState) +} + +// RegisterStoreDecoder registers a decoder for feegrant module's types +func (am AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) { + sdr[feegrant.StoreKey] = simulation.NewDecodeStore(am.cdc) +} + +// WeightedOperations returns all the feegrant module operations with their respective weights. +func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + return simulation.WeightedOperations( + simState.AppParams, simState.TxConfig, + am.accountKeeper, am.bankKeeper, am.keeper, + ) +} diff --git a/x/feegrant/msgs_test.go b/x/feegrant/msgs_test.go index 29c775f1eec8..a0c19d0ff1c3 100644 --- a/x/feegrant/msgs_test.go +++ b/x/feegrant/msgs_test.go @@ -6,12 +6,12 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/math" - "cosmossdk.io/x/auth/migrations/legacytx" "cosmossdk.io/x/feegrant" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) func TestAminoJSON(t *testing.T) { diff --git a/x/feegrant/periodic_fee_test.go b/x/feegrant/periodic_fee_test.go index 6a675beb3990..5c5e46b7fbc9 100644 --- a/x/feegrant/periodic_fee_test.go +++ b/x/feegrant/periodic_fee_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "cosmossdk.io/core/appmodule/v2" + appmodulev2 "cosmossdk.io/core/appmodule/v2" corecontext "cosmossdk.io/core/context" "cosmossdk.io/core/header" storetypes "cosmossdk.io/store/types" @@ -223,7 +223,7 @@ func TestPeriodicFeeValidAllow(t *testing.T) { ctx := testCtx.Ctx.WithHeaderInfo(header.Info{Time: tc.blockTime}) // now try to deduct // Set environment to ctx - remove, err := tc.allow.Accept(context.WithValue(ctx, corecontext.EnvironmentContextKey, appmodule.Environment{ + remove, err := tc.allow.Accept(context.WithValue(ctx, corecontext.EnvironmentContextKey, appmodulev2.Environment{ HeaderService: mockHeaderService{}, GasService: mockGasService{}, }), tc.fee, []sdk.Msg{}) diff --git a/x/feegrant/simulation/operations.go b/x/feegrant/simulation/operations.go index 59c3d0d7df69..65bd53d528e9 100644 --- a/x/feegrant/simulation/operations.go +++ b/x/feegrant/simulation/operations.go @@ -3,13 +3,10 @@ package simulation import ( "math/rand" - "cosmossdk.io/core/address" "cosmossdk.io/x/feegrant" "cosmossdk.io/x/feegrant/keeper" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" @@ -29,14 +26,11 @@ var ( ) func WeightedOperations( - registry codectypes.InterfaceRegistry, appParams simtypes.AppParams, - cdc codec.JSONCodec, txConfig client.TxConfig, ak feegrant.AccountKeeper, bk feegrant.BankKeeper, k keeper.Keeper, - ac address.Codec, ) simulation.WeightedOperations { var ( weightMsgGrantAllowance int @@ -55,23 +49,20 @@ func WeightedOperations( }, ) - pCdc := codec.NewProtoCodec(registry) - return simulation.WeightedOperations{ simulation.NewWeightedOperation( weightMsgGrantAllowance, - SimulateMsgGrantAllowance(pCdc, txConfig, ak, bk, k), + SimulateMsgGrantAllowance(txConfig, ak, bk, k), ), simulation.NewWeightedOperation( weightMsgRevokeAllowance, - SimulateMsgRevokeAllowance(pCdc, txConfig, ak, bk, k), + SimulateMsgRevokeAllowance(txConfig, ak, bk, k), ), } } // SimulateMsgGrantAllowance generates MsgGrantAllowance with random values. func SimulateMsgGrantAllowance( - cdc *codec.ProtoCodec, txConfig client.TxConfig, ak feegrant.AccountKeeper, bk feegrant.BankKeeper, @@ -135,7 +126,6 @@ func SimulateMsgGrantAllowance( // SimulateMsgRevokeAllowance generates a MsgRevokeAllowance with random values. func SimulateMsgRevokeAllowance( - cdc *codec.ProtoCodec, txConfig client.TxConfig, ak feegrant.AccountKeeper, bk feegrant.BankKeeper, diff --git a/x/genutil/client/cli/commands.go b/x/genutil/client/cli/commands.go index 4793db294eb1..6e1415fe0796 100644 --- a/x/genutil/client/cli/commands.go +++ b/x/genutil/client/cli/commands.go @@ -13,8 +13,6 @@ import ( genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" ) -// TODO(serverv2): remove app exporter notion that is server v1 specific - type genesisMM interface { DefaultGenesis() map[string]json.RawMessage ValidateGenesis(genesisData map[string]json.RawMessage) error diff --git a/x/genutil/client/cli/export_test.go b/x/genutil/client/cli/export_test.go index f5f8c570d334..270fa98bfaed 100644 --- a/x/genutil/client/cli/export_test.go +++ b/x/genutil/client/cli/export_test.go @@ -12,12 +12,12 @@ import ( cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" cmttypes "github.com/cometbft/cometbft/types" - dbm "github.com/cosmos/cosmos-db" "github.com/rs/zerolog" "github.com/spf13/viper" "github.com/stretchr/testify/require" corectx "cosmossdk.io/core/context" + corestore "cosmossdk.io/core/store" "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/client" @@ -155,7 +155,7 @@ func (e *mockExporter) SetDefaultExportApp() { // Export panics if neither e.ExportApp nor e.Err have been set. func (e *mockExporter) Export( logger log.Logger, - db dbm.DB, + db corestore.KVStoreWithBatch, traceWriter io.Writer, height int64, forZeroHeight bool, diff --git a/x/genutil/client/cli/genaccount.go b/x/genutil/client/cli/genaccount.go index bafd4f2f9426..34acef113e2e 100644 --- a/x/genutil/client/cli/genaccount.go +++ b/x/genutil/client/cli/genaccount.go @@ -25,7 +25,7 @@ const ( // This command is provided as a default, applications are expected to provide their own command if custom genesis accounts are needed. func AddGenesisAccountCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "add-genesis-account [address_or_key_name] [coin][,[coin]]", + Use: "add-genesis-account [,...]", Short: "Add a genesis account to genesis.json", Long: `Add a genesis account to genesis.json. The provided account must specify the account address or key name and a list of initial coins. If a key name is given, diff --git a/x/genutil/client/cli/genaccount_test.go b/x/genutil/client/cli/genaccount_test.go index 9acf60e29ade..c0b293cb43b3 100644 --- a/x/genutil/client/cli/genaccount_test.go +++ b/x/genutil/client/cli/genaccount_test.go @@ -9,7 +9,6 @@ import ( corectx "cosmossdk.io/core/context" "cosmossdk.io/log" - "cosmossdk.io/x/auth" "github.com/cosmos/cosmos-sdk/client" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" @@ -18,6 +17,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/auth" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" genutiltest "github.com/cosmos/cosmos-sdk/x/genutil/client/testutil" ) diff --git a/x/genutil/client/cli/gentx.go b/x/genutil/client/cli/gentx.go index 8e1302863320..c56c772afc7a 100644 --- a/x/genutil/client/cli/gentx.go +++ b/x/genutil/client/cli/gentx.go @@ -12,7 +12,6 @@ import ( "github.com/spf13/cobra" "cosmossdk.io/errors" - authclient "cosmossdk.io/x/auth/client" "cosmossdk.io/x/staking/client/cli" "github.com/cosmos/cosmos-sdk/client" @@ -22,6 +21,7 @@ import ( "github.com/cosmos/cosmos-sdk/server" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" + authclient "github.com/cosmos/cosmos-sdk/x/auth/client" "github.com/cosmos/cosmos-sdk/x/genutil" "github.com/cosmos/cosmos-sdk/x/genutil/types" ) @@ -32,7 +32,7 @@ func GenTxCmd(genMM genesisMM, genBalIterator types.GenesisBalancesIterator) *co fsCreateValidator, defaultsDesc := cli.CreateValidatorMsgFlagSet(ipDefault) cmd := &cobra.Command{ - Use: "gentx [key_name] [amount]", + Use: "gentx ", Short: "Generate a genesis tx carrying a self delegation", Args: cobra.ExactArgs(2), Long: fmt.Sprintf(`Generate a genesis transaction that creates a validator with a self-delegation, diff --git a/x/genutil/client/cli/init.go b/x/genutil/client/cli/init.go index 557050b10aee..8217e8744350 100644 --- a/x/genutil/client/cli/init.go +++ b/x/genutil/client/cli/init.go @@ -73,7 +73,7 @@ func displayInfo(dst io.Writer, info printInfo) error { // and the respective application. func InitCmd(mm genesisMM) *cobra.Command { cmd := &cobra.Command{ - Use: "init [moniker]", + Use: "init ", Short: "Initialize private validator, p2p, genesis, and application configuration files", Long: `Initialize validators's and node's configuration files.`, Args: cobra.ExactArgs(1), diff --git a/x/genutil/client/cli/migrate.go b/x/genutil/client/cli/migrate.go index 1ee0fc07f0ca..2763ba06cfb4 100644 --- a/x/genutil/client/cli/migrate.go +++ b/x/genutil/client/cli/migrate.go @@ -3,12 +3,12 @@ package cli import ( "encoding/json" "fmt" - "sort" + "maps" + "slices" "strings" "time" "github.com/spf13/cobra" - "golang.org/x/exp/maps" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" @@ -26,7 +26,7 @@ var MigrationMap = types.MigrationMap{} // When the application migration includes a SDK migration, the Cosmos SDK migration function should as well be called. func MigrateGenesisCmd(migrations types.MigrationMap) *cobra.Command { cmd := &cobra.Command{ - Use: "migrate [target-version] [genesis-file]", + Use: "migrate ", Short: "Migrate genesis to a specified target version", Long: "Migrate the source genesis into the target version and print to STDOUT", Example: fmt.Sprintf("%s migrate v0.47 /path/to/genesis.json --chain-id=cosmoshub-3 --genesis-time=2019-04-22T17:00:00Z", version.AppName), @@ -52,8 +52,7 @@ func MigrateHandler(cmd *cobra.Command, args []string, migrations types.Migratio migrationFunc, ok := migrations[target] if !ok || migrationFunc == nil { versions := maps.Keys(migrations) - sort.Strings(versions) - return fmt.Errorf("unknown migration function for version: %s (supported versions %s)", target, strings.Join(versions, ", ")) + return fmt.Errorf("unknown migration function for version: %s (supported versions %s)", target, strings.Join(slices.Sorted(versions), ", ")) } importGenesis := args[1] diff --git a/x/genutil/collect.go b/x/genutil/collect.go index d070f92c62f6..11b8db747d2b 100644 --- a/x/genutil/collect.go +++ b/x/genutil/collect.go @@ -12,7 +12,6 @@ import ( cfg "github.com/cometbft/cometbft/config" "cosmossdk.io/core/address" - stakingtypes "cosmossdk.io/x/staking/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" @@ -120,11 +119,12 @@ func CollectTxs(txJSONDecoder sdk.TxDecoder, moniker, genTxsDir string, // genesis transactions must be single-message msgs := genTx.GetMsgs() - // TODO abstract out staking message validation back to staking - msg := msgs[0].(*stakingtypes.MsgCreateValidator) - + msg, ok := msgs[0].(msgWithMoniker) + if !ok { + return appGenTxs, persistentPeers, fmt.Errorf("expected msgWithMoniker, got %T", msgs[0]) + } // exclude itself from persistent peers - if msg.Description.Moniker != moniker { + if msg.GetMoniker() != moniker { addressesIPs = append(addressesIPs, nodeAddrIP) } } @@ -134,3 +134,8 @@ func CollectTxs(txJSONDecoder sdk.TxDecoder, moniker, genTxsDir string, return appGenTxs, persistentPeers, nil } + +// MsgWithMoniker must have GetMoniker() method to use CollectTx +type msgWithMoniker interface { + GetMoniker() string +} diff --git a/x/genutil/genaccounts.go b/x/genutil/genaccounts.go index d55fdd3ef903..75899c8cfd89 100644 --- a/x/genutil/genaccounts.go +++ b/x/genutil/genaccounts.go @@ -6,12 +6,12 @@ import ( "fmt" "cosmossdk.io/core/address" - authtypes "cosmossdk.io/x/auth/types" - authvesting "cosmossdk.io/x/auth/vesting/types" banktypes "cosmossdk.io/x/bank/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" ) diff --git a/x/genutil/genesis.go b/x/genutil/genesis.go index 2008f28fe19d..386a281659cf 100644 --- a/x/genutil/genesis.go +++ b/x/genutil/genesis.go @@ -2,7 +2,7 @@ package genutil import ( "context" - "fmt" + "errors" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/types/module" @@ -22,7 +22,7 @@ func InitGenesis( txEncodingConfig client.TxEncodingConfig, ) (validatorUpdates []module.ValidatorUpdate, err error) { if deliverTx == nil { - return nil, fmt.Errorf("deliverTx (genesis.TxHandler) not defined, verify x/genutil wiring") + return nil, errors.New("deliverTx (genesis.TxHandler) not defined, verify x/genutil wiring") } if len(genesisState.GenTxs) > 0 { diff --git a/x/genutil/v2/cli/commands.go b/x/genutil/v2/cli/commands.go new file mode 100644 index 000000000000..515bf329a52a --- /dev/null +++ b/x/genutil/v2/cli/commands.go @@ -0,0 +1,47 @@ +package cli + +import ( + "encoding/json" + + "github.com/spf13/cobra" + + banktypes "cosmossdk.io/x/bank/types" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/x/genutil" + "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + v2 "github.com/cosmos/cosmos-sdk/x/genutil/v2" +) + +type genesisMM interface { + DefaultGenesis() map[string]json.RawMessage + ValidateGenesis(genesisData map[string]json.RawMessage) error +} + +// Commands adds core sdk's sub-commands into genesis command. +func Commands(genutilModule genutil.AppModule, genMM genesisMM, appExport v2.AppExporter) *cobra.Command { + return CommandsWithCustomMigrationMap(genutilModule, genMM, appExport, cli.MigrationMap) +} + +// CommandsWithCustomMigrationMap adds core sdk's sub-commands into genesis command with custom migration map. +// This custom migration map can be used by the application to add its own migration map. +func CommandsWithCustomMigrationMap(genutilModule genutil.AppModule, genMM genesisMM, appExport v2.AppExporter, migrationMap genutiltypes.MigrationMap) *cobra.Command { + cmd := &cobra.Command{ + Use: "genesis", + Short: "Application's genesis-related subcommands", + DisableFlagParsing: false, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + cmd.AddCommand( + cli.GenTxCmd(genMM, banktypes.GenesisBalancesIterator{}), + cli.MigrateGenesisCmd(migrationMap), + cli.CollectGenTxsCmd(genutilModule.GenTxValidator()), + cli.ValidateGenesisCmd(genMM), + cli.AddGenesisAccountCmd(), + ExportCmd(appExport), + ) + + return cmd +} diff --git a/x/genutil/v2/cli/export.go b/x/genutil/v2/cli/export.go new file mode 100644 index 000000000000..c19a02f870e3 --- /dev/null +++ b/x/genutil/v2/cli/export.go @@ -0,0 +1,106 @@ +package cli + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "os" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/version" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + v2 "github.com/cosmos/cosmos-sdk/x/genutil/v2" +) + +const ( + flagHeight = "height" + flagJailAllowedAddrs = "jail-allowed-addrs" +) + +// ExportCmd dumps app state to JSON. +func ExportCmd(appExporter v2.AppExporter) *cobra.Command { + cmd := &cobra.Command{ + Use: "export", + Short: "Export state to JSON", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, _ []string) error { + config := client.GetConfigFromCmd(cmd) + viper := client.GetViperFromCmd(cmd) + logger := client.GetLoggerFromCmd(cmd) + + if _, err := os.Stat(config.GenesisFile()); os.IsNotExist(err) { + return err + } + + if appExporter == nil { + if _, err := fmt.Fprintln(cmd.ErrOrStderr(), "WARNING: App exporter not defined. Returning genesis file."); err != nil { + return err + } + + // Open file in read-only mode so we can copy it to stdout. + // It is possible that the genesis file is large, + // so we don't need to read it all into memory + // before we stream it out. + f, err := os.OpenFile(config.GenesisFile(), os.O_RDONLY, 0) + if err != nil { + return err + } + defer f.Close() + + if _, err := io.Copy(cmd.OutOrStdout(), f); err != nil { + return err + } + + return nil + } + + height, _ := cmd.Flags().GetInt64(flagHeight) + jailAllowedAddrs, _ := cmd.Flags().GetStringSlice(flagJailAllowedAddrs) + outputDocument, _ := cmd.Flags().GetString(flags.FlagOutputDocument) + + exported, err := appExporter(logger, height, jailAllowedAddrs, viper) + if err != nil { + return fmt.Errorf("error exporting state: %w", err) + } + + appGenesis, err := genutiltypes.AppGenesisFromFile(config.GenesisFile()) + if err != nil { + return err + } + + // set current binary version + appGenesis.AppName = version.AppName + appGenesis.AppVersion = version.Version + + appGenesis.AppState = exported.AppState + appGenesis.InitialHeight = exported.Height + + out, err := json.Marshal(appGenesis) + if err != nil { + return err + } + + if outputDocument == "" { + // Copy the entire genesis file to stdout. + _, err := io.Copy(cmd.OutOrStdout(), bytes.NewReader(out)) + return err + } + + if err = appGenesis.SaveAs(outputDocument); err != nil { + return err + } + + return nil + }, + } + + cmd.Flags().Int64(flagHeight, -1, "Export state from a particular height (-1 means latest height)") + cmd.Flags().StringSlice(flagJailAllowedAddrs, []string{}, "Comma-separated list of operator addresses of jailed validators to unjail") + cmd.Flags().String(flags.FlagOutputDocument, "", "Exported state is written to the given file instead of STDOUT") + + return cmd +} diff --git a/x/genutil/v2/doc.go b/x/genutil/v2/doc.go new file mode 100644 index 000000000000..93ae66285cf6 --- /dev/null +++ b/x/genutil/v2/doc.go @@ -0,0 +1,5 @@ +// v2 contains logic and CLI used for genutil by server/v2 / runtime/v2 applications. +// It contains the AppExporter struct which is used when exporting the application state. +// Additionally it holds the a custom Export command specific to the v2 application. +// The rest of the CLI commands are the same as the ones in the genutil module. +package v2 diff --git a/x/genutil/v2/types.go b/x/genutil/v2/types.go new file mode 100644 index 000000000000..1b94c8bbc9be --- /dev/null +++ b/x/genutil/v2/types.go @@ -0,0 +1,27 @@ +package v2 + +import ( + "encoding/json" + + "github.com/spf13/viper" + + "cosmossdk.io/log" +) + +// AppExporter is a function that dumps all app state to +// JSON-serializable structure and returns the current validator set. +type AppExporter func( + logger log.Logger, + height int64, + jailAllowedAddrs []string, + viper *viper.Viper, +) (ExportedApp, error) + +// ExportedApp represents an exported app state, along with +// validators, consensus params and latest app height. +type ExportedApp struct { + // AppState is the application state as JSON. + AppState json.RawMessage + // Height is the app's latest block height. + Height int64 +} diff --git a/x/gov/autocli.go b/x/gov/autocli.go index 26508fb79821..b0f97e48c0f4 100644 --- a/x/gov/autocli.go +++ b/x/gov/autocli.go @@ -22,7 +22,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "MessageBasedParams", - Use: "params-by-msg-url [msg-url]", + Use: "params-by-msg-url ", Short: "Query the governance parameters of specific message", PositionalArgs: []*autocliv1.PositionalArgDescriptor{ {ProtoField: "msg_url"}, @@ -36,7 +36,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "Proposal", - Use: "proposal [proposal-id]", + Use: "proposal ", Alias: []string{"proposer"}, Short: "Query details of a single proposal", Example: fmt.Sprintf("%s query gov proposal 1", version.AppName), @@ -46,7 +46,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "Vote", - Use: "vote [proposal-id] [voter-addr]", + Use: "vote ", Short: "Query details of a single vote", Example: fmt.Sprintf("%s query gov vote 1 cosmos1...", version.AppName), PositionalArgs: []*autocliv1.PositionalArgDescriptor{ @@ -56,7 +56,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "Votes", - Use: "votes [proposal-id]", + Use: "votes ", Short: "Query votes of a single proposal", Example: fmt.Sprintf("%s query gov votes 1", version.AppName), PositionalArgs: []*autocliv1.PositionalArgDescriptor{ @@ -65,7 +65,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "Deposit", - Use: "deposit [proposal-id] [depositor-addr]", + Use: "deposit ", Short: "Query details of a deposit", PositionalArgs: []*autocliv1.PositionalArgDescriptor{ {ProtoField: "proposal_id"}, @@ -74,7 +74,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "Deposits", - Use: "deposits [proposal-id]", + Use: "deposits ", Short: "Query deposits on a proposal", PositionalArgs: []*autocliv1.PositionalArgDescriptor{ {ProtoField: "proposal_id"}, @@ -82,7 +82,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "TallyResult", - Use: "tally [proposal-id]", + Use: "tally ", Short: "Query the tally of a proposal vote", Example: fmt.Sprintf("%s query gov tally 1", version.AppName), PositionalArgs: []*autocliv1.PositionalArgDescriptor{ @@ -102,7 +102,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { RpcMethod: "Deposit", - Use: "deposit [proposal-id] [deposit]", + Use: "deposit ", Short: "Deposit tokens for an active proposal", Long: fmt.Sprintf(`Submit a deposit for an active proposal. You can find the proposal-id by running "%s query gov proposals"`, version.AppName), Example: fmt.Sprintf(`$ %s tx gov deposit 1 10stake --from mykey`, version.AppName), @@ -113,7 +113,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "CancelProposal", - Use: "cancel-proposal [proposal-id]", + Use: "cancel-proposal ", Short: "Cancel governance proposal before the voting period ends. Must be signed by the proposal creator.", Example: fmt.Sprintf(`$ %s tx gov cancel-proposal 1 --from mykey`, version.AppName), PositionalArgs: []*autocliv1.PositionalArgDescriptor{ @@ -122,7 +122,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "Vote", - Use: "vote [proposal-id] [option]", + Use: "vote