diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a469a56102d8..5b5a0bfb21f5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -275,7 +275,7 @@ jobs: if: env.GIT_DIFF run: | cd client/v2 - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -306,7 +306,7 @@ jobs: if: env.GIT_DIFF run: | cd core - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -337,7 +337,7 @@ jobs: if: env.GIT_DIFF run: | cd depinject - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -366,7 +366,7 @@ jobs: if: env.GIT_DIFF run: | cd errors - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -397,7 +397,7 @@ jobs: if: env.GIT_DIFF run: | cd math - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -428,12 +428,12 @@ jobs: if: env.GIT_DIFF run: | cd simapp - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock' ./... - name: tests simapp v1 if: env.GIT_DIFF run: | cd simapp - go test -mod=readonly -timeout 30m -tags='app_v1 norace ledger test_ledger_mock rocksdb_build' ./... + go test -mod=readonly -timeout 30m -tags='app_v1 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 @@ -464,7 +464,7 @@ jobs: if: env.GIT_DIFF run: | cd collections - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -495,7 +495,7 @@ jobs: if: env.GIT_DIFF run: | cd orm - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -526,7 +526,7 @@ jobs: if: env.GIT_DIFF run: | cd tools/cosmovisor - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -557,7 +557,7 @@ jobs: if: env.GIT_DIFF run: | cd tools/confix - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -588,7 +588,7 @@ jobs: if: env.GIT_DIFF run: | cd tools/hubl - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -652,7 +652,7 @@ jobs: if: env.GIT_DIFF run: | cd log - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -690,7 +690,7 @@ jobs: if: env.GIT_DIFF run: | cd x/accounts - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -721,7 +721,7 @@ jobs: if: env.GIT_DIFF run: | cd x/tx - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -752,7 +752,7 @@ jobs: if: env.GIT_DIFF run: | cd x/nft - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -783,7 +783,7 @@ jobs: if: env.GIT_DIFF run: | cd x/circuit - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -814,7 +814,7 @@ jobs: if: env.GIT_DIFF run: | cd x/distribution - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -845,7 +845,7 @@ jobs: if: env.GIT_DIFF run: | cd x/protocolpool - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -876,7 +876,7 @@ jobs: if: env.GIT_DIFF run: | cd x/feegrant - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -907,7 +907,7 @@ jobs: if: env.GIT_DIFF run: | cd x/evidence - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -937,7 +937,7 @@ jobs: if: env.GIT_DIFF run: | cd x/params - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -967,7 +967,7 @@ jobs: if: env.GIT_DIFF run: | cd x/upgrade - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -997,7 +997,7 @@ jobs: if: env.GIT_DIFF run: | cd x/group - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -1027,7 +1027,7 @@ jobs: if: env.GIT_DIFF run: | cd x/gov - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -1058,7 +1058,7 @@ jobs: if: env.GIT_DIFF run: | cd x/slashing - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -1089,7 +1089,7 @@ jobs: if: env.GIT_DIFF run: | cd x/staking - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -1120,7 +1120,7 @@ jobs: if: env.GIT_DIFF run: | cd x/authz - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -1151,7 +1151,7 @@ jobs: if: env.GIT_DIFF run: | cd x/bank - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 @@ -1182,7 +1182,7 @@ jobs: if: env.GIT_DIFF run: | cd x/mint - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + 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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 710da54d28b3..0945d053498a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (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 +* (version) [#18063](https://github.com/cosmos/cosmos-sdk/pull/18063) Include additional information in the Info struct. This change enhances the Info struct by adding support for additional information through the ExtraInfo field * [#18204](https://github.com/cosmos/cosmos-sdk/pull/18204) Use streaming json parser to parse chain-id from genesis file. ### Bug Fixes @@ -185,6 +186,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (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/consensus) [#18041](https://github.com/cosmos/cosmos-sdk/pull/18041) `ToProtoConsensusParams()` returns an error * (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 ### CLI Breaking Changes diff --git a/api/cosmos/counter/v1/tx.pulsar.go b/api/cosmos/counter/v1/tx.pulsar.go index 0bac1a4f14cb..8ca3213e0e73 100644 --- a/api/cosmos/counter/v1/tx.pulsar.go +++ b/api/cosmos/counter/v1/tx.pulsar.go @@ -2,6 +2,7 @@ package counterv1 import ( + _ "cosmossdk.io/api/amino" _ "cosmossdk.io/api/cosmos/msg/v1" fmt "fmt" _ "github.com/cosmos/cosmos-proto" @@ -991,36 +992,39 @@ var file_cosmos_counter_v1_tx_proto_rawDesc = []byte{ 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 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, 0x22, 0x69, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x61, - 0x73, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x69, 0x67, - 0x6e, 0x65, 0x72, 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, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x22, 0x37, - 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x65, - 0x77, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6e, - 0x65, 0x77, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x32, 0x71, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x63, - 0x0a, 0x0d, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, - 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x61, 0x73, 0x65, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x1a, 0x2b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x49, 0x6e, - 0x63, 0x72, 0x65, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xb4, 0x01, 0x0a, 0x15, 0x63, - 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x2c, 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, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x31, 0xa2, 0x02, 0x03, - 0x43, 0x43, 0x58, 0xaa, 0x02, 0x11, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x11, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x5c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1d, 0x43, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x31, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x43, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x3a, 0x3a, 0x56, - 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x89, 0x01, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x49, 0x6e, + 0x63, 0x72, 0x65, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x30, 0x0a, + 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 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, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x12, + 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x2b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x69, 0x67, 0x6e, + 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, + 0x6b, 0x2f, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x22, 0x37, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x61, 0x73, + 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, + 0x0a, 0x09, 0x6e, 0x65, 0x77, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x08, 0x6e, 0x65, 0x77, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x32, 0x71, 0x0a, 0x03, 0x4d, + 0x73, 0x67, 0x12, 0x63, 0x0a, 0x0d, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x61, 0x73, 0x65, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x12, 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x63, 0x72, 0x65, + 0x61, 0x73, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x1a, 0x2b, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4d, + 0x73, 0x67, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xb4, + 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x2c, 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, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x76, + 0x31, 0xa2, 0x02, 0x03, 0x43, 0x43, 0x58, 0xaa, 0x02, 0x11, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x11, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x31, 0xe2, + 0x02, 0x1d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/client/fuzz_test.go b/client/fuzz_test.go index 21d8cc5bd295..e8053c2d19e4 100644 --- a/client/fuzz_test.go +++ b/client/fuzz_test.go @@ -7,17 +7,15 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/metadata" - "cosmossdk.io/x/bank/types" - "github.com/cosmos/cosmos-sdk/testutil/testdata" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/counter/types" ) type fuzzSuite struct { IntegrationTestSuite } -func (fz *fuzzSuite) FuzzQueryBalance(f *testing.F) { +func (fz *fuzzSuite) FuzzQuery(f *testing.F) { if testing.Short() { f.Skip("In -short mode") } @@ -28,24 +26,21 @@ func (fz *fuzzSuite) FuzzQueryBalance(f *testing.F) { fz.Require().Equal("hello", testRes.Message) // 1. Generate some seeds. - bz, err := fz.cdc.Marshal(&types.QueryBalanceRequest{ - Address: fz.genesisAccount.GetAddress().String(), - Denom: sdk.DefaultBondDenom, - }) + bz, err := fz.cdc.Marshal(&types.QueryGetCountRequest{}) fz.Require().NoError(err) f.Add(bz) // 2. Now fuzz it and ensure that we don't get any panics. ctx := context.Background() f.Fuzz(func(t *testing.T, in []byte) { - qbReq := new(types.QueryBalanceRequest) + qbReq := new(types.QueryGetCountRequest) if err := fz.cdc.Unmarshal(in, qbReq); err != nil { return } // gRPC query to bank service should work var header metadata.MD - _, _ = fz.bankClient.Balance( + _, _ = fz.counterClient.GetCount( ctx, qbReq, grpc.Header(&header), @@ -53,9 +48,9 @@ func (fz *fuzzSuite) FuzzQueryBalance(f *testing.F) { }) } -func FuzzQueryBalance(f *testing.F) { +func FuzzQuery(f *testing.F) { fzs := new(fuzzSuite) fzs.SetT(new(testing.T)) fzs.SetupSuite() - fzs.FuzzQueryBalance(f) + fzs.FuzzQuery(f) } diff --git a/client/grpc_query_test.go b/client/grpc_query_test.go index dad9d83becbd..f63c3f52f985 100644 --- a/client/grpc_query_test.go +++ b/client/grpc_query_test.go @@ -4,110 +4,52 @@ import ( "context" "testing" - abci "github.com/cometbft/cometbft/abci/types" - cmtjson "github.com/cometbft/cometbft/libs/json" - dbm "github.com/cosmos/cosmos-db" "github.com/stretchr/testify/suite" "google.golang.org/grpc" "google.golang.org/grpc/metadata" - "cosmossdk.io/depinject" "cosmossdk.io/log" - "cosmossdk.io/math" - bankkeeper "cosmossdk.io/x/bank/keeper" - "cosmossdk.io/x/bank/types" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/baseapp" "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/runtime" - "github.com/cosmos/cosmos-sdk/testutil/sims" + "github.com/cosmos/cosmos-sdk/testutil/integration" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/testutil" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/counter" + counterkeeper "github.com/cosmos/cosmos-sdk/x/counter/keeper" + countertypes "github.com/cosmos/cosmos-sdk/x/counter/types" ) type IntegrationTestSuite struct { suite.Suite - ctx sdk.Context - cdc codec.Codec - genesisAccount *authtypes.BaseAccount - bankClient types.QueryClient - testClient testdata.QueryClient - genesisAccountBalance int64 + ctx sdk.Context + cdc codec.Codec + counterClient countertypes.QueryClient + testClient testdata.QueryClient } func (s *IntegrationTestSuite) SetupSuite() { s.T().Log("setting up integration test suite") - var ( - interfaceRegistry codectypes.InterfaceRegistry - bankKeeper bankkeeper.BaseKeeper - appBuilder *runtime.AppBuilder - cdc codec.Codec - ) - // TODO duplicated from testutils/sims/app_helpers.go - // need more composable startup options for simapp, this test needed a handle to the closed over genesis account - // to query balances - err := depinject.Inject( - depinject.Configs( - testutil.AppConfig, - depinject.Supply(log.NewNopLogger()), - ), - &interfaceRegistry, &bankKeeper, &appBuilder, &cdc) - s.NoError(err) + logger := log.NewNopLogger() + keys := storetypes.NewKVStoreKeys(countertypes.StoreKey) + cms := integration.CreateMultiStore(keys, logger) + s.ctx = sdk.NewContext(cms, true, logger) + cfg := moduletestutil.MakeTestEncodingConfig(counter.AppModuleBasic{}) + s.cdc = cfg.Codec - app := appBuilder.Build(dbm.NewMemDB(), nil) - err = app.Load(true) - s.NoError(err) - - valSet, err := sims.CreateRandomValidatorSet() - s.NoError(err) - - // generate genesis account - s.genesisAccountBalance = 100000000000000 - senderPrivKey := secp256k1.GenPrivKey() - acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0) - balance := types.Balance{ - Address: acc.GetAddress().String(), - Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(s.genesisAccountBalance))), - } - - genesisState, err := sims.GenesisStateWithValSet(cdc, app.DefaultGenesis(), valSet, []authtypes.GenesisAccount{acc}, balance) - s.NoError(err) - - stateBytes, err := cmtjson.MarshalIndent(genesisState, "", " ") - s.NoError(err) - - // init chain will set the validator set and initialize the genesis accounts - _, err = app.InitChain(&abci.RequestInitChain{ - Validators: []abci.ValidatorUpdate{}, - ConsensusParams: sims.DefaultConsensusParams, - AppStateBytes: stateBytes, - }, - ) - s.NoError(err) - - _, err = app.FinalizeBlock(&abci.RequestFinalizeBlock{ - Height: app.LastBlockHeight() + 1, - Hash: app.LastCommitID().Hash, - NextValidatorsHash: valSet.Hash(), - }) - s.NoError(err) - - // end of app init - - s.ctx = app.BaseApp.NewContext(false) - s.cdc = cdc - queryHelper := baseapp.NewQueryServerTestHelper(s.ctx, interfaceRegistry) - types.RegisterQueryServer(queryHelper, bankKeeper) + queryHelper := baseapp.NewQueryServerTestHelper(s.ctx, cfg.InterfaceRegistry) testdata.RegisterQueryServer(queryHelper, testdata.QueryImpl{}) - s.bankClient = types.NewQueryClient(queryHelper) s.testClient = testdata.NewQueryClient(queryHelper) - s.genesisAccount = acc + + kvs := runtime.NewKVStoreService(keys[countertypes.StoreKey]) + counterKeeper := counterkeeper.NewKeeper(kvs, runtime.EventService{}) + countertypes.RegisterQueryServer(queryHelper, counterKeeper) + s.counterClient = countertypes.NewQueryClient(queryHelper) } func (s *IntegrationTestSuite) TearDownSuite() { @@ -115,23 +57,15 @@ func (s *IntegrationTestSuite) TearDownSuite() { } func (s *IntegrationTestSuite) TestGRPCQuery() { - denom := sdk.DefaultBondDenom - // gRPC query to test service should work testRes, err := s.testClient.Echo(context.Background(), &testdata.EchoRequest{Message: "hello"}) s.Require().NoError(err) s.Require().Equal("hello", testRes.Message) - // gRPC query to bank service should work var header metadata.MD - res, err := s.bankClient.Balance( - context.Background(), - &types.QueryBalanceRequest{Address: s.genesisAccount.GetAddress().String(), Denom: denom}, - grpc.Header(&header), // Also fetch grpc header - ) + res, err := s.counterClient.GetCount(s.ctx, &countertypes.QueryGetCountRequest{}, grpc.Header(&header)) s.Require().NoError(err) - bal := res.GetBalance() - s.Equal(sdk.NewCoin(denom, math.NewInt(s.genesisAccountBalance)), *bal) + s.Require().Equal(int64(0), res.TotalCount) } func TestIntegrationTestSuite(t *testing.T) { diff --git a/client/tx/aux_builder_test.go b/client/tx/aux_builder_test.go index 66f17b792220..4758247f9e86 100644 --- a/client/tx/aux_builder_test.go +++ b/client/tx/aux_builder_test.go @@ -5,8 +5,6 @@ import ( "github.com/stretchr/testify/require" - "cosmossdk.io/x/bank" - "github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -16,16 +14,17 @@ import ( moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" typestx "github.com/cosmos/cosmos-sdk/types/tx" "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/counter" ) func TestAuxTxBuilder(t *testing.T) { - bankModule := bank.AppModuleBasic{} - cdc := moduletestutil.MakeTestEncodingConfig(bankModule).Codec + counterModule := counter.AppModuleBasic{} + cdc := moduletestutil.MakeTestEncodingConfig(counterModule).Codec reg := codectypes.NewInterfaceRegistry() testdata.RegisterInterfaces(reg) // required for test case: "GetAuxSignerData works for DIRECT_AUX" - bankModule.RegisterInterfaces(reg) + counterModule.RegisterInterfaces(reg) var b tx.AuxTxBuilder diff --git a/client/tx/legacy_test.go b/client/tx/legacy_test.go index 0d399ab2d822..15aac031523e 100644 --- a/client/tx/legacy_test.go +++ b/client/tx/legacy_test.go @@ -1,10 +1,8 @@ package tx_test import ( - banktypes "cosmossdk.io/x/bank/types" - "github.com/cosmos/cosmos-sdk/testutil/testdata" - "github.com/cosmos/cosmos-sdk/types" + countertypes "github.com/cosmos/cosmos-sdk/x/counter/types" ) const ( @@ -16,7 +14,7 @@ var ( _, pub1, addr1 = testdata.KeyTestPubAddr() _, _, addr2 = testdata.KeyTestPubAddr() rawSig = []byte("dummy") - msg1 = banktypes.NewMsgSend(addr1, addr2, types.NewCoins(types.NewInt64Coin("wack", 2))) + msg1 = &countertypes.MsgIncreaseCounter{Signer: addr1.String(), Count: 1} chainID = "test-chain" ) diff --git a/client/tx/tx_test.go b/client/tx/tx_test.go index 25f571d45950..7b2b4b7f0d05 100644 --- a/client/tx/tx_test.go +++ b/client/tx/tx_test.go @@ -9,8 +9,6 @@ import ( "github.com/stretchr/testify/require" "google.golang.org/grpc" - banktypes "cosmossdk.io/x/bank/types" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/codec" @@ -26,6 +24,7 @@ import ( ante "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" + countertypes "github.com/cosmos/cosmos-sdk/x/counter/types" ) func newTestTxConfig() (client.TxConfig, codec.Codec) { @@ -127,7 +126,7 @@ func TestBuildSimTx(t *testing.T) { require.NoError(t, err) txf := mockTxFactory(txCfg).WithSignMode(defaultSignMode).WithKeybase(kb) - msg := banktypes.NewMsgSend(sdk.AccAddress("from"), sdk.AccAddress("to"), nil) + msg := &countertypes.MsgIncreaseCounter{Signer: sdk.AccAddress("from").String(), Count: 1} bz, err := txf.BuildSimTx(msg) require.NoError(t, err) require.NotNil(t, bz) @@ -143,7 +142,7 @@ func TestBuildUnsignedTx(t *testing.T) { _, _, err = kb.NewMnemonic("test_key1", keyring.English, path, keyring.DefaultBIP39Passphrase, hd.Secp256k1) require.NoError(t, err) txf := mockTxFactory(txConfig).WithKeybase(kb) - msg := banktypes.NewMsgSend(sdk.AccAddress("from"), sdk.AccAddress("to"), nil) + msg := &countertypes.MsgIncreaseCounter{Signer: sdk.AccAddress("from").String(), Count: 1} tx, err := txf.BuildUnsignedTx(msg) require.NoError(t, err) require.NotNil(t, tx) @@ -162,7 +161,7 @@ func TestBuildUnsignedTxWithWithExtensionOptions(t *testing.T) { }, } txf := mockTxFactory(txCfg).WithExtensionOptions(extOpts...) - msg := banktypes.NewMsgSend(sdk.AccAddress("from"), sdk.AccAddress("to"), nil) + msg := &countertypes.MsgIncreaseCounter{Signer: sdk.AccAddress("from").String(), Count: 1} tx, err := txf.BuildUnsignedTx(msg) require.NoError(t, err) require.NotNil(t, tx) @@ -205,7 +204,7 @@ func TestMnemonicInMemo(t *testing.T) { WithChainID("test-chain"). WithKeybase(kb) - msg := banktypes.NewMsgSend(sdk.AccAddress("from"), sdk.AccAddress("to"), nil) + msg := &countertypes.MsgIncreaseCounter{Signer: sdk.AccAddress("from").String(), Count: 1} tx, err := txf.BuildUnsignedTx(msg) if tc.error { require.Error(t, err) @@ -256,8 +255,8 @@ func TestSign(t *testing.T) { requireT.NoError(err) addr2, err := k2.GetAddress() requireT.NoError(err) - msg1 := banktypes.NewMsgSend(addr1, sdk.AccAddress("to"), nil) - msg2 := banktypes.NewMsgSend(addr2, sdk.AccAddress("to"), nil) + msg1 := &countertypes.MsgIncreaseCounter{Signer: addr1.String(), Count: 1} + msg2 := &countertypes.MsgIncreaseCounter{Signer: addr2.String(), Count: 1} txb, err := txfNoKeybase.BuildUnsignedTx(msg1, msg2) requireT.NoError(err) txb2, err := txfNoKeybase.BuildUnsignedTx(msg1, msg2) @@ -404,8 +403,8 @@ func TestPreprocessHook(t *testing.T) { addr1, err := kr.GetAddress() requireT.NoError(err) - msg1 := banktypes.NewMsgSend(addr1, sdk.AccAddress("to"), nil) - msg2 := banktypes.NewMsgSend(addr2, sdk.AccAddress("to"), nil) + msg1 := &countertypes.MsgIncreaseCounter{Signer: addr1.String(), Count: 1} + msg2 := &countertypes.MsgIncreaseCounter{Signer: addr2.String(), Count: 1} txb, err := txfDirect.BuildUnsignedTx(msg1, msg2) requireT.NoError(err) diff --git a/client/v2/go.mod b/client/v2/go.mod index 3bef062da4b3..baf68515850e 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/client/v2 go 1.21 require ( - cosmossdk.io/api v0.7.2 + cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 diff --git a/client/v2/go.sum b/client/v2/go.sum index 56febcb73172..66328b566cef 100644 --- a/client/v2/go.sum +++ b/client/v2/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= -cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/codec/bench_test.go b/codec/bench_test.go index 4ffb2bbc3872..b52135a951a8 100644 --- a/codec/bench_test.go +++ b/codec/bench_test.go @@ -7,30 +7,29 @@ import ( protov2 "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/dynamicpb" - bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" - banktypes "cosmossdk.io/x/bank/types" + counterv1 "cosmossdk.io/api/cosmos/counter/v1" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" + countertypes "github.com/cosmos/cosmos-sdk/x/counter/types" ) -type bankSendWrapper struct { - *banktypes.MsgSend +type msgCounterWrapper struct { + *countertypes.MsgIncreaseCounter } -func (msg bankSendWrapper) GetSigners() []sdk.AccAddress { - fromAddress, _ := sdk.AccAddressFromBech32(msg.FromAddress) +func (msg msgCounterWrapper) GetSigners() []sdk.AccAddress { + fromAddress, _ := sdk.AccAddressFromBech32(msg.Signer) return []sdk.AccAddress{fromAddress} } func BenchmarkLegacyGetSigners(b *testing.B) { _, _, addr := testdata.KeyTestPubAddr() - msg := bankSendWrapper{&banktypes.MsgSend{ - FromAddress: addr.String(), - ToAddress: "", - Amount: nil, + msg := msgCounterWrapper{&countertypes.MsgIncreaseCounter{ + Signer: addr.String(), + Count: 2, }} b.ResetTimer() @@ -44,10 +43,9 @@ func BenchmarkProtoreflectGetSigners(b *testing.B) { signingCtx := cdc.InterfaceRegistry().SigningContext() _, _, addr := testdata.KeyTestPubAddr() // use a pulsar message - msg := &bankv1beta1.MsgSend{ - FromAddress: addr.String(), - ToAddress: "", - Amount: nil, + msg := &counterv1.MsgIncreaseCounter{ + Signer: addr.String(), + Count: 1, } b.ResetTimer() @@ -63,10 +61,9 @@ func BenchmarkProtoreflectGetSignersWithUnmarshal(b *testing.B) { cdc := codectestutil.CodecOptions{}.NewCodec() _, _, addr := testdata.KeyTestPubAddr() // start with a protoreflect message - msg := &banktypes.MsgSend{ - FromAddress: addr.String(), - ToAddress: "", - Amount: nil, + msg := &countertypes.MsgIncreaseCounter{ + Signer: addr.String(), + Count: 1, } // marshal to an any first because this is what we get from the wire a, err := codectypes.NewAnyWithValue(msg) @@ -85,10 +82,9 @@ func BenchmarkProtoreflectGetSignersDynamicpb(b *testing.B) { cdc := codectestutil.CodecOptions{}.NewCodec() signingCtx := cdc.InterfaceRegistry().SigningContext() _, _, addr := testdata.KeyTestPubAddr() - msg := &bankv1beta1.MsgSend{ - FromAddress: addr.String(), - ToAddress: "", - Amount: nil, + msg := &counterv1.MsgIncreaseCounter{ + Signer: addr.String(), + Count: 1, } bz, err := protov2.Marshal(msg) require.NoError(b, err) diff --git a/codec/proto_codec_test.go b/codec/proto_codec_test.go index c674437cefe2..d4d6d12baca3 100644 --- a/codec/proto_codec_test.go +++ b/codec/proto_codec_test.go @@ -13,16 +13,14 @@ import ( protov2 "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoregistry" - bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" - basev1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" - sdkmath "cosmossdk.io/math" - banktypes "cosmossdk.io/x/bank/types" + counterv1 "cosmossdk.io/api/cosmos/counter/v1" "cosmossdk.io/x/tx/signing" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" + countertypes "github.com/cosmos/cosmos-sdk/x/counter/types" ) func createTestInterfaceRegistry() types.InterfaceRegistry { @@ -113,7 +111,7 @@ func TestProtoCodecMarshal(t *testing.T) { require.NoError(t, err) // test typed nil input shouldn't panic - var v *banktypes.QueryBalanceResponse + var v *countertypes.QueryGetCountRequest bz, err = grpcServerEncode(cartoonCdc.GRPCCodec(), v) require.NoError(t, err) require.Empty(t, bz) @@ -189,15 +187,9 @@ func TestGetSigners(t *testing.T) { cdc := codec.NewProtoCodec(interfaceRegistry) testAddr := sdk.AccAddress("test") testAddrStr := testAddr.String() - testAddr2 := sdk.AccAddress("test2") - testAddrStr2 := testAddr2.String() - - msgSendV1 := banktypes.NewMsgSend(testAddr, testAddr2, sdk.NewCoins(sdk.NewCoin("foo", sdkmath.NewInt(1)))) - msgSendV2 := &bankv1beta1.MsgSend{ - FromAddress: testAddrStr, - ToAddress: testAddrStr2, - Amount: []*basev1beta1.Coin{{Denom: "foo", Amount: "1"}}, - } + + msgSendV1 := &countertypes.MsgIncreaseCounter{Signer: testAddrStr, Count: 1} + msgSendV2 := &counterv1.MsgIncreaseCounter{Signer: testAddrStr, Count: 1} signers, msgSendV2Copy, err := cdc.GetMsgV1Signers(msgSendV1) require.NoError(t, err) diff --git a/collections/README.md b/collections/README.md index 0210a9466af8..842881648d38 100644 --- a/collections/README.md +++ b/collections/README.md @@ -23,11 +23,12 @@ go get cosmossdk.io/collections ## Core types Collections offers 5 different APIs to work with state, which will be explored in the next sections, these APIs are: -- ``Map``: to work with typed arbitrary KV pairings. -- ``KeySet``: to work with just typed keys -- ``Item``: to work with just one typed value -- ``Sequence``: which is a monotonically increasing number. -- ``IndexedMap``: which combines ``Map`` and `KeySet` to provide a `Map` with indexing capabilities. + +* ``Map``: to work with typed arbitrary KV pairings. +* ``KeySet``: to work with just typed keys +* ``Item``: to work with just one typed value +* ``Sequence``: which is a monotonically increasing number. +* ``IndexedMap``: which combines ``Map`` and `KeySet` to provide a `Map` with indexing capabilities. ## Preliminary components @@ -82,8 +83,9 @@ The second argument passed to our ``KeySet`` is a `collections.Prefix`, a prefix where all the state of a specific collection will be saved. Since a module can have multiple collections, the following is expected: -- module params will become a `collections.Item` -- the `AllowList` is a `collections.KeySet` + +* module params will become a `collections.Item` +* the `AllowList` is a `collections.KeySet` We don't want a collection to write over the state of the other collection so we pass it a prefix, which defines a storage partition owned by the collection. @@ -91,6 +93,7 @@ partition owned by the collection. If you already built modules, the prefix translates to the items you were creating in your ``types/keys.go`` file, example: https://github.com/cosmos/cosmos-sdk/blob/main/x/feegrant/key.go#L27 your old: + ```go var ( // FeeAllowanceKeyPrefix is the set of the kvstore for fee allowance data @@ -102,7 +105,9 @@ var ( FeeAllowanceQueueKeyPrefix = []byte{0x01} ) ``` + becomes: + ```go var ( // FeeAllowanceKeyPrefix is the set of the kvstore for fee allowance data @@ -130,6 +135,7 @@ prefix2 := collections.NewPrefix("prefix") // THIS IS BAD! prefix1 := collections.NewPrefix("a") prefix2 := collections.NewPrefix("aa") // prefix2 starts with the same as prefix1: BAD!!! ``` + ### Human-Readable Name The third parameter we pass to a collection is a string, which is a human-readable name. @@ -390,6 +396,7 @@ func (k Keeper) RemoveValidator(ctx sdk.Context, validator sdk.ValAddress) error return nil } ``` + The first difference we notice is that `KeySet` needs use to specify only one type parameter: the key (`sdk.ValAddress` in this case). The second difference we notice is that `KeySet` in its `NewKeySet` function does not require us to specify a `ValueCodec` but only a `KeyCodec`. This is because a `KeySet` only saves keys and not values. @@ -679,6 +686,7 @@ func NewKeeper(storeKey *storetypes.KVStoreKey) Keeper { #### The Map Key definition First of all we can see that in order to define a composite key of two elements we use the `collections.Pair` type: + ````go collections.Map[collections.Pair[sdk.AccAddress, string], math.Int] ```` diff --git a/go.mod b/go.mod index 5b98f0ec9181..c2d7a6bf851d 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ go 1.21 module github.com/cosmos/cosmos-sdk require ( - cosmossdk.io/api v0.7.2 + cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 @@ -12,7 +12,6 @@ require ( cosmossdk.io/math v1.1.3-rc.1 cosmossdk.io/store v1.0.0-rc.0 cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 - cosmossdk.io/x/distribution v0.0.0-20230925135524-a1bc045b3190 cosmossdk.io/x/gov v0.0.0-20230925135524-a1bc045b3190 cosmossdk.io/x/mint v0.0.0-00010101000000-000000000000 cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 @@ -66,7 +65,6 @@ require ( ) require ( - cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/DataDog/zstd v1.5.5 // indirect diff --git a/go.sum b/go.sum index c703d0515d3f..314636e94089 100644 --- a/go.sum +++ b/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= -cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/proto/cosmos/counter/v1/tx.proto b/proto/cosmos/counter/v1/tx.proto index 0a733e05c1a6..0d4a2ef480d4 100644 --- a/proto/cosmos/counter/v1/tx.proto +++ b/proto/cosmos/counter/v1/tx.proto @@ -4,6 +4,7 @@ package cosmos.counter.v1; import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/counter/types"; @@ -17,6 +18,7 @@ service Msg { // MsgIncreaseCounter defines a count Msg service counter. message MsgIncreaseCounter { + option (amino.name) = "cosmos-sdk/increase_counter"; // TODO: remove amino option (cosmos.msg.v1.signer) = "signer"; // signer is the address that controls the module (defaults to x/gov unless overwritten). diff --git a/scripts/go-lint-all.bash b/scripts/go-lint-all.bash index 3860c0dd3e17..2f7ad6b47d0a 100755 --- a/scripts/go-lint-all.bash +++ b/scripts/go-lint-all.bash @@ -15,6 +15,7 @@ lint_module() { else golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --build-tags=rocksdb,e2e,ledger,test_ledger_mock fi + # always lint simapp with app_v1 build tag, otherwise it never gets linted if [[ "$(grep "^module" go.mod)" == "module cosmossdk.io/simapp" ]]; then golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --build-tags=app_v1 fi @@ -38,14 +39,16 @@ else for f in $(dirname $(echo "$GIT_DIFF" | tr -d "'") | uniq); do echo "linting $f [$(date -Iseconds -u)]" && cd $f && - if [[ -z "${NIX:-}" ]]; then - golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --build-tags=e2e,ledger,test_ledger_mock - else - golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --build-tags=rocksdb,e2e,ledger,test_ledger_mock - fi + if [[ (-z "${NIX:-}" && $f != store) || $f == "tools/"* ]]; then + golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --build-tags=e2e,ledger,test_ledger_mock + else + golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --build-tags=rocksdb,e2e,ledger,test_ledger_mock + fi + if [[ $f == simapp || $f == simapp/simd/cmd ]]; then golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --build-tags=app_v1 fi + cd $REPO_ROOT done fi diff --git a/simapp/go.mod b/simapp/go.mod index 70a5e8a31838..30e08346b3ee 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/simapp go 1.21 require ( - cosmossdk.io/api v0.7.2 + cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 cosmossdk.io/client/v2 v2.0.0-20230630094428-02b760776860 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 @@ -213,6 +213,7 @@ require ( // SimApp on main always tests the latest extracted SDK modules importing the sdk replace ( + cosmossdk.io/api => ../api cosmossdk.io/client/v2 => ../client/v2 cosmossdk.io/tools/confix => ../tools/confix cosmossdk.io/x/authz => ../x/authz diff --git a/simapp/go.sum b/simapp/go.sum index b5f41857b155..16354abe7ce6 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -187,8 +187,6 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= -cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/simapp/gomod2nix.toml b/simapp/gomod2nix.toml index d4962a77a6a8..2cded1b22002 100644 --- a/simapp/gomod2nix.toml +++ b/simapp/gomod2nix.toml @@ -16,9 +16,6 @@ schema = 3 [mod."cloud.google.com/go/storage"] version = "v1.33.0" hash = "sha256-oW2OubL84ZHjw7/XD6Pjl6pdUPkAqtFS2bXQKVUec6A=" - [mod."cosmossdk.io/api"] - version = "v0.7.2" - hash = "sha256-iJOdaqOqjXHZtfUOrUxJAYP5bUshIOMMaXcZ5ZFy2ZA=" [mod."cosmossdk.io/collections"] version = "v0.4.0" hash = "sha256-minFyzgO/D+Oda4E3B1qvOAN5qd65SjS6nmjca4cp/8=" diff --git a/tests/go.mod b/tests/go.mod index 8f7df4e3104a..2588ec8f6065 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -3,7 +3,7 @@ module github.com/cosmos/cosmos-sdk/tests go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231018072017-35c402025504 + cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 @@ -42,6 +42,7 @@ require ( cosmossdk.io/x/mint v0.0.0-00010101000000-000000000000 cosmossdk.io/x/slashing v0.0.0-00010101000000-000000000000 cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 + github.com/google/go-cmp v0.6.0 ) require ( @@ -104,7 +105,6 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // 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/uuid v1.3.1 // indirect diff --git a/tests/go.sum b/tests/go.sum index 72202ee425c3..c9ed9a7a6e7f 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -187,8 +187,8 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -cosmossdk.io/api v0.7.3-0.20231018072017-35c402025504 h1:DrOuHptmmjB+jIsOG/eLq9cLdb5BZy3y70E60gnZINw= -cosmossdk.io/api v0.7.3-0.20231018072017-35c402025504/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/testutil/integration/example_test.go b/tests/integration/example/example_test.go similarity index 100% rename from testutil/integration/example_test.go rename to tests/integration/example/example_test.go diff --git a/tests/starship/tests/go.mod b/tests/starship/tests/go.mod index 190ea5535a9d..c8603b141f82 100644 --- a/tests/starship/tests/go.mod +++ b/tests/starship/tests/go.mod @@ -48,7 +48,7 @@ require ( cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/iam v1.1.3 // indirect cloud.google.com/go/storage v1.33.0 // indirect - cosmossdk.io/api v0.7.2 // indirect + cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 // indirect cosmossdk.io/client/v2 v2.0.0-20230630094428-02b760776860 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/core v0.12.0 // indirect diff --git a/tests/starship/tests/go.sum b/tests/starship/tests/go.sum index 1f9b9c9a2257..aa62d8c731fb 100644 --- a/tests/starship/tests/go.sum +++ b/tests/starship/tests/go.sum @@ -187,8 +187,8 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= -cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/testutil/integration/doc.go b/testutil/integration/doc.go index 9bb3feef40f2..c1b9902d7cfe 100644 --- a/testutil/integration/doc.go +++ b/testutil/integration/doc.go @@ -1,2 +1,3 @@ // Integration contains the integration test setup used for SDK modules. +// To see how to use this, check the tests/integration/example_test.go file. package integration diff --git a/tools/cosmovisor/process.go b/tools/cosmovisor/process.go index 051a3621eb9e..c41731e04b33 100644 --- a/tools/cosmovisor/process.go +++ b/tools/cosmovisor/process.go @@ -101,7 +101,7 @@ func (l Launcher) Run(args []string, stdout, stderr io.Writer) (bool, error) { // It returns (true, nil) if an upgrade should be initiated (and we killed the process) // It returns (false, err) if the process died by itself // It returns (false, nil) if the process exited normally without triggering an upgrade. This is very unlikely -// to happen with "start" but may happen with short-lived commands like `simd export ...` +// to happen with "start" but may happen with short-lived commands like `simd genesis export ...` func (l Launcher) WaitForUpgradeOrExit(cmd *exec.Cmd) (bool, error) { currentUpgrade, err := l.cfg.UpgradeInfo() if err != nil { diff --git a/tools/cosmovisor/scanner.go b/tools/cosmovisor/scanner.go index f67692751db9..af8774949d2b 100644 --- a/tools/cosmovisor/scanner.go +++ b/tools/cosmovisor/scanner.go @@ -189,7 +189,7 @@ func parseUpgradeInfoFile(filename string, disableRecase bool) (upgradetypes.Pla } if len(f) == 0 { - return upgradetypes.Plan{}, errors.New("empty upgrade-info.json") + return upgradetypes.Plan{}, fmt.Errorf("empty upgrade-info.json in %q", filename) } var upgradePlan upgradetypes.Plan @@ -207,5 +207,5 @@ func parseUpgradeInfoFile(filename string, disableRecase bool) (upgradetypes.Pla upgradePlan.Name = strings.ToLower(upgradePlan.Name) } - return upgradePlan, err + return upgradePlan, nil } diff --git a/tools/cosmovisor/scanner_test.go b/tools/cosmovisor/scanner_test.go index 02ece86218d6..3f110703a0a0 100644 --- a/tools/cosmovisor/scanner_test.go +++ b/tools/cosmovisor/scanner_test.go @@ -14,67 +14,64 @@ func TestParseUpgradeInfoFile(t *testing.T) { filename string expectUpgrade upgradetypes.Plan disableRecase bool - expectErr bool + expectErr string }{ { filename: "f1-good.json", disableRecase: false, expectUpgrade: upgradetypes.Plan{Name: "upgrade1", Info: "some info", Height: 123}, - expectErr: false, }, { filename: "f2-normalized-name.json", disableRecase: false, expectUpgrade: upgradetypes.Plan{Name: "upgrade2", Info: "some info", Height: 125}, - expectErr: false, }, { filename: "f2-normalized-name.json", disableRecase: true, expectUpgrade: upgradetypes.Plan{Name: "Upgrade2", Info: "some info", Height: 125}, - expectErr: false, }, { filename: "f2-bad-type.json", disableRecase: false, expectUpgrade: upgradetypes.Plan{}, - expectErr: true, + expectErr: "cannot unmarshal number into Go struct", }, { filename: "f2-bad-type-2.json", disableRecase: false, expectUpgrade: upgradetypes.Plan{}, - expectErr: true, + expectErr: "height must be greater than 0: invalid request", }, { filename: "f3-empty.json", disableRecase: false, expectUpgrade: upgradetypes.Plan{}, - expectErr: true, + expectErr: "empty upgrade-info.json in", }, { filename: "f4-empty-obj.json", disableRecase: false, expectUpgrade: upgradetypes.Plan{}, - expectErr: true, + expectErr: "invalid upgrade-info.json content: name cannot be empty", }, { filename: "f5-partial-obj-1.json", disableRecase: false, expectUpgrade: upgradetypes.Plan{}, - expectErr: true, + expectErr: "height must be greater than 0", }, { filename: "f5-partial-obj-2.json", disableRecase: false, expectUpgrade: upgradetypes.Plan{}, - expectErr: true, + expectErr: "name cannot be empty: invalid request", }, { - filename: "unknown.json", + filename: "non-existent.json", disableRecase: false, expectUpgrade: upgradetypes.Plan{}, - expectErr: true, + expectErr: "no such file or directory", }, } @@ -83,8 +80,9 @@ func TestParseUpgradeInfoFile(t *testing.T) { t.Run(tc.filename, func(t *testing.T) { require := require.New(t) ui, err := parseUpgradeInfoFile(filepath.Join(".", "testdata", "upgrade-files", tc.filename), tc.disableRecase) - if tc.expectErr { + if tc.expectErr != "" { require.Error(err) + require.Contains(err.Error(), tc.expectErr) } else { require.NoError(err) require.Equal(tc.expectUpgrade, ui) diff --git a/tools/cosmovisor/testdata/upgrade-files/f3-empty.json b/tools/cosmovisor/testdata/upgrade-files/f3-empty.json index 8b137891791f..e69de29bb2d1 100644 --- a/tools/cosmovisor/testdata/upgrade-files/f3-empty.json +++ b/tools/cosmovisor/testdata/upgrade-files/f3-empty.json @@ -1 +0,0 @@ - diff --git a/types/coin.go b/types/coin.go index fbaf006d6a33..87847800f755 100644 --- a/types/coin.go +++ b/types/coin.go @@ -881,7 +881,8 @@ func ParseCoinNormalized(coinStr string) (coin Coin, err error) { return Coin{}, err } - coin, _ = NormalizeDecCoin(decCoin).TruncateDecimal() + coin, _ = NewDecCoinFromDec(decCoin.Denom, decCoin.Amount).TruncateDecimal() + return coin, nil } @@ -900,3 +901,20 @@ func ParseCoinsNormalized(coinStr string) (Coins, error) { } return NormalizeCoins(coins), nil } + +// ---------------------------------------------------------------------------- + +// NormalizeCoins normalize and truncate a list of decimal coins +func NormalizeCoins(coins []DecCoin) Coins { + if coins == nil { + return nil + } + result := make([]Coin, 0, len(coins)) + + for _, coin := range coins { + newCoin, _ := NewDecCoinFromDec(coin.Denom, coin.Amount).TruncateDecimal() + result = append(result, newCoin) + } + + return result +} diff --git a/types/denom.go b/types/denom.go deleted file mode 100644 index 5cd0910ad44f..000000000000 --- a/types/denom.go +++ /dev/null @@ -1,160 +0,0 @@ -package types - -import ( - "fmt" - - "cosmossdk.io/math" -) - -// denomUnits contains a mapping of denomination mapped to their respective unit -// multipliers (e.g. 1atom = 10^-6uatom). -var denomUnits = map[string]math.LegacyDec{} - -// baseDenom is the denom of smallest unit registered -var baseDenom string - -// RegisterDenom registers a denomination with a corresponding unit. If the -// denomination is already registered, an error will be returned. -func RegisterDenom(denom string, unit math.LegacyDec) error { - if err := ValidateDenom(denom); err != nil { - return err - } - - if _, ok := denomUnits[denom]; ok { - return fmt.Errorf("denom %s already registered", denom) - } - - denomUnits[denom] = unit - - if baseDenom == "" || unit.LT(denomUnits[baseDenom]) { - baseDenom = denom - } - return nil -} - -// GetDenomUnit returns a unit for a given denomination if it exists. A boolean -// is returned if the denomination is registered. -func GetDenomUnit(denom string) (math.LegacyDec, bool) { - if err := ValidateDenom(denom); err != nil { - return math.LegacyZeroDec(), false - } - - unit, ok := denomUnits[denom] - if !ok { - return math.LegacyZeroDec(), false - } - - return unit, true -} - -// SetBaseDenom allow overwritting the base denom -// if the denom has registered before, otherwise return error -func SetBaseDenom(denom string) error { - _, ok := denomUnits[denom] - if !ok { - return fmt.Errorf("denom %s not registered", denom) - } - baseDenom = denom - return nil -} - -// GetBaseDenom returns the denom of smallest unit registered -func GetBaseDenom() (string, error) { - if baseDenom == "" { - return "", fmt.Errorf("no denom is registered") - } - return baseDenom, nil -} - -// ConvertCoin attempts to convert a coin to a given denomination. If the given -// denomination is invalid or if neither denomination is registered, an error -// is returned. -func ConvertCoin(coin Coin, denom string) (Coin, error) { - if err := ValidateDenom(denom); err != nil { - return Coin{}, err - } - - srcUnit, ok := GetDenomUnit(coin.Denom) - if !ok { - return Coin{}, fmt.Errorf("source denom not registered: %s", coin.Denom) - } - - dstUnit, ok := GetDenomUnit(denom) - if !ok { - return Coin{}, fmt.Errorf("destination denom not registered: %s", denom) - } - - if srcUnit.Equal(dstUnit) { - return NewCoin(denom, coin.Amount), nil - } - - return NewCoin(denom, math.LegacyNewDecFromInt(coin.Amount).Mul(srcUnit).Quo(dstUnit).TruncateInt()), nil -} - -// ConvertDecCoin attempts to convert a decimal coin to a given denomination. If the given -// denomination is invalid or if neither denomination is registered, an error -// is returned. -func ConvertDecCoin(coin DecCoin, denom string) (DecCoin, error) { - if err := ValidateDenom(denom); err != nil { - return DecCoin{}, err - } - - srcUnit, ok := GetDenomUnit(coin.Denom) - if !ok { - return DecCoin{}, fmt.Errorf("source denom not registered: %s", coin.Denom) - } - - dstUnit, ok := GetDenomUnit(denom) - if !ok { - return DecCoin{}, fmt.Errorf("destination denom not registered: %s", denom) - } - - if srcUnit.Equal(dstUnit) { - return NewDecCoinFromDec(denom, coin.Amount), nil - } - - return NewDecCoinFromDec(denom, coin.Amount.Mul(srcUnit).Quo(dstUnit)), nil -} - -// NormalizeCoin try to convert a coin to the smallest unit registered, -// returns original one if failed. -func NormalizeCoin(coin Coin) Coin { - base, err := GetBaseDenom() - if err != nil { - return coin - } - newCoin, err := ConvertCoin(coin, base) - if err != nil { - return coin - } - return newCoin -} - -// NormalizeDecCoin try to convert a decimal coin to the smallest unit registered, -// returns original one if failed. -func NormalizeDecCoin(coin DecCoin) DecCoin { - base, err := GetBaseDenom() - if err != nil { - return coin - } - newCoin, err := ConvertDecCoin(coin, base) - if err != nil { - return coin - } - return newCoin -} - -// NormalizeCoins normalize and truncate a list of decimal coins -func NormalizeCoins(coins []DecCoin) Coins { - if coins == nil { - return nil - } - result := make([]Coin, 0, len(coins)) - - for _, coin := range coins { - newCoin, _ := NormalizeDecCoin(coin).TruncateDecimal() - result = append(result, newCoin) - } - - return result -} diff --git a/types/denom_internal_test.go b/types/denom_internal_test.go deleted file mode 100644 index a22c3a211540..000000000000 --- a/types/denom_internal_test.go +++ /dev/null @@ -1,211 +0,0 @@ -package types - -import ( - "testing" - - "github.com/stretchr/testify/suite" - - "cosmossdk.io/math" -) - -var ( - atom = "atom" // 1 (base denom unit) - matom = "matom" // 10^-3 (milli) - uatom = "uatom" // 10^-6 (micro) - natom = "natom" // 10^-9 (nano) -) - -type internalDenomTestSuite struct { - suite.Suite -} - -func TestInternalDenomTestSuite(t *testing.T) { - suite.Run(t, new(internalDenomTestSuite)) -} - -func (s *internalDenomTestSuite) TestRegisterDenom() { - atomUnit := math.LegacyOneDec() // 1 (base denom unit) - - s.Require().NoError(RegisterDenom(atom, atomUnit)) - s.Require().Error(RegisterDenom(atom, atomUnit)) - - res, ok := GetDenomUnit(atom) - s.Require().True(ok) - s.Require().Equal(atomUnit, res) - - res, ok = GetDenomUnit(matom) - s.Require().False(ok) - s.Require().Equal(math.LegacyZeroDec(), res) - - err := SetBaseDenom(atom) - s.Require().NoError(err) - - res, ok = GetDenomUnit(atom) - s.Require().True(ok) - s.Require().Equal(atomUnit, res) - - // reset registration - baseDenom = "" - denomUnits = map[string]math.LegacyDec{} -} - -func (s *internalDenomTestSuite) TestConvertCoins() { - atomUnit := math.LegacyOneDec() // 1 (base denom unit) - s.Require().NoError(RegisterDenom(atom, atomUnit)) - - matomUnit := math.LegacyNewDecWithPrec(1, 3) // 10^-3 (milli) - s.Require().NoError(RegisterDenom(matom, matomUnit)) - - uatomUnit := math.LegacyNewDecWithPrec(1, 6) // 10^-6 (micro) - s.Require().NoError(RegisterDenom(uatom, uatomUnit)) - - natomUnit := math.LegacyNewDecWithPrec(1, 9) // 10^-9 (nano) - s.Require().NoError(RegisterDenom(natom, natomUnit)) - - res, err := GetBaseDenom() - s.Require().NoError(err) - s.Require().Equal(res, natom) - s.Require().Equal(NormalizeCoin(NewCoin(uatom, math.NewInt(1))), NewCoin(natom, math.NewInt(1000))) - s.Require().Equal(NormalizeCoin(NewCoin(matom, math.NewInt(1))), NewCoin(natom, math.NewInt(1000000))) - s.Require().Equal(NormalizeCoin(NewCoin(atom, math.NewInt(1))), NewCoin(natom, math.NewInt(1000000000))) - - coins, err := ParseCoinsNormalized("1atom,1matom,1uatom") - s.Require().NoError(err) - s.Require().Equal(coins, Coins{ - Coin{natom, math.NewInt(1000000000)}, - Coin{natom, math.NewInt(1000000)}, - Coin{natom, math.NewInt(1000)}, - }) - - testCases := []struct { - input Coin - denom string - result Coin - expErr bool - }{ - {NewCoin("foo", math.ZeroInt()), atom, Coin{}, true}, - {NewCoin(atom, math.ZeroInt()), "foo", Coin{}, true}, - {NewCoin(atom, math.ZeroInt()), "FOO", Coin{}, true}, - - {NewCoin(atom, math.NewInt(5)), matom, NewCoin(matom, math.NewInt(5000)), false}, // atom => matom - {NewCoin(atom, math.NewInt(5)), uatom, NewCoin(uatom, math.NewInt(5000000)), false}, // atom => uatom - {NewCoin(atom, math.NewInt(5)), natom, NewCoin(natom, math.NewInt(5000000000)), false}, // atom => natom - - {NewCoin(uatom, math.NewInt(5000000)), matom, NewCoin(matom, math.NewInt(5000)), false}, // uatom => matom - {NewCoin(uatom, math.NewInt(5000000)), natom, NewCoin(natom, math.NewInt(5000000000)), false}, // uatom => natom - {NewCoin(uatom, math.NewInt(5000000)), atom, NewCoin(atom, math.NewInt(5)), false}, // uatom => atom - - {NewCoin(matom, math.NewInt(5000)), natom, NewCoin(natom, math.NewInt(5000000000)), false}, // matom => natom - {NewCoin(matom, math.NewInt(5000)), uatom, NewCoin(uatom, math.NewInt(5000000)), false}, // matom => uatom - } - - for i, tc := range testCases { - res, err := ConvertCoin(tc.input, tc.denom) - s.Require().Equal( - tc.expErr, err != nil, - "unexpected error; tc: #%d, input: %s, denom: %s", i+1, tc.input, tc.denom, - ) - s.Require().Equal( - tc.result, res, - "invalid result; tc: #%d, input: %s, denom: %s", i+1, tc.input, tc.denom, - ) - } - - // reset registration - baseDenom = "" - denomUnits = map[string]math.LegacyDec{} -} - -func (s *internalDenomTestSuite) TestConvertDecCoins() { - atomUnit := math.LegacyOneDec() // 1 (base denom unit) - s.Require().NoError(RegisterDenom(atom, atomUnit)) - - matomUnit := math.LegacyNewDecWithPrec(1, 3) // 10^-3 (milli) - s.Require().NoError(RegisterDenom(matom, matomUnit)) - - uatomUnit := math.LegacyNewDecWithPrec(1, 6) // 10^-6 (micro) - s.Require().NoError(RegisterDenom(uatom, uatomUnit)) - - natomUnit := math.LegacyNewDecWithPrec(1, 9) // 10^-9 (nano) - s.Require().NoError(RegisterDenom(natom, natomUnit)) - - res, err := GetBaseDenom() - s.Require().NoError(err) - s.Require().Equal(res, natom) - s.Require().Equal(NormalizeDecCoin(NewDecCoin(uatom, math.NewInt(1))), NewDecCoin(natom, math.NewInt(1000))) - s.Require().Equal(NormalizeDecCoin(NewDecCoin(matom, math.NewInt(1))), NewDecCoin(natom, math.NewInt(1000000))) - s.Require().Equal(NormalizeDecCoin(NewDecCoin(atom, math.NewInt(1))), NewDecCoin(natom, math.NewInt(1000000000))) - - coins, err := ParseCoinsNormalized("0.1atom,0.1matom,0.1uatom") - s.Require().NoError(err) - s.Require().Equal(coins, Coins{ - Coin{natom, math.NewInt(100000000)}, - Coin{natom, math.NewInt(100000)}, - Coin{natom, math.NewInt(100)}, - }) - - testCases := []struct { - input DecCoin - denom string - result DecCoin - expErr bool - }{ - {NewDecCoin("foo", math.ZeroInt()), atom, DecCoin{}, true}, - {NewDecCoin(atom, math.ZeroInt()), "foo", DecCoin{}, true}, - {NewDecCoin(atom, math.ZeroInt()), "FOO", DecCoin{}, true}, - - // 0.5atom - {NewDecCoinFromDec(atom, math.LegacyNewDecWithPrec(5, 1)), matom, NewDecCoin(matom, math.NewInt(500)), false}, // atom => matom - {NewDecCoinFromDec(atom, math.LegacyNewDecWithPrec(5, 1)), uatom, NewDecCoin(uatom, math.NewInt(500000)), false}, // atom => uatom - {NewDecCoinFromDec(atom, math.LegacyNewDecWithPrec(5, 1)), natom, NewDecCoin(natom, math.NewInt(500000000)), false}, // atom => natom - - {NewDecCoin(uatom, math.NewInt(5000000)), matom, NewDecCoin(matom, math.NewInt(5000)), false}, // uatom => matom - {NewDecCoin(uatom, math.NewInt(5000000)), natom, NewDecCoin(natom, math.NewInt(5000000000)), false}, // uatom => natom - {NewDecCoin(uatom, math.NewInt(5000000)), atom, NewDecCoin(atom, math.NewInt(5)), false}, // uatom => atom - - {NewDecCoin(matom, math.NewInt(5000)), natom, NewDecCoin(natom, math.NewInt(5000000000)), false}, // matom => natom - {NewDecCoin(matom, math.NewInt(5000)), uatom, NewDecCoin(uatom, math.NewInt(5000000)), false}, // matom => uatom - } - - for i, tc := range testCases { - res, err := ConvertDecCoin(tc.input, tc.denom) - s.Require().Equal( - tc.expErr, err != nil, - "unexpected error; tc: #%d, input: %s, denom: %s", i+1, tc.input, tc.denom, - ) - s.Require().Equal( - tc.result, res, - "invalid result; tc: #%d, input: %s, denom: %s", i+1, tc.input, tc.denom, - ) - } - - // reset registration - baseDenom = "" - denomUnits = map[string]math.LegacyDec{} -} - -func (s *internalDenomTestSuite) TestDecOperationOrder() { - dec, err := math.LegacyNewDecFromStr("11") - s.Require().NoError(err) - s.Require().NoError(RegisterDenom("unit1", dec)) - dec, err = math.LegacyNewDecFromStr("100000011") - s.Require().NoError(err) - s.Require().NoError(RegisterDenom("unit2", dec)) - - coin, err := ConvertCoin(NewCoin("unit1", math.NewInt(100000011)), "unit2") - s.Require().NoError(err) - s.Require().Equal(coin, NewCoin("unit2", math.NewInt(11))) - - // reset registration - baseDenom = "" - denomUnits = map[string]math.LegacyDec{} -} - -func (s *internalDenomTestSuite) TestSetBaseDenomError() { - err := SetBaseDenom(atom) - s.Require().Error(err) - - // reset registration - baseDenom = "" - denomUnits = map[string]math.LegacyDec{} -} diff --git a/types/mempool/mempool_test.go b/types/mempool/mempool_test.go index 4901a3397473..4f0906bd2014 100644 --- a/types/mempool/mempool_test.go +++ b/types/mempool/mempool_test.go @@ -10,7 +10,6 @@ import ( protov2 "google.golang.org/protobuf/proto" "cosmossdk.io/log" - "cosmossdk.io/x/distribution" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -19,6 +18,7 @@ import ( 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" + "github.com/cosmos/cosmos-sdk/x/counter" ) // testPubKey is a dummy implementation of PubKey used for testing. @@ -226,16 +226,16 @@ func (s *MempoolTestSuite) TestSampleTxs() { t := s.T() s.resetMempool() mp := s.mempool - delegatorTx, err := unmarshalTx(msgWithdrawDelegatorReward) + countTx, err := unmarshalTx(msgCounter) require.NoError(t, err) - require.NoError(t, mp.Insert(ctxt, delegatorTx)) + require.NoError(t, mp.Insert(ctxt, countTx)) require.Equal(t, 1, mp.CountTx()) } func unmarshalTx(txBytes []byte) (sdk.Tx, error) { - cfg := moduletestutil.MakeTestEncodingConfig(distribution.AppModuleBasic{}) + cfg := moduletestutil.MakeTestEncodingConfig(counter.AppModuleBasic{}) return cfg.TxConfig.TxJSONDecoder()(txBytes) } -var msgWithdrawDelegatorReward = []byte("{\"body\":{\"messages\":[{\"@type\":\"\\/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\",\"delegator_address\":\"cosmos16w6g0whmw703t8h2m9qmq2fd9dwaw6fjszzjsw\",\"validator_address\":\"cosmosvaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxerarrl\"},{\"@type\":\"\\/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\",\"delegator_address\":\"cosmos16w6g0whmw703t8h2m9qmq2fd9dwaw6fjszzjsw\",\"validator_address\":\"cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0\"},{\"@type\":\"\\/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\",\"delegator_address\":\"cosmos16w6g0whmw703t8h2m9qmq2fd9dwaw6fjszzjsw\",\"validator_address\":\"cosmosvaloper196ax4vc0lwpxndu9dyhvca7jhxp70rmcvrj90c\"},{\"@type\":\"\\/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\",\"delegator_address\":\"cosmos16w6g0whmw703t8h2m9qmq2fd9dwaw6fjszzjsw\",\"validator_address\":\"cosmosvaloper1k2d9ed9vgfuk2m58a2d80q9u6qljkh4vfaqjfq\"},{\"@type\":\"\\/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\",\"delegator_address\":\"cosmos16w6g0whmw703t8h2m9qmq2fd9dwaw6fjszzjsw\",\"validator_address\":\"cosmosvaloper1vygmh344ldv9qefss9ek7ggsnxparljlmj56q5\"},{\"@type\":\"\\/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\",\"delegator_address\":\"cosmos16w6g0whmw703t8h2m9qmq2fd9dwaw6fjszzjsw\",\"validator_address\":\"cosmosvaloper1ej2es5fjztqjcd4pwa0zyvaevtjd2y5wxxp9gd\"}],\"memo\":\"\",\"timeout_height\":\"0\",\"extension_options\":[],\"non_critical_extension_options\":[]},\"auth_info\":{\"signer_infos\":[{\"public_key\":{\"@type\":\"\\/cosmos.crypto.secp256k1.PubKey\",\"key\":\"AmbXAy10a0SerEefTYQzqyGQdX5kiTEWJZ1PZKX1oswX\"},\"mode_info\":{\"single\":{\"mode\":\"SIGN_MODE_LEGACY_AMINO_JSON\"}},\"sequence\":\"119\"}],\"fee\":{\"amount\":[{\"denom\":\"uatom\",\"amount\":\"15968\"}],\"gas_limit\":\"638717\",\"payer\":\"\",\"granter\":\"\"}},\"signatures\":[\"ji+inUo4xGlN9piRQLdLCeJWa7irwnqzrMVPcmzJyG5y6NPc+ZuNaIc3uvk5NLDJytRB8AHX0GqNETR\\/Q8fz4Q==\"]}") +var msgCounter = []byte("{\"body\":{\"messages\":[{\"@type\":\"\\/cosmos.counter.v1.MsgIncreaseCounter\",\"signer\":\"cosmos16w6g0whmw703t8h2m9qmq2fd9dwaw6fjszzjsw\",\"count\":\"1\"}],\"memo\":\"\",\"timeout_height\":\"0\",\"extension_options\":[],\"non_critical_extension_options\":[]},\"auth_info\":{\"signer_infos\":[{\"public_key\":{\"@type\":\"\\/cosmos.crypto.secp256k1.PubKey\",\"key\":\"AmbXAy10a0SerEefTYQzqyGQdX5kiTEWJZ1PZKX1oswX\"},\"mode_info\":{\"single\":{\"mode\":\"SIGN_MODE_LEGACY_AMINO_JSON\"}},\"sequence\":\"119\"}],\"fee\":{\"amount\":[{\"denom\":\"uatom\",\"amount\":\"15968\"}],\"gas_limit\":\"638717\",\"payer\":\"\",\"granter\":\"\"}},\"signatures\":[\"ji+inUo4xGlN9piRQLdLCeJWa7irwnqzrMVPcmzJyG5y6NPc+ZuNaIc3uvk5NLDJytRB8AHX0GqNETR\\/Q8fz4Q==\"]}") diff --git a/version/command.go b/version/command.go index 451173400c22..163e6e5c7d25 100644 --- a/version/command.go +++ b/version/command.go @@ -15,6 +15,11 @@ const ( ) // NewVersionCommand returns a CLI command to interactively print the application binary version information. +// Note: When seeking to add the extra info to the context +// The below can be added to the initRootCmd to include the extraInfo field +// +// cmdContext := context.WithValue(context.Background(), version.ContextKey{}, extraInfo) +// rootCmd.SetContext(cmdContext) func NewVersionCommand() *cobra.Command { cmd := &cobra.Command{ Use: "version", @@ -28,6 +33,10 @@ func NewVersionCommand() *cobra.Command { return nil } + // Extract and set extra information from the context + extraInfo := extraInfoFromContext(cmd) + verInfo.ExtraInfo = &extraInfo + var ( bz []byte err error @@ -56,3 +65,14 @@ func NewVersionCommand() *cobra.Command { return cmd } + +func extraInfoFromContext(cmd *cobra.Command) ExtraInfo { + ctx := cmd.Context() + if ctx != nil { + extraInfo, ok := ctx.Value(ContextKey{}).(ExtraInfo) + if ok { + return extraInfo + } + } + return nil +} diff --git a/version/version.go b/version/version.go index 502185ad9a0c..b407f2b36e56 100644 --- a/version/version.go +++ b/version/version.go @@ -23,6 +23,9 @@ import ( "runtime/debug" ) +// ContextKey is used to store the ExtraInfo in the context. +type ContextKey struct{} + var ( // application's name Name = "" @@ -55,6 +58,9 @@ func getSDKVersion() string { return sdkVersion } +// ExtraInfo contains a set of extra information provided by apps +type ExtraInfo map[string]string + // Info defines the application version information. type Info struct { Name string `json:"name" yaml:"name"` @@ -65,6 +71,7 @@ type Info struct { GoVersion string `json:"go" yaml:"go"` BuildDeps []buildDep `json:"build_deps" yaml:"build_deps"` CosmosSdkVersion string `json:"cosmos_sdk_version" yaml:"cosmos_sdk_version"` + ExtraInfo *ExtraInfo `json:"extra_info" yaml:"extra_info"` } func NewInfo() Info { diff --git a/version/version_test.go b/version/version_test.go index caf0a5fb6b60..75e52d8076cd 100644 --- a/version/version_test.go +++ b/version/version_test.go @@ -1,13 +1,13 @@ package version_test import ( + context "context" "encoding/json" "fmt" "runtime" "strings" "testing" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/client/flags" @@ -149,7 +149,7 @@ func Test_runVersionCmd(t *testing.T) { }) require.NoError(t, cmd.Execute()) - assert.Equal(t, "\n", mockOut.String()) + require.Equal(t, "\n", mockOut.String()) mockOut.Reset() cmd.SetArgs([]string{ @@ -158,7 +158,21 @@ func Test_runVersionCmd(t *testing.T) { info := version.NewInfo() stringInfo, err := json.Marshal(info) + + extraInfo := &version.ExtraInfo{"key1": "value1"} + ctx := context.WithValue(context.Background(), version.ContextKey{}, extraInfo) + require.NoError(t, err) require.NoError(t, cmd.Execute()) - assert.Equal(t, string(stringInfo)+"\n", mockOut.String()) + + extraInfoFromContext := ctx.Value(version.ContextKey{}) + require.NotNil(t, extraInfoFromContext) + + castedExtraInfo, ok := extraInfoFromContext.(*version.ExtraInfo) + require.True(t, ok) + + key1Value := (*castedExtraInfo)["key1"] + require.Equal(t, "value1", key1Value) + + require.Equal(t, string(stringInfo)+"\n", mockOut.String()) } diff --git a/x/authz/go.mod b/x/authz/go.mod index ecdebea7f732..646d139c47fe 100644 --- a/x/authz/go.mod +++ b/x/authz/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/authz go 1.21 require ( - cosmossdk.io/api v0.7.2 + cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 diff --git a/x/authz/go.sum b/x/authz/go.sum index e564d4efe08b..ea9506fe960e 100644 --- a/x/authz/go.sum +++ b/x/authz/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= -cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/bank/go.mod b/x/bank/go.mod index b7add03d1d41..b4f76f6bede5 100644 --- a/x/bank/go.mod +++ b/x/bank/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/bank go 1.21 require ( - cosmossdk.io/api v0.7.2 + cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/bank/go.sum b/x/bank/go.sum index 26066029c2da..5fbe99f7b47a 100644 --- a/x/bank/go.sum +++ b/x/bank/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= -cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/circuit/go.mod b/x/circuit/go.mod index 4306c48c63fa..0224f9580831 100644 --- a/x/circuit/go.mod +++ b/x/circuit/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/circuit go 1.21 require ( - cosmossdk.io/api v0.7.2 + cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/circuit/go.sum b/x/circuit/go.sum index 56febcb73172..66328b566cef 100644 --- a/x/circuit/go.sum +++ b/x/circuit/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= -cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/circuit/keeper/genesis_test.go b/x/circuit/keeper/genesis_test.go index e85f3f286859..595330b06b2b 100644 --- a/x/circuit/keeper/genesis_test.go +++ b/x/circuit/keeper/genesis_test.go @@ -34,7 +34,7 @@ func TestGenesisTestSuite(t *testing.T) { } func (s *GenesisTestSuite) SetupTest() { - key := storetypes.NewKVStoreKey(types.StoreKey) + key := storetypes.NewKVStoreKey(types.ModuleName) testCtx := testutil.DefaultContextWithDB(s.T(), key, storetypes.NewTransientStoreKey("transient_test")) encCfg := moduletestutil.MakeTestEncodingConfig(circuit.AppModuleBasic{}) diff --git a/x/circuit/types/keys.go b/x/circuit/types/keys.go index db4e1dc6203e..5a63f2b5b08b 100644 --- a/x/circuit/types/keys.go +++ b/x/circuit/types/keys.go @@ -8,9 +8,6 @@ const ( // StoreKey defines the primary module store key StoreKey = ModuleName - - // RouterKey defines the module's message routing key - RouterKey = ModuleName ) // KVStore keys diff --git a/x/counter/README.md b/x/counter/README.md new file mode 100644 index 000000000000..82c1941336dc --- /dev/null +++ b/x/counter/README.md @@ -0,0 +1,7 @@ +--- +sidebar_position: 1 +--- + +# `x/counter` + +Counter is a module used for testing purposes within the Cosmos SDK. diff --git a/x/counter/keeper/keeper.go b/x/counter/keeper/keeper.go new file mode 100644 index 000000000000..8fc152fa3e52 --- /dev/null +++ b/x/counter/keeper/keeper.go @@ -0,0 +1,81 @@ +package keeper + +import ( + "context" + "errors" + "fmt" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "cosmossdk.io/collections" + "cosmossdk.io/core/event" + storetypes "cosmossdk.io/core/store" + + "github.com/cosmos/cosmos-sdk/x/counter/types" +) + +var StoreKey = "Counter" + +type Keeper struct { + event event.Service + + CountStore collections.Item[int64] +} + +func NewKeeper(storeService storetypes.KVStoreService, em event.Service) Keeper { + sb := collections.NewSchemaBuilder(storeService) + return Keeper{ + event: em, + CountStore: collections.NewItem(sb, collections.NewPrefix(0), "count", collections.Int64Value), + } +} + +// Querier + +var _ types.QueryServer = Keeper{} + +// Params queries params of consensus module +func (k Keeper) GetCount(ctx context.Context, _ *types.QueryGetCountRequest) (*types.QueryGetCountResponse, error) { + count, err := k.CountStore.Get(ctx) + if err != nil { + if errors.Is(err, collections.ErrNotFound) { + return &types.QueryGetCountResponse{TotalCount: 0}, nil + } else { + return nil, status.Error(codes.Internal, err.Error()) + } + } + + return &types.QueryGetCountResponse{TotalCount: count}, nil +} + +// MsgServer + +var _ types.MsgServer = Keeper{} + +func (k Keeper) IncreaseCount(ctx context.Context, msg *types.MsgIncreaseCounter) (*types.MsgIncreaseCountResponse, error) { + var num int64 + num, err := k.CountStore.Get(ctx) + if err != nil { + if errors.Is(err, collections.ErrNotFound) { + num = 0 + } else { + return nil, err + } + } + if err := k.CountStore.Set(ctx, num+msg.Count); err != nil { + return nil, err + } + + if err := k.event.EventManager(ctx).EmitKV( + ctx, + "increase_counter", + event.Attribute{Key: "signer", Value: msg.Signer}, + event.Attribute{Key: "new count", Value: fmt.Sprint(num + msg.Count)}); err != nil { + return nil, err + } + + return &types.MsgIncreaseCountResponse{ + NewCount: num + msg.Count, + }, nil +} diff --git a/x/counter/module.go b/x/counter/module.go new file mode 100644 index 000000000000..6c14ff2e5aeb --- /dev/null +++ b/x/counter/module.go @@ -0,0 +1,106 @@ +package counter + +import ( + gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" + "google.golang.org/grpc" + + modulev1 "cosmossdk.io/api/cosmos/counter/module/v1" + "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/event" + storetypes "cosmossdk.io/core/store" + "cosmossdk.io/depinject" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/x/counter/keeper" + "github.com/cosmos/cosmos-sdk/x/counter/types" +) + +var ( + _ module.AppModuleBasic = AppModule{} + + _ appmodule.AppModule = AppModule{} + _ appmodule.HasServices = AppModule{} +) + +// AppModuleBasic defines the basic application module used by the consensus module. +type AppModuleBasic struct{} + +// Name returns the consensus module's name. +func (AppModuleBasic) Name() string { return types.ModuleName } + +// RegisterLegacyAminoCodec registers the consensus module's types on the LegacyAmino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *gwruntime.ServeMux) {} + +// RegisterInterfaces registers interfaces and implementations of the bank module. +func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { + types.RegisterInterfaces(registry) +} + +// AppModule implements an application module +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper +} + +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (am AppModule) IsOnePerModuleType() {} + +// IsAppModule implements the appmodule.AppModule interface. +func (am AppModule) IsAppModule() {} + +// RegisterServices registers module services. +func (am AppModule) RegisterServices(registrar grpc.ServiceRegistrar) error { + types.RegisterMsgServer(registrar, am.keeper) + types.RegisterQueryServer(registrar, am.keeper) + return nil +} + +// NewAppModule creates a new AppModule object +func NewAppModule(keeper keeper.Keeper) AppModule { + return AppModule{ + AppModuleBasic: AppModuleBasic{}, + keeper: keeper, + } +} + +// ConsensusVersion implements AppModule/ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +func init() { + appmodule.Register( + &modulev1.Module{}, + appmodule.Provide(ProvideModule), + ) +} + +type ModuleInputs struct { + depinject.In + + Config *modulev1.Module + StoreService storetypes.KVStoreService + EventManager event.Service +} + +type ModuleOutputs struct { + depinject.Out + + Keeper keeper.Keeper + Module appmodule.AppModule +} + +func ProvideModule(in ModuleInputs) ModuleOutputs { + k := keeper.NewKeeper(in.StoreService, in.EventManager) + m := NewAppModule(k) + + return ModuleOutputs{ + Keeper: k, + Module: m, + } +} diff --git a/x/counter/testutil/expected_keepers_mocks.go b/x/counter/testutil/expected_keepers_mocks.go new file mode 100644 index 000000000000..35929b606df5 --- /dev/null +++ b/x/counter/testutil/expected_keepers_mocks.go @@ -0,0 +1,228 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: x/bank/types/expected_keepers.go + +// Package testutil is a generated GoMock package. +package testutil + +import ( + reflect "reflect" + + types "github.com/cosmos/cosmos-sdk/types" + types0 "github.com/cosmos/cosmos-sdk/x/auth/types" + gomock "github.com/golang/mock/gomock" +) + +// MockAccountKeeper is a mock of AccountKeeper interface. +type MockAccountKeeper struct { + ctrl *gomock.Controller + recorder *MockAccountKeeperMockRecorder +} + +// MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. +type MockAccountKeeperMockRecorder struct { + mock *MockAccountKeeper +} + +// NewMockAccountKeeper creates a new mock instance. +func NewMockAccountKeeper(ctrl *gomock.Controller) *MockAccountKeeper { + mock := &MockAccountKeeper{ctrl: ctrl} + mock.recorder = &MockAccountKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockAccountKeeper) EXPECT() *MockAccountKeeperMockRecorder { + return m.recorder +} + +// GetAccount mocks base method. +func (m *MockAccountKeeper) GetAccount(ctx types.Context, addr types.AccAddress) types.AccountI { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAccount", ctx, addr) + ret0, _ := ret[0].(types.AccountI) + return ret0 +} + +// GetAccount indicates an expected call of GetAccount. +func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), ctx, addr) +} + +// GetAllAccounts mocks base method. +func (m *MockAccountKeeper) GetAllAccounts(ctx types.Context) []types.AccountI { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAllAccounts", ctx) + ret0, _ := ret[0].([]types.AccountI) + return ret0 +} + +// GetAllAccounts indicates an expected call of GetAllAccounts. +func (mr *MockAccountKeeperMockRecorder) GetAllAccounts(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllAccounts", reflect.TypeOf((*MockAccountKeeper)(nil).GetAllAccounts), ctx) +} + +// GetModuleAccount mocks base method. +func (m *MockAccountKeeper) GetModuleAccount(ctx types.Context, moduleName string) types0.ModuleAccountI { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetModuleAccount", ctx, moduleName) + ret0, _ := ret[0].(types0.ModuleAccountI) + return ret0 +} + +// GetModuleAccount indicates an expected call of GetModuleAccount. +func (mr *MockAccountKeeperMockRecorder) GetModuleAccount(ctx, moduleName interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAccount), ctx, moduleName) +} + +// GetModuleAccountAndPermissions mocks base method. +func (m *MockAccountKeeper) GetModuleAccountAndPermissions(ctx types.Context, moduleName string) (types0.ModuleAccountI, []string) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetModuleAccountAndPermissions", ctx, moduleName) + ret0, _ := ret[0].(types0.ModuleAccountI) + ret1, _ := ret[1].([]string) + return ret0, ret1 +} + +// GetModuleAccountAndPermissions indicates an expected call of GetModuleAccountAndPermissions. +func (mr *MockAccountKeeperMockRecorder) GetModuleAccountAndPermissions(ctx, moduleName interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAccountAndPermissions", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAccountAndPermissions), ctx, moduleName) +} + +// GetModuleAddress mocks base method. +func (m *MockAccountKeeper) GetModuleAddress(moduleName string) types.AccAddress { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetModuleAddress", moduleName) + ret0, _ := ret[0].(types.AccAddress) + return ret0 +} + +// GetModuleAddress indicates an expected call of GetModuleAddress. +func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(moduleName interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAddress", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAddress), moduleName) +} + +// GetModuleAddressAndPermissions mocks base method. +func (m *MockAccountKeeper) GetModuleAddressAndPermissions(moduleName string) (types.AccAddress, []string) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetModuleAddressAndPermissions", moduleName) + ret0, _ := ret[0].(types.AccAddress) + ret1, _ := ret[1].([]string) + return ret0, ret1 +} + +// GetModuleAddressAndPermissions indicates an expected call of GetModuleAddressAndPermissions. +func (mr *MockAccountKeeperMockRecorder) GetModuleAddressAndPermissions(moduleName interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAddressAndPermissions", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAddressAndPermissions), moduleName) +} + +// GetModulePermissions mocks base method. +func (m *MockAccountKeeper) GetModulePermissions() map[string]types0.PermissionsForAddress { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetModulePermissions") + ret0, _ := ret[0].(map[string]types0.PermissionsForAddress) + return ret0 +} + +// GetModulePermissions indicates an expected call of GetModulePermissions. +func (mr *MockAccountKeeperMockRecorder) GetModulePermissions() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModulePermissions", reflect.TypeOf((*MockAccountKeeper)(nil).GetModulePermissions)) +} + +// HasAccount mocks base method. +func (m *MockAccountKeeper) HasAccount(ctx types.Context, addr types.AccAddress) bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "HasAccount", ctx, addr) + ret0, _ := ret[0].(bool) + return ret0 +} + +// HasAccount indicates an expected call of HasAccount. +func (mr *MockAccountKeeperMockRecorder) HasAccount(ctx, addr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasAccount", reflect.TypeOf((*MockAccountKeeper)(nil).HasAccount), ctx, addr) +} + +// IterateAccounts mocks base method. +func (m *MockAccountKeeper) IterateAccounts(ctx types.Context, process func(types.AccountI) bool) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "IterateAccounts", ctx, process) +} + +// IterateAccounts indicates an expected call of IterateAccounts. +func (mr *MockAccountKeeperMockRecorder) IterateAccounts(ctx, process interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IterateAccounts", reflect.TypeOf((*MockAccountKeeper)(nil).IterateAccounts), ctx, process) +} + +// NewAccount mocks base method. +func (m *MockAccountKeeper) NewAccount(arg0 types.Context, arg1 types.AccountI) types.AccountI { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NewAccount", arg0, arg1) + ret0, _ := ret[0].(types.AccountI) + return ret0 +} + +// NewAccount indicates an expected call of NewAccount. +func (mr *MockAccountKeeperMockRecorder) NewAccount(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewAccount", reflect.TypeOf((*MockAccountKeeper)(nil).NewAccount), arg0, arg1) +} + +// NewAccountWithAddress mocks base method. +func (m *MockAccountKeeper) NewAccountWithAddress(ctx types.Context, addr types.AccAddress) types.AccountI { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NewAccountWithAddress", ctx, addr) + ret0, _ := ret[0].(types.AccountI) + return ret0 +} + +// NewAccountWithAddress indicates an expected call of NewAccountWithAddress. +func (mr *MockAccountKeeperMockRecorder) NewAccountWithAddress(ctx, addr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewAccountWithAddress", reflect.TypeOf((*MockAccountKeeper)(nil).NewAccountWithAddress), ctx, addr) +} + +// SetAccount mocks base method. +func (m *MockAccountKeeper) SetAccount(ctx types.Context, acc types.AccountI) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetAccount", ctx, acc) +} + +// SetAccount indicates an expected call of SetAccount. +func (mr *MockAccountKeeperMockRecorder) SetAccount(ctx, acc interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetAccount), ctx, acc) +} + +// SetModuleAccount mocks base method. +func (m *MockAccountKeeper) SetModuleAccount(ctx types.Context, macc types0.ModuleAccountI) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetModuleAccount", ctx, macc) +} + +// SetModuleAccount indicates an expected call of SetModuleAccount. +func (mr *MockAccountKeeperMockRecorder) SetModuleAccount(ctx, macc interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetModuleAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetModuleAccount), ctx, macc) +} + +// ValidatePermissions mocks base method. +func (m *MockAccountKeeper) ValidatePermissions(macc types0.ModuleAccountI) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidatePermissions", macc) + ret0, _ := ret[0].(error) + return ret0 +} + +// ValidatePermissions indicates an expected call of ValidatePermissions. +func (mr *MockAccountKeeperMockRecorder) ValidatePermissions(macc interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatePermissions", reflect.TypeOf((*MockAccountKeeper)(nil).ValidatePermissions), macc) +} diff --git a/x/counter/types/codec.go b/x/counter/types/codec.go new file mode 100644 index 000000000000..36f13df3b9da --- /dev/null +++ b/x/counter/types/codec.go @@ -0,0 +1,16 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgIncreaseCounter{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} diff --git a/x/counter/types/keys.go b/x/counter/types/keys.go new file mode 100644 index 000000000000..a1a1cbc2fbf9 --- /dev/null +++ b/x/counter/types/keys.go @@ -0,0 +1,9 @@ +package types + +const ( + // ModuleName defines the name of the x/consensus module. + ModuleName = "counter" + + // StoreKey defines the module's store key. + StoreKey = ModuleName +) diff --git a/x/counter/types/tx.pb.go b/x/counter/types/tx.pb.go index 4b50ec60d238..d3b3f9cbf882 100644 --- a/x/counter/types/tx.pb.go +++ b/x/counter/types/tx.pb.go @@ -8,6 +8,7 @@ import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" @@ -138,26 +139,28 @@ func init() { func init() { proto.RegisterFile("cosmos/counter/v1/tx.proto", fileDescriptor_16b86a09a73a7eb5) } var fileDescriptor_16b86a09a73a7eb5 = []byte{ - // 302 bytes of a gzipped FileDescriptorProto + // 328 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0x4f, 0xce, 0x2f, 0xcd, 0x2b, 0x49, 0x2d, 0xd2, 0x2f, 0x33, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x84, 0xc8, 0xe9, 0x41, 0xe5, 0xf4, 0xca, 0x0c, 0xa5, 0x24, 0x21, 0x42, 0xf1, 0x60, 0x05, 0xfa, 0x50, 0x79, 0x30, 0x47, 0x4a, 0x1c, 0x6a, 0x52, - 0x6e, 0x71, 0x3a, 0xc8, 0x94, 0xdc, 0xe2, 0x74, 0x88, 0x84, 0x52, 0x26, 0x97, 0x90, 0x6f, 0x71, - 0xba, 0x67, 0x5e, 0x72, 0x51, 0x6a, 0x62, 0x71, 0xaa, 0x33, 0xc4, 0x30, 0x21, 0x03, 0x2e, 0xb6, - 0xe2, 0xcc, 0xf4, 0xbc, 0xd4, 0x22, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x4e, 0x27, 0x89, 0x4b, 0x5b, - 0x74, 0x45, 0xa0, 0x06, 0x3a, 0xa6, 0xa4, 0x14, 0xa5, 0x16, 0x17, 0x07, 0x97, 0x14, 0x65, 0xe6, - 0xa5, 0x07, 0x41, 0xd5, 0x09, 0x89, 0x70, 0xb1, 0x82, 0x5d, 0x22, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, - 0x1c, 0x04, 0xe1, 0x58, 0x71, 0x37, 0x3d, 0xdf, 0xa0, 0x05, 0x55, 0xa2, 0x64, 0xce, 0x25, 0x81, - 0x6e, 0x55, 0x50, 0x6a, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0x90, 0x34, 0x17, 0x67, 0x5e, 0x6a, - 0x79, 0x3c, 0xc4, 0x08, 0x46, 0xb0, 0x11, 0x1c, 0x79, 0xa9, 0xe5, 0x60, 0x45, 0x46, 0x85, 0x5c, - 0xcc, 0xbe, 0xc5, 0xe9, 0x42, 0xc9, 0x5c, 0xbc, 0x28, 0x9a, 0x85, 0x54, 0xf5, 0x30, 0xc2, 0x40, - 0x0f, 0xd3, 0x33, 0x52, 0xda, 0x44, 0x28, 0x83, 0x39, 0x44, 0x8a, 0xb5, 0xe1, 0xf9, 0x06, 0x2d, - 0x46, 0x27, 0xb7, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, - 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xd2, 0x49, 0xcf, - 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x87, 0x47, 0x0f, 0x88, 0xd2, 0x2d, 0x4e, - 0xc9, 0xd6, 0xaf, 0x80, 0xc7, 0x55, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0x94, 0x8d, - 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8d, 0x8f, 0x77, 0x03, 0xca, 0x01, 0x00, 0x00, + 0x6e, 0x71, 0x3a, 0xc8, 0x94, 0xdc, 0xe2, 0x74, 0xa8, 0x84, 0x60, 0x62, 0x6e, 0x66, 0x5e, 0xbe, + 0x3e, 0x98, 0x84, 0x08, 0x29, 0x75, 0x32, 0x72, 0x09, 0xf9, 0x16, 0xa7, 0x7b, 0xe6, 0x25, 0x17, + 0xa5, 0x26, 0x16, 0xa7, 0x3a, 0x43, 0x2c, 0x10, 0x32, 0xe0, 0x62, 0x2b, 0xce, 0x4c, 0xcf, 0x4b, + 0x2d, 0x92, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x74, 0x92, 0xb8, 0xb4, 0x45, 0x57, 0x04, 0x6a, 0x89, + 0x63, 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0x71, 0x70, 0x49, 0x51, 0x66, 0x5e, 0x7a, 0x10, 0x54, 0x9d, + 0x90, 0x08, 0x17, 0x2b, 0xd8, 0x75, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xcc, 0x41, 0x10, 0x8e, 0x95, + 0x76, 0xd3, 0xf3, 0x0d, 0x5a, 0x50, 0x25, 0x5d, 0xcf, 0x37, 0x68, 0x49, 0x43, 0xcc, 0xd0, 0x2d, + 0x4e, 0xc9, 0xd6, 0xcf, 0x84, 0xda, 0x19, 0x0f, 0xf5, 0x95, 0x92, 0x39, 0x97, 0x04, 0xba, 0x53, + 0x82, 0x52, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x85, 0xa4, 0xb9, 0x38, 0xf3, 0x52, 0xcb, 0x21, + 0x4a, 0xc1, 0x6e, 0x62, 0x0e, 0xe2, 0xc8, 0x4b, 0x2d, 0x07, 0x2b, 0x32, 0x2a, 0xe4, 0x62, 0xf6, + 0x2d, 0x4e, 0x17, 0x4a, 0xe6, 0xe2, 0x45, 0xd1, 0x2c, 0xa4, 0xaa, 0x87, 0x11, 0x6e, 0x7a, 0x98, + 0x9e, 0x95, 0xd2, 0x26, 0x42, 0x19, 0xcc, 0x21, 0x52, 0xac, 0x0d, 0xcf, 0x37, 0x68, 0x31, 0x3a, + 0xb9, 0x9d, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, + 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x4e, 0x7a, 0x66, 0x49, + 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0x3c, 0x4a, 0xe1, 0x9e, 0xae, 0x80, 0xc7, 0x6f, + 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0x1a, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, + 0x6a, 0x52, 0x30, 0x21, 0xfe, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/distribution/go.mod b/x/distribution/go.mod index efcfa1718c2d..8c62f6868d86 100644 --- a/x/distribution/go.mod +++ b/x/distribution/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/distribution go 1.21 require ( - cosmossdk.io/api v0.7.2 + cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/distribution/go.sum b/x/distribution/go.sum index a3605a03a8db..15ea85ec51ee 100644 --- a/x/distribution/go.sum +++ b/x/distribution/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= -cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/distribution/keeper/delegation.go b/x/distribution/keeper/delegation.go index a80064a03a46..a107f35d7c93 100644 --- a/x/distribution/keeper/delegation.go +++ b/x/distribution/keeper/delegation.go @@ -301,9 +301,9 @@ func (k Keeper) withdrawDelegationRewards(ctx context.Context, val stakingtypes. } if finalRewards.IsZero() { - baseDenom, _ := sdk.GetBaseDenom() - if baseDenom == "" { - baseDenom = sdk.DefaultBondDenom + baseDenom, err := k.stakingKeeper.BondDenom(ctx) + if err != nil { + return nil, err } // Note, we do not call the NewCoins constructor as we do not want the zero diff --git a/x/distribution/keeper/delegation_test.go b/x/distribution/keeper/delegation_test.go index 8a17df9eaa94..828bc16aff11 100644 --- a/x/distribution/keeper/delegation_test.go +++ b/x/distribution/keeper/delegation_test.go @@ -1006,6 +1006,7 @@ func Test100PercentCommissionReward(t *testing.T) { accountKeeper.EXPECT().GetModuleAddress("distribution").Return(distrAcc.GetAddress()) stakingKeeper.EXPECT().ValidatorAddressCodec().Return(address.NewBech32Codec(sdk.Bech32PrefixValAddr)).AnyTimes() + stakingKeeper.EXPECT().BondDenom(gomock.Any()).Return("stake", nil).AnyTimes() accountKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec(sdk.Bech32MainPrefix)).AnyTimes() distrKeeper := keeper.NewKeeper( diff --git a/x/distribution/testutil/expected_keepers_mocks.go b/x/distribution/testutil/expected_keepers_mocks.go index 111bc8056aff..f57b9aca571b 100644 --- a/x/distribution/testutil/expected_keepers_mocks.go +++ b/x/distribution/testutil/expected_keepers_mocks.go @@ -315,6 +315,21 @@ func (m *MockStakingKeeper) EXPECT() *MockStakingKeeperMockRecorder { return m.recorder } +// BondDenom mocks base method. +func (m *MockStakingKeeper) BondDenom(ctx context.Context) (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BondDenom", ctx) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// BondDenom indicates an expected call of BondDenom. +func (mr *MockStakingKeeperMockRecorder) BondDenom(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BondDenom", reflect.TypeOf((*MockStakingKeeper)(nil).BondDenom), ctx) +} + // ConsensusAddressCodec mocks base method. func (m *MockStakingKeeper) ConsensusAddressCodec() address.Codec { m.ctrl.T.Helper() diff --git a/x/distribution/types/expected_keepers.go b/x/distribution/types/expected_keepers.go index c0d332000aee..6b0c7ffc391a 100644 --- a/x/distribution/types/expected_keepers.go +++ b/x/distribution/types/expected_keepers.go @@ -44,6 +44,8 @@ type PoolKeeper interface { type StakingKeeper interface { ValidatorAddressCodec() address.Codec ConsensusAddressCodec() address.Codec + BondDenom(ctx context.Context) (string, error) + // iterate through validators by operator address, execute func for each validator IterateValidators(context.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool)) error diff --git a/x/evidence/go.mod b/x/evidence/go.mod index 4bb813367176..985b37858338 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/evidence go 1.21 require ( - cosmossdk.io/api v0.7.2 + cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/evidence/go.sum b/x/evidence/go.sum index 56febcb73172..66328b566cef 100644 --- a/x/evidence/go.sum +++ b/x/evidence/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= -cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/feegrant/go.mod b/x/feegrant/go.mod index 10bee2334586..cd66e2ead2f6 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/feegrant go 1.21 require ( - cosmossdk.io/api v0.7.2 + cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/feegrant/go.sum b/x/feegrant/go.sum index bfcc48e28f0e..cf0fb6006b50 100644 --- a/x/feegrant/go.sum +++ b/x/feegrant/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= -cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/gov/go.mod b/x/gov/go.mod index a269456a876a..a81760a9982b 100644 --- a/x/gov/go.mod +++ b/x/gov/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/gov go 1.21 require ( - cosmossdk.io/api v0.7.2 + cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/gov/go.sum b/x/gov/go.sum index e564d4efe08b..ea9506fe960e 100644 --- a/x/gov/go.sum +++ b/x/gov/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= -cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/group/go.mod b/x/group/go.mod index e332da0347c9..3468a048c561 100644 --- a/x/group/go.mod +++ b/x/group/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/group go 1.21 require ( - cosmossdk.io/api v0.7.2 + cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 diff --git a/x/group/go.sum b/x/group/go.sum index 1018d3dbbef5..f30bc68b3d0b 100644 --- a/x/group/go.sum +++ b/x/group/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= -cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/mint/go.mod b/x/mint/go.mod index 2be7fbf2f45e..41c6990139da 100644 --- a/x/mint/go.mod +++ b/x/mint/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/mint go 1.21 require ( - cosmossdk.io/api v0.7.2 + cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/mint/go.sum b/x/mint/go.sum index 26066029c2da..5fbe99f7b47a 100644 --- a/x/mint/go.sum +++ b/x/mint/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= -cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/nft/go.mod b/x/nft/go.mod index a1d7200eb3c3..64169b4206a8 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/nft go 1.21 require ( - cosmossdk.io/api v0.7.2 + cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 diff --git a/x/nft/go.sum b/x/nft/go.sum index 56febcb73172..66328b566cef 100644 --- a/x/nft/go.sum +++ b/x/nft/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= -cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/params/go.mod b/x/params/go.mod index c4b119ffceb9..dfac162f6208 100644 --- a/x/params/go.mod +++ b/x/params/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/params go 1.21 require ( - cosmossdk.io/api v0.7.2 + cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 diff --git a/x/params/go.sum b/x/params/go.sum index 56febcb73172..66328b566cef 100644 --- a/x/params/go.sum +++ b/x/params/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= -cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/protocolpool/go.mod b/x/protocolpool/go.mod index aa3e71650d68..767bf474e775 100644 --- a/x/protocolpool/go.mod +++ b/x/protocolpool/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/protocolpool go 1.21 require ( - cosmossdk.io/api v0.7.2 + cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 diff --git a/x/protocolpool/go.sum b/x/protocolpool/go.sum index e564d4efe08b..ea9506fe960e 100644 --- a/x/protocolpool/go.sum +++ b/x/protocolpool/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= -cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/slashing/go.mod b/x/slashing/go.mod index 0c196cc3db11..02554147f26f 100644 --- a/x/slashing/go.mod +++ b/x/slashing/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/slashing go 1.21 require ( - cosmossdk.io/api v0.7.2 + cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/slashing/go.sum b/x/slashing/go.sum index a3605a03a8db..15ea85ec51ee 100644 --- a/x/slashing/go.sum +++ b/x/slashing/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= -cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/staking/go.mod b/x/staking/go.mod index 921321817af4..4a597a52f73c 100644 --- a/x/staking/go.mod +++ b/x/staking/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/staking go 1.21 require ( - cosmossdk.io/api v0.7.2 + cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/staking/go.sum b/x/staking/go.sum index a3605a03a8db..15ea85ec51ee 100644 --- a/x/staking/go.sum +++ b/x/staking/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= -cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/upgrade/go.mod b/x/upgrade/go.mod index 616addfdd377..f9f67a9d79b6 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/upgrade go 1.21 require ( - cosmossdk.io/api v0.7.2 + cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 diff --git a/x/upgrade/go.sum b/x/upgrade/go.sum index 4c6885464192..105088e08cb0 100644 --- a/x/upgrade/go.sum +++ b/x/upgrade/go.sum @@ -187,8 +187,8 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= -cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= +cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU=