From e161f16e4374c4b6998183f578025af0cb9b7ee4 Mon Sep 17 00:00:00 2001 From: antstalepresh Date: Tue, 27 Oct 2020 19:18:57 +1000 Subject: [PATCH 01/19] modify gov split proto modification --- proto/cosmos/gov/v1beta1/gov.proto | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proto/cosmos/gov/v1beta1/gov.proto b/proto/cosmos/gov/v1beta1/gov.proto index 1d72e64321..3c00d4b2b2 100644 --- a/proto/cosmos/gov/v1beta1/gov.proto +++ b/proto/cosmos/gov/v1beta1/gov.proto @@ -119,9 +119,9 @@ message Vote { option (gogoproto.goproto_stringer) = false; option (gogoproto.equal) = false; - uint64 proposal_id = 1 [(gogoproto.moretags) = "yaml:\"proposal_id\""]; - string voter = 2; - VoteOption option = 3; + uint64 proposal_id = 1 [(gogoproto.moretags) = "yaml:\"proposal_id\""]; + string voter = 2; + repeated VoteOption options = 3; } // DepositParams defines the params for deposits on governance proposals. From 5061b8fe19086e07f8f610babb2395b5b07113d1 Mon Sep 17 00:00:00 2001 From: antstalepresh Date: Wed, 28 Oct 2020 23:24:55 +1000 Subject: [PATCH 02/19] basic ADR for gov split vote --- docs/architecture/adr-033-gov-split-vote.md | 65 +++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 docs/architecture/adr-033-gov-split-vote.md diff --git a/docs/architecture/adr-033-gov-split-vote.md b/docs/architecture/adr-033-gov-split-vote.md new file mode 100644 index 0000000000..f8e914b4a0 --- /dev/null +++ b/docs/architecture/adr-033-gov-split-vote.md @@ -0,0 +1,65 @@ +# ADR 028: Public Key Addresses + +## Changelog + +- 2020/10/28: Intial draft + +## Status + +Proposed + +## Abstract + +This ADR defines a validator to split votes into several pieces. Assuming a group with multisig address vote on a proposal, the members could have different opinion. In this case spliting voting power into pieces could be useful. + +## Context + +Currently, an address can cast vote with only one of vote options(yes/no/abstrain/no_with_veto) and full votingPower of that address goes to one vote option. + +To be more accurate in voting process, allowing the split of voting power could be very helpful. + +Assume that there are 100 members associated to a single validator address and they participate in voting process via that address. + +60 members cast yes vote, 30 members cast no vote, 5 members abstrain, 5 members no_with_veto. +If they just cast yes vote for 100% of voting power, it won't be fair enough for 40 members especially when that validator's voting power is quite high. + +If total voting power is 10000, and on above case we split voting power into 6000, 3000, 500, 500 pieces. + +## Decision + +We will modify cli command from +```sh +simd tx gov vote 1 yes --from mykey +``` +to +```sh +simd tx gov vote 1 "yes=60,no=30,abstain=5,no_with_veto=5" --from mykey +``` + +``` +simd tx gov vote 1 yes --from mykey +``` +Old command still works and it's automatically converted to like below +``` +simd tx gov vote 1 "yes=1" --from mykey +``` + +If you want to set VoteOption=1, you can omit `=1`. +``` +simd tx gov vote 1 "yes,no" --from mykey +``` +is same as +``` +simd tx gov vote 1 "yes=1,no=1" --from mykey +``` + +## Consequences + +### Positive +- It can make more accurate voting process especially for big validators. + +### Negative + +### Neutral + +## References From e91be95d30998d98c0fd9e879b4e4a75763e7031 Mon Sep 17 00:00:00 2001 From: antstalepresh Date: Wed, 28 Oct 2020 23:27:39 +1000 Subject: [PATCH 03/19] revert proto change --- proto/cosmos/gov/v1beta1/gov.proto | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proto/cosmos/gov/v1beta1/gov.proto b/proto/cosmos/gov/v1beta1/gov.proto index 3c00d4b2b2..1d72e64321 100644 --- a/proto/cosmos/gov/v1beta1/gov.proto +++ b/proto/cosmos/gov/v1beta1/gov.proto @@ -119,9 +119,9 @@ message Vote { option (gogoproto.goproto_stringer) = false; option (gogoproto.equal) = false; - uint64 proposal_id = 1 [(gogoproto.moretags) = "yaml:\"proposal_id\""]; - string voter = 2; - repeated VoteOption options = 3; + uint64 proposal_id = 1 [(gogoproto.moretags) = "yaml:\"proposal_id\""]; + string voter = 2; + VoteOption option = 3; } // DepositParams defines the params for deposits on governance proposals. From ffced9ebefa1b92f0187636514c6f02a21571ee9 Mon Sep 17 00:00:00 2001 From: antstalepresh Date: Wed, 28 Oct 2020 23:31:45 +1000 Subject: [PATCH 04/19] modify title --- docs/architecture/adr-033-gov-split-vote.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture/adr-033-gov-split-vote.md b/docs/architecture/adr-033-gov-split-vote.md index f8e914b4a0..d88ff773a8 100644 --- a/docs/architecture/adr-033-gov-split-vote.md +++ b/docs/architecture/adr-033-gov-split-vote.md @@ -1,4 +1,4 @@ -# ADR 028: Public Key Addresses +# ADR 033: Governance split votes ## Changelog From 3a871b86cef8c56baa6ed5bb6f1f1556dd60fab1 Mon Sep 17 00:00:00 2001 From: Sunny Aggarwal Date: Thu, 29 Oct 2020 14:09:05 -0400 Subject: [PATCH 05/19] sunny updates --- docs/architecture/adr-033-gov-split-vote.md | 74 +++++++++++++-------- 1 file changed, 45 insertions(+), 29 deletions(-) diff --git a/docs/architecture/adr-033-gov-split-vote.md b/docs/architecture/adr-033-gov-split-vote.md index d88ff773a8..5ef1cf5c9e 100644 --- a/docs/architecture/adr-033-gov-split-vote.md +++ b/docs/architecture/adr-033-gov-split-vote.md @@ -10,56 +10,72 @@ Proposed ## Abstract -This ADR defines a validator to split votes into several pieces. Assuming a group with multisig address vote on a proposal, the members could have different opinion. In this case spliting voting power into pieces could be useful. +This ADR defines a modification to the the governance module that would allow a staker to split their votes into several voting options. For example, it could use 70% of its voting power to vote Yes and 30% of its voting power to vote No. ## Context -Currently, an address can cast vote with only one of vote options(yes/no/abstrain/no_with_veto) and full votingPower of that address goes to one vote option. +Currently, an address can cast a vote with only one options (Yes/No/Abstain/NoWithVeto) and use their full voting power behind that choice. -To be more accurate in voting process, allowing the split of voting power could be very helpful. - -Assume that there are 100 members associated to a single validator address and they participate in voting process via that address. - -60 members cast yes vote, 30 members cast no vote, 5 members abstrain, 5 members no_with_veto. -If they just cast yes vote for 100% of voting power, it won't be fair enough for 40 members especially when that validator's voting power is quite high. - -If total voting power is 10000, and on above case we split voting power into 6000, 3000, 500, 500 pieces. +However, often times the entity owning that address might not be a single individual. For example, a company might have different stakeholders who want to vote differently, and so it makes sense to allow them to split their voting power. Another example use case is exchanges. Many centralized exchanges often stake a portion of their users' tokens in their custody. Currently, it is not possible for them to do "passthrough voting" and giving their users voting rights over their tokens. However, with this system, exchanges can poll their users for voting preferences, and then vote on-chain proportionally to the results of the poll. ## Decision -We will modify cli command from -```sh -simd tx gov vote 1 yes --from mykey -``` -to -```sh -simd tx gov vote 1 "yes=60,no=30,abstain=5,no_with_veto=5" --from mykey -``` +We modify the vote structs to be ``` -simd tx gov vote 1 yes --from mykey +Vote { + ProposalId int64 + Voter sdk.Address + Options []Option + Rates []sdk.Dec +} ``` -Old command still works and it's automatically converted to like below + +The `ValidateBasic` of a MsgVote struct would require that +1. The length of the Options slice is equal to the length of Rates slice +2. The sum of all the Rates is equal to 1.0 +3. No Option is repeated + +The governance tally function will iterate over all the options in a vote and add to the tally the result of the voter's voting power * the rate for that option. + +``` +tally() { + map tally + + for (_, vote) in votes { + for (i, options) in vote{ + tally.option += getVotingPower(vote.voter) * vote.rate[i] + } + } +} +``` + +The CLI command for creating a multi-option vote would be as such: +```sh +simd tx gov vote 1 "yes=0.6,no=0.3,abstain=0.05,no_with_veto=0.05" --from mykey +``` + +To create a single-option vote a user can do either ``` simd tx gov vote 1 "yes=1" --from mykey ``` -If you want to set VoteOption=1, you can omit `=1`. -``` -simd tx gov vote 1 "yes,no" --from mykey -``` -is same as -``` -simd tx gov vote 1 "yes=1,no=1" --from mykey +or + +```sh +simd tx gov vote 1 yes --from mykey ``` +to maintain backwards compatibility. + + ## Consequences ### Positive - It can make more accurate voting process especially for big validators. ### Negative +- ### Neutral - -## References +- Relatively minor change to governance tally function. From 71e551bbae237bf570779d451d2c4e21e9744548 Mon Sep 17 00:00:00 2001 From: Sunny Aggarwal Date: Thu, 29 Oct 2020 16:35:50 -0400 Subject: [PATCH 06/19] address @alexanderbez review --- docs/architecture/adr-033-gov-split-vote.md | 29 ++++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/docs/architecture/adr-033-gov-split-vote.md b/docs/architecture/adr-033-gov-split-vote.md index 5ef1cf5c9e..a567dd692d 100644 --- a/docs/architecture/adr-033-gov-split-vote.md +++ b/docs/architecture/adr-033-gov-split-vote.md @@ -23,28 +23,31 @@ However, often times the entity owning that address might not be a single indivi We modify the vote structs to be ``` -Vote { - ProposalId int64 - Voter sdk.Address - Options []Option - Rates []sdk.Dec +type WeightedVoteOption struct { + Option string + Weight sdk.Dec +} + +type Vote struct { + ProposalID int64 + Voter sdk.Address + Options []WeightedVoteOption } ``` The `ValidateBasic` of a MsgVote struct would require that -1. The length of the Options slice is equal to the length of Rates slice -2. The sum of all the Rates is equal to 1.0 -3. No Option is repeated +1. The sum of all the Rates is equal to 1.0 +2. No Option is repeated The governance tally function will iterate over all the options in a vote and add to the tally the result of the voter's voting power * the rate for that option. ``` tally() { - map tally + results := map[types.VoteOption]sdk.Dec - for (_, vote) in votes { - for (i, options) in vote{ - tally.option += getVotingPower(vote.voter) * vote.rate[i] + for _, vote := range votes { + for i, weightedOption := range vote.Options { + results[weightedOption.Option] += getVotingPower(vote.voter) * weightedOption.Weight } } } @@ -72,7 +75,7 @@ to maintain backwards compatibility. ## Consequences ### Positive -- It can make more accurate voting process especially for big validators. +- Can make the voting process more accurate for addresses representing multiple stakeholders, often some of the largest addresses. ### Negative - From ebe73fa28b5c1f320bb0a8a63f5c8228cb64ef72 Mon Sep 17 00:00:00 2001 From: antstalepresh <36045227+antstalepresh@users.noreply.github.com> Date: Mon, 2 Nov 2020 23:10:39 +1000 Subject: [PATCH 07/19] modify ADR for MsgVote backwards compatibility --- docs/architecture/adr-033-gov-split-vote.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/docs/architecture/adr-033-gov-split-vote.md b/docs/architecture/adr-033-gov-split-vote.md index a567dd692d..b473bfc3b2 100644 --- a/docs/architecture/adr-033-gov-split-vote.md +++ b/docs/architecture/adr-033-gov-split-vote.md @@ -35,7 +35,22 @@ type Vote struct { } ``` -The `ValidateBasic` of a MsgVote struct would require that +And for backwards compatibility, we introduce `MsgWeightedVote` while keeping `MsgVote`. +``` +type MsgVote struct { + ProposalID int64 + Voter sdk.Address + Option Option +} + +type MsgWeightedVote struct { + ProposalID int64 + Voter sdk.Address + Options []WeightedVoteOption +} +``` + +The `ValidateBasic` of a `MsgWeightedVote` struct would require that 1. The sum of all the Rates is equal to 1.0 2. No Option is repeated From e9d6a8a48dd1ccbc271521738246f27162e44421 Mon Sep 17 00:00:00 2001 From: Sunny Aggarwal Date: Mon, 2 Nov 2020 12:56:45 -0400 Subject: [PATCH 08/19] add backwards compatibility section --- docs/architecture/adr-033-gov-split-vote.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/architecture/adr-033-gov-split-vote.md b/docs/architecture/adr-033-gov-split-vote.md index b473bfc3b2..759778c0c4 100644 --- a/docs/architecture/adr-033-gov-split-vote.md +++ b/docs/architecture/adr-033-gov-split-vote.md @@ -89,11 +89,16 @@ to maintain backwards compatibility. ## Consequences +### Backwards Compatibility +- Previous VoteMsg types will remain the same and so clients will not have to update their procedure unless they want to support the WeightedVoteMsg feature. +- When querying a Vote struct from state, its structure will be different, and so clients wanting to display all voters and their respective votes will have to handle the new format and the fact that a single voter can have split votes. +- The result of querying the tally function should have the same API for clients. + ### Positive - Can make the voting process more accurate for addresses representing multiple stakeholders, often some of the largest addresses. ### Negative -- +- Is more complex than simple voting, and so may be harder to explain to users. However, this is mostly mitigated because the feature is opt-in. ### Neutral - Relatively minor change to governance tally function. From a0c1deb2e2c5eb65842d705ebb6612ce9399af69 Mon Sep 17 00:00:00 2001 From: Sunny Aggarwal Date: Wed, 11 Nov 2020 13:35:07 -0400 Subject: [PATCH 09/19] reassign to adr 037 --- docs/architecture/README.md | 1 + .../{adr-033-gov-split-vote.md => adr-037-gov-split-vote.md} | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) rename docs/architecture/{adr-033-gov-split-vote.md => adr-037-gov-split-vote.md} (99%) diff --git a/docs/architecture/README.md b/docs/architecture/README.md index d9a52d3898..d3ff033688 100644 --- a/docs/architecture/README.md +++ b/docs/architecture/README.md @@ -72,3 +72,4 @@ Read about the [PROCESS](./PROCESS.md). - [ADR 031: Protobuf Msg Services](./adr-031-msg-service.md) - [ADR 032: Typed Events](./adr-032-typed-events.md) - [ADR 035: Rosetta API Support](./adr-035-rosetta-api-support.md) +- [ADR 037: Governance Split Votes](./adr-037-gov-split-vote.md) \ No newline at end of file diff --git a/docs/architecture/adr-033-gov-split-vote.md b/docs/architecture/adr-037-gov-split-vote.md similarity index 99% rename from docs/architecture/adr-033-gov-split-vote.md rename to docs/architecture/adr-037-gov-split-vote.md index 759778c0c4..af9cd8d6f6 100644 --- a/docs/architecture/adr-033-gov-split-vote.md +++ b/docs/architecture/adr-037-gov-split-vote.md @@ -1,4 +1,4 @@ -# ADR 033: Governance split votes +# ADR 037: Governance split votes ## Changelog From a8ef4a380da4fbdcc762a08c4d564e76c5de29bd Mon Sep 17 00:00:00 2001 From: Amaury Date: Fri, 13 Nov 2020 17:36:58 +0100 Subject: [PATCH 10/19] All Makefile proto commands use Docker (#7931) * Update tooling around docker * Run commands * Remove swagger gen for now * Update proto-gen-any * Fix indentn * Use CURDIR Co-authored-by: Alessio Treglia --- .github/workflows/proto.yml | 4 +- .gitignore | 1 - CONTRIBUTING.md | 14 +- Makefile | 27 +- client/docs/swagger-ui/swagger.yaml | 239 ++++++++++++++++++ codec/types/any.pb.go | 43 ++-- contrib/devtools/Makefile | 10 +- contrib/devtools/proto-tools-installer.sh | 101 -------- proto/cosmos/auth/v1beta1/auth.proto | 11 +- proto/cosmos/bank/v1beta1/tx.proto | 6 +- proto/cosmos/base/abci/v1beta1/abci.proto | 2 +- .../base/store/v1beta1/commit_info.proto | 2 +- proto/cosmos/crisis/v1beta1/tx.proto | 2 +- proto/cosmos/crypto/ed25519/keys.proto | 6 +- proto/cosmos/distribution/v1beta1/tx.proto | 12 +- proto/cosmos/gov/v1beta1/tx.proto | 10 +- proto/cosmos/params/v1beta1/params.proto | 6 +- proto/cosmos/staking/v1beta1/staking.proto | 31 ++- proto/cosmos/staking/v1beta1/tx.proto | 6 +- proto/cosmos/tx/signing/v1beta1/signing.proto | 68 ++--- proto/cosmos/tx/v1beta1/service.proto | 70 ++--- proto/cosmos/upgrade/v1beta1/upgrade.proto | 3 +- proto/cosmos/vesting/v1beta1/tx.proto | 4 +- proto/ibc/applications/transfer/v1/tx.proto | 2 +- proto/ibc/core/channel/v1/genesis.proto | 10 +- proto/ibc/core/channel/v1/query.proto | 15 +- proto/ibc/core/client/v1/genesis.proto | 8 +- proto/ibc/core/client/v1/query.proto | 10 +- proto/ibc/core/client/v1/tx.proto | 8 +- proto/ibc/core/commitment/v1/commitment.proto | 2 +- proto/ibc/core/connection/v1/tx.proto | 16 +- scripts/protocgen-any.sh | 4 +- testutil/testdata/query.proto | 18 +- testutil/testdata/tx.proto | 10 +- testutil/testdata/unknonwnproto.proto | 74 +++--- 35 files changed, 485 insertions(+), 370 deletions(-) delete mode 100755 contrib/devtools/proto-tools-installer.sh diff --git a/.github/workflows/proto.yml b/.github/workflows/proto.yml index b355da087d..13f05c131a 100644 --- a/.github/workflows/proto.yml +++ b/.github/workflows/proto.yml @@ -12,10 +12,10 @@ jobs: steps: - uses: actions/checkout@master - name: lint - run: make proto-lint-docker + run: make proto-lint breakage: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - name: check-breakage - run: make proto-check-breaking-docker + run: make proto-check-breaking diff --git a/.gitignore b/.gitignore index 1755acca7e..2bf1816598 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,6 @@ docs/node_modules docs/modules dist tools-stamp -proto-tools-stamp buf-stamp artifacts diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e13dba1b85..bfa080cc90 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -142,11 +142,15 @@ build, in which case we can fall back on `go mod tidy -v`. We use [Protocol Buffers](https://developers.google.com/protocol-buffers) along with [gogoproto](https://github.com/gogo/protobuf) to generate code for use in Cosmos-SDK. +For determinstic behavior around Protobuf tooling, everything is containerized using Docker. Make sure to have Docker installed on your machine, or head to [Docker's website](https://docs.docker.com/get-docker/) to install it. + For formatting code in `.proto` files, you can run `make proto-format` command. -For linting and checking breaking changes, we use [buf](https://buf.build/). There are two options for linting and to check if your changes will cause a break. The first is that you can install [buf](https://buf.build/docs/installation) locally, the commands for running buf after installing are `make proto-lint` and the breaking changes check will be `make proto-check-breaking`. If you do not want to install buf and have docker installed already then you can use these commands `make proto-lint-docker` and `make proto-check-breaking-docker`. +For linting and checking breaking changes, we use [buf](https://buf.build/). You can use the commands `make proto-lint` and `make proto-check-breaking` to respectively lint your proto files and check for breaking changes. -To generate the protobuf stubs you must have `protoc` and `protoc-gen-gocosmos` installed. To install these tools run `make proto-tools`. After this step you will be able to run `make proto-gen` to generate the protobuf stubs. +To generate the protobuf stubs, you can run `make proto-gen`. + +We also added the `make proto-all` command to run all the above commands sequentially. In order for imports to properly compile in your IDE, you may need to manually set your protobuf path in your IDE's workspace settings/config. @@ -268,8 +272,8 @@ and PRs are merged into `master`, if a contributor wishes the PR to be released - **[Impact]** Explanation of how the bug affects users or developers. - **[Test Case]** section with detailed instructions on how to reproduce the bug. - **[Regression Potential]** section with a discussion how regressions are most likely to manifest, or might - manifest even if it's unlikely, as a result of the change. **It is assumed that any SRU candidate PR is - well-tested before it is merged in and has an overall low risk of regression**. + manifest even if it's unlikely, as a result of the change. **It is assumed that any SRU candidate PR is + well-tested before it is merged in and has an overall low risk of regression**. It is the PR's author's responsibility to fix merge conflicts, update changelog entries, and ensure CI passes. If a PR originates from an external contributor, it may be a core team member's @@ -280,7 +284,7 @@ Finally, when a point release is ready to be made: 1. Create `release/v0.38.N` branch 2. Ensure changelog entries are verified - 2. Be sure changelog entries are added to `RELEASE_CHANGELOG.md` + 1. Be sure changelog entries are added to `RELEASE_CHANGELOG.md` 3. Add release version date to the changelog 4. Push release branch along with the annotated tag: **git tag -a** 5. Create a PR into `master` containing ONLY `CHANGELOG.md` updates diff --git a/Makefile b/Makefile index d908a2ad0b..1d8164219f 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ BUILDDIR ?= $(CURDIR)/build SIMAPP = ./simapp MOCKS_DIR = $(CURDIR)/tests/mocks HTTPS_GIT := https://github.com/cosmos/cosmos-sdk.git -DOCKER_BUF := docker run -v $(shell pwd):/workspace --workdir /workspace bufbuild/buf +DOCKER_BUF := docker run -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf export GO111MODULE = on @@ -356,43 +356,30 @@ devdoc-update: ### Protobuf ### ############################################################################### -proto-all: proto-tools proto-gen proto-lint proto-check-breaking proto-swagger-gen proto-format +proto-all: proto-format proto-lint proto-check-breaking proto-gen proto-gen: - @./scripts/protocgen.sh - -proto-gen-docker: @echo "Generating Protobuf files" - docker run -v $(shell pwd):/workspace --workdir /workspace tendermintdev/sdk-proto-gen sh ./scripts/protocgen.sh -.PHONY: proto-gen-docker + docker run -v $(CURDIR):/workspace --workdir /workspace tendermintdev/sdk-proto-gen sh ./scripts/protocgen.sh proto-format: @echo "Formatting Protobuf files" - docker run -v $(shell pwd):/workspace \ + docker run -v $(CURDIR):/workspace \ --workdir /workspace tendermintdev/docker-build-proto \ find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \; -.PHONY: proto-format # This generates the SDK's custom wrapper for google.protobuf.Any. It should only be run manually when needed proto-gen-any: - @./scripts/protocgen-any.sh + docker run -v $(CURDIR):/workspace --workdir /workspace tendermintdev/sdk-proto-gen sh ./scripts/protocgen-any.sh proto-swagger-gen: @./scripts/protoc-swagger-gen.sh proto-lint: - @buf check lint --error-format=json + @$(DOCKER_BUF) check lint --error-format=json proto-check-breaking: - @buf check breaking --against-input '.git#branch=master' - -proto-lint-docker: - @$(DOCKER_BUF) check lint --error-format=json -.PHONY: proto-lint - -proto-check-breaking-docker: @$(DOCKER_BUF) check breaking --against-input $(HTTPS_GIT)#branch=master -.PHONY: proto-check-breaking-ci TM_URL = https://raw.githubusercontent.com/tendermint/tendermint/v0.34.0-rc6/proto/tendermint GOGO_PROTO_URL = https://raw.githubusercontent.com/regen-network/protobuf/cosmos @@ -445,7 +432,7 @@ proto-update-deps: ## Issue link: https://github.com/confio/ics23/issues/32 @sed -i '4ioption go_package = "github.com/confio/ics23/go";' $(CONFIO_TYPES)/proofs.proto -.PHONY: proto-all proto-gen proto-lint proto-check-breaking proto-update-deps +.PHONY: proto-all proto-gen proto-gen-any proto-swagger-gen proto-format proto-lint proto-check-breaking proto-update-deps ############################################################################### ### Localnet ### diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml index f8a2cccb94..0b52dcf194 100644 --- a/client/docs/swagger-ui/swagger.yaml +++ b/client/docs/swagger-ui/swagger.yaml @@ -19992,6 +19992,221 @@ paths: type: boolean tags: - Query + /ibc/client/v1beta1/params: + get: + summary: ClientParams queries all parameters of the ibc client. + operationId: ClientParams + responses: + '200': + description: A successful response. + schema: + type: object + properties: + params: + description: params defines the parameters of the module. + type: object + properties: + allowed_clients: + type: array + items: + type: string + description: >- + allowed_clients defines the list of allowed client state + types. + description: >- + QueryClientParamsResponse is the response type for the + Query/ClientParams RPC method. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the above + specified type. + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := ptypes.MarshalAny(foo) + ... + foo := &pb.Foo{} + if err := ptypes.UnmarshalAny(any, foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + + JSON + + ==== + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + tags: + - Query /ibc/core/client/v1beta1/client_states: get: summary: ClientStates queries all the IBC light clients of a chain. @@ -33015,6 +33230,30 @@ definitions: description: >- ConsensusStateWithHeight defines a consensus state with an additional height field. + ibc.core.client.v1.Params: + type: object + properties: + allowed_clients: + type: array + items: + type: string + description: allowed_clients defines the list of allowed client state types. + description: Params defines the set of IBC light client parameters. + ibc.core.client.v1.QueryClientParamsResponse: + type: object + properties: + params: + description: params defines the parameters of the module. + type: object + properties: + allowed_clients: + type: array + items: + type: string + description: allowed_clients defines the list of allowed client state types. + description: >- + QueryClientParamsResponse is the response type for the Query/ClientParams + RPC method. ibc.core.client.v1.QueryClientStateResponse: type: object properties: diff --git a/codec/types/any.pb.go b/codec/types/any.pb.go index d084381696..97d9f1c2aa 100644 --- a/codec/types/any.pb.go +++ b/codec/types/any.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: third_party/proto/google/protobuf/any.proto +// source: google/protobuf/any.proto package types @@ -29,7 +29,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package func (m *Any) Reset() { *m = Any{} } func (*Any) ProtoMessage() {} func (*Any) Descriptor() ([]byte, []int) { - return fileDescriptor_cb68f365a8e2bcdc, []int{0} + return fileDescriptor_b53526c13ae22eb4, []int{0} } func (*Any) XXX_WellKnownType() string { return "Any" } func (m *Any) XXX_Unmarshal(b []byte) error { @@ -79,28 +79,25 @@ func (*Any) XXX_MessageName() string { func init() { } -func init() { - proto.RegisterFile("third_party/proto/google/protobuf/any.proto", fileDescriptor_cb68f365a8e2bcdc) -} +func init() { proto.RegisterFile("google/protobuf/any.proto", fileDescriptor_b53526c13ae22eb4) } -var fileDescriptor_cb68f365a8e2bcdc = []byte{ - // 246 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x2e, 0xc9, 0xc8, 0x2c, - 0x4a, 0x89, 0x2f, 0x48, 0x2c, 0x2a, 0xa9, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x4f, 0xcf, - 0xcf, 0x4f, 0xcf, 0x49, 0x85, 0x70, 0x92, 0x4a, 0xd3, 0xf4, 0x13, 0xf3, 0x2a, 0xf5, 0xc0, 0x1c, - 0x21, 0x7e, 0x88, 0x94, 0x1e, 0x4c, 0x4a, 0x4a, 0x0d, 0x9b, 0xee, 0xf4, 0x7c, 0x04, 0x0b, 0xa2, - 0x54, 0xc9, 0x86, 0x8b, 0xd9, 0x31, 0xaf, 0x52, 0x48, 0x92, 0x8b, 0xa3, 0xa4, 0xb2, 0x20, 0x35, - 0xbe, 0xb4, 0x28, 0x47, 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, 0x88, 0x1d, 0xc4, 0x0f, 0x2d, 0xca, - 0x11, 0x12, 0xe1, 0x62, 0x2d, 0x4b, 0xcc, 0x29, 0x4d, 0x95, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x09, - 0x82, 0x70, 0xac, 0x58, 0x3e, 0x2c, 0x94, 0x67, 0x70, 0x6a, 0x66, 0xbc, 0xf1, 0x50, 0x8e, 0xe1, - 0xc3, 0x43, 0x39, 0xc6, 0x1f, 0x0f, 0xe5, 0x18, 0x1b, 0x1e, 0xc9, 0x31, 0xae, 0x78, 0x24, 0xc7, - 0x78, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0xbe, 0x78, 0x24, - 0xc7, 0xf0, 0x01, 0x24, 0xfe, 0x58, 0x8e, 0xf1, 0xc0, 0x63, 0x39, 0x86, 0x13, 0x8f, 0xe5, 0x18, - 0xb9, 0x84, 0x93, 0xf3, 0x73, 0xf5, 0xd0, 0x5c, 0xec, 0xc4, 0xe1, 0x98, 0x57, 0x19, 0x00, 0xe2, - 0x04, 0x30, 0x46, 0xb1, 0x82, 0x2c, 0x2f, 0x5e, 0xc4, 0xc4, 0xec, 0x1e, 0xe0, 0xb4, 0x8a, 0x49, - 0xce, 0x1d, 0xa2, 0x34, 0x00, 0xaa, 0x54, 0x2f, 0x3c, 0x35, 0x27, 0xc7, 0x3b, 0x2f, 0xbf, 0x3c, - 0x2f, 0x04, 0xa4, 0x2c, 0x89, 0x0d, 0x6c, 0x86, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x16, 0xc3, - 0x46, 0x5f, 0x32, 0x01, 0x00, 0x00, +var fileDescriptor_b53526c13ae22eb4 = []byte{ + // 235 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xcf, 0xcf, 0x4f, + 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcc, 0xab, 0xd4, + 0x03, 0x73, 0x84, 0xf8, 0x21, 0x52, 0x7a, 0x30, 0x29, 0x29, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0x30, + 0x4f, 0x1f, 0xc4, 0x82, 0x48, 0x28, 0xd9, 0x70, 0x31, 0x3b, 0xe6, 0x55, 0x0a, 0x49, 0x72, 0x71, + 0x94, 0x54, 0x16, 0xa4, 0xc6, 0x97, 0x16, 0xe5, 0x48, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x06, 0xb1, + 0x83, 0xf8, 0xa1, 0x45, 0x39, 0x42, 0x22, 0x5c, 0xac, 0x65, 0x89, 0x39, 0xa5, 0xa9, 0x12, 0x4c, + 0x0a, 0x8c, 0x1a, 0x3c, 0x41, 0x10, 0x8e, 0x15, 0xcb, 0x87, 0x85, 0xf2, 0x0c, 0x4e, 0xcd, 0x8c, + 0x37, 0x1e, 0xca, 0x31, 0x7c, 0x78, 0x28, 0xc7, 0xf8, 0xe3, 0xa1, 0x1c, 0x63, 0xc3, 0x23, 0x39, + 0xc6, 0x15, 0x8f, 0xe4, 0x18, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, + 0x39, 0xc6, 0x17, 0x8f, 0xe4, 0x18, 0x3e, 0x80, 0xc4, 0x1f, 0xcb, 0x31, 0x1e, 0x78, 0x2c, 0xc7, + 0x70, 0xe2, 0xb1, 0x1c, 0x23, 0x97, 0x70, 0x72, 0x7e, 0xae, 0x1e, 0x9a, 0xfb, 0x9c, 0x38, 0x1c, + 0xf3, 0x2a, 0x03, 0x40, 0x9c, 0x00, 0xc6, 0x28, 0x56, 0x90, 0xe5, 0xc5, 0x8b, 0x98, 0x98, 0xdd, + 0x03, 0x9c, 0x56, 0x31, 0xc9, 0xb9, 0x43, 0x94, 0x06, 0x40, 0x95, 0xea, 0x85, 0xa7, 0xe6, 0xe4, + 0x78, 0xe7, 0xe5, 0x97, 0xe7, 0x85, 0x80, 0x94, 0x25, 0xb1, 0x81, 0xcd, 0x30, 0x06, 0x04, 0x00, + 0x00, 0xff, 0xff, 0xe6, 0xfb, 0xa0, 0x21, 0x0e, 0x01, 0x00, 0x00, } func (this *Any) Compare(that interface{}) int { diff --git a/contrib/devtools/Makefile b/contrib/devtools/Makefile index 69271030fc..2e3741fd85 100644 --- a/contrib/devtools/Makefile +++ b/contrib/devtools/Makefile @@ -57,14 +57,6 @@ tools-stamp: statik runsim # in a row. touch $@ -proto-tools: proto-tools-stamp -proto-tools-stamp: - bash $(mkfile_dir)/proto-tools-installer.sh - # Create dummy file to satisfy dependency and avoid - # rebuilding when this Makefile target is hit twice - # in a row. - touch $@ - # Install the runsim binary with a temporary workaround of entering an outside # directory as the "go get" command ignores the -mod option and will polute the # go.{mod, sum} files. @@ -87,6 +79,6 @@ $(RUNSIM): tools-clean: rm -f $(STATIK) $(GOLANGCI_LINT) $(RUNSIM) - rm -f proto-tools-stamp tools-stamp + rm -f tools-stamp .PHONY: tools-clean statik runsim diff --git a/contrib/devtools/proto-tools-installer.sh b/contrib/devtools/proto-tools-installer.sh deleted file mode 100755 index fc736d55e8..0000000000 --- a/contrib/devtools/proto-tools-installer.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/bash - -set -ue - -DESTDIR=${DESTDIR:-} -PREFIX=${PREFIX:-/usr/local} -UNAME_S="$(uname -s 2>/dev/null)" -UNAME_M="$(uname -m 2>/dev/null)" -BUF_VERSION=0.30.0 -PROTOC_GRPC_GATEWAY_VERSION=1.14.7 - -f_abort() { - local l_rc=$1 - shift - - echo $@ >&2 - exit ${l_rc} -} - -case "${UNAME_S}" in -Linux) - PROTOC_ZIP="protoc-${PROTOC_VERSION}-linux-x86_64.zip" - PROTOC_GRPC_GATEWAY_BIN="protoc-gen-grpc-gateway-v${PROTOC_GRPC_GATEWAY_VERSION}-linux-x86_64" - ;; -Darwin) - PROTOC_ZIP="protoc-${PROTOC_VERSION}-osx-x86_64.zip" - PROTOC_GRPC_GATEWAY_BIN="protoc-gen-grpc-gateway-v${PROTOC_GRPC_GATEWAY_VERSION}-darwin-x86_64" - ;; -*) - f_abort 1 "Unknown kernel name. Exiting." -esac - -TEMPDIR="$(mktemp -d)" - -trap "rm -rvf ${TEMPDIR}" EXIT - -f_print_installing_with_padding() { - printf "Installing %30s ..." "$1" >&2 -} - -f_print_done() { - echo -e "\tDONE" >&2 -} - -f_ensure_tools() { - ! which curl &>/dev/null && f_abort 2 "couldn't find curl, aborting" || true -} - -f_ensure_dirs() { - mkdir -p "${DESTDIR}/${PREFIX}/bin" - mkdir -p "${DESTDIR}/${PREFIX}/include" -} - -f_needs_install() { - if [ -x $1 ]; then - echo -e "\talready installed. Skipping." >&2 - return 1 - fi - - return 0 -} - -f_install_buf() { - f_print_installing_with_padding buf - f_needs_install "${DESTDIR}/${PREFIX}/bin/buf" || return 0 - - curl -sSL "https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-${UNAME_S}-${UNAME_M}" -o "${DESTDIR}/${PREFIX}/bin/buf" - chmod +x "${DESTDIR}/${PREFIX}/bin/buf" - f_print_done -} - -f_install_protoc_gen_grpc_gateway() { - f_print_installing_with_padding protoc-gen-grpc-gateway - f_needs_install "${DESTDIR}/${PREFIX}/bin/protoc-gen-grpc-gateway" || return 0 - - curl -o "${DESTDIR}/${PREFIX}/bin/protoc-gen-grpc-gateway" -sSL "https://github.com/grpc-ecosystem/grpc-gateway/releases/download/v${PROTOC_GRPC_GATEWAY_VERSION}/${PROTOC_GRPC_GATEWAY_BIN}" - f_print_done -} - -f_install_protoc_gen_swagger() { - f_print_installing_with_padding protoc-gen-swagger - f_needs_install "${DESTDIR}/${PREFIX}/bin/protoc-gen-swagger" || return 0 - - if ! which npm &>/dev/null ; then - echo -e "\tNPM is not installed. Skipping." - return 0 - fi - - pushd "${TEMPDIR}" >/dev/null - go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger - npm install -g swagger-combine - popd >/dev/null - f_print_done -} - -f_ensure_tools -f_ensure_dirs -f_install_buf -f_install_protoc_gen_gocosmos -f_install_protoc_gen_grpc_gateway -f_install_protoc_gen_swagger diff --git a/proto/cosmos/auth/v1beta1/auth.proto b/proto/cosmos/auth/v1beta1/auth.proto index 0caa123829..72e1d9ec28 100644 --- a/proto/cosmos/auth/v1beta1/auth.proto +++ b/proto/cosmos/auth/v1beta1/auth.proto @@ -17,8 +17,9 @@ message BaseAccount { option (cosmos_proto.implements_interface) = "AccountI"; - string address = 1; - google.protobuf.Any pub_key = 2 [(gogoproto.jsontag) = "public_key,omitempty", (gogoproto.moretags) = "yaml:\"public_key\""]; + string address = 1; + google.protobuf.Any pub_key = 2 + [(gogoproto.jsontag) = "public_key,omitempty", (gogoproto.moretags) = "yaml:\"public_key\""]; uint64 account_number = 3 [(gogoproto.moretags) = "yaml:\"account_number\""]; uint64 sequence = 4; } @@ -29,9 +30,9 @@ message ModuleAccount { option (gogoproto.goproto_stringer) = false; option (cosmos_proto.implements_interface) = "ModuleAccountI"; - BaseAccount base_account = 1 [(gogoproto.embed) = true, (gogoproto.moretags) = "yaml:\"base_account\""]; - string name = 2; - repeated string permissions = 3; + BaseAccount base_account = 1 [(gogoproto.embed) = true, (gogoproto.moretags) = "yaml:\"base_account\""]; + string name = 2; + repeated string permissions = 3; } // Params defines the parameters for the auth module. diff --git a/proto/cosmos/bank/v1beta1/tx.proto b/proto/cosmos/bank/v1beta1/tx.proto index 0216ad665e..26b2ab41f4 100644 --- a/proto/cosmos/bank/v1beta1/tx.proto +++ b/proto/cosmos/bank/v1beta1/tx.proto @@ -28,15 +28,15 @@ message MsgSend { } // MsgSendResponse defines the Msg/Send response type. -message MsgSendResponse { } +message MsgSendResponse {} // MsgMultiSend represents an arbitrary multi-in, multi-out send message. message MsgMultiSend { option (gogoproto.equal) = false; - repeated Input inputs = 1 [(gogoproto.nullable) = false]; + repeated Input inputs = 1 [(gogoproto.nullable) = false]; repeated Output outputs = 2 [(gogoproto.nullable) = false]; } // MsgMultiSendResponse defines the Msg/MultiSend response type. -message MsgMultiSendResponse { } +message MsgMultiSendResponse {} diff --git a/proto/cosmos/base/abci/v1beta1/abci.proto b/proto/cosmos/base/abci/v1beta1/abci.proto index 9d7edbbbbd..72da2aacc3 100644 --- a/proto/cosmos/base/abci/v1beta1/abci.proto +++ b/proto/cosmos/base/abci/v1beta1/abci.proto @@ -58,7 +58,7 @@ message ABCIMessageLog { message StringEvent { option (gogoproto.stringer) = true; - string type = 1; + string type = 1; repeated Attribute attributes = 2 [(gogoproto.nullable) = false]; } diff --git a/proto/cosmos/base/store/v1beta1/commit_info.proto b/proto/cosmos/base/store/v1beta1/commit_info.proto index 3bc23af84e..98a33d30e7 100644 --- a/proto/cosmos/base/store/v1beta1/commit_info.proto +++ b/proto/cosmos/base/store/v1beta1/commit_info.proto @@ -8,7 +8,7 @@ option go_package = "github.com/cosmos/cosmos-sdk/store/types"; // CommitInfo defines commit information used by the multi-store when committing // a version/height. message CommitInfo { - int64 version = 1; + int64 version = 1; repeated StoreInfo store_infos = 2 [(gogoproto.nullable) = false]; } diff --git a/proto/cosmos/crisis/v1beta1/tx.proto b/proto/cosmos/crisis/v1beta1/tx.proto index c6156b8a72..26457ad6d5 100644 --- a/proto/cosmos/crisis/v1beta1/tx.proto +++ b/proto/cosmos/crisis/v1beta1/tx.proto @@ -22,4 +22,4 @@ message MsgVerifyInvariant { } // MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type. -message MsgVerifyInvariantResponse { } +message MsgVerifyInvariantResponse {} diff --git a/proto/cosmos/crypto/ed25519/keys.proto b/proto/cosmos/crypto/ed25519/keys.proto index 3f667a0b21..bed9c29cc7 100644 --- a/proto/cosmos/crypto/ed25519/keys.proto +++ b/proto/cosmos/crypto/ed25519/keys.proto @@ -11,12 +11,12 @@ option go_package = "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"; // the x-coordinate. Otherwise the first byte is a 0x03. // This prefix is followed with the x-coordinate. message PubKey { - option (gogoproto.goproto_stringer) = false; + option (gogoproto.goproto_stringer) = false; - bytes key = 1 [(gogoproto.casttype) = "crypto/ed25519.PublicKey"]; + bytes key = 1 [(gogoproto.casttype) = "crypto/ed25519.PublicKey"]; } // PrivKey defines a ed25519 private key. message PrivKey { - bytes key = 1 [(gogoproto.casttype) = "crypto/ed25519.PrivateKey"]; + bytes key = 1 [(gogoproto.casttype) = "crypto/ed25519.PrivateKey"]; } diff --git a/proto/cosmos/distribution/v1beta1/tx.proto b/proto/cosmos/distribution/v1beta1/tx.proto index 783f06d1d7..e6ce478bcd 100644 --- a/proto/cosmos/distribution/v1beta1/tx.proto +++ b/proto/cosmos/distribution/v1beta1/tx.proto @@ -9,7 +9,7 @@ import "cosmos/base/v1beta1/coin.proto"; // Msg defines the distribution Msg service. service Msg { - // SetWithdrawAddress defines a method to change the withdraw address + // SetWithdrawAddress defines a method to change the withdraw address // for a delegator (or validator self-delegation). rpc SetWithdrawAddress(MsgSetWithdrawAddress) returns (MsgSetWithdrawAddressResponse); @@ -17,7 +17,7 @@ service Msg { // from a single validator. rpc WithdrawDelegatorReward(MsgWithdrawDelegatorReward) returns (MsgWithdrawDelegatorRewardResponse); - // WithdrawValidatorCommission defines a method to withdraw the + // WithdrawValidatorCommission defines a method to withdraw the // full commission to the validator address. rpc WithdrawValidatorCommission(MsgWithdrawValidatorCommission) returns (MsgWithdrawValidatorCommissionResponse); @@ -37,7 +37,7 @@ message MsgSetWithdrawAddress { } // MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response type. -message MsgSetWithdrawAddressResponse { } +message MsgSetWithdrawAddressResponse {} // MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator // from a single validator. @@ -50,7 +50,7 @@ message MsgWithdrawDelegatorReward { } // MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward response type. -message MsgWithdrawDelegatorRewardResponse { } +message MsgWithdrawDelegatorRewardResponse {} // MsgWithdrawValidatorCommission withdraws the full commission to the validator // address. @@ -62,7 +62,7 @@ message MsgWithdrawValidatorCommission { } // MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type. -message MsgWithdrawValidatorCommissionResponse { } +message MsgWithdrawValidatorCommissionResponse {} // MsgFundCommunityPool allows an account to directly // fund the community pool. @@ -76,4 +76,4 @@ message MsgFundCommunityPool { } // MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type. -message MsgFundCommunityPoolResponse { } +message MsgFundCommunityPoolResponse {} diff --git a/proto/cosmos/gov/v1beta1/tx.proto b/proto/cosmos/gov/v1beta1/tx.proto index 5c0560757d..d4f0c1f99a 100644 --- a/proto/cosmos/gov/v1beta1/tx.proto +++ b/proto/cosmos/gov/v1beta1/tx.proto @@ -7,7 +7,7 @@ import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types"; +option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types"; // Msg defines the bank Msg service. service Msg { @@ -24,7 +24,7 @@ service Msg { // MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary // proposal Content. message MsgSubmitProposal { - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = false; option (gogoproto.stringer) = false; option (gogoproto.goproto_getters) = false; @@ -40,12 +40,12 @@ message MsgSubmitProposal { // MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. message MsgSubmitProposalResponse { - uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (gogoproto.moretags) = "yaml:\"proposal_id\""]; + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (gogoproto.moretags) = "yaml:\"proposal_id\""]; } // MsgVote defines a message to cast a vote. message MsgVote { - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = false; option (gogoproto.stringer) = false; option (gogoproto.goproto_getters) = false; @@ -60,7 +60,7 @@ message MsgVoteResponse {} // MsgDeposit defines a message to submit a deposit to an existing proposal. message MsgDeposit { - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = false; option (gogoproto.stringer) = false; option (gogoproto.goproto_getters) = false; diff --git a/proto/cosmos/params/v1beta1/params.proto b/proto/cosmos/params/v1beta1/params.proto index 5b47261b19..5382fd7999 100644 --- a/proto/cosmos/params/v1beta1/params.proto +++ b/proto/cosmos/params/v1beta1/params.proto @@ -11,9 +11,9 @@ message ParameterChangeProposal { option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_stringer) = false; - string title = 1; - string description = 2; - repeated ParamChange changes = 3 [(gogoproto.nullable) = false]; + string title = 1; + string description = 2; + repeated ParamChange changes = 3 [(gogoproto.nullable) = false]; } // ParamChange defines an individual parameter change, for use in diff --git a/proto/cosmos/staking/v1beta1/staking.proto b/proto/cosmos/staking/v1beta1/staking.proto index ac68af05f4..eadc86e9d1 100644 --- a/proto/cosmos/staking/v1beta1/staking.proto +++ b/proto/cosmos/staking/v1beta1/staking.proto @@ -18,7 +18,7 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types"; // (`n` is set by the staking module's `historical_entries` parameter). message HistoricalInfo { tendermint.types.Header header = 1 [(gogoproto.nullable) = false]; - repeated Validator valset = 2 [(gogoproto.nullable) = false]; + repeated Validator valset = 2 [(gogoproto.nullable) = false]; } // CommissionRates defines the initial commission rates to be used for creating @@ -75,13 +75,12 @@ message Validator { option (gogoproto.goproto_stringer) = false; option (gogoproto.goproto_getters) = false; - string operator_address = 1 [(gogoproto.moretags) = "yaml:\"operator_address\""]; - google.protobuf.Any consensus_pubkey = 2 [ - (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", - (gogoproto.moretags) = "yaml:\"consensus_pubkey\""]; - bool jailed = 3; - BondStatus status = 4; - string tokens = 5 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; + string operator_address = 1 [(gogoproto.moretags) = "yaml:\"operator_address\""]; + google.protobuf.Any consensus_pubkey = 2 + [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", (gogoproto.moretags) = "yaml:\"consensus_pubkey\""]; + bool jailed = 3; + BondStatus status = 4; + string tokens = 5 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; string delegator_shares = 6 [ (gogoproto.moretags) = "yaml:\"delegator_shares\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", @@ -177,8 +176,8 @@ message UnbondingDelegation { option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_stringer) = false; - string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; - string validator_address = 2 [(gogoproto.moretags) = "yaml:\"validator_address\""]; + string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; + string validator_address = 2 [(gogoproto.moretags) = "yaml:\"validator_address\""]; repeated UnbondingDelegationEntry entries = 3 [(gogoproto.nullable) = false]; // unbonding delegation entries } @@ -222,10 +221,10 @@ message Redelegation { option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_stringer) = false; - string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; - string validator_src_address = 2 [(gogoproto.moretags) = "yaml:\"validator_src_address\""]; - string validator_dst_address = 3 [(gogoproto.moretags) = "yaml:\"validator_dst_address\""]; - repeated RedelegationEntry entries = 4 [(gogoproto.nullable) = false]; // redelegation entries + string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; + string validator_src_address = 2 [(gogoproto.moretags) = "yaml:\"validator_src_address\""]; + string validator_dst_address = 3 [(gogoproto.moretags) = "yaml:\"validator_dst_address\""]; + repeated RedelegationEntry entries = 4 [(gogoproto.nullable) = false]; // redelegation entries } // Params defines the parameters for the staking module. @@ -268,8 +267,8 @@ message RedelegationEntryResponse { message RedelegationResponse { option (gogoproto.equal) = false; - Redelegation redelegation = 1 [(gogoproto.nullable) = false]; - repeated RedelegationEntryResponse entries = 2 [(gogoproto.nullable) = false]; + Redelegation redelegation = 1 [(gogoproto.nullable) = false]; + repeated RedelegationEntryResponse entries = 2 [(gogoproto.nullable) = false]; } // Pool is used for tracking bonded and not-bonded token supply of the bond diff --git a/proto/cosmos/staking/v1beta1/tx.proto b/proto/cosmos/staking/v1beta1/tx.proto index 389957091d..ffcd74b2d9 100644 --- a/proto/cosmos/staking/v1beta1/tx.proto +++ b/proto/cosmos/staking/v1beta1/tx.proto @@ -51,7 +51,7 @@ message MsgCreateValidator { } // MsgCreateValidatorResponse defines the Msg/CreateValidator response type. -message MsgCreateValidatorResponse { } +message MsgCreateValidatorResponse {} // MsgEditValidator defines a SDK message for editing an existing validator. message MsgEditValidator { @@ -77,7 +77,7 @@ message MsgEditValidator { } // MsgEditValidatorResponse defines the Msg/EditValidator response type. -message MsgEditValidatorResponse { } +message MsgEditValidatorResponse {} // MsgDelegate defines a SDK message for performing a delegation of coins // from a delegator to a validator. @@ -91,7 +91,7 @@ message MsgDelegate { } // MsgDelegateResponse defines the Msg/Delegate response type. -message MsgDelegateResponse { } +message MsgDelegateResponse {} // MsgBeginRedelegate defines a SDK message for performing a redelegation // of coins from a delegator and source validator to a destination validator. diff --git a/proto/cosmos/tx/signing/v1beta1/signing.proto b/proto/cosmos/tx/signing/v1beta1/signing.proto index 73c8596483..4c1be40594 100644 --- a/proto/cosmos/tx/signing/v1beta1/signing.proto +++ b/proto/cosmos/tx/signing/v1beta1/signing.proto @@ -37,43 +37,43 @@ message SignatureDescriptors { // signature itself. It is primarily used for coordinating signatures between // clients. message SignatureDescriptor { - // public_key is the public key of the signer - google.protobuf.Any public_key = 1; + // public_key is the public key of the signer + google.protobuf.Any public_key = 1; - Data data = 2; + Data data = 2; - // sequence is the sequence of the account, which describes the - // number of committed transactions signed by a given address. It is used to prevent - // replay attacks. - uint64 sequence = 3; + // sequence is the sequence of the account, which describes the + // number of committed transactions signed by a given address. It is used to prevent + // replay attacks. + uint64 sequence = 3; - // Data represents signature data - message Data { - // sum is the oneof that specifies whether this represents single or multi-signature data - oneof sum { - // single represents a single signer - Single single = 1; + // Data represents signature data + message Data { + // sum is the oneof that specifies whether this represents single or multi-signature data + oneof sum { + // single represents a single signer + Single single = 1; - // multi represents a multisig signer - Multi multi = 2; - } - - // Single is the signature data for a single signer - message Single { - // mode is the signing mode of the single signer - SignMode mode = 1; - - // signature is the raw signature bytes - bytes signature = 2; - } - - // Multi is the signature data for a multisig public key - message Multi { - // bitarray specifies which keys within the multisig are signing - cosmos.crypto.multisig.v1beta1.CompactBitArray bitarray = 1; - - // signatures is the signatures of the multi-signature - repeated Data signatures = 2; - } + // multi represents a multisig signer + Multi multi = 2; } + + // Single is the signature data for a single signer + message Single { + // mode is the signing mode of the single signer + SignMode mode = 1; + + // signature is the raw signature bytes + bytes signature = 2; + } + + // Multi is the signature data for a multisig public key + message Multi { + // bitarray specifies which keys within the multisig are signing + cosmos.crypto.multisig.v1beta1.CompactBitArray bitarray = 1; + + // signatures is the signatures of the multi-signature + repeated Data signatures = 2; + } + } } diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index 99cfbcd719..d78216d031 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -10,68 +10,68 @@ option go_package = "github.com/cosmos/cosmos-sdk/types/tx"; // Service defines a gRPC service for interacting with transactions. service Service { - // Simulate simulates executing a transaction for estimating gas usage. - rpc Simulate(SimulateRequest) returns (SimulateResponse) { - option (google.api.http).post = "/cosmos/tx/v1beta1/simulate"; - } - // GetTx fetches a tx by hash. - rpc GetTx(GetTxRequest) returns (GetTxResponse) { - option (google.api.http).get = "/cosmos/tx/v1beta1/tx/{hash}"; - } + // Simulate simulates executing a transaction for estimating gas usage. + rpc Simulate(SimulateRequest) returns (SimulateResponse) { + option (google.api.http).post = "/cosmos/tx/v1beta1/simulate"; + } + // GetTx fetches a tx by hash. + rpc GetTx(GetTxRequest) returns (GetTxResponse) { + option (google.api.http).get = "/cosmos/tx/v1beta1/tx/{hash}"; + } - // GetTxsEvent fetches txs by event. - rpc GetTxsEvent(GetTxsEventRequest) returns (GetTxsEventResponse) { - option (google.api.http).get = "/cosmos/tx/v1beta1/txs"; - } + // GetTxsEvent fetches txs by event. + rpc GetTxsEvent(GetTxsEventRequest) returns (GetTxsEventResponse) { + option (google.api.http).get = "/cosmos/tx/v1beta1/txs"; + } } // GetTxsEventRequest is the request type for the Service.TxsByEvents // RPC method. message GetTxsEventRequest { - // event is the transaction event type. - string event = 1; - // pagination defines an pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; + // event is the transaction event type. + string event = 1; + // pagination defines an pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; } // GetTxsEventResponse is the response type for the Service.TxsByEvents // RPC method. message GetTxsEventResponse { - // txs is the list of queried transactions. - repeated cosmos.tx.v1beta1.Tx txs = 1; - // tx_responses is the list of queried TxResponses. - repeated cosmos.base.abci.v1beta1.TxResponse tx_responses = 2; - // pagination defines an pagination for the response. - cosmos.base.query.v1beta1.PageResponse pagination = 3; + // txs is the list of queried transactions. + repeated cosmos.tx.v1beta1.Tx txs = 1; + // tx_responses is the list of queried TxResponses. + repeated cosmos.base.abci.v1beta1.TxResponse tx_responses = 2; + // pagination defines an pagination for the response. + cosmos.base.query.v1beta1.PageResponse pagination = 3; } // SimulateRequest is the request type for the Service.Simulate // RPC method. message SimulateRequest { - // tx is the transaction to simulate. - cosmos.tx.v1beta1.Tx tx = 1; + // tx is the transaction to simulate. + cosmos.tx.v1beta1.Tx tx = 1; } - + // SimulateResponse is the response type for the // Service.SimulateRPC method. message SimulateResponse { - // gas_info is the information about gas used in the simulation. - cosmos.base.abci.v1beta1.GasInfo gas_info = 1; - // result is the result of the simulation. - cosmos.base.abci.v1beta1.Result result = 2; + // gas_info is the information about gas used in the simulation. + cosmos.base.abci.v1beta1.GasInfo gas_info = 1; + // result is the result of the simulation. + cosmos.base.abci.v1beta1.Result result = 2; } // GetTxRequest is the request type for the Service.GetTx // RPC method. message GetTxRequest { - // hash is the tx hash to query, encoded as a hex string. - string hash = 1; + // hash is the tx hash to query, encoded as a hex string. + string hash = 1; } // GetTxResponse is the response type for the Service.GetTx method. message GetTxResponse { - // tx is the queried transaction. - cosmos.tx.v1beta1.Tx tx = 1; - // tx_response is the queried TxResponses. - cosmos.base.abci.v1beta1.TxResponse tx_response = 2; + // tx is the queried transaction. + cosmos.tx.v1beta1.Tx tx = 1; + // tx_response is the queried TxResponses. + cosmos.base.abci.v1beta1.TxResponse tx_response = 2; } \ No newline at end of file diff --git a/proto/cosmos/upgrade/v1beta1/upgrade.proto b/proto/cosmos/upgrade/v1beta1/upgrade.proto index 858634b2b2..826440e5d7 100644 --- a/proto/cosmos/upgrade/v1beta1/upgrade.proto +++ b/proto/cosmos/upgrade/v1beta1/upgrade.proto @@ -39,7 +39,8 @@ message Plan { // so that connecting chains can verify that the new upgraded client is valid by verifying a proof on the // previous version of the chain. // This will allow IBC connections to persist smoothly across planned chain upgrades - google.protobuf.Any upgraded_client_state = 5 [(gogoproto.moretags) = "yaml:\"upgraded_client_state\""];; + google.protobuf.Any upgraded_client_state = 5 [(gogoproto.moretags) = "yaml:\"upgraded_client_state\""]; + ; } // SoftwareUpgradeProposal is a gov Content type for initiating a software diff --git a/proto/cosmos/vesting/v1beta1/tx.proto b/proto/cosmos/vesting/v1beta1/tx.proto index 41873315c0..c49be802a7 100644 --- a/proto/cosmos/vesting/v1beta1/tx.proto +++ b/proto/cosmos/vesting/v1beta1/tx.proto @@ -6,7 +6,6 @@ import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"; - // Msg defines the bank Msg service. service Msg { // CreateVestingAccount defines a method that enables creating a vesting @@ -14,7 +13,6 @@ service Msg { rpc CreateVestingAccount(MsgCreateVestingAccount) returns (MsgCreateVestingAccountResponse); } - // MsgCreateVestingAccount defines a message that enables creating a vesting // account. message MsgCreateVestingAccount { @@ -30,4 +28,4 @@ message MsgCreateVestingAccount { } // MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. -message MsgCreateVestingAccountResponse { } \ No newline at end of file +message MsgCreateVestingAccountResponse {} \ No newline at end of file diff --git a/proto/ibc/applications/transfer/v1/tx.proto b/proto/ibc/applications/transfer/v1/tx.proto index eb2e12e5df..a0f0827aaf 100644 --- a/proto/ibc/applications/transfer/v1/tx.proto +++ b/proto/ibc/applications/transfer/v1/tx.proto @@ -40,4 +40,4 @@ message MsgTransfer { } // MsgTransferResponse defines the Msg/Transfer response type. -message MsgTransferResponse { } +message MsgTransferResponse {} diff --git a/proto/ibc/core/channel/v1/genesis.proto b/proto/ibc/core/channel/v1/genesis.proto index 98a7e630aa..a89e69c7dd 100644 --- a/proto/ibc/core/channel/v1/genesis.proto +++ b/proto/ibc/core/channel/v1/genesis.proto @@ -8,11 +8,11 @@ import "ibc/core/channel/v1/channel.proto"; // GenesisState defines the ibc channel submodule's genesis state. message GenesisState { - repeated IdentifiedChannel channels = 1 [(gogoproto.casttype) = "IdentifiedChannel", (gogoproto.nullable) = false]; - repeated PacketState acknowledgements = 2 [(gogoproto.nullable) = false]; - repeated PacketState commitments = 3 [(gogoproto.nullable) = false]; - repeated PacketState receipts = 4 [(gogoproto.nullable) = false]; - repeated PacketSequence send_sequences = 5 + repeated IdentifiedChannel channels = 1 [(gogoproto.casttype) = "IdentifiedChannel", (gogoproto.nullable) = false]; + repeated PacketState acknowledgements = 2 [(gogoproto.nullable) = false]; + repeated PacketState commitments = 3 [(gogoproto.nullable) = false]; + repeated PacketState receipts = 4 [(gogoproto.nullable) = false]; + repeated PacketSequence send_sequences = 5 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"send_sequences\""]; repeated PacketSequence recv_sequences = 6 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"recv_sequences\""]; diff --git a/proto/ibc/core/channel/v1/query.proto b/proto/ibc/core/channel/v1/query.proto index 90d2adaea2..4121096240 100644 --- a/proto/ibc/core/channel/v1/query.proto +++ b/proto/ibc/core/channel/v1/query.proto @@ -37,8 +37,9 @@ service Query { // ChannelConsensusState queries for the consensus state for the channel // associated with the provided channel identifiers. rpc ChannelConsensusState(QueryChannelConsensusStateRequest) returns (QueryChannelConsensusStateResponse) { - option (google.api.http).get = "/ibc/core/channel/v1beta1/channels/{channel_id}/ports/{port_id}/consensus_state/version/" - "{version_number}/height/{version_height}"; + option (google.api.http).get = + "/ibc/core/channel/v1beta1/channels/{channel_id}/ports/{port_id}/consensus_state/version/" + "{version_number}/height/{version_height}"; } // PacketCommitment queries a stored packet commitment hash. @@ -55,21 +56,23 @@ service Query { // PacketReceipt queries if a given packet sequence has been received on the queried chain rpc PacketReceipt(QueryPacketReceiptRequest) returns (QueryPacketReceiptResponse) { - option (google.api.http).get = "/ibc/core/channel/v1beta1/channels/{channel_id}/ports/{port_id}/packet_receipts/{sequence}"; + option (google.api.http).get = + "/ibc/core/channel/v1beta1/channels/{channel_id}/ports/{port_id}/packet_receipts/{sequence}"; } // PacketAcknowledgement queries a stored packet acknowledgement hash. rpc PacketAcknowledgement(QueryPacketAcknowledgementRequest) returns (QueryPacketAcknowledgementResponse) { - option (google.api.http).get = "/ibc/core/channel/v1beta1/channels/{channel_id}/ports/{port_id}/packet_acks/{sequence}"; + option (google.api.http).get = + "/ibc/core/channel/v1beta1/channels/{channel_id}/ports/{port_id}/packet_acks/{sequence}"; } // PacketAcknowledgements returns all the packet acknowledgements associated // with a channel. rpc PacketAcknowledgements(QueryPacketAcknowledgementsRequest) returns (QueryPacketAcknowledgementsResponse) { - option (google.api.http).get = "/ibc/core/channel/v1beta1/channels/{channel_id}/ports/{port_id}/packet_acknowledgements"; + option (google.api.http).get = + "/ibc/core/channel/v1beta1/channels/{channel_id}/ports/{port_id}/packet_acknowledgements"; } - // UnreceivedPackets returns all the unreceived IBC packets associated with a // channel and sequences. rpc UnreceivedPackets(QueryUnreceivedPacketsRequest) returns (QueryUnreceivedPacketsResponse) { diff --git a/proto/ibc/core/client/v1/genesis.proto b/proto/ibc/core/client/v1/genesis.proto index 110140e232..b1c4247c94 100644 --- a/proto/ibc/core/client/v1/genesis.proto +++ b/proto/ibc/core/client/v1/genesis.proto @@ -9,17 +9,15 @@ import "gogoproto/gogo.proto"; // GenesisState defines the ibc client submodule's genesis state. message GenesisState { // client states with their corresponding identifiers - repeated IdentifiedClientState clients = 1 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "IdentifiedClientStates" - ]; + repeated IdentifiedClientState clients = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "IdentifiedClientStates"]; // consensus states from each client repeated ClientConsensusStates clients_consensus = 2 [ (gogoproto.nullable) = false, (gogoproto.castrepeated) = "ClientsConsensusStates", (gogoproto.moretags) = "yaml:\"clients_consensus\"" ]; - Params params = 3 [ (gogoproto.nullable) = false]; + Params params = 3 [(gogoproto.nullable) = false]; // create localhost on initialization bool create_localhost = 4 [(gogoproto.moretags) = "yaml:\"create_localhost\""]; } diff --git a/proto/ibc/core/client/v1/query.proto b/proto/ibc/core/client/v1/query.proto index 038b97bc46..7a1bf50538 100644 --- a/proto/ibc/core/client/v1/query.proto +++ b/proto/ibc/core/client/v1/query.proto @@ -34,8 +34,8 @@ service Query { option (google.api.http).get = "/ibc/core/client/v1beta1/consensus_states/{client_id}"; } - // ClientParams queries all parameters of the ibc client. - rpc ClientParams(QueryClientParamsRequest) returns (QueryClientParamsResponse) { + // ClientParams queries all parameters of the ibc client. + rpc ClientParams(QueryClientParamsRequest) returns (QueryClientParamsResponse) { option (google.api.http).get = "/ibc/client/v1beta1/params"; } } @@ -70,10 +70,8 @@ message QueryClientStatesRequest { // method. message QueryClientStatesResponse { // list of stored ClientStates of the chain. - repeated IdentifiedClientState client_states = 1 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "IdentifiedClientStates" - ]; + repeated IdentifiedClientState client_states = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "IdentifiedClientStates"]; // pagination response cosmos.base.query.v1beta1.PageResponse pagination = 2; } diff --git a/proto/ibc/core/client/v1/tx.proto b/proto/ibc/core/client/v1/tx.proto index efe843cba4..fd54a92108 100644 --- a/proto/ibc/core/client/v1/tx.proto +++ b/proto/ibc/core/client/v1/tx.proto @@ -39,7 +39,7 @@ message MsgCreateClient { } // MsgCreateClientResponse defines the Msg/CreateClient response type. -message MsgCreateClientResponse { } +message MsgCreateClientResponse {} // MsgUpdateClient defines an sdk.Msg to update a IBC client state using // the given header. @@ -56,7 +56,7 @@ message MsgUpdateClient { } // MsgUpdateClientResponse defines the Msg/UpdateClient response type. -message MsgUpdateClientResponse { } +message MsgUpdateClientResponse {} // MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client state message MsgUpgradeClient { @@ -73,7 +73,7 @@ message MsgUpgradeClient { } // MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. -message MsgUpgradeClientResponse { } +message MsgUpgradeClientResponse {} // MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for // light client misbehaviour. @@ -90,4 +90,4 @@ message MsgSubmitMisbehaviour { } // MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response type. -message MsgSubmitMisbehaviourResponse { } +message MsgSubmitMisbehaviourResponse {} diff --git a/proto/ibc/core/commitment/v1/commitment.proto b/proto/ibc/core/commitment/v1/commitment.proto index 9e9d22f081..51c1027316 100644 --- a/proto/ibc/core/commitment/v1/commitment.proto +++ b/proto/ibc/core/commitment/v1/commitment.proto @@ -36,5 +36,5 @@ message MerklePath { // should be succinct. // MerkleProofs are ordered from leaf-to-root message MerkleProof { - repeated ics23.CommitmentProof proofs = 1; + repeated ics23.CommitmentProof proofs = 1; } \ No newline at end of file diff --git a/proto/ibc/core/connection/v1/tx.proto b/proto/ibc/core/connection/v1/tx.proto index 8de521886b..02a12b0e31 100644 --- a/proto/ibc/core/connection/v1/tx.proto +++ b/proto/ibc/core/connection/v1/tx.proto @@ -18,7 +18,7 @@ service Msg { // ConnectionOpenAck defines a rpc handler method for MsgConnectionOpenAck. rpc ConnectionOpenAck(MsgConnectionOpenAck) returns (MsgConnectionOpenAckResponse); - + // ConnectionOpenConfirm defines a rpc handler method for MsgConnectionOpenConfirm. rpc ConnectionOpenConfirm(MsgConnectionOpenConfirm) returns (MsgConnectionOpenConfirmResponse); } @@ -37,7 +37,7 @@ message MsgConnectionOpenInit { } // MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit response type. -message MsgConnectionOpenInitResponse { } +message MsgConnectionOpenInitResponse {} // MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a // connection on Chain B. @@ -48,9 +48,9 @@ message MsgConnectionOpenTry { string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; string desired_connection_id = 2 [(gogoproto.moretags) = "yaml:\"desired_connection_id\""]; string counterparty_chosen_connection_id = 3 [(gogoproto.moretags) = "yaml:\"counterparty_chosen_connection_id\""]; - google.protobuf.Any client_state = 4 [(gogoproto.moretags) = "yaml:\"client_state\""]; - Counterparty counterparty = 5 [(gogoproto.nullable) = false]; - repeated Version counterparty_versions = 6 [(gogoproto.moretags) = "yaml:\"counterparty_versions\""]; + google.protobuf.Any client_state = 4 [(gogoproto.moretags) = "yaml:\"client_state\""]; + Counterparty counterparty = 5 [(gogoproto.nullable) = false]; + repeated Version counterparty_versions = 6 [(gogoproto.moretags) = "yaml:\"counterparty_versions\""]; ibc.core.client.v1.Height proof_height = 7 [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; // proof of the initialization the connection on Chain A: `UNITIALIZED -> @@ -66,7 +66,7 @@ message MsgConnectionOpenTry { } // MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response type. -message MsgConnectionOpenTryResponse { } +message MsgConnectionOpenTryResponse {} // MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to // acknowledge the change of connection state to TRYOPEN on Chain B. @@ -93,7 +93,7 @@ message MsgConnectionOpenAck { } // MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response type. -message MsgConnectionOpenAckResponse { } +message MsgConnectionOpenAckResponse {} // MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to // acknowledge the change of connection state to OPEN on Chain A. @@ -110,4 +110,4 @@ message MsgConnectionOpenConfirm { } // MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm response type. -message MsgConnectionOpenConfirmResponse { } +message MsgConnectionOpenConfirmResponse {} diff --git a/scripts/protocgen-any.sh b/scripts/protocgen-any.sh index 83ee1fe70d..2a094265d3 100755 --- a/scripts/protocgen-any.sh +++ b/scripts/protocgen-any.sh @@ -8,8 +8,8 @@ set -eo pipefail go install github.com/gogo/protobuf/protoc-gen-gogotypes -buf protoc -I. --gogotypes_out=./codec/types third_party/proto/google/protobuf/any.proto -mv codec/types/third_party/proto/google/protobuf/any.pb.go codec/types +buf protoc -I "third_party/proto" --gogotypes_out=./codec/types third_party/proto/google/protobuf/any.proto +mv codec/types/google/protobuf/any.pb.go codec/types rm -rf codec/types/third_party # This removes the call to RegisterType in the custom generated Any wrapper diff --git a/testutil/testdata/query.proto b/testutil/testdata/query.proto index 0090b4fca8..3a60acaad1 100644 --- a/testutil/testdata/query.proto +++ b/testutil/testdata/query.proto @@ -9,31 +9,31 @@ option go_package = "github.com/cosmos/cosmos-sdk/testutil/testdata"; // Query tests the protobuf Query service as defined in // https://github.com/cosmos/cosmos-sdk/issues/5921. service Query { - rpc Echo(EchoRequest) returns (EchoResponse); - rpc SayHello(SayHelloRequest) returns (SayHelloResponse); - rpc TestAny(TestAnyRequest) returns (TestAnyResponse); + rpc Echo(EchoRequest) returns (EchoResponse); + rpc SayHello(SayHelloRequest) returns (SayHelloResponse); + rpc TestAny(TestAnyRequest) returns (TestAnyResponse); } message EchoRequest { - string message = 1; + string message = 1; } message EchoResponse { - string message = 1; + string message = 1; } message SayHelloRequest { - string name = 1; + string name = 1; } message SayHelloResponse { - string greeting = 1; + string greeting = 1; } message TestAnyRequest { - google.protobuf.Any any_animal = 1; + google.protobuf.Any any_animal = 1; } message TestAnyResponse { - testdata.HasAnimal has_animal = 1; + testdata.HasAnimal has_animal = 1; } diff --git a/testutil/testdata/tx.proto b/testutil/testdata/tx.proto index 8f670fc50e..eaeb9580e5 100644 --- a/testutil/testdata/tx.proto +++ b/testutil/testdata/tx.proto @@ -9,20 +9,20 @@ option go_package = "github.com/cosmos/cosmos-sdk/testutil/testdata"; // Msg tests the Protobuf message service as defined in // https://github.com/cosmos/cosmos-sdk/issues/7500. service Msg { - rpc CreateDog(MsgCreateDog) returns (MsgCreateDogResponse); + rpc CreateDog(MsgCreateDog) returns (MsgCreateDogResponse); } message MsgCreateDog { - testdata.Dog dog = 1; + testdata.Dog dog = 1; } message MsgCreateDogResponse { - string name = 1; + string name = 1; } // TestMsg is msg type for testing protobuf message using any, as defined in // https://github.com/cosmos/cosmos-sdk/issues/6213. message TestMsg { - option (gogoproto.goproto_getters) = false; - repeated string signers = 1; + option (gogoproto.goproto_getters) = false; + repeated string signers = 1; } diff --git a/testutil/testdata/unknonwnproto.proto b/testutil/testdata/unknonwnproto.proto index a11773f92e..7bf1ce6bba 100644 --- a/testutil/testdata/unknonwnproto.proto +++ b/testutil/testdata/unknonwnproto.proto @@ -42,8 +42,8 @@ message Nested4A { } message Nested3A { - int32 id = 1; - string name = 2; + int32 id = 1; + string name = 2; repeated Nested4A a4 = 4; map index = 5; } @@ -66,10 +66,10 @@ message Nested4B { } message Nested3B { - int32 id = 1; - int32 age = 2; - string name = 3; - repeated Nested4B b4 = 4; + int32 id = 1; + int32 age = 2; + string name = 3; + repeated Nested4B b4 = 4; } message Nested2B { @@ -101,32 +101,32 @@ message Customer3 { } message TestVersion1 { - int64 x = 1; - TestVersion1 a = 2; - TestVersion1 b = 3; // [(gogoproto.nullable) = false] generates invalid recursive structs; + int64 x = 1; + TestVersion1 a = 2; + TestVersion1 b = 3; // [(gogoproto.nullable) = false] generates invalid recursive structs; repeated TestVersion1 c = 4; repeated TestVersion1 d = 5 [(gogoproto.nullable) = false]; oneof sum { int32 e = 6; TestVersion1 f = 7; } - google.protobuf.Any g = 8; + google.protobuf.Any g = 8; repeated TestVersion1 h = 9; // [(gogoproto.castrepeated) = "TestVersion1"]; // google.protobuf.Timestamp i = 10; // google.protobuf.Timestamp j = 11; // [(gogoproto.stdtime) = true]; Customer1 k = 12 [(gogoproto.embed) = true]; } message TestVersion2 { - int64 x = 1; - TestVersion2 a = 2; - TestVersion2 b = 3; // [(gogoproto.nullable) = false]; + int64 x = 1; + TestVersion2 a = 2; + TestVersion2 b = 3; // [(gogoproto.nullable) = false]; repeated TestVersion2 c = 4; repeated TestVersion2 d = 5; // [(gogoproto.nullable) = false]; oneof sum { int32 e = 6; TestVersion2 f = 7; } - google.protobuf.Any g = 8; + google.protobuf.Any g = 8; repeated TestVersion1 h = 9; // [(gogoproto.castrepeated) = "TestVersion1"]; // google.protobuf.Timestamp i = 10; // google.protobuf.Timestamp j = 11; // [(gogoproto.stdtime) = true]; @@ -134,16 +134,16 @@ message TestVersion2 { uint64 new_field = 25; } message TestVersion3 { - int64 x = 1; - TestVersion3 a = 2; - TestVersion3 b = 3; // [(gogoproto.nullable) = false]; + int64 x = 1; + TestVersion3 a = 2; + TestVersion3 b = 3; // [(gogoproto.nullable) = false]; repeated TestVersion3 c = 4; repeated TestVersion3 d = 5; // [(gogoproto.nullable) = false]; oneof sum { int32 e = 6; TestVersion3 f = 7; } - google.protobuf.Any g = 8; + google.protobuf.Any g = 8; repeated TestVersion1 h = 9; //[(gogoproto.castrepeated) = "TestVersion1"]; // google.protobuf.Timestamp i = 10; // google.protobuf.Timestamp j = 11; // [(gogoproto.stdtime) = true]; @@ -152,15 +152,15 @@ message TestVersion3 { } message TestVersion3LoneOneOfValue { - int64 x = 1; - TestVersion3 a = 2; - TestVersion3 b = 3; // [(gogoproto.nullable) = false]; + int64 x = 1; + TestVersion3 a = 2; + TestVersion3 b = 3; // [(gogoproto.nullable) = false]; repeated TestVersion3 c = 4; repeated TestVersion3 d = 5; // [(gogoproto.nullable) = false]; oneof sum { int32 e = 6; } - google.protobuf.Any g = 8; + google.protobuf.Any g = 8; repeated TestVersion1 h = 9; //[(gogoproto.castrepeated) = "TestVersion1"]; // google.protobuf.Timestamp i = 10; // google.protobuf.Timestamp j = 11; // [(gogoproto.stdtime) = true]; @@ -169,15 +169,15 @@ message TestVersion3LoneOneOfValue { } message TestVersion3LoneNesting { - int64 x = 1; - TestVersion3 a = 2; - TestVersion3 b = 3; // [(gogoproto.nullable) = false]; + int64 x = 1; + TestVersion3 a = 2; + TestVersion3 b = 3; // [(gogoproto.nullable) = false]; repeated TestVersion3 c = 4; repeated TestVersion3 d = 5; // [(gogoproto.nullable) = false]; oneof sum { TestVersion3LoneNesting f = 7; } - google.protobuf.Any g = 8; + google.protobuf.Any g = 8; repeated TestVersion1 h = 9; //[(gogoproto.castrepeated) = "TestVersion1"]; // google.protobuf.Timestamp i = 10; // google.protobuf.Timestamp j = 11; // [(gogoproto.stdtime) = true]; @@ -210,15 +210,15 @@ message TestVersion3LoneNesting { } message TestVersion4LoneNesting { - int64 x = 1; - TestVersion3 a = 2; - TestVersion3 b = 3; // [(gogoproto.nullable) = false]; + int64 x = 1; + TestVersion3 a = 2; + TestVersion3 b = 3; // [(gogoproto.nullable) = false]; repeated TestVersion3 c = 4; repeated TestVersion3 d = 5; // [(gogoproto.nullable) = false]; oneof sum { TestVersion3LoneNesting f = 7; } - google.protobuf.Any g = 8; + google.protobuf.Any g = 8; repeated TestVersion1 h = 9; //[(gogoproto.castrepeated) = "TestVersion1"]; // google.protobuf.Timestamp i = 10; // google.protobuf.Timestamp j = 11; // [(gogoproto.stdtime) = true]; @@ -257,7 +257,7 @@ message TestVersionFD1 { int32 e = 6; TestVersion1 f = 7; } - google.protobuf.Any g = 8; + google.protobuf.Any g = 8; repeated TestVersion1 h = 9; // [(gogoproto.castrepeated) = "TestVersion1"]; } @@ -268,7 +268,7 @@ message TestVersionFD1WithExtraAny { int32 e = 6; TestVersion1 f = 7; } - AnyWithExtra g = 8; + AnyWithExtra g = 8; repeated TestVersion1 h = 9; // [(gogoproto.castrepeated) = "TestVersion1"]; } @@ -279,11 +279,11 @@ message AnyWithExtra { } message TestUpdatedTxRaw { - bytes body_bytes = 1; - bytes auth_info_bytes = 2; - repeated bytes signatures = 3; - bytes new_field_5 = 5; - bytes new_field_1024 = 1024; + bytes body_bytes = 1; + bytes auth_info_bytes = 2; + repeated bytes signatures = 3; + bytes new_field_5 = 5; + bytes new_field_1024 = 1024; } message TestUpdatedTxBody { From 7e6978ae551bbed439c69178184dea0a25d0e747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?colin=20axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Fri, 13 Nov 2020 20:01:33 +0100 Subject: [PATCH 11/19] ibc: tendermint misbehaviour should use block hash for equality check (#7928) * check block hash equality * update err msg * valid commit now uses block id hash Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> --- x/ibc/light-clients/07-tendermint/types/misbehaviour.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/x/ibc/light-clients/07-tendermint/types/misbehaviour.go b/x/ibc/light-clients/07-tendermint/types/misbehaviour.go index 3e604e0f91..85fb615e5e 100644 --- a/x/ibc/light-clients/07-tendermint/types/misbehaviour.go +++ b/x/ibc/light-clients/07-tendermint/types/misbehaviour.go @@ -1,6 +1,7 @@ package types import ( + "bytes" "math" "time" @@ -107,8 +108,8 @@ func (misbehaviour Misbehaviour) ValidateBasic() error { } // Ensure that Commit Hashes are different - if blockID1.Equals(*blockID2) { - return sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "headers blockIDs are equal") + if bytes.Equal(blockID1.Hash, blockID2.Hash) { + return sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "headers block hashes are equal") } if err := ValidCommit(misbehaviour.Header1.Header.ChainID, misbehaviour.Header1.Commit, misbehaviour.Header1.ValidatorSet); err != nil { return err @@ -145,8 +146,8 @@ func ValidCommit(chainID string, commit *tmproto.Commit, valSet *tmproto.Validat blockID, ok := voteSet.TwoThirdsMajority() - // Check that ValidatorSet did indeed commit to blockID in Commit - if !ok || !blockID.Equals(tmCommit.BlockID) { + // Check that ValidatorSet did indeed commit to blockID hash in Commit + if !ok || !bytes.Equal(blockID.Hash, tmCommit.BlockID.Hash) { return sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "validator set did not commit to header") } From 2802529eeb468077f92fd920ac48bb63a9a47859 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Sat, 14 Nov 2020 14:44:07 +0000 Subject: [PATCH 12/19] prune testdata (#7937) Remove cruft leftover. --- .../00ddf62001f91b9aaf7758fb727bea3932bb236e.address | 1 - .../252b5fe0336e82b269d1c26e379b11b54474f57a.address | 1 - .../43ca6f8e891fd1ef46a28d67c9be33ffecd8a6f8.address | 1 - .../454b29a63587e58ce2487836d90bda016c6fff7c.address | 1 - .../900b3a0b8932e443b60fd6273cc3026aa25116c8.address | 1 - .../9a85abde78d0e55e7650f11dcfdbb6bd131038d0.address | 1 - client/keys/keyring-test/keyname1.info | 1 - client/keys/keyring-test/keyname2.info | 1 - client/keys/keyring-test/keyname4.info | 1 - client/keys/keyring-test/keyname5.info | 1 - client/keys/keyring-test/keyname6.info | 1 - client/keys/keyring-test/keyname7.info | 1 - 12 files changed, 12 deletions(-) delete mode 100644 client/keys/keyring-test/00ddf62001f91b9aaf7758fb727bea3932bb236e.address delete mode 100644 client/keys/keyring-test/252b5fe0336e82b269d1c26e379b11b54474f57a.address delete mode 100644 client/keys/keyring-test/43ca6f8e891fd1ef46a28d67c9be33ffecd8a6f8.address delete mode 100644 client/keys/keyring-test/454b29a63587e58ce2487836d90bda016c6fff7c.address delete mode 100644 client/keys/keyring-test/900b3a0b8932e443b60fd6273cc3026aa25116c8.address delete mode 100644 client/keys/keyring-test/9a85abde78d0e55e7650f11dcfdbb6bd131038d0.address delete mode 100644 client/keys/keyring-test/keyname1.info delete mode 100644 client/keys/keyring-test/keyname2.info delete mode 100644 client/keys/keyring-test/keyname4.info delete mode 100644 client/keys/keyring-test/keyname5.info delete mode 100644 client/keys/keyring-test/keyname6.info delete mode 100644 client/keys/keyring-test/keyname7.info diff --git a/client/keys/keyring-test/00ddf62001f91b9aaf7758fb727bea3932bb236e.address b/client/keys/keyring-test/00ddf62001f91b9aaf7758fb727bea3932bb236e.address deleted file mode 100644 index f53c291b43..0000000000 --- a/client/keys/keyring-test/00ddf62001f91b9aaf7758fb727bea3932bb236e.address +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0xMC0wOCAxMzowNjozOC45MTAzNTggLTA0MDAgRURUIG09KzAuMDUwMTczMjM4IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiT25IN1lscERZSHZUVFFQcCJ9.27X3naS_OL75csQLEIFoPvvCyYb9R4D573z1Z1obm3TRGn4HyPFN_w.GXNcqKAUkxqM537Q.cT169l1KGKeOra6NXHbx3kEOEDw77Lom-42mwKV0bRQ_5WZU3kG5o6Ix14r7LFL1ajjc8rdXkuiUgKQyVXEXVpo-6WkEfk2-D_CQaaUgq0-UErT-9Pj7djI3FZkPPG-yxlVSiQXB1xMk38I_AxYwAakctpwHlEK_YC0-UycFmk25Qjezar_ni69KDRPyuqCYh3dyhimG6LgdpWF4pQHjtZPy5qIqcaE7TR0OeKvf9MtsaKEzpAQOeAvh.WbbZ_Fs8qk9rsN6FuWa2zg \ No newline at end of file diff --git a/client/keys/keyring-test/252b5fe0336e82b269d1c26e379b11b54474f57a.address b/client/keys/keyring-test/252b5fe0336e82b269d1c26e379b11b54474f57a.address deleted file mode 100644 index 4e99364230..0000000000 --- a/client/keys/keyring-test/252b5fe0336e82b269d1c26e379b11b54474f57a.address +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0xMC0wOCAxMjo1MDoxOC4yMzA4ODggLTA0MDAgRURUIG09KzAuMTYxMTg1Nzk2IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiU3ZNM1hfZU42VHhpSVg3aiJ9.BjL9xqItRueA3u4ujcWPTp4TJjO6w4NeR9G7p32ndo63ADDGJ7j1JQ.8Fd_XM52yxKhF31U.7Cm3SBAmp0u4QffFwBgeueuU3rWT1npSKI5CUROX5COgKbDpqj5CaT54k6UGeZiUxv8itQXglUpAsg7XsF-1LjbbUAfVxXe9H9n1GcfxrLov0L8_Ia-5JadXMXkbvv9jKyjhVg6kSziQXoHcHaeauF1X0_ij3a-UVH87cLqsdAI_OXtptyU8GonVyt_Q0n8mljonjZhj2c_bmXmHARYXZOmCj52dmzSpmkyQ9vqdhlRPco93-JWR5P1V.5J7fb71-1WKJ91g02D0JGg \ No newline at end of file diff --git a/client/keys/keyring-test/43ca6f8e891fd1ef46a28d67c9be33ffecd8a6f8.address b/client/keys/keyring-test/43ca6f8e891fd1ef46a28d67c9be33ffecd8a6f8.address deleted file mode 100644 index d03cbd2cbc..0000000000 --- a/client/keys/keyring-test/43ca6f8e891fd1ef46a28d67c9be33ffecd8a6f8.address +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0xMC0wOCAxMjo1MzoyMy4yNjI0NzEgLTA0MDAgRURUIG09KzAuMDc2MzQ4MjA5IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiTE02SnY0RUdZNHBPLTQxWSJ9.wsqaCPHz_PlOH4_B3QlKT_4N9nTEjMzqn_Rqjq2ZM3vzf1dTO1_gjA.WVEaKSvNNWJ3ZaTT.eWrtCGCCplDULPw1QEyijVO_totUT5-6yx-TK4KP_BdKmhdEG8Bm319dXU33BchHthFa2VxDyB4NH_hsUenErJSKIJgJGoVc_AMwqrVZr0Wg0qJaay7jRGh1IRNXc0cuEsNpEek1C31tNaXjD2IuJzkicwdDT3BARFLFFdRhY97LG83YTvX0gVKyJFfjx8TAgUHZgpYyJMI4_vVajnneI-v1SYCY_VMbFTaCqWKFZdYOhu3x-hXfFBww.rxnMJbBz5OU4itr8nuyZgA \ No newline at end of file diff --git a/client/keys/keyring-test/454b29a63587e58ce2487836d90bda016c6fff7c.address b/client/keys/keyring-test/454b29a63587e58ce2487836d90bda016c6fff7c.address deleted file mode 100644 index 12fc44167b..0000000000 --- a/client/keys/keyring-test/454b29a63587e58ce2487836d90bda016c6fff7c.address +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0xMC0wOCAxMjo1MDoxOC4yNDQwMTEgLTA0MDAgRURUIG09KzAuMTc0MzMxMjAxIiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiYmlQLXR5Mnlvc3U2aHBvLSJ9.3drCmgYTeqS3PohaYKQc7i1fyjtOMuEPu_pDqMpT0UStPNDxG_LUDg.VS6Au9HoIruV0RiE._2BmFif-VbT_x4OD1NfsOCVFdL2MZfsG645SkptEKZAncOwHkKmWnBlKiV_LwnNzRBh-9eGGsCGfyou3zjUQRMDDHJOuW2EaVNmufmBWcAb9UoNO8O5kzPHwIvNqqJo5TQyjOviKCoP2PVcJXAwzttqDOw71B-9OuPwt_Ed4G6u8evwGIe08CzV6CKVImzj-AQg-1UI-uL06yFIEJ6CzB1DMdPR0qDQddP8pSYR_RTHnEUsii7HeKK1O.jqlYm4IZhXqe1k5kBQtguA \ No newline at end of file diff --git a/client/keys/keyring-test/900b3a0b8932e443b60fd6273cc3026aa25116c8.address b/client/keys/keyring-test/900b3a0b8932e443b60fd6273cc3026aa25116c8.address deleted file mode 100644 index 4f49e8bddd..0000000000 --- a/client/keys/keyring-test/900b3a0b8932e443b60fd6273cc3026aa25116c8.address +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0xMC0wOCAxMjo1MDoxOC4yMDQ1NjYgLTA0MDAgRURUIG09KzAuMTM0ODY0MzE4IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoidjVpMzRMY3NNbXduakEyMiJ9.XTokiwtSrKOIGREG7P7uaSfcV3hEr2ANHVUwaKbvLbuQVlTQO8fALw.bldSMLqfirE4GM9S.kNlvEojt1cavNW-nCaxX-Qk3tNm09xtXbuKppWbmMBUCf-_p-U_TWsnHuKbLon47RH1lxomrc1RpcfXwWhDEsGLwibtsjRdxz_2DGh124jeKOr4-Bl2raoPWdHKimm_cf5Ve17ChFfVy1AOaXwIr97ZdGWSU0FP8hOvv5_z5iUsuMK9T0DLxjz0162-_xSQMWWl4-hLknHz-QdO3oR_FpYo2K2eucNaFKmcN5Rn4s2n8FYLU9dIcopUF.WpNuRheBDoTiv3rK95yNjA \ No newline at end of file diff --git a/client/keys/keyring-test/9a85abde78d0e55e7650f11dcfdbb6bd131038d0.address b/client/keys/keyring-test/9a85abde78d0e55e7650f11dcfdbb6bd131038d0.address deleted file mode 100644 index 9110d23a6b..0000000000 --- a/client/keys/keyring-test/9a85abde78d0e55e7650f11dcfdbb6bd131038d0.address +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0xMC0wOCAxMjo1MDoxOC4yMjAyOSAtMDQwMCBFRFQgbT0rMC4xNTA1ODc4MjYiLCJlbmMiOiJBMjU2R0NNIiwicDJjIjo4MTkyLCJwMnMiOiJJYXRUWEFMVjBfeXV2ZnNMIn0.kCXD6XXDHeBiXR-GqF10fbMWBvy3qe38r16b92Xu3oLpA5c0a6ByMg.ONW9ggBJFhdfIA8M.IWm_ioQqOCLSK3FbSwjAlEVtzRR4AAW7ceIXpKzv_voaCGDNgcr7xSyRR5N-YK-sVYInwUDrme8rb5T14mjcsNgoGdKKB2QXuApY-GcPwpe2Tf7TyiCxFp91VotHnrbjCh1NvWnjDC-SZNm8HDVolkYtiBPkIkk0uFGh35WWprkVpgEYFyNIFQ0PP3XD4D9A58X0UXdGEu5Q8VcJnt1p86XUyI1le_LufJUrWAz3o_89n3xKj-b6sYzQ.KZSIrdNzE97BxrTSNkMkTw \ No newline at end of file diff --git a/client/keys/keyring-test/keyname1.info b/client/keys/keyring-test/keyname1.info deleted file mode 100644 index 6da5735e6e..0000000000 --- a/client/keys/keyring-test/keyname1.info +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0xMC0wOCAxMzowNjozOC45MDMwMjcgLTA0MDAgRURUIG09KzAuMDQyODQyNTY4IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiSjBxN2Zza0pGRUJJR25mYSJ9.W91-I2lpaBfacsUO2Xn2_tCadqztjGX7MjAkA6GKL4uMkqjEHDXyhw.c8uKD9z5w-jpSmq1.XGnt9JaOg0VT1cjg4RAlwC6Bsq9KowSF6wM6Ak1Y16Kq4sV3NnwA4CqJKnluIjAG6D4sfBKEs2FCHy5zux4uaOQ3Y5EJjRxWoTdBP7HahmO2-jsSFX_sPIzr86KIlKIqaYFJAOUqvaObOsQkX3EL_2-vDonSRMz32abg8thFS6mNi7NtM4xGXQ5Knrix-6OgzBmvWbn4Y0v82vNNWh8d4ubKf_RSEBV7CIWfuFg2CxfRq5EbUUmtMINF74eG52F8y8zjTDcn6n3qKLcecdr6s0n1tc7iq-f3s1EHnzPefwROPLFxiq0Zyt7N7vZCSowOElYZtgQWEg0dy6CIyZ274gNPlfLXMHA-kUsZj4Q_3w.sUPc7D8bBR4I3S-njXa4Ww \ No newline at end of file diff --git a/client/keys/keyring-test/keyname2.info b/client/keys/keyring-test/keyname2.info deleted file mode 100644 index bc7b594c5a..0000000000 --- a/client/keys/keyring-test/keyname2.info +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0xMC0wOCAxMjo1MzoyMy4yNTg0OTUgLTA0MDAgRURUIG09KzAuMDcyMzcyNTM1IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiTW1XOFlVU0Nia2JUNW9iSSJ9.JyBrlPAvgtgYWwu0rcfTn6k9qvv6DywUotcWxPUiJncCBue2WPC5cQ.CmWeu5wMFFinUfiE.FA9k3Q_W8mBgSuJRkYV8h_U5YR2mDmW595L4DnFzuSFJ19Us0O1SQF9-xPJQAyjh4jli46o5mfFfsmU0ce1h4HwklW7AdrRJXVXZ0reZLjrdiojCbLvzyM9tsWInRXi6izUcwLggv2lNCXP5UIRpjMpUPiEC4GsHiwNH8qN04_feICxHuSWJ4mKLWEDtgKxHTrBqvaHT304UF6gRD-_W9_hWdEIj66-5HE4jlxcJAe22WdoF2Z1c3ujhm4piSfHaNnWYsZHLI5Jy1WhkFC2eULOe31c6eAeik5DyUUdWKvAoSiEk4H0Z9EcSbNzlW2rrU30WIIb-icK1qLID21WYurbxM8zvXl-CvhSM2VRN1g.tu_usvTlCOy3okBKmC6zHg \ No newline at end of file diff --git a/client/keys/keyring-test/keyname4.info b/client/keys/keyring-test/keyname4.info deleted file mode 100644 index 2a198cd917..0000000000 --- a/client/keys/keyring-test/keyname4.info +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0xMC0wOCAxMjo1MDoxOC4xOTkwMDUgLTA0MDAgRURUIG09KzAuMTI5MzA0MDMxIiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiYzVYM09VdTBtQmJ4TFd4ayJ9.Pa4p1u-9N9x4E9-5rjUlReLsfH3TvTfAw-Dr1iV8z5ccAfnqLY1UWQ.Q41_cYh4c-C2zi3v.aFna4CwpZeGQBI2_ecOzlJSKypCV0NLCD8PCOnpYvY-k-HqoUFSeouFbuKeN9VaIo12JSZmjzGhfCAupZDBcSJisLVHOvaBAjl5XCOa8k49jb-aSopMI4HXQWatBJcnM65p9Hl1JrYOcnoKPxNKzJ4PiPQnHKv_VgAvWU_CBt6nnSjkwwVJjPMobgvNzeQTEFq-4pyziJNDbDWKUrQSrc-VaO-31JBlhpu6dPOJPFsnOcMyPc76po5cAQQdog-g79d59_Y4vj8s7qd-YPCHnWmoCbgf9w8vbpmJ4Y9evXZQz8A0-c0rFX7F96aZBYtQOeC1ZpRi0BMsbs_WHrpdN678HXej6YpfNDijQmiNYzQ.ayDBvX4W6GiGxAjN3ch8DA \ No newline at end of file diff --git a/client/keys/keyring-test/keyname5.info b/client/keys/keyring-test/keyname5.info deleted file mode 100644 index 5c9bbe4e97..0000000000 --- a/client/keys/keyring-test/keyname5.info +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0xMC0wOCAxMjo1MDoxOC4yMTYwNTkgLTA0MDAgRURUIG09KzAuMTQ2MzU3MTI5IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoidmNnOXNfXzFvY0N1ZC1YTCJ9.hQ21Z1cXTw925V8Xxm_Gywb05S92rKEX54tnELv16xZvkgV8XiEj9A.4Wnaa4LemIi3bdIT.kEJyzWUvmLof5_bYbDePbrYyfjyqTLuUIOdnom3igOuwfzFDHtPuEb3rSLKjxj7LgJOmZVqZGP_ihW1sJQPXbK7ZuWA4zH_Wf-n5T8CFDmNIUhlUIb6sfd_ze-s45CE58hjKRkp7b5k61xBnMujZ5KC5Vk_JHUOUyZB5SqhTuEUJDjSSCFnMDJ1UYKEp23U__XFwcZonent4IMfM0fWvmA6NC2h0qLAMcKw9hbJ_yyNHt2I3lI5twthsAOsXKxUkjhx7c9Tc7BnttFxq-puD_QyjReExP77DzuueDJ-5KBd8PMgeiQMHoYM8e2NAAJU7MXe7voB-D8Ki2QcEgH7GfHNcr6vP1by3hvV5M32OXg.ifBDbtRjrXBOdH_jEORHgw \ No newline at end of file diff --git a/client/keys/keyring-test/keyname6.info b/client/keys/keyring-test/keyname6.info deleted file mode 100644 index f193785ba6..0000000000 --- a/client/keys/keyring-test/keyname6.info +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0xMC0wOCAxMjo1MDoxOC4yMjY1OTEgLTA0MDAgRURUIG09KzAuMTU2ODg5MTU0IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiNUtTSWJtdGhCVHVSUnRjYyJ9.qD2C7cQK5P0EHy2Yr-uQZzMHep6U6n57z2LwWTmgxQp6m7ujLw-C-g.rmsltoJfFO4e56RZ.IDpVmduqe2WgyepT_-paXzcosHQzK6sfKY9JH16lT4QRVJ_lAozQOyZrW3X5MbgefrmtXGsoEIEFYhTDYBtXxrW7IqLaBhSCiA5MVwR403H3C2NkcygdGDdR-uDQGW3_bp7xnOhVL_3ofu0-7MQMMhZyz_wEmVW-aG7F6lN68TPaO5KTIqfnI8vOJyyZsSgB0M0gA3f-P4aar64YDTUdjgXPOSBkyRZr07JIOauGhTFXwmHWsDVBvGo3aIIx9ybAg_Blgo8ZAPqOJ6EYmA3J5RE2_LkfJjgI8dEpIFaviBHeWrG54AAN0klQ7trq9MOCpUGPc7PqySwiwTmxb2g4kFH9fR_yQ-g5g6mjj3JYVA.GRnNxd28SYmRt1I9twptPw \ No newline at end of file diff --git a/client/keys/keyring-test/keyname7.info b/client/keys/keyring-test/keyname7.info deleted file mode 100644 index 7b09ba0a78..0000000000 --- a/client/keys/keyring-test/keyname7.info +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0xMC0wOCAxMjo1MDoxOC4yMzg1MTQgLTA0MDAgRURUIG09KzAuMTY4ODExNzMwIiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiUmZDZC0xeGh6OVJ3RzJfViJ9.hMyIYfHwLYAwJs6THPC30rWfhd1SRUl5po4ifTvln5cV_VHyHLW3MQ.ku5jtKB-G5acpq4v.s0oNPaUaRQbFk-X8AL8QitkI_SdBWB2BpBmRRbo2ZMAkq4x81hSC5p7RlSrM3OGTNFZ4yOrRgzdMv43YpCl7ZpJIypF4l7Hyvl_13jTjqzB7o81dEhl_10SI_Fw607VKCnwqq02_VoqD489EpMVuQ05Fg2pUT3M_mJMacGztORYVJrIWwzbyUiHfM4GlnaoUQaKfwbkHS2W2-1wOPTSWTLEBVJlRG1EAZR_upcPJolcAStjl8PY5EfkxXD56c8Xu6SI8LjMrJAXXg7lTqOGNOkt0v8M8UZWd95Gy2zH_KJm3ItYR_YjPoMIHh-_Cb2-0uoXNRyykW4EpGptp08n7QubSYltzXwaw_NgLP9KUmg.67EgfbLDNyvEYCR12Bjoew \ No newline at end of file From 6cbbe0d4ef90f886dfc356979b89979ddfcd00d8 Mon Sep 17 00:00:00 2001 From: Riccardo Montagnin Date: Sun, 15 Nov 2020 13:29:37 +0100 Subject: [PATCH 13/19] Update dependencies to use gRPC v1.33.2 (#7925) * Updated gRCP version to v1.33.1 since v1.33.0 was deleted (see https://github.com/grpc/grpc-go/issues/3945) * Updated CHANGELOG * Updated CHANGELOG Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- CHANGELOG.md | 6 ++++++ go.mod | 13 ++++++------- go.sum | 24 ++++++++++++++---------- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index efaf660f3d..7e63adfaca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,12 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +### Improvements +- (SDK) [\#7925](https://github.com/cosmos/cosmos-sdk/pull/7925) Updated dependencies to use gRPC v1.33.2 + * Updated gRPC dependency to v1.33.2 + * Updated iavl dependency to v0.15-rc2 + + ## [v0.40.0-rc3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.40.0-rc3) - 2020-11-06 ### Client Breaking diff --git a/go.mod b/go.mod index 004cb69e0b..7049f591ab 100644 --- a/go.mod +++ b/go.mod @@ -11,9 +11,8 @@ require ( github.com/btcsuite/btcutil v1.0.2 github.com/confio/ics23/go v0.6.3 github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d - github.com/cosmos/iavl v0.15.0-rc4 + github.com/cosmos/iavl v0.15.0-rc5 github.com/cosmos/ledger-cosmos-go v0.11.1 - github.com/dgraph-io/badger/v2 v2.2007.2 // indirect github.com/dgraph-io/ristretto v0.0.3 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/enigmampc/btcutil v1.0.3-0.20200723161021-e2fb6adb2a25 @@ -24,7 +23,7 @@ require ( github.com/golang/snappy v0.0.2 // indirect github.com/gorilla/handlers v1.5.1 github.com/gorilla/mux v1.8.0 - github.com/grpc-ecosystem/grpc-gateway v1.15.2 + github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/hashicorp/golang-lru v0.5.4 github.com/magiconair/properties v1.8.4 github.com/mattn/go-isatty v0.0.12 @@ -46,11 +45,11 @@ require ( github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 github.com/tendermint/go-amino v0.16.0 github.com/tendermint/tendermint v0.34.0-rc6 - github.com/tendermint/tm-db v0.6.2 - golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee + github.com/tendermint/tm-db v0.6.3 + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 golang.org/x/net v0.0.0-20200930145003-4acb6c075d10 // indirect - google.golang.org/genproto v0.0.0-20201014134559-03b6142f0dc9 - google.golang.org/grpc v1.33.0 + google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6 + google.golang.org/grpc v1.33.2 google.golang.org/protobuf v1.25.0 gopkg.in/yaml.v2 v2.3.0 ) diff --git a/go.sum b/go.sum index 8090e2d10b..db70ba9caf 100644 --- a/go.sum +++ b/go.sum @@ -121,8 +121,8 @@ github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfc github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE= -github.com/cosmos/iavl v0.15.0-rc4 h1:P1wmET7BueqCzfxsn+BzVkDWDLY9ij2JNwkbIdM7RG8= -github.com/cosmos/iavl v0.15.0-rc4/go.mod h1:5CsecJdh44Uj4vZ6WSPeWq84hNW5BwRI36ZsAbfJvRw= +github.com/cosmos/iavl v0.15.0-rc5 h1:AMKgaAjXwGANWv56NL4q4hV+a0puSkLYD6cCQAv3i44= +github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I= github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI= @@ -284,8 +284,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t github.com/grpc-ecosystem/grpc-gateway v1.9.5 h1:UImYN5qQ8tuGpGE16ZmjvcTtTw24zw1QAp/SlnNrZhI= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU= -github.com/grpc-ecosystem/grpc-gateway v1.15.2 h1:HC+hWRWf+v5zTMPyoaYTKIJih+4sd4XRWmj0qlG87Co= -github.com/grpc-ecosystem/grpc-gateway v1.15.2/go.mod h1:vO11I9oWA+KsxmfFQPhLnnIb1VDE24M+pdxZFiuZcA8= +github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= @@ -599,6 +599,8 @@ github.com/tendermint/tendermint v0.34.0-rc6 h1:SVuKGvvE22KxfuK8QUHctUrmOWJsncZS github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg= github.com/tendermint/tm-db v0.6.2 h1:DOn8jwCdjJblrCFJbtonEIPD1IuJWpbRUUdR8GWE4RM= github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI= +github.com/tendermint/tm-db v0.6.3 h1:ZkhQcKnB8/2jr5EaZwGndN4owkPsGezW2fSisS9zGbg= +github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= @@ -643,8 +645,8 @@ golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee h1:4yd7jl+vXjalO5ztz6Vc1VADv+S/80LGJmyl1ROJ2AI= -golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -692,6 +694,7 @@ golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200930145003-4acb6c075d10 h1:YfxMZzv3PjGonQYNUaeU2+DhAdqOxerQ30JFB6WgAXo= golang.org/x/net v0.0.0-20200930145003-4acb6c075d10/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -808,8 +811,8 @@ google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201014134559-03b6142f0dc9 h1:fG84H9C3EXfuDlzkG+VEPDYHHExklP6scH1QZ5gQTqU= -google.golang.org/genproto v0.0.0-20201014134559-03b6142f0dc9/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6 h1:iRN4+t0lvZX/l9gH14ARF9i58tsVa5a97k6aH95rC3Y= +google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -828,8 +831,9 @@ google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3Iji google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.0 h1:IBKSUNL2uBS2DkJBncPP+TwT0sp9tgA8A75NjHt6umg= -google.golang.org/grpc v1.33.0/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= From 6b62d266bb01a1561fd13721c868fe1d130ad179 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Mon, 16 Nov 2020 10:14:21 +0100 Subject: [PATCH 14/19] use verifycommitlight (#7936) --- .../07-tendermint/types/misbehaviour.go | 28 +++++-------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/x/ibc/light-clients/07-tendermint/types/misbehaviour.go b/x/ibc/light-clients/07-tendermint/types/misbehaviour.go index 85fb615e5e..d4de93504e 100644 --- a/x/ibc/light-clients/07-tendermint/types/misbehaviour.go +++ b/x/ibc/light-clients/07-tendermint/types/misbehaviour.go @@ -111,27 +111,19 @@ func (misbehaviour Misbehaviour) ValidateBasic() error { if bytes.Equal(blockID1.Hash, blockID2.Hash) { return sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "headers block hashes are equal") } - if err := ValidCommit(misbehaviour.Header1.Header.ChainID, misbehaviour.Header1.Commit, misbehaviour.Header1.ValidatorSet); err != nil { + if err := validCommit(misbehaviour.Header1.Header.ChainID, *blockID1, + misbehaviour.Header1.Commit, misbehaviour.Header1.ValidatorSet); err != nil { return err } - if err := ValidCommit(misbehaviour.Header2.Header.ChainID, misbehaviour.Header2.Commit, misbehaviour.Header2.ValidatorSet); err != nil { + if err := validCommit(misbehaviour.Header2.Header.ChainID, *blockID2, + misbehaviour.Header2.Commit, misbehaviour.Header2.ValidatorSet); err != nil { return err } return nil } -// ValidCommit checks if the given commit is a valid commit from the passed-in validatorset -// -// CommitToVoteSet will panic if the commit cannot be converted to a valid voteset given the validatorset -// This implies that someone tried to submit misbehaviour that wasn't actually committed by the validatorset -// thus we should return an error here and reject the misbehaviour rather than panicing. -func ValidCommit(chainID string, commit *tmproto.Commit, valSet *tmproto.ValidatorSet) (err error) { - defer func() { - if r := recover(); r != nil { - err = sdkerrors.Wrapf(clienttypes.ErrInvalidMisbehaviour, "invalid commit: %v", r) - } - }() - +// validCommit checks if the given commit is a valid commit from the passed-in validatorset +func validCommit(chainID string, blockID tmtypes.BlockID, commit *tmproto.Commit, valSet *tmproto.ValidatorSet) (err error) { tmCommit, err := tmtypes.CommitFromProto(commit) if err != nil { return sdkerrors.Wrap(err, "commit is not tendermint commit type") @@ -141,13 +133,7 @@ func ValidCommit(chainID string, commit *tmproto.Commit, valSet *tmproto.Validat return sdkerrors.Wrap(err, "validator set is not tendermint validator set type") } - // Convert commits to vote-sets given the validator set so we can check if they both have 2/3 power - voteSet := tmtypes.CommitToVoteSet(chainID, tmCommit, tmValset) - - blockID, ok := voteSet.TwoThirdsMajority() - - // Check that ValidatorSet did indeed commit to blockID hash in Commit - if !ok || !bytes.Equal(blockID.Hash, tmCommit.BlockID.Hash) { + if err := tmValset.VerifyCommitLight(chainID, blockID, tmCommit.Height, tmCommit); err != nil { return sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "validator set did not commit to header") } From cd29fd642a3c948c68355e5f14e55405242aed3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?colin=20axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 16 Nov 2020 10:30:57 +0100 Subject: [PATCH 15/19] Fix connection path validation and remove unused PathValidator function (#7930) Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- x/ibc/core/03-connection/types/connection_test.go | 13 +++++++------ x/ibc/core/03-connection/types/genesis.go | 6 +++--- x/ibc/core/03-connection/types/genesis_test.go | 9 ++++----- x/ibc/core/24-host/validate.go | 11 ----------- x/ibc/core/24-host/validate_test.go | 7 ++++++- x/ibc/core/genesis_test.go | 13 ++++++------- 6 files changed, 26 insertions(+), 33 deletions(-) diff --git a/x/ibc/core/03-connection/types/connection_test.go b/x/ibc/core/03-connection/types/connection_test.go index ff2aa08d4a..93891cbea1 100644 --- a/x/ibc/core/03-connection/types/connection_test.go +++ b/x/ibc/core/03-connection/types/connection_test.go @@ -12,12 +12,13 @@ import ( ) var ( - chainID = "gaiamainnet" - connectionID = "connectionidone" - clientID = "clientidone" - connectionID2 = "connectionidtwo" - clientID2 = "clientidtwo" - clientHeight = clienttypes.NewHeight(0, 6) + chainID = "gaiamainnet" + connectionID = "connectionidone" + clientID = "clientidone" + connectionID2 = "connectionidtwo" + clientID2 = "clientidtwo" + invalidConnectionID = "(invalidConnectionID)" + clientHeight = clienttypes.NewHeight(0, 6) ) func TestConnectionValidateBasic(t *testing.T) { diff --git a/x/ibc/core/03-connection/types/genesis.go b/x/ibc/core/03-connection/types/genesis.go index 9b155a368b..58b21678c2 100644 --- a/x/ibc/core/03-connection/types/genesis.go +++ b/x/ibc/core/03-connection/types/genesis.go @@ -45,9 +45,9 @@ func (gs GenesisState) Validate() error { if err := host.ClientIdentifierValidator(conPaths.ClientId); err != nil { return fmt.Errorf("invalid client connection path %d: %w", i, err) } - for _, path := range conPaths.Paths { - if err := host.PathValidator(path); err != nil { - return fmt.Errorf("invalid client connection path %d: %w", i, err) + for _, connectionID := range conPaths.Paths { + if err := host.ConnectionIdentifierValidator(connectionID); err != nil { + return fmt.Errorf("invalid client connection ID (%s) in connection paths %d: %w", connectionID, i, err) } } } diff --git a/x/ibc/core/03-connection/types/genesis_test.go b/x/ibc/core/03-connection/types/genesis_test.go index 8080f49d5c..6290a98a9f 100644 --- a/x/ibc/core/03-connection/types/genesis_test.go +++ b/x/ibc/core/03-connection/types/genesis_test.go @@ -7,7 +7,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/ibc/core/03-connection/types" commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/core/23-commitment/types" - host "github.com/cosmos/cosmos-sdk/x/ibc/core/24-host" ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing" ) @@ -30,7 +29,7 @@ func TestValidateGenesis(t *testing.T) { types.NewIdentifiedConnection(connectionID, types.NewConnectionEnd(types.INIT, clientID, types.Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}, []*types.Version{ibctesting.ConnectionVersion})), }, []types.ConnectionPaths{ - {clientID, []string{host.ConnectionPath(connectionID)}}, + {clientID, []string{connectionID}}, }, ), expPass: true, @@ -42,7 +41,7 @@ func TestValidateGenesis(t *testing.T) { types.NewIdentifiedConnection(connectionID, types.NewConnectionEnd(types.INIT, "(CLIENTIDONE)", types.Counterparty{clientID, connectionID, commitmenttypes.NewMerklePrefix([]byte("prefix"))}, []*types.Version{ibctesting.ConnectionVersion})), }, []types.ConnectionPaths{ - {clientID, []string{host.ConnectionPath(connectionID)}}, + {clientID, []string{connectionID}}, }, ), expPass: false, @@ -54,7 +53,7 @@ func TestValidateGenesis(t *testing.T) { types.NewIdentifiedConnection(connectionID, types.NewConnectionEnd(types.INIT, clientID, types.Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}, []*types.Version{ibctesting.ConnectionVersion})), }, []types.ConnectionPaths{ - {"(CLIENTIDONE)", []string{host.ConnectionPath(connectionID)}}, + {"(CLIENTIDONE)", []string{connectionID}}, }, ), expPass: false, @@ -66,7 +65,7 @@ func TestValidateGenesis(t *testing.T) { types.NewIdentifiedConnection(connectionID, types.NewConnectionEnd(types.INIT, clientID, types.Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}, []*types.Version{ibctesting.ConnectionVersion})), }, []types.ConnectionPaths{ - {clientID, []string{connectionID}}, + {clientID, []string{invalidConnectionID}}, }, ), expPass: false, diff --git a/x/ibc/core/24-host/validate.go b/x/ibc/core/24-host/validate.go index bbfafbee75..d589223f58 100644 --- a/x/ibc/core/24-host/validate.go +++ b/x/ibc/core/24-host/validate.go @@ -112,14 +112,3 @@ func NewPathValidator(idValidator ValidateFn) ValidateFn { return nil } } - -// PathValidator takes in path string and validates with default identifier rules: -// path consists of `/`-separated valid identifiers, -// each identifier is between 1-64 characters and contains only alphanumeric and some allowed -// special characters (see IsValidID). -func PathValidator(path string) error { - f := NewPathValidator(func(path string) error { - return nil - }) - return f(path) -} diff --git a/x/ibc/core/24-host/validate_test.go b/x/ibc/core/24-host/validate_test.go index 41dd5167d9..40987bd157 100644 --- a/x/ibc/core/24-host/validate_test.go +++ b/x/ibc/core/24-host/validate_test.go @@ -73,7 +73,12 @@ func TestPathValidator(t *testing.T) { } for _, tc := range testCases { - err := PathValidator(tc.id) + f := NewPathValidator(func(path string) error { + return nil + }) + + err := f(tc.id) + if tc.expPass { seps := strings.Count(tc.id, "/") require.Equal(t, 1, seps) diff --git a/x/ibc/core/genesis_test.go b/x/ibc/core/genesis_test.go index a14669faaa..d435cf8566 100644 --- a/x/ibc/core/genesis_test.go +++ b/x/ibc/core/genesis_test.go @@ -14,7 +14,6 @@ import ( connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/core/03-connection/types" channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types" commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/core/23-commitment/types" - host "github.com/cosmos/cosmos-sdk/x/ibc/core/24-host" "github.com/cosmos/cosmos-sdk/x/ibc/core/exported" "github.com/cosmos/cosmos-sdk/x/ibc/core/types" ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/light-clients/07-tendermint/types" @@ -77,7 +76,7 @@ func (suite *IBCTestSuite) TestValidateGenesis() { ClientGenesis: clienttypes.NewGenesisState( []clienttypes.IdentifiedClientState{ clienttypes.NewIdentifiedClientState( - clientID, ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false), + clientID, ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false), ), clienttypes.NewIdentifiedClientState( exported.Localhost, localhosttypes.NewClientState("chaindID", clientHeight), @@ -104,7 +103,7 @@ func (suite *IBCTestSuite) TestValidateGenesis() { connectiontypes.NewIdentifiedConnection(connectionID, connectiontypes.NewConnectionEnd(connectiontypes.INIT, clientID, connectiontypes.NewCounterparty(clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))), []*connectiontypes.Version{ibctesting.ConnectionVersion})), }, []connectiontypes.ConnectionPaths{ - connectiontypes.NewConnectionPaths(clientID, []string{host.ConnectionPath(connectionID)}), + connectiontypes.NewConnectionPaths(clientID, []string{connectionID}), }, ), ChannelGenesis: channeltypes.NewGenesisState( @@ -144,7 +143,7 @@ func (suite *IBCTestSuite) TestValidateGenesis() { ClientGenesis: clienttypes.NewGenesisState( []clienttypes.IdentifiedClientState{ clienttypes.NewIdentifiedClientState( - clientID, ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false), + clientID, ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false), ), clienttypes.NewIdentifiedClientState( exported.Localhost, localhosttypes.NewClientState("(chaindID)", clienttypes.ZeroHeight()), @@ -167,7 +166,7 @@ func (suite *IBCTestSuite) TestValidateGenesis() { connectiontypes.NewIdentifiedConnection(connectionID, connectiontypes.NewConnectionEnd(connectiontypes.INIT, "(CLIENTIDONE)", connectiontypes.NewCounterparty(clientID, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))), []*connectiontypes.Version{connectiontypes.NewVersion("1.1", nil)})), }, []connectiontypes.ConnectionPaths{ - connectiontypes.NewConnectionPaths(clientID, []string{host.ConnectionPath(connectionID)}), + connectiontypes.NewConnectionPaths(clientID, []string{connectionID}), }, ), }, @@ -216,7 +215,7 @@ func (suite *IBCTestSuite) TestInitGenesis() { ClientGenesis: clienttypes.NewGenesisState( []clienttypes.IdentifiedClientState{ clienttypes.NewIdentifiedClientState( - clientID, ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false), + clientID, ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false), ), clienttypes.NewIdentifiedClientState( exported.Localhost, localhosttypes.NewClientState("chaindID", clientHeight), @@ -243,7 +242,7 @@ func (suite *IBCTestSuite) TestInitGenesis() { connectiontypes.NewIdentifiedConnection(connectionID, connectiontypes.NewConnectionEnd(connectiontypes.INIT, clientID, connectiontypes.NewCounterparty(clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))), []*connectiontypes.Version{ibctesting.ConnectionVersion})), }, []connectiontypes.ConnectionPaths{ - connectiontypes.NewConnectionPaths(clientID, []string{host.ConnectionPath(connectionID)}), + connectiontypes.NewConnectionPaths(clientID, []string{connectionID}), }, ), ChannelGenesis: channeltypes.NewGenesisState( From b5e873cd9197ee3e1a13f921d8db9d8f138c1875 Mon Sep 17 00:00:00 2001 From: Paul Kim Date: Mon, 16 Nov 2020 19:00:34 +0900 Subject: [PATCH 16/19] version --long displays replaced build dependencies (#7941) * version --long displays replaced modules * Update CHANGELOG * Update CHANGELOG * Update version/version.go * Update CHANGELOG.md * Update CHANGELOG.md Co-authored-by: Alessio Treglia Co-authored-by: Alessio Treglia --- CHANGELOG.md | 2 +- version/version.go | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e63adfaca..46d8a76ef3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,7 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ - (SDK) [\#7925](https://github.com/cosmos/cosmos-sdk/pull/7925) Updated dependencies to use gRPC v1.33.2 * Updated gRPC dependency to v1.33.2 * Updated iavl dependency to v0.15-rc2 - +* (version) [\#7848](https://github.com/cosmos/cosmos-sdk/pull/7848) [\#7941](https://github.com/cosmos/cosmos-sdk/pull/7941) `version --long` output now shows the list of build dependencies and replaced build dependencies. ## [v0.40.0-rc3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.40.0-rc3) - 2020-11-06 diff --git a/version/version.go b/version/version.go index 25995932fc..a179b37fe3 100644 --- a/version/version.go +++ b/version/version.go @@ -85,6 +85,13 @@ type buildDep struct { *debug.Module } -func (d buildDep) String() string { return fmt.Sprintf("%s@%s", d.Path, d.Version) } +func (d buildDep) String() string { + if d.Replace != nil { + return fmt.Sprintf("%s@%s => %s@%s", d.Path, d.Version, d.Replace.Path, d.Replace.Version) + } + + return fmt.Sprintf("%s@%s", d.Path, d.Version) +} + func (d buildDep) MarshalJSON() ([]byte, error) { return json.Marshal(d.String()) } func (d buildDep) MarshalYAML() (interface{}, error) { return d.String(), nil } From 0d0c9696e8faa1d34052c9ed583494ad7f36ad1c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Nov 2020 10:36:09 +0000 Subject: [PATCH 17/19] build(deps): bump github.com/prometheus/common from 0.14.0 to 0.15.0 (#7942) Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.14.0 to 0.15.0. - [Release notes](https://github.com/prometheus/common/releases) - [Commits](https://github.com/prometheus/common/compare/v0.14.0...v0.15.0) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 7049f591ab..ad65e29a68 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/pelletier/go-toml v1.8.0 // indirect github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.8.0 - github.com/prometheus/common v0.14.0 + github.com/prometheus/common v0.15.0 github.com/rakyll/statik v0.1.7 github.com/regen-network/cosmos-proto v0.3.0 github.com/spf13/afero v1.2.2 // indirect diff --git a/go.sum b/go.sum index db70ba9caf..3fb9fc93bf 100644 --- a/go.sum +++ b/go.sum @@ -501,6 +501,8 @@ github.com/prometheus/common v0.10.0 h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lN github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.14.0 h1:RHRyE8UocrbjU+6UvRzwi6HjiDfxrrBU91TtbKzkGp4= github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/common v0.15.0 h1:4fgOnadei3EZvgRwxJ7RMpG1k1pOZth5Pc13tyspaKM= +github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= From 54201d11e6d2c14f47542e3eac600c10c9db4723 Mon Sep 17 00:00:00 2001 From: yihuang Date: Mon, 16 Nov 2020 19:34:54 +0800 Subject: [PATCH 18/19] cli: convert coins to smallest unit registered (#7777) * cli: convert coins to smallest unit registered fixes: #7623 - test order of decimal operations - support both int and decimal coins, truncate when normalizing to base unit * Update types/coin_test.go * Update types/coin_test.go Co-authored-by: Alessio Treglia Co-authored-by: Amaury Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- client/tx/factory.go | 2 +- simapp/simd/cmd/genaccounts.go | 4 +- types/coin.go | 39 +++------- types/coin_test.go | 12 +-- types/dec_coin_test.go | 7 +- types/denom.go | 85 +++++++++++++++++++++- types/denom_internal_test.go | 101 ++++++++++++++++++++++++++ types/rest/rest_test.go | 2 +- types/simulation/rand_util_test.go | 2 +- x/auth/vesting/client/cli/tx.go | 2 +- x/bank/client/cli/tx.go | 2 +- x/bank/client/testutil/cli_helpers.go | 2 +- x/distribution/client/cli/tx.go | 6 +- x/genutil/client/cli/gentx.go | 2 +- x/gov/client/cli/tx.go | 4 +- x/params/client/cli/tx.go | 2 +- x/upgrade/client/cli/tx.go | 4 +- 17 files changed, 225 insertions(+), 53 deletions(-) diff --git a/client/tx/factory.go b/client/tx/factory.go index 5077d36e74..19c7c61dea 100644 --- a/client/tx/factory.go +++ b/client/tx/factory.go @@ -120,7 +120,7 @@ func (f Factory) WithGas(gas uint64) Factory { // WithFees returns a copy of the Factory with an updated fee. func (f Factory) WithFees(fees string) Factory { - parsedFees, err := sdk.ParseCoins(fees) + parsedFees, err := sdk.ParseCoinsNormalized(fees) if err != nil { panic(err) } diff --git a/simapp/simd/cmd/genaccounts.go b/simapp/simd/cmd/genaccounts.go index 167da30578..dc6925120e 100644 --- a/simapp/simd/cmd/genaccounts.go +++ b/simapp/simd/cmd/genaccounts.go @@ -67,7 +67,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa addr = info.GetAddress() } - coins, err := sdk.ParseCoins(args[1]) + coins, err := sdk.ParseCoinsNormalized(args[1]) if err != nil { return fmt.Errorf("failed to parse coins: %w", err) } @@ -76,7 +76,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa vestingEnd, _ := cmd.Flags().GetInt64(flagVestingEnd) vestingAmtStr, _ := cmd.Flags().GetString(flagVestingAmt) - vestingAmt, err := sdk.ParseCoins(vestingAmtStr) + vestingAmt, err := sdk.ParseCoinsNormalized(vestingAmtStr) if err != nil { return fmt.Errorf("failed to parse vesting amount: %w", err) } diff --git a/types/coin.go b/types/coin.go index 8ac9a8843d..5e2c22bdf8 100644 --- a/types/coin.go +++ b/types/coin.go @@ -600,7 +600,7 @@ var ( // a letter, a number or a separator ('/'). reDnmString = `[a-zA-Z][a-zA-Z0-9/]{2,127}` reAmt = `[[:digit:]]+` - reDecAmt = `[[:digit:]]*\.[[:digit:]]+` + reDecAmt = `[[:digit:]]+(?:\.[[:digit:]]+)?|\.[[:digit:]]+` reSpc = `[[:space:]]*` reDnm = returnReDnm reCoin = returnReCoin @@ -664,33 +664,18 @@ func ParseCoin(coinStr string) (coin Coin, err error) { return NewCoin(denomStr, amount), nil } -// ParseCoins will parse out a list of coins separated by commas. If the parsing is successuful, -// the provided coins will be sanitized by removing zero coins and sorting the coin set. Lastly -// a validation of the coin set is executed. If the check passes, ParseCoins will return the sanitized coins. +// ParseCoinsNormalized will parse out a list of coins separated by commas, and normalize them by converting to smallest +// unit. If the parsing is successuful, the provided coins will be sanitized by removing zero coins and sorting the coin +// set. Lastly a validation of the coin set is executed. If the check passes, ParseCoinsNormalized will return the +// sanitized coins. // Otherwise it will return an error. -// If an empty string is provided to ParseCoins, it returns nil Coins. +// If an empty string is provided to ParseCoinsNormalized, it returns nil Coins. +// ParseCoinsNormalized supports decimal coins as inputs, and truncate them to int after converted to smallest unit. // Expected format: "{amount0}{denomination},...,{amountN}{denominationN}" -func ParseCoins(coinsStr string) (Coins, error) { - coinsStr = strings.TrimSpace(coinsStr) - if len(coinsStr) == 0 { - return nil, nil +func ParseCoinsNormalized(coinStr string) (Coins, error) { + coins, err := ParseDecCoins(coinStr) + if err != nil { + return Coins{}, err } - - coinStrs := strings.Split(coinsStr, ",") - coins := make(Coins, len(coinStrs)) - for i, coinStr := range coinStrs { - coin, err := ParseCoin(coinStr) - if err != nil { - return nil, err - } - - coins[i] = coin - } - - newCoins := sanitizeCoins(coins) - if err := newCoins.Validate(); err != nil { - return nil, err - } - - return newCoins, nil + return NormalizeCoins(coins), nil } diff --git a/types/coin_test.go b/types/coin_test.go index 9d4130576b..0e4bbf739f 100644 --- a/types/coin_test.go +++ b/types/coin_test.go @@ -660,18 +660,18 @@ func (s *coinTestSuite) TestParseCoins() { {"98 bar , 1 foo ", true, sdk.Coins{{"bar", sdk.NewInt(98)}, {"foo", one}}}, {" 55\t \t bling\n", true, sdk.Coins{{"bling", sdk.NewInt(55)}}}, {"2foo, 97 bar", true, sdk.Coins{{"bar", sdk.NewInt(97)}, {"foo", sdk.NewInt(2)}}}, - {"5 mycoin,", false, nil}, // no empty coins in a list - {"2 3foo, 97 bar", false, nil}, // 3foo is invalid coin name - {"11me coin, 12you coin", false, nil}, // no spaces in coin names - {"1.2btc", false, nil}, // amount must be integer - {"5foo:bar", false, nil}, // invalid separator + {"5 mycoin,", false, nil}, // no empty coins in a list + {"2 3foo, 97 bar", false, nil}, // 3foo is invalid coin name + {"11me coin, 12you coin", false, nil}, // no spaces in coin names + {"1.2btc", true, sdk.Coins{{"btc", sdk.NewInt(1)}}}, // amount can be decimal, will get truncated + {"5foo:bar", false, nil}, // invalid separator {"10atom10", true, sdk.Coins{{"atom10", sdk.NewInt(10)}}}, {"200transfer/channelToA/uatom", true, sdk.Coins{{"transfer/channelToA/uatom", sdk.NewInt(200)}}}, {"50ibc/7F1D3FCF4AE79E1554D670D1AD949A9BA4E4A3C76C63093E17E446A46061A7A2", true, sdk.Coins{{"ibc/7F1D3FCF4AE79E1554D670D1AD949A9BA4E4A3C76C63093E17E446A46061A7A2", sdk.NewInt(50)}}}, } for tcIndex, tc := range cases { - res, err := sdk.ParseCoins(tc.input) + res, err := sdk.ParseCoinsNormalized(tc.input) if !tc.valid { s.Require().Error(err, "%s: %#v. tc #%d", tc.input, res, tcIndex) } else if s.Assert().Nil(err, "%s: %+v", tc.input, err) { diff --git a/types/dec_coin_test.go b/types/dec_coin_test.go index e0f4a66b23..938f7dddff 100644 --- a/types/dec_coin_test.go +++ b/types/dec_coin_test.go @@ -352,8 +352,11 @@ func (s *decCoinTestSuite) TestParseDecCoins() { expectedErr bool }{ {"", nil, false}, - {"4stake", nil, true}, - {"5.5atom,4stake", nil, true}, + {"4stake", sdk.DecCoins{sdk.NewDecCoinFromDec("stake", sdk.NewDecFromInt(sdk.NewInt(4)))}, false}, + {"5.5atom,4stake", sdk.DecCoins{ + sdk.NewDecCoinFromDec("atom", sdk.NewDecWithPrec(5500000000000000000, sdk.Precision)), + sdk.NewDecCoinFromDec("stake", sdk.NewDec(4)), + }, false}, {"0.0stake", sdk.DecCoins{}, false}, // remove zero coins {"10.0btc,1.0atom,20.0btc", nil, true}, { diff --git a/types/denom.go b/types/denom.go index f79bef8b94..160e2806e1 100644 --- a/types/denom.go +++ b/types/denom.go @@ -8,6 +8,9 @@ import ( // multipliers (e.g. 1atom = 10^-6uatom). var denomUnits = map[string]Dec{} +// 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 Dec) error { @@ -20,6 +23,10 @@ func RegisterDenom(denom string, unit Dec) error { } denomUnits[denom] = unit + + if baseDenom == "" || unit.LT(denomUnits[baseDenom]) { + baseDenom = denom + } return nil } @@ -38,6 +45,14 @@ func GetDenomUnit(denom string) (Dec, bool) { return unit, true } +// 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. @@ -60,5 +75,73 @@ func ConvertCoin(coin Coin, denom string) (Coin, error) { return NewCoin(denom, coin.Amount), nil } - return NewCoin(denom, coin.Amount.ToDec().Mul(srcUnit.Quo(dstUnit)).TruncateInt()), nil + return NewCoin(denom, coin.Amount.ToDec().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 index e540b28d57..8c957353eb 100644 --- a/types/denom_internal_test.go +++ b/types/denom_internal_test.go @@ -36,6 +36,7 @@ func (s *internalDenomTestSuite) TestRegisterDenom() { s.Require().Equal(ZeroDec(), res) // reset registration + baseDenom = "" denomUnits = map[string]Dec{} } @@ -52,6 +53,21 @@ func (s *internalDenomTestSuite) TestConvertCoins() { natomUnit := NewDecWithPrec(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, NewInt(1))), NewCoin(natom, NewInt(1000))) + s.Require().Equal(NormalizeCoin(NewCoin(matom, NewInt(1))), NewCoin(natom, NewInt(1000000))) + s.Require().Equal(NormalizeCoin(NewCoin(atom, NewInt(1))), NewCoin(natom, NewInt(1000000000))) + + coins, err := ParseCoinsNormalized("1atom,1matom,1uatom") + s.Require().NoError(err) + s.Require().Equal(coins, Coins{ + Coin{natom, NewInt(1000000000)}, + Coin{natom, NewInt(1000000)}, + Coin{natom, NewInt(1000)}, + }) + testCases := []struct { input Coin denom string @@ -87,5 +103,90 @@ func (s *internalDenomTestSuite) TestConvertCoins() { } // reset registration + baseDenom = "" + denomUnits = map[string]Dec{} +} + +func (s *internalDenomTestSuite) TestConvertDecCoins() { + atomUnit := OneDec() // 1 (base denom unit) + s.Require().NoError(RegisterDenom(atom, atomUnit)) + + matomUnit := NewDecWithPrec(1, 3) // 10^-3 (milli) + s.Require().NoError(RegisterDenom(matom, matomUnit)) + + uatomUnit := NewDecWithPrec(1, 6) // 10^-6 (micro) + s.Require().NoError(RegisterDenom(uatom, uatomUnit)) + + natomUnit := NewDecWithPrec(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, NewInt(1))), NewDecCoin(natom, NewInt(1000))) + s.Require().Equal(NormalizeDecCoin(NewDecCoin(matom, NewInt(1))), NewDecCoin(natom, NewInt(1000000))) + s.Require().Equal(NormalizeDecCoin(NewDecCoin(atom, NewInt(1))), NewDecCoin(natom, NewInt(1000000000))) + + coins, err := ParseCoinsNormalized("0.1atom,0.1matom,0.1uatom") + s.Require().NoError(err) + s.Require().Equal(coins, Coins{ + Coin{natom, NewInt(100000000)}, + Coin{natom, NewInt(100000)}, + Coin{natom, NewInt(100)}, + }) + + testCases := []struct { + input DecCoin + denom string + result DecCoin + expErr bool + }{ + {NewDecCoin("foo", ZeroInt()), atom, DecCoin{}, true}, + {NewDecCoin(atom, ZeroInt()), "foo", DecCoin{}, true}, + {NewDecCoin(atom, ZeroInt()), "FOO", DecCoin{}, true}, + + // 0.5atom + {NewDecCoinFromDec(atom, NewDecWithPrec(5, 1)), matom, NewDecCoin(matom, NewInt(500)), false}, // atom => matom + {NewDecCoinFromDec(atom, NewDecWithPrec(5, 1)), uatom, NewDecCoin(uatom, NewInt(500000)), false}, // atom => uatom + {NewDecCoinFromDec(atom, NewDecWithPrec(5, 1)), natom, NewDecCoin(natom, NewInt(500000000)), false}, // atom => natom + + {NewDecCoin(uatom, NewInt(5000000)), matom, NewDecCoin(matom, NewInt(5000)), false}, // uatom => matom + {NewDecCoin(uatom, NewInt(5000000)), natom, NewDecCoin(natom, NewInt(5000000000)), false}, // uatom => natom + {NewDecCoin(uatom, NewInt(5000000)), atom, NewDecCoin(atom, NewInt(5)), false}, // uatom => atom + + {NewDecCoin(matom, NewInt(5000)), natom, NewDecCoin(natom, NewInt(5000000000)), false}, // matom => natom + {NewDecCoin(matom, NewInt(5000)), uatom, NewDecCoin(uatom, 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]Dec{} +} + +func (s *internalDenomTestSuite) TestDecOperationOrder() { + dec, err := NewDecFromStr("11") + s.Require().NoError(err) + s.Require().NoError(RegisterDenom("unit1", dec)) + dec, err = NewDecFromStr("100000011") + s.Require().NoError(RegisterDenom("unit2", dec)) + + coin, err := ConvertCoin(NewCoin("unit1", NewInt(100000011)), "unit2") + s.Require().NoError(err) + s.Require().Equal(coin, NewCoin("unit2", NewInt(11))) + + // reset registration + baseDenom = "" denomUnits = map[string]Dec{} } diff --git a/types/rest/rest_test.go b/types/rest/rest_test.go index 0a3e16b29d..8f873645d6 100644 --- a/types/rest/rest_test.go +++ b/types/rest/rest_test.go @@ -42,7 +42,7 @@ func TestBaseReq_Sanitize(t *testing.T) { func TestBaseReq_ValidateBasic(t *testing.T) { fromAddr := "cosmos1cq0sxam6x4l0sv9yz3a2vlqhdhvt2k6jtgcse0" - tenstakes, err := types.ParseCoins("10stake") + tenstakes, err := types.ParseCoinsNormalized("10stake") require.NoError(t, err) onestake, err := types.ParseDecCoins("1.0stake") require.NoError(t, err) diff --git a/types/simulation/rand_util_test.go b/types/simulation/rand_util_test.go index d68db7c6ab..c487625ed0 100644 --- a/types/simulation/rand_util_test.go +++ b/types/simulation/rand_util_test.go @@ -56,7 +56,7 @@ func TestRandStringOfLength(t *testing.T) { } func mustParseCoins(s string) sdk.Coins { - coins, err := sdk.ParseCoins(s) + coins, err := sdk.ParseCoinsNormalized(s) if err != nil { panic(err) } diff --git a/x/auth/vesting/client/cli/tx.go b/x/auth/vesting/client/cli/tx.go index 33668fadde..0974552c8a 100644 --- a/x/auth/vesting/client/cli/tx.go +++ b/x/auth/vesting/client/cli/tx.go @@ -58,7 +58,7 @@ timestamp.`, return err } - amount, err := sdk.ParseCoins(args[1]) + amount, err := sdk.ParseCoinsNormalized(args[1]) if err != nil { return err } diff --git a/x/bank/client/cli/tx.go b/x/bank/client/cli/tx.go index 64ea2ea217..21a2e6c330 100644 --- a/x/bank/client/cli/tx.go +++ b/x/bank/client/cli/tx.go @@ -46,7 +46,7 @@ ignored as it is implied from [from_key_or_address].`, return err } - coins, err := sdk.ParseCoins(args[2]) + coins, err := sdk.ParseCoinsNormalized(args[2]) if err != nil { return err } diff --git a/x/bank/client/testutil/cli_helpers.go b/x/bank/client/testutil/cli_helpers.go index 4dff74e2b5..92062a182b 100644 --- a/x/bank/client/testutil/cli_helpers.go +++ b/x/bank/client/testutil/cli_helpers.go @@ -87,7 +87,7 @@ ignored as it is implied from [from_key_or_address].`, return err } - coins, err := sdk.ParseCoins(args[2]) + coins, err := sdk.ParseCoinsNormalized(args[2]) if err != nil { return err } diff --git a/x/distribution/client/cli/tx.go b/x/distribution/client/cli/tx.go index 67635e5782..386174b083 100644 --- a/x/distribution/client/cli/tx.go +++ b/x/distribution/client/cli/tx.go @@ -256,7 +256,7 @@ $ %s tx distribution fund-community-pool 100uatom --from mykey } depositorAddr := clientCtx.GetFromAddress() - amount, err := sdk.ParseCoins(args[0]) + amount, err := sdk.ParseCoinsNormalized(args[0]) if err != nil { return err } @@ -315,12 +315,12 @@ Where proposal.json contains: return err } - amount, err := sdk.ParseCoins(proposal.Amount) + amount, err := sdk.ParseCoinsNormalized(proposal.Amount) if err != nil { return err } - deposit, err := sdk.ParseCoins(proposal.Deposit) + deposit, err := sdk.ParseCoinsNormalized(proposal.Deposit) if err != nil { return err } diff --git a/x/genutil/client/cli/gentx.go b/x/genutil/client/cli/gentx.go index b151290e5d..33a37760ed 100644 --- a/x/genutil/client/cli/gentx.go +++ b/x/genutil/client/cli/gentx.go @@ -116,7 +116,7 @@ $ %s gentx my-key-name --home=/path/to/home/dir --keyring-backend=os --chain-id= } amount, _ := cmd.Flags().GetString(cli.FlagAmount) - coins, err := sdk.ParseCoins(amount) + coins, err := sdk.ParseCoinsNormalized(amount) if err != nil { return errors.Wrap(err, "failed to parse coins") } diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index 5f04d9184c..b13786ede8 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -114,7 +114,7 @@ $ %s tx gov submit-proposal --title="Test Proposal" --description="My awesome pr return fmt.Errorf("failed to parse proposal: %w", err) } - amount, err := sdk.ParseCoins(proposal.Deposit) + amount, err := sdk.ParseCoinsNormalized(proposal.Deposit) if err != nil { return err } @@ -177,7 +177,7 @@ $ %s tx gov deposit 1 10stake --from mykey from := clientCtx.GetFromAddress() // Get amount of coins - amount, err := sdk.ParseCoins(args[1]) + amount, err := sdk.ParseCoinsNormalized(args[1]) if err != nil { return err } diff --git a/x/params/client/cli/tx.go b/x/params/client/cli/tx.go index fcc8080438..154722a144 100644 --- a/x/params/client/cli/tx.go +++ b/x/params/client/cli/tx.go @@ -73,7 +73,7 @@ Where proposal.json contains: proposal.Title, proposal.Description, proposal.Changes.ToParamChanges(), ) - deposit, err := sdk.ParseCoins(proposal.Deposit) + deposit, err := sdk.ParseCoinsNormalized(proposal.Deposit) if err != nil { return err } diff --git a/x/upgrade/client/cli/tx.go b/x/upgrade/client/cli/tx.go index 2a44cd5591..fd7a6ed760 100644 --- a/x/upgrade/client/cli/tx.go +++ b/x/upgrade/client/cli/tx.go @@ -61,7 +61,7 @@ func NewCmdSubmitUpgradeProposal() *cobra.Command { if err != nil { return err } - deposit, err := sdk.ParseCoins(depositStr) + deposit, err := sdk.ParseCoinsNormalized(depositStr) if err != nil { return err } @@ -110,7 +110,7 @@ func NewCmdSubmitCancelUpgradeProposal() *cobra.Command { return err } - deposit, err := sdk.ParseCoins(depositStr) + deposit, err := sdk.ParseCoinsNormalized(depositStr) if err != nil { return err } From be10bcb1633b20ae0510fcb08fa3fc1537ecde22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?colin=20axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 16 Nov 2020 16:06:55 +0100 Subject: [PATCH 19/19] counterParty -> counterparty (#7946) * nit * fix spec and docs --- docs/ibc/custom.md | 2 +- x/ibc/core/05-port/types/module.go | 2 +- x/ibc/core/spec/05_callbacks.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/ibc/custom.md b/docs/ibc/custom.md index dd840ebf13..09cd27a951 100644 --- a/docs/ibc/custom.md +++ b/docs/ibc/custom.md @@ -45,7 +45,7 @@ func (k Keeper) OnChanOpenInit(ctx sdk.Context, portID string, channelID string, channelCap *capabilitytypes.Capability, - counterParty channeltypes.Counterparty, + counterparty channeltypes.Counterparty, version string, ) error { // OpenInit must claim the channelCapability that IBC passes into the callback diff --git a/x/ibc/core/05-port/types/module.go b/x/ibc/core/05-port/types/module.go index a9a7b50922..4c68673201 100644 --- a/x/ibc/core/05-port/types/module.go +++ b/x/ibc/core/05-port/types/module.go @@ -17,7 +17,7 @@ type IBCModule interface { portID string, channelID string, channelCap *capabilitytypes.Capability, - counterParty channeltypes.Counterparty, + counterparty channeltypes.Counterparty, version string, ) error diff --git a/x/ibc/core/spec/05_callbacks.md b/x/ibc/core/spec/05_callbacks.md index c276ae370e..dd74738025 100644 --- a/x/ibc/core/spec/05_callbacks.md +++ b/x/ibc/core/spec/05_callbacks.md @@ -18,7 +18,7 @@ type IBCModule interface { portId string, channelId string, channelCap *capability.Capability, - counterParty channeltypes.Counterparty, + counterparty channeltypes.Counterparty, version string, ) error