From 8133ee8048a114679743b730fd796f3a8d5cb59a Mon Sep 17 00:00:00 2001 From: atheeshp <59333759+atheeshp@users.noreply.github.com> Date: Wed, 26 Jan 2022 16:07:20 +0530 Subject: [PATCH 1/5] refactor: remove deprecated vote option (#10854) ## Description Closes: #10792 --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) --- CHANGELOG.md | 1 + api/cosmos/gov/v1beta2/gov.pulsar.go | 236 ++++++++++----------------- orm/internal/testpb/bank.pulsar.go | 10 +- proto/cosmos/gov/v1beta2/gov.proto | 5 +- x/gov/keeper/grpc_query.go | 1 - x/gov/keeper/grpc_query_test.go | 6 +- x/gov/keeper/vote.go | 18 -- x/gov/keeper/vote_test.go | 4 - x/gov/types/v1beta2/gov.pb.go | 186 +++++++++------------ x/gov/types/v1beta2/tx.pb.go | 2 +- 10 files changed, 168 insertions(+), 301 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f91faa1788d..9e17643146d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -149,6 +149,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (deps) [\#10210](https://github.com/cosmos/cosmos-sdk/pull/10210) Bump Tendermint to [v0.35.0](https://github.com/tendermint/tendermint/releases/tag/v0.35.0). * (deps) [\#10706](https://github.com/cosmos/cosmos-sdk/issues/10706) Bump rosetta-sdk-go to v0.7.2 and rosetta-cli to v0.7.3 * (types/errors) [\#10779](https://github.com/cosmos/cosmos-sdk/pull/10779) Move most functionality in `types/errors` to a standalone `errors` go module, except the `RootCodespace` errors and ABCI response helpers. All functions and types that used to live in `types/errors` are now aliased so this is not a breaking change. +* (gov) [\#10854](https://github.com/cosmos/cosmos-sdk/pull/10854) v1beta2's vote doesn't include the deprecate `option VoteOption` anymore. Instead, it only uses `WeightedVoteOption`. ### Bug Fixes diff --git a/api/cosmos/gov/v1beta2/gov.pulsar.go b/api/cosmos/gov/v1beta2/gov.pulsar.go index c2d3cd802cbd..07c3b2a672cd 100644 --- a/api/cosmos/gov/v1beta2/gov.pulsar.go +++ b/api/cosmos/gov/v1beta2/gov.pulsar.go @@ -2881,7 +2881,6 @@ var ( md_Vote protoreflect.MessageDescriptor fd_Vote_proposal_id protoreflect.FieldDescriptor fd_Vote_voter protoreflect.FieldDescriptor - fd_Vote_option protoreflect.FieldDescriptor fd_Vote_options protoreflect.FieldDescriptor ) @@ -2890,7 +2889,6 @@ func init() { md_Vote = File_cosmos_gov_v1beta2_gov_proto.Messages().ByName("Vote") fd_Vote_proposal_id = md_Vote.Fields().ByName("proposal_id") fd_Vote_voter = md_Vote.Fields().ByName("voter") - fd_Vote_option = md_Vote.Fields().ByName("option") fd_Vote_options = md_Vote.Fields().ByName("options") } @@ -2971,12 +2969,6 @@ func (x *fastReflection_Vote) Range(f func(protoreflect.FieldDescriptor, protore return } } - if x.Option != 0 { - value := protoreflect.ValueOfEnum((protoreflect.EnumNumber)(x.Option)) - if !f(fd_Vote_option, value) { - return - } - } if len(x.Options) != 0 { value := protoreflect.ValueOfList(&_Vote_4_list{list: &x.Options}) if !f(fd_Vote_options, value) { @@ -3002,8 +2994,6 @@ func (x *fastReflection_Vote) Has(fd protoreflect.FieldDescriptor) bool { return x.ProposalId != uint64(0) case "cosmos.gov.v1beta2.Vote.voter": return x.Voter != "" - case "cosmos.gov.v1beta2.Vote.option": - return x.Option != 0 case "cosmos.gov.v1beta2.Vote.options": return len(x.Options) != 0 default: @@ -3026,8 +3016,6 @@ func (x *fastReflection_Vote) Clear(fd protoreflect.FieldDescriptor) { x.ProposalId = uint64(0) case "cosmos.gov.v1beta2.Vote.voter": x.Voter = "" - case "cosmos.gov.v1beta2.Vote.option": - x.Option = 0 case "cosmos.gov.v1beta2.Vote.options": x.Options = nil default: @@ -3052,9 +3040,6 @@ func (x *fastReflection_Vote) Get(descriptor protoreflect.FieldDescriptor) proto case "cosmos.gov.v1beta2.Vote.voter": value := x.Voter return protoreflect.ValueOfString(value) - case "cosmos.gov.v1beta2.Vote.option": - value := x.Option - return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) case "cosmos.gov.v1beta2.Vote.options": if len(x.Options) == 0 { return protoreflect.ValueOfList(&_Vote_4_list{}) @@ -3085,8 +3070,6 @@ func (x *fastReflection_Vote) Set(fd protoreflect.FieldDescriptor, value protore x.ProposalId = value.Uint() case "cosmos.gov.v1beta2.Vote.voter": x.Voter = value.Interface().(string) - case "cosmos.gov.v1beta2.Vote.option": - x.Option = (VoteOption)(value.Enum()) case "cosmos.gov.v1beta2.Vote.options": lv := value.List() clv := lv.(*_Vote_4_list) @@ -3121,8 +3104,6 @@ func (x *fastReflection_Vote) Mutable(fd protoreflect.FieldDescriptor) protorefl panic(fmt.Errorf("field proposal_id of message cosmos.gov.v1beta2.Vote is not mutable")) case "cosmos.gov.v1beta2.Vote.voter": panic(fmt.Errorf("field voter of message cosmos.gov.v1beta2.Vote is not mutable")) - case "cosmos.gov.v1beta2.Vote.option": - panic(fmt.Errorf("field option of message cosmos.gov.v1beta2.Vote is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1beta2.Vote")) @@ -3140,8 +3121,6 @@ func (x *fastReflection_Vote) NewField(fd protoreflect.FieldDescriptor) protoref return protoreflect.ValueOfUint64(uint64(0)) case "cosmos.gov.v1beta2.Vote.voter": return protoreflect.ValueOfString("") - case "cosmos.gov.v1beta2.Vote.option": - return protoreflect.ValueOfEnum(0) case "cosmos.gov.v1beta2.Vote.options": list := []*WeightedVoteOption{} return protoreflect.ValueOfList(&_Vote_4_list{list: &list}) @@ -3221,9 +3200,6 @@ func (x *fastReflection_Vote) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - if x.Option != 0 { - n += 1 + runtime.Sov(uint64(x.Option)) - } if len(x.Options) > 0 { for _, e := range x.Options { l = options.Size(e) @@ -3275,11 +3251,6 @@ func (x *fastReflection_Vote) ProtoMethods() *protoiface.Methods { dAtA[i] = 0x22 } } - if x.Option != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.Option)) - i-- - dAtA[i] = 0x18 - } if len(x.Voter) > 0 { i -= len(x.Voter) copy(dAtA[i:], x.Voter) @@ -3392,25 +3363,6 @@ func (x *fastReflection_Vote) ProtoMethods() *protoiface.Methods { } x.Voter = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) - } - x.Option = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.Option |= VoteOption(b&0x7F) << shift - if b < 0x80 { - break - } - } case 4: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) @@ -5444,15 +5396,9 @@ type Vote struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` - // Deprecated: Prefer to use `options` instead. This field is set in queries - // if and only if `len(options) == 1` and that option has weight 1. In all - // other cases, this field will default to VOTE_OPTION_UNSPECIFIED. - // - // Deprecated: Do not use. - Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos.gov.v1beta2.VoteOption" json:"option,omitempty"` - Options []*WeightedVoteOption `protobuf:"bytes,4,rep,name=options,proto3" json:"options,omitempty"` + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` + Options []*WeightedVoteOption `protobuf:"bytes,4,rep,name=options,proto3" json:"options,omitempty"` } func (x *Vote) Reset() { @@ -5489,14 +5435,6 @@ func (x *Vote) GetVoter() string { return "" } -// Deprecated: Do not use. -func (x *Vote) GetOption() VoteOption { - if x != nil { - return x.Option - } - return VoteOption_VOTE_OPTION_UNSPECIFIED -} - func (x *Vote) GetOptions() []*WeightedVoteOption { if x != nil { return x.Options @@ -5727,89 +5665,86 @@ var file_cosmos_gov_v1beta2_gov_proto_rawDesc = []byte{ 0x49, 0x6e, 0x74, 0x52, 0x02, 0x6e, 0x6f, 0x12, 0x30, 0x0a, 0x0c, 0x6e, 0x6f, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x76, 0x65, 0x74, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0a, 0x6e, - 0x6f, 0x57, 0x69, 0x74, 0x68, 0x56, 0x65, 0x74, 0x6f, 0x22, 0xd5, 0x01, 0x0a, 0x04, 0x56, 0x6f, + 0x6f, 0x57, 0x69, 0x74, 0x68, 0x56, 0x65, 0x74, 0x6f, 0x22, 0x9f, 0x01, 0x0a, 0x04, 0x56, 0x6f, 0x74, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x76, 0x6f, - 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, 0x2e, 0x56, 0x6f, 0x74, 0x65, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x42, 0x02, 0x18, 0x01, 0x52, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x40, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x32, 0x2e, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x56, 0x6f, - 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x22, 0xd9, 0x01, 0x0a, 0x0d, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x12, 0x59, 0x0a, 0x0b, 0x6d, 0x69, 0x6e, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, - 0x69, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, - 0x6f, 0x69, 0x6e, 0x42, 0x1d, 0xc8, 0xde, 0x1f, 0x00, 0xea, 0xde, 0x1f, 0x15, 0x6d, 0x69, 0x6e, - 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x2c, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, - 0x74, 0x79, 0x52, 0x0a, 0x6d, 0x69, 0x6e, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x12, 0x6d, - 0x0a, 0x12, 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x5f, 0x70, 0x65, - 0x72, 0x69, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x24, 0xea, 0xde, 0x1f, 0x1c, 0x6d, 0x61, 0x78, 0x5f, 0x64, - 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x2c, 0x6f, 0x6d, - 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x98, 0xdf, 0x1f, 0x01, 0x52, 0x10, 0x6d, 0x61, 0x78, - 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x22, 0x54, 0x0a, - 0x0c, 0x56, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x44, 0x0a, - 0x0d, 0x76, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x01, + 0x74, 0x65, 0x72, 0x12, 0x40, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, + 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, 0x2e, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, + 0x65, 0x64, 0x56, 0x6f, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x4a, 0x04, 0x08, 0x03, 0x10, 0x04, 0x22, 0xd9, 0x01, 0x0a, 0x0d, + 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x59, 0x0a, + 0x0b, 0x6d, 0x69, 0x6e, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x1d, 0xc8, + 0xde, 0x1f, 0x00, 0xea, 0xde, 0x1f, 0x15, 0x6d, 0x69, 0x6e, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x2c, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x0a, 0x6d, 0x69, + 0x6e, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x12, 0x6d, 0x0a, 0x12, 0x6d, 0x61, 0x78, 0x5f, + 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, - 0x04, 0x98, 0xdf, 0x1f, 0x01, 0x52, 0x0c, 0x76, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x65, 0x72, - 0x69, 0x6f, 0x64, 0x22, 0xe1, 0x01, 0x0a, 0x0b, 0x54, 0x61, 0x6c, 0x6c, 0x79, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x12, 0x3a, 0x0a, 0x06, 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x22, 0xea, 0xde, 0x1f, 0x10, 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x2c, - 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x06, 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x12, - 0x43, 0x0a, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x25, 0xea, 0xde, 0x1f, 0x13, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, - 0x64, 0x2c, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, - 0x68, 0x6f, 0x6c, 0x64, 0x12, 0x51, 0x0a, 0x0e, 0x76, 0x65, 0x74, 0x6f, 0x5f, 0x74, 0x68, 0x72, - 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2a, 0xea, 0xde, - 0x1f, 0x18, 0x76, 0x65, 0x74, 0x6f, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, - 0x2c, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0d, 0x76, 0x65, 0x74, 0x6f, 0x54, 0x68, - 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x2a, 0x89, 0x01, 0x0a, 0x0a, 0x56, 0x6f, 0x74, 0x65, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x17, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, - 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, - 0x44, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, - 0x4f, 0x4e, 0x5f, 0x59, 0x45, 0x53, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x56, 0x4f, 0x54, 0x45, - 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x42, 0x53, 0x54, 0x41, 0x49, 0x4e, 0x10, - 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, - 0x5f, 0x4e, 0x4f, 0x10, 0x03, 0x12, 0x1c, 0x0a, 0x18, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, - 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x5f, 0x57, 0x49, 0x54, 0x48, 0x5f, 0x56, 0x45, 0x54, - 0x4f, 0x10, 0x04, 0x2a, 0xce, 0x01, 0x0a, 0x0e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1f, 0x0a, 0x1b, 0x50, 0x52, 0x4f, 0x50, 0x4f, 0x53, - 0x41, 0x4c, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, - 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x22, 0x0a, 0x1e, 0x50, 0x52, 0x4f, 0x50, 0x4f, - 0x53, 0x41, 0x4c, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x44, 0x45, 0x50, 0x4f, 0x53, - 0x49, 0x54, 0x5f, 0x50, 0x45, 0x52, 0x49, 0x4f, 0x44, 0x10, 0x01, 0x12, 0x21, 0x0a, 0x1d, 0x50, - 0x52, 0x4f, 0x50, 0x4f, 0x53, 0x41, 0x4c, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x56, - 0x4f, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x45, 0x52, 0x49, 0x4f, 0x44, 0x10, 0x02, 0x12, 0x1a, - 0x0a, 0x16, 0x50, 0x52, 0x4f, 0x50, 0x4f, 0x53, 0x41, 0x4c, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, - 0x53, 0x5f, 0x50, 0x41, 0x53, 0x53, 0x45, 0x44, 0x10, 0x03, 0x12, 0x1c, 0x0a, 0x18, 0x50, 0x52, - 0x4f, 0x50, 0x4f, 0x53, 0x41, 0x4c, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x52, 0x45, - 0x4a, 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, 0x04, 0x12, 0x1a, 0x0a, 0x16, 0x50, 0x52, 0x4f, 0x50, - 0x4f, 0x53, 0x41, 0x4c, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x46, 0x41, 0x49, 0x4c, - 0x45, 0x44, 0x10, 0x05, 0x42, 0xcc, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, 0x42, - 0x08, 0x47, 0x6f, 0x76, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3e, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x67, 0x6f, 0x76, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, - 0x3b, 0x67, 0x6f, 0x76, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, 0xa2, 0x02, 0x03, 0x43, 0x47, - 0x58, 0xaa, 0x02, 0x12, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x47, 0x6f, 0x76, 0x2e, 0x56, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, 0xca, 0x02, 0x12, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, - 0x47, 0x6f, 0x76, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, 0xe2, 0x02, 0x1e, 0x43, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x6f, 0x76, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x43, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x47, 0x6f, 0x76, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x24, 0xea, 0xde, 0x1f, 0x1c, 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x2c, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, + 0x79, 0x98, 0xdf, 0x1f, 0x01, 0x52, 0x10, 0x6d, 0x61, 0x78, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x22, 0x54, 0x0a, 0x0c, 0x56, 0x6f, 0x74, 0x69, 0x6e, + 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x44, 0x0a, 0x0d, 0x76, 0x6f, 0x74, 0x69, 0x6e, + 0x67, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x04, 0x98, 0xdf, 0x1f, 0x01, 0x52, + 0x0c, 0x76, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x22, 0xe1, 0x01, + 0x0a, 0x0b, 0x54, 0x61, 0x6c, 0x6c, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x3a, 0x0a, + 0x06, 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x22, 0xea, + 0xde, 0x1f, 0x10, 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x2c, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, + 0x70, 0x74, 0x79, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, + 0x63, 0x52, 0x06, 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x12, 0x43, 0x0a, 0x09, 0x74, 0x68, 0x72, + 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x25, 0xea, 0xde, + 0x1f, 0x13, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x2c, 0x6f, 0x6d, 0x69, 0x74, + 0x65, 0x6d, 0x70, 0x74, 0x79, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x44, 0x65, 0x63, 0x52, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x12, 0x51, + 0x0a, 0x0e, 0x76, 0x65, 0x74, 0x6f, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2a, 0xea, 0xde, 0x1f, 0x18, 0x76, 0x65, 0x74, 0x6f, + 0x5f, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x2c, 0x6f, 0x6d, 0x69, 0x74, 0x65, + 0x6d, 0x70, 0x74, 0x79, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, + 0x65, 0x63, 0x52, 0x0d, 0x76, 0x65, 0x74, 0x6f, 0x54, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, + 0x64, 0x2a, 0x89, 0x01, 0x0a, 0x0a, 0x56, 0x6f, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x1b, 0x0a, 0x17, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x13, 0x0a, + 0x0f, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x59, 0x45, 0x53, + 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, + 0x4e, 0x5f, 0x41, 0x42, 0x53, 0x54, 0x41, 0x49, 0x4e, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x56, + 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x10, 0x03, 0x12, + 0x1c, 0x0a, 0x18, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4e, + 0x4f, 0x5f, 0x57, 0x49, 0x54, 0x48, 0x5f, 0x56, 0x45, 0x54, 0x4f, 0x10, 0x04, 0x2a, 0xce, 0x01, + 0x0a, 0x0e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x12, 0x1f, 0x0a, 0x1b, 0x50, 0x52, 0x4f, 0x50, 0x4f, 0x53, 0x41, 0x4c, 0x5f, 0x53, 0x54, 0x41, + 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x22, 0x0a, 0x1e, 0x50, 0x52, 0x4f, 0x50, 0x4f, 0x53, 0x41, 0x4c, 0x5f, 0x53, 0x54, + 0x41, 0x54, 0x55, 0x53, 0x5f, 0x44, 0x45, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x5f, 0x50, 0x45, 0x52, + 0x49, 0x4f, 0x44, 0x10, 0x01, 0x12, 0x21, 0x0a, 0x1d, 0x50, 0x52, 0x4f, 0x50, 0x4f, 0x53, 0x41, + 0x4c, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x56, 0x4f, 0x54, 0x49, 0x4e, 0x47, 0x5f, + 0x50, 0x45, 0x52, 0x49, 0x4f, 0x44, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x50, 0x52, 0x4f, 0x50, + 0x4f, 0x53, 0x41, 0x4c, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x50, 0x41, 0x53, 0x53, + 0x45, 0x44, 0x10, 0x03, 0x12, 0x1c, 0x0a, 0x18, 0x50, 0x52, 0x4f, 0x50, 0x4f, 0x53, 0x41, 0x4c, + 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x52, 0x45, 0x4a, 0x45, 0x43, 0x54, 0x45, 0x44, + 0x10, 0x04, 0x12, 0x1a, 0x0a, 0x16, 0x50, 0x52, 0x4f, 0x50, 0x4f, 0x53, 0x41, 0x4c, 0x5f, 0x53, + 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x05, 0x42, 0xcc, + 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, + 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, 0x42, 0x08, 0x47, 0x6f, 0x76, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, + 0x73, 0x64, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x67, + 0x6f, 0x76, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, 0x3b, 0x67, 0x6f, 0x76, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x32, 0xa2, 0x02, 0x03, 0x43, 0x47, 0x58, 0xaa, 0x02, 0x12, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x47, 0x6f, 0x76, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, + 0xca, 0x02, 0x12, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x6f, 0x76, 0x5c, 0x56, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x32, 0xe2, 0x02, 0x1e, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, + 0x6f, 0x76, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, + 0x3a, 0x47, 0x6f, 0x76, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -5853,16 +5788,15 @@ var file_cosmos_gov_v1beta2_gov_proto_depIdxs = []int32{ 10, // 7: cosmos.gov.v1beta2.Proposal.total_deposit:type_name -> cosmos.base.v1beta1.Coin 12, // 8: cosmos.gov.v1beta2.Proposal.voting_start_time:type_name -> google.protobuf.Timestamp 12, // 9: cosmos.gov.v1beta2.Proposal.voting_end_time:type_name -> google.protobuf.Timestamp - 0, // 10: cosmos.gov.v1beta2.Vote.option:type_name -> cosmos.gov.v1beta2.VoteOption - 2, // 11: cosmos.gov.v1beta2.Vote.options:type_name -> cosmos.gov.v1beta2.WeightedVoteOption - 10, // 12: cosmos.gov.v1beta2.DepositParams.min_deposit:type_name -> cosmos.base.v1beta1.Coin - 13, // 13: cosmos.gov.v1beta2.DepositParams.max_deposit_period:type_name -> google.protobuf.Duration - 13, // 14: cosmos.gov.v1beta2.VotingParams.voting_period:type_name -> google.protobuf.Duration - 15, // [15:15] is the sub-list for method output_type - 15, // [15:15] is the sub-list for method input_type - 15, // [15:15] is the sub-list for extension type_name - 15, // [15:15] is the sub-list for extension extendee - 0, // [0:15] is the sub-list for field type_name + 2, // 10: cosmos.gov.v1beta2.Vote.options:type_name -> cosmos.gov.v1beta2.WeightedVoteOption + 10, // 11: cosmos.gov.v1beta2.DepositParams.min_deposit:type_name -> cosmos.base.v1beta1.Coin + 13, // 12: cosmos.gov.v1beta2.DepositParams.max_deposit_period:type_name -> google.protobuf.Duration + 13, // 13: cosmos.gov.v1beta2.VotingParams.voting_period:type_name -> google.protobuf.Duration + 14, // [14:14] is the sub-list for method output_type + 14, // [14:14] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name } func init() { file_cosmos_gov_v1beta2_gov_proto_init() } diff --git a/orm/internal/testpb/bank.pulsar.go b/orm/internal/testpb/bank.pulsar.go index 524ccf76abbf..36cfc62a53a4 100644 --- a/orm/internal/testpb/bank.pulsar.go +++ b/orm/internal/testpb/bank.pulsar.go @@ -2,16 +2,14 @@ package testpb import ( fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/cosmos-sdk/api/cosmos/orm/v1alpha1" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - - _ "github.com/cosmos/cosmos-sdk/api/cosmos/orm/v1alpha1" + io "io" + reflect "reflect" + sync "sync" ) var ( diff --git a/proto/cosmos/gov/v1beta2/gov.proto b/proto/cosmos/gov/v1beta2/gov.proto index c021c6823cd5..662314de052c 100644 --- a/proto/cosmos/gov/v1beta2/gov.proto +++ b/proto/cosmos/gov/v1beta2/gov.proto @@ -88,10 +88,7 @@ message TallyResult { message Vote { uint64 proposal_id = 1; string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // Deprecated: Prefer to use `options` instead. This field is set in queries - // if and only if `len(options) == 1` and that option has weight 1. In all - // other cases, this field will default to VOTE_OPTION_UNSPECIFIED. - VoteOption option = 3 [deprecated = true]; + reserved 3; repeated WeightedVoteOption options = 4; } diff --git a/x/gov/keeper/grpc_query.go b/x/gov/keeper/grpc_query.go index 05ab8c4171ab..f0a605c34bc2 100644 --- a/x/gov/keeper/grpc_query.go +++ b/x/gov/keeper/grpc_query.go @@ -143,7 +143,6 @@ func (q Keeper) Votes(c context.Context, req *v1beta2.QueryVotesRequest) (*v1bet if err := q.cdc.Unmarshal(value, &vote); err != nil { return err } - populateLegacyOption(&vote) votes = append(votes, &vote) return nil diff --git a/x/gov/keeper/grpc_query_test.go b/x/gov/keeper/grpc_query_test.go index 0b6088c92f0f..1b3c6986886d 100644 --- a/x/gov/keeper/grpc_query_test.go +++ b/x/gov/keeper/grpc_query_test.go @@ -315,7 +315,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryVote() { Voter: addrs[0].String(), } - expRes = &v1beta2.QueryVoteResponse{Vote: &v1beta2.Vote{ProposalId: proposal.ProposalId, Voter: addrs[0].String(), Option: v1beta2.OptionAbstain, Options: []*v1beta2.WeightedVoteOption{{Option: v1beta2.OptionAbstain, Weight: sdk.MustNewDecFromStr("1.0").String()}}}} + expRes = &v1beta2.QueryVoteResponse{Vote: &v1beta2.Vote{ProposalId: proposal.ProposalId, Voter: addrs[0].String(), Options: []*v1beta2.WeightedVoteOption{{Option: v1beta2.OptionAbstain, Weight: sdk.MustNewDecFromStr("1.0").String()}}}} }, true, }, @@ -412,8 +412,8 @@ func (suite *KeeperTestSuite) TestGRPCQueryVotes() { app.GovKeeper.SetProposal(ctx, proposal) votes = []*v1beta2.Vote{ - {ProposalId: proposal.ProposalId, Voter: addrs[0].String(), Option: v1beta2.OptionAbstain, Options: v1beta2.NewNonSplitVoteOption(v1beta2.OptionAbstain)}, - {ProposalId: proposal.ProposalId, Voter: addrs[1].String(), Option: v1beta2.OptionYes, Options: v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)}, + {ProposalId: proposal.ProposalId, Voter: addrs[0].String(), Options: v1beta2.NewNonSplitVoteOption(v1beta2.OptionAbstain)}, + {ProposalId: proposal.ProposalId, Voter: addrs[1].String(), Options: v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)}, } accAddr1, err1 := sdk.AccAddressFromBech32(votes[0].Voter) accAddr2, err2 := sdk.AccAddressFromBech32(votes[1].Voter) diff --git a/x/gov/keeper/vote.go b/x/gov/keeper/vote.go index dd18950dc40a..75eb0108d71b 100644 --- a/x/gov/keeper/vote.go +++ b/x/gov/keeper/vote.go @@ -45,7 +45,6 @@ func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.A // GetAllVotes returns all the votes from the store func (keeper Keeper) GetAllVotes(ctx sdk.Context) (votes v1beta2.Votes) { keeper.IterateAllVotes(ctx, func(vote v1beta2.Vote) bool { - populateLegacyOption(&vote) votes = append(votes, &vote) return false }) @@ -55,7 +54,6 @@ func (keeper Keeper) GetAllVotes(ctx sdk.Context) (votes v1beta2.Votes) { // GetVotes returns all the votes from a proposal func (keeper Keeper) GetVotes(ctx sdk.Context, proposalID uint64) (votes v1beta2.Votes) { keeper.IterateVotes(ctx, proposalID, func(vote v1beta2.Vote) bool { - populateLegacyOption(&vote) votes = append(votes, &vote) return false }) @@ -71,18 +69,12 @@ func (keeper Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.A } keeper.cdc.MustUnmarshal(bz, &vote) - populateLegacyOption(&vote) return vote, true } // SetVote sets a Vote to the gov store func (keeper Keeper) SetVote(ctx sdk.Context, vote v1beta2.Vote) { - // vote.Option is a deprecated field, we don't set it in state - if vote.Option != v1beta2.OptionEmpty { // nolint - vote.Option = v1beta2.OptionEmpty // nolint - } - store := ctx.KVStore(keeper.storeKey) bz := keeper.cdc.MustMarshal(&vote) addr, err := sdk.AccAddressFromBech32(vote.Voter) @@ -101,7 +93,6 @@ func (keeper Keeper) IterateAllVotes(ctx sdk.Context, cb func(vote v1beta2.Vote) for ; iterator.Valid(); iterator.Next() { var vote v1beta2.Vote keeper.cdc.MustUnmarshal(iterator.Value(), &vote) - populateLegacyOption(&vote) if cb(vote) { break @@ -118,7 +109,6 @@ func (keeper Keeper) IterateVotes(ctx sdk.Context, proposalID uint64, cb func(vo for ; iterator.Valid(); iterator.Next() { var vote v1beta2.Vote keeper.cdc.MustUnmarshal(iterator.Value(), &vote) - populateLegacyOption(&vote) if cb(vote) { break @@ -131,11 +121,3 @@ func (keeper Keeper) deleteVote(ctx sdk.Context, proposalID uint64, voterAddr sd store := ctx.KVStore(keeper.storeKey) store.Delete(types.VoteKey(proposalID, voterAddr)) } - -// populateLegacyOption adds graceful fallback of deprecated `Option` field, in case -// there's only 1 VoteOption. -func populateLegacyOption(vote *v1beta2.Vote) { - if len(vote.Options) == 1 && sdk.MustNewDecFromStr(vote.Options[0].Weight).Equal(sdk.MustNewDecFromStr("1.0")) { - vote.Option = vote.Options[0].Option // nolint - } -} diff --git a/x/gov/keeper/vote_test.go b/x/gov/keeper/vote_test.go index 2790a3d03a21..12f55705808e 100644 --- a/x/gov/keeper/vote_test.go +++ b/x/gov/keeper/vote_test.go @@ -40,7 +40,6 @@ func TestVotes(t *testing.T) { require.Equal(t, proposalID, vote.ProposalId) require.True(t, len(vote.Options) == 1) require.Equal(t, v1beta2.OptionAbstain, vote.Options[0].Option) - require.Equal(t, v1beta2.OptionAbstain, vote.Option) // Test change of vote require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes))) @@ -50,7 +49,6 @@ func TestVotes(t *testing.T) { require.Equal(t, proposalID, vote.ProposalId) require.True(t, len(vote.Options) == 1) require.Equal(t, v1beta2.OptionYes, vote.Options[0].Option) - require.Equal(t, v1beta2.OptionYes, vote.Option) // Test second vote require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta2.WeightedVoteOptions{ @@ -72,7 +70,6 @@ func TestVotes(t *testing.T) { require.Equal(t, vote.Options[1].Weight, sdk.NewDecWithPrec(30, 2).String()) require.Equal(t, vote.Options[2].Weight, sdk.NewDecWithPrec(5, 2).String()) require.Equal(t, vote.Options[3].Weight, sdk.NewDecWithPrec(5, 2).String()) - require.Equal(t, v1beta2.OptionEmpty, vote.Option) // Test vote iterator // NOTE order of deposits is determined by the addresses @@ -90,5 +87,4 @@ func TestVotes(t *testing.T) { require.Equal(t, votes[1].Options[1].Weight, sdk.NewDecWithPrec(30, 2).String()) require.Equal(t, votes[1].Options[2].Weight, sdk.NewDecWithPrec(5, 2).String()) require.Equal(t, votes[1].Options[3].Weight, sdk.NewDecWithPrec(5, 2).String()) - require.Equal(t, v1beta2.OptionEmpty, vote.Option) } diff --git a/x/gov/types/v1beta2/gov.pb.go b/x/gov/types/v1beta2/gov.pb.go index 98e8b1075805..cb9098534f87 100644 --- a/x/gov/types/v1beta2/gov.pb.go +++ b/x/gov/types/v1beta2/gov.pb.go @@ -246,7 +246,7 @@ type Proposal struct { TotalDeposit []types.Coin `protobuf:"bytes,7,rep,name=total_deposit,json=totalDeposit,proto3" json:"total_deposit"` VotingStartTime *time.Time `protobuf:"bytes,8,opt,name=voting_start_time,json=votingStartTime,proto3,stdtime" json:"voting_start_time,omitempty"` VotingEndTime *time.Time `protobuf:"bytes,9,opt,name=voting_end_time,json=votingEndTime,proto3,stdtime" json:"voting_end_time,omitempty"` - // metadata is any arbitrary metadata to attached to the proposal. + // metadata is any arbitrary metadata attached to the proposal. Metadata []byte `protobuf:"bytes,10,opt,name=metadata,proto3" json:"metadata,omitempty"` } @@ -425,13 +425,9 @@ func (m *TallyResult) GetNoWithVeto() string { // Vote defines a vote on a governance proposal. // A Vote consists of a proposal ID, the voter, and the vote option. type Vote struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` - // Deprecated: Prefer to use `options` instead. This field is set in queries - // if and only if `len(options) == 1` and that option has weight 1. In all - // other cases, this field will default to VOTE_OPTION_UNSPECIFIED. - Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos.gov.v1beta2.VoteOption" json:"option,omitempty"` // Deprecated: Do not use. - Options []*WeightedVoteOption `protobuf:"bytes,4,rep,name=options,proto3" json:"options,omitempty"` + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` + Options []*WeightedVoteOption `protobuf:"bytes,4,rep,name=options,proto3" json:"options,omitempty"` } func (m *Vote) Reset() { *m = Vote{} } @@ -481,14 +477,6 @@ func (m *Vote) GetVoter() string { return "" } -// Deprecated: Do not use. -func (m *Vote) GetOption() VoteOption { - if m != nil { - return m.Option - } - return VoteOption_VOTE_OPTION_UNSPECIFIED -} - func (m *Vote) GetOptions() []*WeightedVoteOption { if m != nil { return m.Options @@ -680,76 +668,75 @@ func init() { func init() { proto.RegisterFile("cosmos/gov/v1beta2/gov.proto", fileDescriptor_5abf7b8852811c49) } var fileDescriptor_5abf7b8852811c49 = []byte{ - // 1095 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0xc1, 0x6e, 0xdb, 0x46, - 0x10, 0x35, 0x25, 0x59, 0xb6, 0x47, 0xb6, 0xc2, 0xae, 0xdd, 0x86, 0x76, 0x1c, 0x49, 0x15, 0xda, - 0x40, 0x30, 0x6a, 0xc9, 0x76, 0x81, 0x14, 0xc8, 0xa9, 0x92, 0xc5, 0x34, 0x32, 0x5c, 0x53, 0x25, - 0x19, 0x19, 0xe9, 0x85, 0xa0, 0xcc, 0x8d, 0x44, 0x54, 0xe4, 0xaa, 0xdc, 0x95, 0x63, 0x7d, 0x42, - 0x6f, 0x39, 0x16, 0xe8, 0x27, 0xf4, 0x9a, 0x8f, 0xc8, 0xa9, 0x08, 0x02, 0x14, 0x68, 0x2f, 0x6a, - 0x6b, 0xdf, 0x7c, 0xeb, 0x1f, 0x04, 0x5c, 0x2e, 0x2d, 0x59, 0x72, 0x60, 0x9f, 0xb4, 0x9a, 0x79, - 0xef, 0xcd, 0x0c, 0xf7, 0xed, 0x92, 0xb0, 0x79, 0x42, 0xa8, 0x47, 0x68, 0xa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 0xd6, 0xe5, 0xf9, 0xda, 0xc1, - 0xdb, 0xf3, 0x9c, 0xf4, 0xee, 0x3c, 0x27, 0xfd, 0x7b, 0x9e, 0x93, 0x5e, 0x5f, 0xe4, 0xe6, 0xde, - 0x5d, 0xe4, 0xe6, 0xfe, 0xba, 0xc8, 0xcd, 0xfd, 0xb8, 0xd3, 0x71, 0x59, 0x77, 0xd0, 0x2e, 0x9f, - 0x10, 0x4f, 0x7c, 0xb3, 0x88, 0x9f, 0x6d, 0xea, 0xfc, 0x54, 0x39, 0xe3, 0x5f, 0x64, 0x6c, 0xd8, - 0xc7, 0x34, 0xfe, 0x2e, 0x6b, 0xa7, 0xb9, 0x67, 0xbf, 0xfe, 0x10, 0x00, 0x00, 0xff, 0xff, 0x64, - 0xbb, 0x92, 0x2d, 0xb4, 0x09, 0x00, 0x00, + // 1087 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0x41, 0x53, 0xdb, 0x46, + 0x14, 0x46, 0xb6, 0x30, 0xf0, 0x0c, 0x8e, 0xba, 0xd0, 0x46, 0x10, 0x62, 0xbb, 0x9e, 0x36, 0xe3, + 0x61, 0x8a, 0x0d, 0x74, 0x26, 0x9d, 0xc9, 0xa9, 0x36, 0x56, 0x1a, 0x33, 0x14, 0xbb, 0x92, 0x62, + 0x26, 0xbd, 0x68, 0x64, 0xb4, 0xb1, 0x35, 0xb5, 0xb4, 0xae, 0x76, 0x4d, 0xf0, 0x4f, 0xe8, 0x2d, + 0xc7, 0xce, 0xf4, 0xd0, 0x1f, 0xd0, 0x6b, 0x7e, 0x44, 0x4e, 0x9d, 0x4c, 0x4e, 0xed, 0xc5, 0x6d, + 0xe1, 0xc6, 0xad, 0xff, 0x20, 0xa3, 0xd5, 0x0a, 0x1b, 0x9b, 0x0c, 0x9c, 0xbc, 0x7a, 0xef, 0xfb, + 0xbe, 0xf7, 0x9e, 0xf6, 0xdb, 0xb5, 0x60, 0xf3, 0x84, 0x50, 0x8f, 0xd0, 0x72, 0x87, 0x9c, 0x96, + 0x4f, 0x77, 0xdb, 0x98, 0xd9, 0x7b, 0xe1, 0xba, 0xd4, 0x0f, 0x08, 0x23, 0x08, 0x45, 0xd9, 0x52, + 0x18, 0x11, 0xd9, 0x8d, 0xac, 0x60, 0xb4, 0x6d, 0x8a, 0x05, 0x65, 0xb7, 0x7c, 0x42, 0x5c, 0x3f, + 0xe2, 0x6c, 0xac, 0x75, 0x48, 0x87, 0xf0, 0x65, 0x39, 0x5c, 0x89, 0x68, 0xae, 0x43, 0x48, 0xa7, + 0x87, 0xcb, 0xfc, 0xa9, 0x3d, 0x78, 0x59, 0x66, 0xae, 0x87, 0x29, 0xb3, 0xbd, 0xbe, 0x00, 0xac, + 0x4f, 0x03, 0x6c, 0x7f, 0x28, 0x52, 0xd9, 0xe9, 0x94, 0x33, 0x08, 0x6c, 0xe6, 0x92, 0xb8, 0xe2, + 0x7a, 0xd4, 0x91, 0x15, 0x15, 0x15, 0x2d, 0xf3, 0x87, 0x02, 0x03, 0x74, 0x8c, 0xdd, 0x4e, 0x97, + 0x61, 0xa7, 0x45, 0x18, 0x6e, 0xf4, 0x43, 0x1a, 0x7a, 0x0c, 0x29, 0xc2, 0x57, 0xaa, 0x94, 0x97, + 0x8a, 0x99, 0xbd, 0x6c, 0x69, 0x76, 0xce, 0xd2, 0x18, 0xaf, 0x0b, 0x34, 0x7a, 0x04, 0xa9, 0x57, + 0x5c, 0x4d, 0x4d, 0xe4, 0xa5, 0xe2, 0x52, 0x35, 0xf3, 0xfe, 0xcd, 0x36, 0x08, 0x6a, 0x0d, 0x9f, + 0xe8, 0x22, 0x5b, 0xf8, 0x4d, 0x82, 0x85, 0x1a, 0xee, 0x13, 0xea, 0x32, 0x94, 0x83, 0x74, 0x3f, + 0x20, 0x7d, 0x42, 0xed, 0x9e, 0xe5, 0x3a, 0xbc, 0xa0, 0xac, 0x43, 0x1c, 0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xf9, 0xea, 0xc1, 0xdb, 0xf3, 0xac, 0xf4, 0xee, 0x3c, 0x2b, 0xfd, + 0x7b, 0x9e, 0x95, 0x5e, 0x5f, 0x64, 0xe7, 0xde, 0x5d, 0x64, 0xe7, 0xfe, 0xba, 0xc8, 0xce, 0xfd, + 0xb8, 0xd3, 0x71, 0x59, 0x77, 0xd0, 0x2e, 0x9d, 0x10, 0x4f, 0x7c, 0x7d, 0x88, 0x9f, 0x6d, 0xea, + 0xfc, 0x54, 0x3e, 0xe3, 0xdf, 0x56, 0x6c, 0xd8, 0xc7, 0x34, 0xfe, 0xc2, 0x6a, 0xa7, 0xb8, 0x67, + 0xbf, 0xfe, 0x10, 0x00, 0x00, 0xff, 0xff, 0x71, 0x11, 0x94, 0x66, 0x7e, 0x09, 0x00, 0x00, } func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) { @@ -1041,11 +1028,6 @@ func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x22 } } - if m.Option != 0 { - i = encodeVarintGov(dAtA, i, uint64(m.Option)) - i-- - dAtA[i] = 0x18 - } if len(m.Voter) > 0 { i -= len(m.Voter) copy(dAtA[i:], m.Voter) @@ -1323,9 +1305,6 @@ func (m *Vote) Size() (n int) { if l > 0 { n += 1 + l + sovGov(uint64(l)) } - if m.Option != 0 { - n += 1 + sovGov(uint64(m.Option)) - } if len(m.Options) > 0 { for _, e := range m.Options { l = e.Size() @@ -2258,25 +2237,6 @@ func (m *Vote) Unmarshal(dAtA []byte) error { } m.Voter = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) - } - m.Option = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Option |= VoteOption(b&0x7F) << shift - if b < 0x80 { - break - } - } case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) diff --git a/x/gov/types/v1beta2/tx.pb.go b/x/gov/types/v1beta2/tx.pb.go index 82d5d9d74872..5067ce8b5ade 100644 --- a/x/gov/types/v1beta2/tx.pb.go +++ b/x/gov/types/v1beta2/tx.pb.go @@ -37,7 +37,7 @@ type MsgSubmitProposal struct { Messages []*types.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` InitialDeposit []types1.Coin `protobuf:"bytes,2,rep,name=initial_deposit,json=initialDeposit,proto3" json:"initial_deposit"` Proposer string `protobuf:"bytes,3,opt,name=proposer,proto3" json:"proposer,omitempty"` - // metadata is any arbitrary metadata to attached to the proposal. + // metadata is any arbitrary metadata attached to the proposal. Metadata []byte `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"` } From 9606c16c311a8818f382b03358ccef933d8611bd Mon Sep 17 00:00:00 2001 From: Marko Date: Wed, 26 Jan 2022 19:36:24 +0100 Subject: [PATCH 2/5] feat: remove burning of deposits in gov (#11011) ## Description Closes: #11010 only burn deposits on veto'd proposals/ --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) --- CHANGELOG.md | 1 + x/gov/abci.go | 4 ++-- x/gov/keeper/tally.go | 2 +- x/gov/keeper/tally_test.go | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e17643146d1..c36c6b714b46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -192,6 +192,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#10763](https://github.com/cosmos/cosmos-sdk/pull/10763) modify the fields in `TallyParams` to use `string` instead of `bytes` * [#10770](https://github.com/cosmos/cosmos-sdk/pull/10770) revert tx when block gas limit exceeded * [\#10868](https://github.com/cosmos/cosmos-sdk/pull/10868) Bump gov to v1beta2. Both v1beta1 and v1beta2 queries and Msgs are accepted. +* [\#11011](https://github.com/cosmos/cosmos-sdk/pull/11011) Remove burning of deposits when qourum is not reached on a governance proposal and when the deposit is not fully met. ### Deprecated diff --git a/x/gov/abci.go b/x/gov/abci.go index 36fea6f2c0e9..5876358ef493 100644 --- a/x/gov/abci.go +++ b/x/gov/abci.go @@ -17,10 +17,10 @@ func EndBlocker(ctx sdk.Context, keeper keeper.Keeper) { logger := keeper.Logger(ctx) - // delete dead proposals from store and burn theirs deposits. A proposal is dead when it's inactive and didn't get enough deposit on time to get into voting phase. + // delete dead proposals from store and returns theirs deposits. A proposal is dead when it's inactive and didn't get enough deposit on time to get into voting phase. keeper.IterateInactiveProposalsQueue(ctx, ctx.BlockHeader().Time, func(proposal v1beta2.Proposal) bool { keeper.DeleteProposal(ctx, proposal.ProposalId) - keeper.DeleteAndBurnDeposits(ctx, proposal.ProposalId) + keeper.RefundAndDeleteDeposits(ctx, proposal.ProposalId) // refund deposit if proposal got removed without getting 100% of the proposal // called when proposal become inactive keeper.AfterProposalFailedMinDeposit(ctx, proposal.ProposalId) diff --git a/x/gov/keeper/tally.go b/x/gov/keeper/tally.go index 2cabec0cf5bc..470af87088ba 100644 --- a/x/gov/keeper/tally.go +++ b/x/gov/keeper/tally.go @@ -105,7 +105,7 @@ func (keeper Keeper) Tally(ctx sdk.Context, proposal v1beta2.Proposal) (passes b percentVoting := totalVotingPower.Quo(keeper.sk.TotalBondedTokens(ctx).ToDec()) quorum, _ := sdk.NewDecFromStr(tallyParams.Quorum) if percentVoting.LT(quorum) { - return false, true, tallyResults + return false, false, tallyResults } // If no one votes (everyone abstains), proposal fails diff --git a/x/gov/keeper/tally_test.go b/x/gov/keeper/tally_test.go index 2f9d48618f88..a7e3176e18ea 100644 --- a/x/gov/keeper/tally_test.go +++ b/x/gov/keeper/tally_test.go @@ -31,7 +31,7 @@ func TestTallyNoOneVotes(t *testing.T) { passes, burnDeposits, tallyResults := app.GovKeeper.Tally(ctx, proposal) require.False(t, passes) - require.True(t, burnDeposits) + require.False(t, burnDeposits) require.True(t, tallyResults.Equals(v1beta2.EmptyTallyResult())) } @@ -57,7 +57,7 @@ func TestTallyNoQuorum(t *testing.T) { require.True(t, ok) passes, burnDeposits, _ := app.GovKeeper.Tally(ctx, proposal) require.False(t, passes) - require.True(t, burnDeposits) + require.False(t, burnDeposits) } func TestTallyOnlyValidatorsAllYes(t *testing.T) { From 006650c3db909b32576c4f0464ead706eb854453 Mon Sep 17 00:00:00 2001 From: Zhiqiang Zhang <745124335@qq.com> Date: Thu, 27 Jan 2022 16:47:28 +0800 Subject: [PATCH 3/5] feat!: enhanced grpc interface of nft module (#10709) * add grpc NFTsOfOwner method * add comment * fix test error * apply comment from github * format code * apply comments from github * add test case * assert error msg * update adr-043 docs Co-authored-by: Marko --- docs/architecture/adr-043-nft-module.md | 46 ++--- proto/cosmos/nft/v1beta1/query.proto | 14 +- x/nft/client/cli/query.go | 44 +++-- x/nft/client/testutil/grpc.go | 84 +++------ x/nft/client/testutil/query.go | 60 ++----- x/nft/client/testutil/test_helper.go | 12 +- x/nft/keeper/grpc_query.go | 92 +++++----- x/nft/keeper/grpc_query_test.go | 155 ++++++++-------- x/nft/keeper/keeper_test.go | 2 +- x/nft/keeper/keys.go | 39 +++- x/nft/keeper/nft.go | 6 + x/nft/query.pb.go | 228 ++++++++++++------------ x/nft/query.pb.gw.go | 70 ++------ 13 files changed, 394 insertions(+), 458 deletions(-) diff --git a/docs/architecture/adr-043-nft-module.md b/docs/architecture/adr-043-nft-module.md index cf07070c3fee..0da4a5822d29 100644 --- a/docs/architecture/adr-043-nft-module.md +++ b/docs/architecture/adr-043-nft-module.md @@ -95,8 +95,8 @@ message NFT { } ``` -- `class_id` is the identifier of the NFT class where the NFT belongs; _required_ -- `id` is an alphanumeric identifier of the NFT, unique within the scope of its class. It is specified by the creator of the NFT and may be expanded to use DID in the future. `class_id` combined with `id` uniquely identifies an NFT and is used as the primary index for storing the NFT; _required_ +- `class_id` is the identifier of the NFT class where the NFT belongs; _required_,`[a-zA-Z][a-zA-Z0-9/:-]{2,100}` +- `id` is an alphanumeric identifier of the NFT, unique within the scope of its class. It is specified by the creator of the NFT and may be expanded to use DID in the future. `class_id` combined with `id` uniquely identifies an NFT and is used as the primary index for storing the NFT; _required_,`[a-zA-Z][a-zA-Z0-9/:-]{2,100}` ``` {class_id}/{id} --> NFT (bytes) @@ -175,10 +175,9 @@ The query service methods for the `x/nft` module are: ```proto service Query { - // Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) { - option (google.api.http).get = "/cosmos/nft/v1beta1/balance/{class_id}/{owner}"; + option (google.api.http).get = "/cosmos/nft/v1beta1/balance/{owner}/{class_id}"; } // Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 @@ -186,19 +185,14 @@ service Query { option (google.api.http).get = "/cosmos/nft/v1beta1/owner/{class_id}/{id}"; } - // Supply queries the number of NFTs of a given class, same as totalSupply in ERC721Enumerable + // Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. rpc Supply(QuerySupplyRequest) returns (QuerySupplyResponse) { option (google.api.http).get = "/cosmos/nft/v1beta1/supply/{class_id}"; } - // NFTsOfClassByOwner queries the NFTs of a given class owned by the owner, similar to tokenOfOwnerByIndex in ERC721Enumerable - rpc NFTsOfClassByOwner(QueryNFTsOfClassByOwnerRequest) returns (QueryNFTsResponse) { - option (google.api.http).get = "/cosmos/nft/v1beta1/owned_nfts/{class_id}/{owner}"; - } - - // NFTsOfClass queries all NFTs of a given class, similar to tokenByIndex in ERC721Enumerable - rpc NFTsOfClass(QueryNFTsOfClassRequest) returns (QueryNFTsResponse) { - option (google.api.http).get = "/cosmos/nft/v1beta1/nfts/{class_id}"; + // NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in ERC721Enumerable + rpc NFTs(QueryNFTsRequest) returns (QueryNFTsResponse) { + option (google.api.http).get = "/cosmos/nft/v1beta1/nfts"; } // NFT queries an NFT based on its class and id. @@ -208,12 +202,12 @@ service Query { // Class queries an NFT class based on its id rpc Class(QueryClassRequest) returns (QueryClassResponse) { - option (google.api.http).get = "/cosmos/nft/v1beta1/classes/{class_id}"; + option (google.api.http).get = "/cosmos/nft/v1beta1/classes/{class_id}"; } // Classes queries all NFT classes rpc Classes(QueryClassesRequest) returns (QueryClassesResponse) { - option (google.api.http).get = "/cosmos/nft/v1beta1/classes"; + option (google.api.http).get = "/cosmos/nft/v1beta1/classes"; } } @@ -224,7 +218,7 @@ message QueryBalanceRequest { } // QueryBalanceResponse is the response type for the Query/Balance RPC method -message QueryBalanceResponse{ +message QueryBalanceResponse { uint64 amount = 1; } @@ -235,7 +229,7 @@ message QueryOwnerRequest { } // QueryOwnerResponse is the response type for the Query/Owner RPC method -message QueryOwnerResponse{ +message QueryOwnerResponse { string owner = 1; } @@ -249,20 +243,14 @@ message QuerySupplyResponse { uint64 amount = 1; } -// QueryNFTsOfClassByOwnerRequest is the request type for the Query/NFTsOfClassByOwner RPC method -message QueryNFTsOfClassByOwnerRequest { - string class_id = 1; - string owner = 2; - cosmos.base.query.v1beta1.PageResponse pagination = 3; -} - -// QueryNFTsOfClassRequest is the request type for the Query/NFTsOfClass RPC method -message QueryNFTsOfClassRequest { - string class_id = 1; - cosmos.base.query.v1beta1.PageResponse pagination = 2; +// QueryNFTstRequest is the request type for the Query/NFTs RPC method +message QueryNFTsRequest { + string class_id = 1; + string owner = 2; + cosmos.base.query.v1beta1.PageRequest pagination = 3; } -// QueryNFTsResponse is the response type for the Query/NFTsOfClass and Query/NFTsOfClassByOwner RPC methods +// QueryNFTsResponse is the response type for the Query/NFTs RPC methods message QueryNFTsResponse { repeated cosmos.nft.v1beta1.NFT nfts = 1; cosmos.base.query.v1beta1.PageResponse pagination = 2; diff --git a/proto/cosmos/nft/v1beta1/query.proto b/proto/cosmos/nft/v1beta1/query.proto index 4beb72e9aa28..d343ca6f6695 100644 --- a/proto/cosmos/nft/v1beta1/query.proto +++ b/proto/cosmos/nft/v1beta1/query.proto @@ -24,9 +24,9 @@ service Query { option (google.api.http).get = "/cosmos/nft/v1beta1/supply/{class_id}"; } - // NFTsOfClass queries all NFTs of a given class or optional owner, similar to tokenByIndex in ERC721Enumerable - rpc NFTsOfClass(QueryNFTsOfClassRequest) returns (QueryNFTsOfClassResponse) { - option (google.api.http).get = "/cosmos/nft/v1beta1/nfts/{class_id}"; + // NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in ERC721Enumerable + rpc NFTs(QueryNFTsRequest) returns (QueryNFTsResponse) { + option (google.api.http).get = "/cosmos/nft/v1beta1/nfts"; } // NFT queries an NFT based on its class and id. @@ -77,15 +77,15 @@ message QuerySupplyResponse { uint64 amount = 1; } -// QueryNFTsOfClassRequest is the request type for the Query/NFTsOfClass RPC method -message QueryNFTsOfClassRequest { +// QueryNFTstRequest is the request type for the Query/NFTs RPC method +message QueryNFTsRequest { string class_id = 1; string owner = 2; cosmos.base.query.v1beta1.PageRequest pagination = 3; } -// QueryNFTsOfClassResponse is the response type for the Query/NFTsOfClass and Query/NFTsOfClassByOwner RPC methods -message QueryNFTsOfClassResponse { +// QueryNFTsResponse is the response type for the Query/NFTs RPC methods +message QueryNFTsResponse { repeated cosmos.nft.v1beta1.NFT nfts = 1; cosmos.base.query.v1beta1.PageResponse pagination = 2; } diff --git a/x/nft/client/cli/query.go b/x/nft/client/cli/query.go index cb8a379d6ba5..3231aa85a916 100644 --- a/x/nft/client/cli/query.go +++ b/x/nft/client/cli/query.go @@ -2,19 +2,21 @@ package cli import ( "fmt" - "strings" - "github.com/spf13/cobra" + "strings" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/nft" ) // Flag names and values const ( - FlagOwner = "owner" + FlagOwner = "owner" + FlagClassID = "class-id" ) // GetQueryCmd returns the cli query commands for this module @@ -126,8 +128,7 @@ func GetCmdQueryNFT() *cobra.Command { // GetCmdQueryNFTs implements the query nft command. func GetCmdQueryNFTs() *cobra.Command { cmd := &cobra.Command{ - Use: "nfts [class-id]", - Args: cobra.ExactArgs(1), + Use: "nfts", Short: "query all NFTs of a given class or owner address.", Long: strings.TrimSpace( fmt.Sprintf(`Query all NFTs of a given class or owner address. If owner @@ -148,20 +149,38 @@ $ %s query %s nfts --owner= return err } - request := &nft.QueryNFTsOfClassRequest{ - ClassId: args[0], - Pagination: pageReq, - } - owner, err := cmd.Flags().GetString(FlagOwner) if err != nil { return err } if len(owner) > 0 { - request.Owner = owner + if _, err := sdk.AccAddressFromBech32(owner); err != nil { + return err + } + } + + classID, err := cmd.Flags().GetString(FlagClassID) + if err != nil { + return err + } + + if len(classID) > 0 { + if err := nft.ValidateClassID(classID); err != nil { + return err + } + } + + if len(owner) == 0 && len(classID) == 0 { + return errors.ErrInvalidRequest.Wrap("must provide at least one of classID or owner") + } + + request := &nft.QueryNFTsRequest{ + ClassId: classID, + Owner: owner, + Pagination: pageReq, } - res, err := queryClient.NFTsOfClass(cmd.Context(), request) + res, err := queryClient.NFTs(cmd.Context(), request) if err != nil { return err } @@ -171,6 +190,7 @@ $ %s query %s nfts --owner= flags.AddQueryFlagsToCmd(cmd) flags.AddPaginationFlagsToCmd(cmd, "nfts") cmd.Flags().String(FlagOwner, "", "The owner of the nft") + cmd.Flags().String(FlagClassID, "", "The class-id of the nft") return cmd } diff --git a/x/nft/client/testutil/grpc.go b/x/nft/client/testutil/grpc.go index e89196cbfabd..8d98182c5b7d 100644 --- a/x/nft/client/testutil/grpc.go +++ b/x/nft/client/testutil/grpc.go @@ -161,6 +161,7 @@ func (s *IntegrationTestSuite) TestQueryOwnerGRPC() { var result nft.QueryOwnerResponse err = val.ClientCtx.Codec.UnmarshalJSON(resp, &result) s.Require().NoError(err) + s.Require().EqualValues(tc.expectResult, result.Owner) } }) } @@ -228,7 +229,7 @@ func (s *IntegrationTestSuite) TestQuerySupplyGRPC() { } } -func (s *IntegrationTestSuite) TestQueryNFTsByOwnerGRPC() { +func (s *IntegrationTestSuite) TestQueryNFTsGRPC() { val := s.network.Validators[0] testCases := []struct { name string @@ -241,125 +242,82 @@ func (s *IntegrationTestSuite) TestQueryNFTsByOwnerGRPC() { expectResult []*nft.NFT }{ { - name: "class id is invalid", + name: "classID and owner are both empty", args: struct { ClassId string Owner string - }{ - ClassId: "invalid_class_id", - Owner: s.owner.String(), - }, + }{}, + errorMsg: "must provide at least one of classID or owner", expectErr: true, - errorMsg: "invalid class id", expectResult: []*nft.NFT{}, }, { - name: "class id does not exist", + name: "classID is invalid", args: struct { ClassId string Owner string }{ - ClassId: "class-id", - Owner: s.owner.String(), + ClassId: "invalid_class_id", }, - expectErr: false, + expectErr: true, expectResult: []*nft.NFT{}, }, { - name: "owner does not exist", + name: "classID does not exist", args: struct { ClassId string Owner string }{ - ClassId: ExpNFT.ClassId, - Owner: s.owner.String(), + ClassId: "class-id", }, expectErr: false, expectResult: []*nft.NFT{}, }, { - name: "nft exist", + name: "success query by classID", args: struct { ClassId string Owner string }{ ClassId: ExpNFT.ClassId, - Owner: val.Address.String(), }, expectErr: false, expectResult: []*nft.NFT{&ExpNFT}, }, - } - nftsOfClassURL := val.APIAddress + "/cosmos/nft/v1beta1/nfts/%s?owner=%s" - for _, tc := range testCases { - uri := fmt.Sprintf(nftsOfClassURL, tc.args.ClassId, tc.args.Owner) - s.Run(tc.name, func() { - resp, err := rest.GetRequest(uri) - if tc.expectErr { - s.Require().Contains(string(resp), tc.errorMsg) - } else { - s.Require().NoError(err) - var result nft.QueryNFTsOfClassResponse - err = val.ClientCtx.Codec.UnmarshalJSON(resp, &result) - s.Require().NoError(err) - s.Require().EqualValues(tc.expectResult, result.Nfts) - } - }) - } -} - -func (s *IntegrationTestSuite) TestQueryNFTsOfClassGRPC() { - val := s.network.Validators[0] - testCases := []struct { - name string - args struct { - ClassId string - } - expectErr bool - errorMsg string - expectResult []*nft.NFT - }{ - { - name: "class id is invalid", - args: struct { - ClassId string - }{ - ClassId: "invalid_class_id", - }, - expectErr: true, - expectResult: []*nft.NFT{}, - }, { - name: "class id does not exist", + name: "success query by owner", args: struct { ClassId string + Owner string }{ - ClassId: "class-id", + Owner: val.Address.String(), }, expectErr: false, - expectResult: []*nft.NFT{}, + expectResult: []*nft.NFT{&ExpNFT}, }, { - name: "class id exist", + name: "success query by owner and classID", args: struct { ClassId string + Owner string }{ ClassId: ExpNFT.ClassId, + Owner: val.Address.String(), }, expectErr: false, expectResult: []*nft.NFT{&ExpNFT}, }, } - nftsOfClassURL := val.APIAddress + "/cosmos/nft/v1beta1/nfts/%s" + nftsOfClassURL := val.APIAddress + "/cosmos/nft/v1beta1/nfts?class_id=%s&owner=%s" for _, tc := range testCases { - uri := fmt.Sprintf(nftsOfClassURL, tc.args.ClassId) + uri := fmt.Sprintf(nftsOfClassURL, tc.args.ClassId, tc.args.Owner) s.Run(tc.name, func() { resp, err := rest.GetRequest(uri) if tc.expectErr { s.Require().Contains(string(resp), tc.errorMsg) } else { s.Require().NoError(err) - var result nft.QueryNFTsOfClassResponse + var result nft.QueryNFTsResponse err = val.ClientCtx.Codec.UnmarshalJSON(resp, &result) s.Require().NoError(err) s.Require().EqualValues(tc.expectResult, result.Nfts) diff --git a/x/nft/client/testutil/query.go b/x/nft/client/testutil/query.go index 83588d524ba0..ecc9660d2abf 100644 --- a/x/nft/client/testutil/query.go +++ b/x/nft/client/testutil/query.go @@ -137,53 +137,6 @@ func (s *IntegrationTestSuite) TestQueryNFT() { } func (s *IntegrationTestSuite) TestQueryNFTs() { - val := s.network.Validators[0] - testCases := []struct { - name string - args struct { - ClassID string - } - expectErr bool - expectResult []*nft.NFT - }{ - { - name: "class id does not exist", - args: struct { - ClassID string - }{ - ClassID: "class", - }, - expectErr: false, - expectResult: []*nft.NFT{}, - }, - { - name: "class id exist", - args: struct { - ClassID string - }{ - ClassID: testClassID, - }, - expectErr: false, - expectResult: []*nft.NFT{&ExpNFT}, - }, - } - for _, tc := range testCases { - s.Run(tc.name, func() { - resp, err := ExecQueryNFTs(val, tc.args.ClassID) - if tc.expectErr { - s.Require().Error(err) - } else { - s.Require().NoError(err) - var result nft.QueryNFTsOfClassResponse - err = val.ClientCtx.Codec.UnmarshalJSON(resp.Bytes(), &result) - s.Require().NoError(err) - s.Require().EqualValues(tc.expectResult, result.Nfts) - } - }) - } -} - -func (s *IntegrationTestSuite) TestQueryNFTsByOwner() { val := s.network.Validators[0] testCases := []struct { name string @@ -218,6 +171,15 @@ func (s *IntegrationTestSuite) TestQueryNFTsByOwner() { expectErr: false, expectResult: []*nft.NFT{}, }, + { + name: "class id and owner both does not exist", + args: struct { + ClassID string + Owner string + }{}, + expectErr: true, + expectResult: []*nft.NFT{}, + }, { name: "nft exist", args: struct { @@ -233,12 +195,12 @@ func (s *IntegrationTestSuite) TestQueryNFTsByOwner() { } for _, tc := range testCases { s.Run(tc.name, func() { - resp, err := ExecQueryNFTsByOwner(val, tc.args.ClassID, tc.args.Owner) + resp, err := ExecQueryNFTs(val, tc.args.ClassID, tc.args.Owner) if tc.expectErr { s.Require().Error(err) } else { s.Require().NoError(err) - var result nft.QueryNFTsOfClassResponse + var result nft.QueryNFTsResponse err = val.ClientCtx.Codec.UnmarshalJSON(resp.Bytes(), &result) s.Require().NoError(err) s.Require().EqualValues(tc.expectResult, result.Nfts) diff --git a/x/nft/client/testutil/test_helper.go b/x/nft/client/testutil/test_helper.go index a3f43045c8aa..20edd5cbfc9a 100644 --- a/x/nft/client/testutil/test_helper.go +++ b/x/nft/client/testutil/test_helper.go @@ -40,18 +40,10 @@ func ExecQueryNFT(val *network.Validator, classID, nftID string) (testutil.Buffe return clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, args) } -func ExecQueryNFTs(val *network.Validator, classID string) (testutil.BufferWriter, error) { +func ExecQueryNFTs(val *network.Validator, classID, owner string) (testutil.BufferWriter, error) { cmd := cli.GetCmdQueryNFTs() var args []string - args = append(args, classID) - args = append(args, fmt.Sprintf("--%s=json", tmcli.OutputFlag)) - return clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, args) -} - -func ExecQueryNFTsByOwner(val *network.Validator, classID, owner string) (testutil.BufferWriter, error) { - cmd := cli.GetCmdQueryNFTs() - var args []string - args = append(args, classID) + args = append(args, fmt.Sprintf("--%s=%s", cli.FlagClassID, classID)) args = append(args, fmt.Sprintf("--%s=%s", cli.FlagOwner, owner)) args = append(args, fmt.Sprintf("--%s=json", tmcli.OutputFlag)) return clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, args) diff --git a/x/nft/keeper/grpc_query.go b/x/nft/keeper/grpc_query.go index 602ea7a180b6..f79641326e4c 100644 --- a/x/nft/keeper/grpc_query.go +++ b/x/nft/keeper/grpc_query.go @@ -15,7 +15,7 @@ var _ nft.QueryServer = Keeper{} // Balance return the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 func (k Keeper) Balance(goCtx context.Context, r *nft.QueryBalanceRequest) (*nft.QueryBalanceResponse, error) { if r == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty request") + return nil, sdkerrors.ErrInvalidRequest.Wrap("empty request") } if err := nft.ValidateClassID(r.ClassId); err != nil { @@ -35,7 +35,7 @@ func (k Keeper) Balance(goCtx context.Context, r *nft.QueryBalanceRequest) (*nft // Owner return the owner of the NFT based on its class and id, same as ownerOf in ERC721 func (k Keeper) Owner(goCtx context.Context, r *nft.QueryOwnerRequest) (*nft.QueryOwnerResponse, error) { if r == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty request") + return nil, sdkerrors.ErrInvalidRequest.Wrap("empty request") } if err := nft.ValidateClassID(r.ClassId); err != nil { @@ -54,7 +54,7 @@ func (k Keeper) Owner(goCtx context.Context, r *nft.QueryOwnerRequest) (*nft.Que // Supply return the number of NFTs from the given class, same as totalSupply of ERC721. func (k Keeper) Supply(goCtx context.Context, r *nft.QuerySupplyRequest) (*nft.QuerySupplyResponse, error) { if r == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty request") + return nil, sdkerrors.ErrInvalidRequest.Wrap("empty request") } if err := nft.ValidateClassID(r.ClassId); err != nil { @@ -65,58 +65,68 @@ func (k Keeper) Supply(goCtx context.Context, r *nft.QuerySupplyRequest) (*nft.Q return &nft.QuerySupplyResponse{Amount: supply}, nil } -// NFTsOfClass return all NFTs of a given class or optional owner, similar to tokenByIndex in ERC721Enumerable -func (k Keeper) NFTsOfClass(goCtx context.Context, r *nft.QueryNFTsOfClassRequest) (*nft.QueryNFTsOfClassResponse, error) { +// NFTs queries all NFTs of a given class or owner (at least one must be provided), similar to tokenByIndex in ERC721Enumerable +func (k Keeper) NFTs(goCtx context.Context, r *nft.QueryNFTsRequest) (*nft.QueryNFTsResponse, error) { if r == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty request") + return nil, sdkerrors.ErrInvalidRequest.Wrap("empty request") } - if err := nft.ValidateClassID(r.ClassId); err != nil { - return nil, err + var err error + var owner sdk.AccAddress + if len(r.ClassId) > 0 { + if err := nft.ValidateClassID(r.ClassId); err != nil { + return nil, err + } } - var nfts []*nft.NFT - ctx := sdk.UnwrapSDKContext(goCtx) - - // if owner is not empty, filter nft by owner if len(r.Owner) > 0 { - owner, err := sdk.AccAddressFromBech32(r.Owner) + owner, err = sdk.AccAddressFromBech32(r.Owner) if err != nil { return nil, err } + } + + var nfts []*nft.NFT + var pageRes *query.PageResponse + ctx := sdk.UnwrapSDKContext(goCtx) - ownerStore := k.getClassStoreByOwner(ctx, owner, r.ClassId) - pageRes, err := query.Paginate(ownerStore, r.Pagination, func(key []byte, _ []byte) error { + switch { + case len(r.ClassId) > 0 && len(r.Owner) > 0: + if pageRes, err = query.Paginate(k.getClassStoreByOwner(ctx, owner, r.ClassId), r.Pagination, func(key []byte, _ []byte) error { nft, has := k.GetNFT(ctx, r.ClassId, string(key)) if has { nfts = append(nfts, &nft) } return nil - }) - - if err != nil { + }); err != nil { return nil, err } - return &nft.QueryNFTsOfClassResponse{ - Nfts: nfts, - Pagination: pageRes, - }, nil - } - - nftStore := k.getNFTStore(ctx, r.ClassId) - pageRes, err := query.Paginate(nftStore, r.Pagination, func(_ []byte, value []byte) error { - var nft nft.NFT - if err := k.cdc.Unmarshal(value, &nft); err != nil { - return err + case len(r.ClassId) > 0 && len(r.Owner) == 0: + nftStore := k.getNFTStore(ctx, r.ClassId) + if pageRes, err = query.Paginate(nftStore, r.Pagination, func(_ []byte, value []byte) error { + var nft nft.NFT + if err := k.cdc.Unmarshal(value, &nft); err != nil { + return err + } + nfts = append(nfts, &nft) + return nil + }); err != nil { + return nil, err } - nfts = append(nfts, &nft) - return nil - }) - - if err != nil { - return nil, err + case len(r.ClassId) == 0 && len(r.Owner) > 0: + if pageRes, err = query.Paginate(k.prefixStoreNftOfClassByOwner(ctx, owner), r.Pagination, func(key []byte, value []byte) error { + classID, nftID := parseNftOfClassByOwnerStoreKey(key) + if n, has := k.GetNFT(ctx, classID, nftID); has { + nfts = append(nfts, &n) + } + return nil + }); err != nil { + return nil, err + } + default: + return nil, sdkerrors.ErrInvalidRequest.Wrap("must provide at least one of classID or owner") } - return &nft.QueryNFTsOfClassResponse{ + return &nft.QueryNFTsResponse{ Nfts: nfts, Pagination: pageRes, }, nil @@ -125,7 +135,7 @@ func (k Keeper) NFTsOfClass(goCtx context.Context, r *nft.QueryNFTsOfClassReques // NFT return an NFT based on its class and id. func (k Keeper) NFT(goCtx context.Context, r *nft.QueryNFTRequest) (*nft.QueryNFTResponse, error) { if r == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty request") + return nil, sdkerrors.ErrInvalidRequest.Wrap("empty request") } if err := nft.ValidateClassID(r.ClassId); err != nil { @@ -138,7 +148,7 @@ func (k Keeper) NFT(goCtx context.Context, r *nft.QueryNFTRequest) (*nft.QueryNF ctx := sdk.UnwrapSDKContext(goCtx) n, has := k.GetNFT(ctx, r.ClassId, r.Id) if !has { - return nil, sdkerrors.Wrapf(nft.ErrNFTNotExists, "not found nft: class: %s, id: %s", r.ClassId, r.Id) + return nil, nft.ErrNFTNotExists.Wrapf("not found nft: class: %s, id: %s", r.ClassId, r.Id) } return &nft.QueryNFTResponse{Nft: &n}, nil @@ -147,7 +157,7 @@ func (k Keeper) NFT(goCtx context.Context, r *nft.QueryNFTRequest) (*nft.QueryNF // Class return an NFT class based on its id func (k Keeper) Class(goCtx context.Context, r *nft.QueryClassRequest) (*nft.QueryClassResponse, error) { if r == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty request") + return nil, sdkerrors.ErrInvalidRequest.Wrap("empty request") } if err := nft.ValidateClassID(r.ClassId); err != nil { @@ -157,7 +167,7 @@ func (k Keeper) Class(goCtx context.Context, r *nft.QueryClassRequest) (*nft.Que ctx := sdk.UnwrapSDKContext(goCtx) class, has := k.GetClass(ctx, r.ClassId) if !has { - return nil, sdkerrors.Wrapf(nft.ErrClassNotExists, "not found class: %s", r.ClassId) + return nil, nft.ErrClassNotExists.Wrapf("not found class: %s", r.ClassId) } return &nft.QueryClassResponse{Class: &class}, nil } @@ -165,7 +175,7 @@ func (k Keeper) Class(goCtx context.Context, r *nft.QueryClassRequest) (*nft.Que // Classes return all NFT classes func (k Keeper) Classes(goCtx context.Context, r *nft.QueryClassesRequest) (*nft.QueryClassesResponse, error) { if r == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty request") + return nil, sdkerrors.ErrInvalidRequest.Wrap("empty request") } ctx := sdk.UnwrapSDKContext(goCtx) diff --git a/x/nft/keeper/grpc_query_test.go b/x/nft/keeper/grpc_query_test.go index 0997721c481b..20d0f0afbc7c 100644 --- a/x/nft/keeper/grpc_query_test.go +++ b/x/nft/keeper/grpc_query_test.go @@ -15,7 +15,7 @@ func TestGRPCQuery(t *testing.T) { suite.Run(t, new(TestSuite)) } -func (suite *TestSuite) TestBalance() { +func (s *TestSuite) TestBalance() { var ( req *nft.QueryBalanceRequest ) @@ -50,10 +50,10 @@ func (suite *TestSuite) TestBalance() { { "Success", func(index int, require *require.Assertions) { - suite.TestMint() + s.TestMint() req = &nft.QueryBalanceRequest{ ClassId: testClassID, - Owner: suite.addrs[0].String(), + Owner: s.addrs[0].String(), } }, "", @@ -64,10 +64,10 @@ func (suite *TestSuite) TestBalance() { }, } for index, tc := range testCases { - suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { - require := suite.Require() + s.Run(fmt.Sprintf("Case %s", tc.msg), func() { + require := s.Require() tc.malleate(index, require) - result, err := suite.queryClient.Balance(gocontext.Background(), req) + result, err := s.queryClient.Balance(gocontext.Background(), req) if tc.expError == "" { require.NoError(err) } else { @@ -79,7 +79,7 @@ func (suite *TestSuite) TestBalance() { } } -func (suite *TestSuite) TestOwner() { +func (s *TestSuite) TestOwner() { var ( req *nft.QueryOwnerRequest owner string @@ -139,12 +139,12 @@ func (suite *TestSuite) TestOwner() { { "Success", func(index int, require *require.Assertions) { - suite.TestMint() + s.TestMint() req = &nft.QueryOwnerRequest{ ClassId: testClassID, Id: testID, } - owner = suite.addrs[0].String() + owner = s.addrs[0].String() }, "", func(index int, require *require.Assertions, res *nft.QueryOwnerResponse) { @@ -153,10 +153,10 @@ func (suite *TestSuite) TestOwner() { }, } for index, tc := range testCases { - suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { - require := suite.Require() + s.Run(fmt.Sprintf("Case %s", tc.msg), func() { + require := s.Require() tc.malleate(index, require) - result, err := suite.queryClient.Owner(gocontext.Background(), req) + result, err := s.queryClient.Owner(gocontext.Background(), req) if tc.expError == "" { require.NoError(err) } else { @@ -168,7 +168,7 @@ func (suite *TestSuite) TestOwner() { } } -func (suite *TestSuite) TestSupply() { +func (s *TestSuite) TestSupply() { var ( req *nft.QuerySupplyRequest ) @@ -207,7 +207,7 @@ func (suite *TestSuite) TestSupply() { req = &nft.QuerySupplyRequest{ ClassId: testClassID, } - suite.TestSaveClass() + s.TestSaveClass() }, "", 0, @@ -223,7 +223,7 @@ func (suite *TestSuite) TestSupply() { Id: testID, Uri: testURI, } - err := suite.app.NFTKeeper.Mint(suite.ctx, n, suite.addrs[0]) + err := s.app.NFTKeeper.Mint(s.ctx, n, s.addrs[0]) require.NoError(err, "the error occurred on:%d", index) req = &nft.QuerySupplyRequest{ @@ -238,10 +238,10 @@ func (suite *TestSuite) TestSupply() { }, } for index, tc := range testCases { - suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { - require := suite.Require() + s.Run(fmt.Sprintf("Case %s", tc.msg), func() { + require := s.Require() tc.malleate(index, require) - result, err := suite.queryClient.Supply(gocontext.Background(), req) + result, err := s.queryClient.Supply(gocontext.Background(), req) if tc.expError == "" { require.NoError(err) } else { @@ -252,43 +252,42 @@ func (suite *TestSuite) TestSupply() { }) } } - -func (suite *TestSuite) TestNFTsOfClass() { +func (s *TestSuite) TestNFTs() { var ( - req *nft.QueryNFTsOfClassRequest + req *nft.QueryNFTsRequest nfts []*nft.NFT ) testCases := []struct { msg string malleate func(index int, require *require.Assertions) expError string - postTest func(index int, require *require.Assertions, res *nft.QueryNFTsOfClassResponse) + postTest func(index int, require *require.Assertions, res *nft.QueryNFTsResponse) }{ { - "fail empty ClassId", + "fail empty Owner and ClassId", func(index int, require *require.Assertions) { - req = &nft.QueryNFTsOfClassRequest{} + req = &nft.QueryNFTsRequest{} }, - "invalid class id", - func(index int, require *require.Assertions, res *nft.QueryNFTsOfClassResponse) {}, + "must provide at least one of classID or owner", + func(index int, require *require.Assertions, res *nft.QueryNFTsResponse) {}, }, { - "success, no nft", + "success,empty ClassId and no nft", func(index int, require *require.Assertions) { - req = &nft.QueryNFTsOfClassRequest{ - ClassId: testClassID, + req = &nft.QueryNFTsRequest{ + Owner: s.addrs[1].String(), } - suite.TestSaveClass() + s.TestSaveClass() }, "", - func(index int, require *require.Assertions, res *nft.QueryNFTsOfClassResponse) { + func(index int, require *require.Assertions, res *nft.QueryNFTsResponse) { require.Len(res.Nfts, 0, "the error occurred on:%d", index) }, }, { - "success, class id not exist", + "success, empty Owner and class id not exist", func(index int, require *require.Assertions) { - req = &nft.QueryNFTsOfClassRequest{ + req = &nft.QueryNFTsRequest{ ClassId: "kitty1", } n := nft.NFT{ @@ -296,52 +295,60 @@ func (suite *TestSuite) TestNFTsOfClass() { Id: testID, Uri: testURI, } - err := suite.app.NFTKeeper.Mint(suite.ctx, n, suite.addrs[0]) + err := s.app.NFTKeeper.Mint(s.ctx, n, s.addrs[0]) require.NoError(err, "the error occurred on:%d", index) }, "", - func(index int, require *require.Assertions, res *nft.QueryNFTsOfClassResponse) { + func(index int, require *require.Assertions, res *nft.QueryNFTsResponse) { require.Len(res.Nfts, 0, "the error occurred on:%d", index) }, }, { - "success, owner not exist", + "Success,query by owner", func(index int, require *require.Assertions) { - req = &nft.QueryNFTsOfClassRequest{ - ClassId: testClassID, - Owner: suite.addrs[1].String(), + err := s.app.NFTKeeper.SaveClass(s.ctx, nft.Class{ + Id: "MyKitty", + }) + require.NoError(err) + + nfts = []*nft.NFT{} + for i := 0; i < 5; i++ { + n := nft.NFT{ + ClassId: "MyKitty", + Id: fmt.Sprintf("MyCat%d", i), + } + err := s.app.NFTKeeper.Mint(s.ctx, n, s.addrs[2]) + require.NoError(err) + nfts = append(nfts, &n) + } + + req = &nft.QueryNFTsRequest{ + Owner: s.addrs[2].String(), } }, "", - func(index int, require *require.Assertions, res *nft.QueryNFTsOfClassResponse) { - require.Len(res.Nfts, 0, "the error occurred on:%d", index) + func(index int, require *require.Assertions, res *nft.QueryNFTsResponse) { + require.EqualValues(res.Nfts, nfts, "the error occurred on:%d", index) }, }, { - "Success, query by classId", + "Success,query by classID", func(index int, require *require.Assertions) { - req = &nft.QueryNFTsOfClassRequest{ - ClassId: testClassID, - } - nfts = []*nft.NFT{ - { - ClassId: testClassID, - Id: testID, - Uri: testURI, - }, + req = &nft.QueryNFTsRequest{ + ClassId: "MyKitty", } }, "", - func(index int, require *require.Assertions, res *nft.QueryNFTsOfClassResponse) { - require.Equal(res.Nfts, nfts, "the error occurred on:%d", index) + func(index int, require *require.Assertions, res *nft.QueryNFTsResponse) { + require.EqualValues(res.Nfts, nfts, "the error occurred on:%d", index) }, }, { "Success,query by classId and owner", func(index int, require *require.Assertions) { - req = &nft.QueryNFTsOfClassRequest{ + req = &nft.QueryNFTsRequest{ ClassId: testClassID, - Owner: suite.addrs[0].String(), + Owner: s.addrs[0].String(), } nfts = []*nft.NFT{ { @@ -352,16 +359,16 @@ func (suite *TestSuite) TestNFTsOfClass() { } }, "", - func(index int, require *require.Assertions, res *nft.QueryNFTsOfClassResponse) { + func(index int, require *require.Assertions, res *nft.QueryNFTsResponse) { require.Equal(res.Nfts, nfts, "the error occurred on:%d", index) }, }, } for index, tc := range testCases { - suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { - require := suite.Require() + s.Run(fmt.Sprintf("Case %s", tc.msg), func() { + require := s.Require() tc.malleate(index, require) - result, err := suite.queryClient.NFTsOfClass(gocontext.Background(), req) + result, err := s.queryClient.NFTs(gocontext.Background(), req) if tc.expError == "" { require.NoError(err) } else { @@ -373,7 +380,7 @@ func (suite *TestSuite) TestNFTsOfClass() { } } -func (suite *TestSuite) TestNFT() { +func (s *TestSuite) TestNFT() { var ( req *nft.QueryNFTRequest expNFT nft.NFT @@ -409,7 +416,7 @@ func (suite *TestSuite) TestNFT() { ClassId: "kitty1", Id: testID, } - suite.TestMint() + s.TestMint() }, "not found nft", func(index int, require *require.Assertions, res *nft.QueryNFTResponse) {}, @@ -445,10 +452,10 @@ func (suite *TestSuite) TestNFT() { }, } for index, tc := range testCases { - suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { - require := suite.Require() + s.Run(fmt.Sprintf("Case %s", tc.msg), func() { + require := s.Require() tc.malleate(index, require) - result, err := suite.queryClient.NFT(gocontext.Background(), req) + result, err := s.queryClient.NFT(gocontext.Background(), req) if tc.expError == "" { require.NoError(err) } else { @@ -460,7 +467,7 @@ func (suite *TestSuite) TestNFT() { } } -func (suite *TestSuite) TestClass() { +func (s *TestSuite) TestClass() { var ( req *nft.QueryClassRequest class nft.Class @@ -485,7 +492,7 @@ func (suite *TestSuite) TestClass() { req = &nft.QueryClassRequest{ ClassId: "kitty1", } - suite.TestSaveClass() + s.TestSaveClass() }, "not found class", func(index int, require *require.Assertions, res *nft.QueryClassResponse) {}, @@ -512,10 +519,10 @@ func (suite *TestSuite) TestClass() { }, } for index, tc := range testCases { - suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { - require := suite.Require() + s.Run(fmt.Sprintf("Case %s", tc.msg), func() { + require := s.Require() tc.malleate(index, require) - result, err := suite.queryClient.Class(gocontext.Background(), req) + result, err := s.queryClient.Class(gocontext.Background(), req) if tc.expError == "" { require.NoError(err) } else { @@ -527,7 +534,7 @@ func (suite *TestSuite) TestClass() { } } -func (suite *TestSuite) TestClasses() { +func (s *TestSuite) TestClasses() { var ( req *nft.QueryClassesRequest classes []nft.Class @@ -562,7 +569,7 @@ func (suite *TestSuite) TestClasses() { UriHash: testClassURIHash, }, } - suite.TestSaveClass() + s.TestSaveClass() }, "", func(index int, require *require.Assertions, res *nft.QueryClassesResponse) { @@ -572,10 +579,10 @@ func (suite *TestSuite) TestClasses() { }, } for index, tc := range testCases { - suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { - require := suite.Require() + s.Run(fmt.Sprintf("Case %s", tc.msg), func() { + require := s.Require() tc.malleate(index, require) - result, err := suite.queryClient.Classes(gocontext.Background(), req) + result, err := s.queryClient.Classes(gocontext.Background(), req) if tc.expError == "" { require.NoError(err) } else { diff --git a/x/nft/keeper/keeper_test.go b/x/nft/keeper/keeper_test.go index 150446349b32..7e03f79eb582 100644 --- a/x/nft/keeper/keeper_test.go +++ b/x/nft/keeper/keeper_test.go @@ -169,7 +169,7 @@ func (s *TestSuite) TestMint() { // test GetNFTsOfClassByOwner actNFTs = s.app.NFTKeeper.GetNFTsOfClassByOwner(s.ctx, testClassID, s.addrs[0]) - s.Require().EqualValues([]nft.NFT{expNFT,expNFT2}, actNFTs) + s.Require().EqualValues([]nft.NFT{expNFT, expNFT2}, actNFTs) // test GetBalance balance = s.app.NFTKeeper.GetBalance(s.ctx, testClassID, s.addrs[0]) diff --git a/x/nft/keeper/keys.go b/x/nft/keeper/keys.go index 13c338089124..2e385fdecedb 100644 --- a/x/nft/keeper/keys.go +++ b/x/nft/keeper/keys.go @@ -1,6 +1,7 @@ package keeper import ( + "bytes" "github.com/cosmos/cosmos-sdk/internal/conv" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" @@ -48,16 +49,43 @@ func classTotalSupply(classID string) []byte { // nftOfClassByOwnerStoreKey returns the byte representation of the nft owner // Items are stored with the following key: values -// 0x03 +// 0x03 func nftOfClassByOwnerStoreKey(owner sdk.AccAddress, classID string) []byte { owner = address.MustLengthPrefix(owner) classIDBz := conv.UnsafeStrToBytes(classID) - var key = make([]byte, len(NFTOfClassByOwnerKey)+len(owner)+len(classIDBz)+len(Delimiter)) + var key = make([]byte, len(NFTOfClassByOwnerKey)+len(owner)+len(Delimiter)+len(classIDBz)+len(Delimiter)) copy(key, NFTOfClassByOwnerKey) copy(key[len(NFTOfClassByOwnerKey):], owner) - copy(key[len(NFTOfClassByOwnerKey)+len(owner):], classIDBz) - return append(key, Delimiter...) + copy(key[len(NFTOfClassByOwnerKey)+len(owner):], Delimiter) + copy(key[len(NFTOfClassByOwnerKey)+len(owner)+len(Delimiter):], classIDBz) + copy(key[len(NFTOfClassByOwnerKey)+len(owner)+len(Delimiter)+len(classIDBz):], Delimiter) + return key +} + +// prefixNftOfClassByOwnerStoreKey returns the prefix of the result of the method nftOfClassByOwnerStoreKey +// Items are stored with the following key: values +// 0x03 +func prefixNftOfClassByOwnerStoreKey(owner sdk.AccAddress) []byte { + owner = address.MustLengthPrefix(owner) + + var key = make([]byte, len(NFTOfClassByOwnerKey)+len(owner)+len(Delimiter)) + copy(key, NFTOfClassByOwnerKey) + copy(key[len(NFTOfClassByOwnerKey):], owner) + copy(key[len(NFTOfClassByOwnerKey)+len(owner):], Delimiter) + return key +} + +// Note: the full path of the nftOfClassByOwnerStoreKey stored in the store: 0x03, +// the key of the prefix store query result constructed using the prefixNftOfClassByOwnerStoreKey function needs to remove the 0x03 prefix +func parseNftOfClassByOwnerStoreKey(key []byte) (classID, nftID string) { + ret := bytes.Split(key, Delimiter) + if len(ret) != 2 { + panic("invalid nftOfClassByOwnerStoreKey") + } + classID = conv.UnsafeBytesToStr(ret[0]) + nftID = string(ret[1]) + return } // ownerStoreKey returns the byte representation of the nft owner @@ -72,5 +100,6 @@ func ownerStoreKey(classID, nftID string) []byte { copy(key, OwnerKey) copy(key[len(OwnerKey):], classIDBz) copy(key[len(OwnerKey)+len(classIDBz):], Delimiter) - return append(key, nftIDBz...) + copy(key[len(OwnerKey)+len(classIDBz)+len(Delimiter):], nftIDBz) + return key } diff --git a/x/nft/keeper/nft.go b/x/nft/keeper/nft.go index 1cb4e817116c..c3fb583db9d5 100644 --- a/x/nft/keeper/nft.go +++ b/x/nft/keeper/nft.go @@ -175,6 +175,12 @@ func (k Keeper) getClassStoreByOwner(ctx sdk.Context, owner sdk.AccAddress, clas return prefix.NewStore(store, key) } +func (k Keeper) prefixStoreNftOfClassByOwner(ctx sdk.Context, owner sdk.AccAddress) prefix.Store { + store := ctx.KVStore(k.storeKey) + key := prefixNftOfClassByOwnerStoreKey(owner) + return prefix.NewStore(store, key) +} + func (k Keeper) incrTotalSupply(ctx sdk.Context, classID string) { supply := k.GetTotalSupply(ctx, classID) + 1 k.updateTotalSupply(ctx, classID, supply) diff --git a/x/nft/query.pb.go b/x/nft/query.pb.go index b25a1c9e400b..2e52980cc628 100644 --- a/x/nft/query.pb.go +++ b/x/nft/query.pb.go @@ -315,25 +315,25 @@ func (m *QuerySupplyResponse) GetAmount() uint64 { return 0 } -// QueryNFTsOfClassRequest is the request type for the Query/NFTsOfClass RPC method -type QueryNFTsOfClassRequest struct { +// QueryNFTstRequest is the request type for the Query/NFTs RPC method +type QueryNFTsRequest struct { ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` Pagination *query.PageRequest `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryNFTsOfClassRequest) Reset() { *m = QueryNFTsOfClassRequest{} } -func (m *QueryNFTsOfClassRequest) String() string { return proto.CompactTextString(m) } -func (*QueryNFTsOfClassRequest) ProtoMessage() {} -func (*QueryNFTsOfClassRequest) Descriptor() ([]byte, []int) { +func (m *QueryNFTsRequest) Reset() { *m = QueryNFTsRequest{} } +func (m *QueryNFTsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryNFTsRequest) ProtoMessage() {} +func (*QueryNFTsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_0d24e0db697b0f9d, []int{6} } -func (m *QueryNFTsOfClassRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryNFTsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryNFTsOfClassRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryNFTsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryNFTsOfClassRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryNFTsRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -343,57 +343,57 @@ func (m *QueryNFTsOfClassRequest) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } -func (m *QueryNFTsOfClassRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryNFTsOfClassRequest.Merge(m, src) +func (m *QueryNFTsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryNFTsRequest.Merge(m, src) } -func (m *QueryNFTsOfClassRequest) XXX_Size() int { +func (m *QueryNFTsRequest) XXX_Size() int { return m.Size() } -func (m *QueryNFTsOfClassRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryNFTsOfClassRequest.DiscardUnknown(m) +func (m *QueryNFTsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryNFTsRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryNFTsOfClassRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryNFTsRequest proto.InternalMessageInfo -func (m *QueryNFTsOfClassRequest) GetClassId() string { +func (m *QueryNFTsRequest) GetClassId() string { if m != nil { return m.ClassId } return "" } -func (m *QueryNFTsOfClassRequest) GetOwner() string { +func (m *QueryNFTsRequest) GetOwner() string { if m != nil { return m.Owner } return "" } -func (m *QueryNFTsOfClassRequest) GetPagination() *query.PageRequest { +func (m *QueryNFTsRequest) GetPagination() *query.PageRequest { if m != nil { return m.Pagination } return nil } -// QueryNFTsOfClassResponse is the response type for the Query/NFTsOfClass and Query/NFTsOfClassByOwner RPC methods -type QueryNFTsOfClassResponse struct { +// QueryNFTsResponse is the response type for the Query/NFTs RPC methods +type QueryNFTsResponse struct { Nfts []*NFT `protobuf:"bytes,1,rep,name=nfts,proto3" json:"nfts,omitempty"` Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryNFTsOfClassResponse) Reset() { *m = QueryNFTsOfClassResponse{} } -func (m *QueryNFTsOfClassResponse) String() string { return proto.CompactTextString(m) } -func (*QueryNFTsOfClassResponse) ProtoMessage() {} -func (*QueryNFTsOfClassResponse) Descriptor() ([]byte, []int) { +func (m *QueryNFTsResponse) Reset() { *m = QueryNFTsResponse{} } +func (m *QueryNFTsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryNFTsResponse) ProtoMessage() {} +func (*QueryNFTsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_0d24e0db697b0f9d, []int{7} } -func (m *QueryNFTsOfClassResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryNFTsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryNFTsOfClassResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryNFTsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryNFTsOfClassResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryNFTsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -403,26 +403,26 @@ func (m *QueryNFTsOfClassResponse) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } -func (m *QueryNFTsOfClassResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryNFTsOfClassResponse.Merge(m, src) +func (m *QueryNFTsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryNFTsResponse.Merge(m, src) } -func (m *QueryNFTsOfClassResponse) XXX_Size() int { +func (m *QueryNFTsResponse) XXX_Size() int { return m.Size() } -func (m *QueryNFTsOfClassResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryNFTsOfClassResponse.DiscardUnknown(m) +func (m *QueryNFTsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryNFTsResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryNFTsOfClassResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryNFTsResponse proto.InternalMessageInfo -func (m *QueryNFTsOfClassResponse) GetNfts() []*NFT { +func (m *QueryNFTsResponse) GetNfts() []*NFT { if m != nil { return m.Nfts } return nil } -func (m *QueryNFTsOfClassResponse) GetPagination() *query.PageResponse { +func (m *QueryNFTsResponse) GetPagination() *query.PageResponse { if m != nil { return m.Pagination } @@ -723,8 +723,8 @@ func init() { proto.RegisterType((*QueryOwnerResponse)(nil), "cosmos.nft.v1beta1.QueryOwnerResponse") proto.RegisterType((*QuerySupplyRequest)(nil), "cosmos.nft.v1beta1.QuerySupplyRequest") proto.RegisterType((*QuerySupplyResponse)(nil), "cosmos.nft.v1beta1.QuerySupplyResponse") - proto.RegisterType((*QueryNFTsOfClassRequest)(nil), "cosmos.nft.v1beta1.QueryNFTsOfClassRequest") - proto.RegisterType((*QueryNFTsOfClassResponse)(nil), "cosmos.nft.v1beta1.QueryNFTsOfClassResponse") + proto.RegisterType((*QueryNFTsRequest)(nil), "cosmos.nft.v1beta1.QueryNFTsRequest") + proto.RegisterType((*QueryNFTsResponse)(nil), "cosmos.nft.v1beta1.QueryNFTsResponse") proto.RegisterType((*QueryNFTRequest)(nil), "cosmos.nft.v1beta1.QueryNFTRequest") proto.RegisterType((*QueryNFTResponse)(nil), "cosmos.nft.v1beta1.QueryNFTResponse") proto.RegisterType((*QueryClassRequest)(nil), "cosmos.nft.v1beta1.QueryClassRequest") @@ -736,53 +736,53 @@ func init() { func init() { proto.RegisterFile("cosmos/nft/v1beta1/query.proto", fileDescriptor_0d24e0db697b0f9d) } var fileDescriptor_0d24e0db697b0f9d = []byte{ - // 734 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x4f, 0x4f, 0x13, 0x4f, - 0x18, 0xc7, 0x99, 0x96, 0xd2, 0xdf, 0xef, 0x21, 0xf1, 0xcf, 0x48, 0xa4, 0x54, 0xdd, 0x90, 0x45, - 0xda, 0x42, 0x65, 0x86, 0x3f, 0x89, 0x27, 0xf4, 0x80, 0xb1, 0xc6, 0x0b, 0x68, 0xe5, 0x64, 0x62, - 0xcc, 0xb6, 0xdd, 0xd6, 0x8d, 0x65, 0x77, 0x61, 0xb6, 0x2a, 0x21, 0x1c, 0xe4, 0x60, 0xf4, 0x46, - 0x14, 0xdf, 0x93, 0x47, 0x12, 0x2f, 0xde, 0x34, 0xe0, 0x0b, 0x31, 0x3b, 0xf3, 0x6c, 0xd9, 0x95, - 0xed, 0x6e, 0x43, 0x3c, 0x91, 0xd9, 0xf9, 0x3e, 0xf3, 0xfd, 0xcc, 0xf3, 0x3c, 0xf3, 0x50, 0xd0, - 0x9a, 0x8e, 0xd8, 0x72, 0x04, 0xb7, 0xdb, 0x1e, 0x7f, 0xb3, 0xd4, 0x30, 0x3d, 0x63, 0x89, 0x6f, - 0xf7, 0xcc, 0x9d, 0x5d, 0xe6, 0xee, 0x38, 0x9e, 0x43, 0xa9, 0xda, 0x67, 0x76, 0xdb, 0x63, 0xb8, - 0x5f, 0x9c, 0xc7, 0x98, 0x86, 0x21, 0x4c, 0x25, 0xee, 0x87, 0xba, 0x46, 0xc7, 0xb2, 0x0d, 0xcf, - 0x72, 0x6c, 0x15, 0x5f, 0xbc, 0xd9, 0x71, 0x9c, 0x4e, 0xd7, 0xe4, 0x86, 0x6b, 0x71, 0xc3, 0xb6, - 0x1d, 0x4f, 0x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xa8, 0xdd, 0xf6, 0x44, 0x81, 0x4c, 0x67, - 0x2b, 0xe3, 0xcb, 0x93, 0xec, 0x7c, 0x03, 0xb2, 0xf5, 0xda, 0x66, 0x5d, 0x8a, 0xe8, 0xa3, 0x08, - 0x51, 0x46, 0x12, 0x95, 0x53, 0x89, 0x94, 0x53, 0x04, 0x69, 0x15, 0x2e, 0x07, 0x44, 0x17, 0xa8, - 0xf8, 0x3d, 0xb8, 0x72, 0x16, 0x8d, 0xf7, 0x98, 0x83, 0xac, 0xdd, 0x56, 0xe5, 0x48, 0xb8, 0x86, - 0xaf, 0xd1, 0x19, 0x36, 0xdc, 0x90, 0xd5, 0xd1, 0x1f, 0x62, 0xd3, 0x44, 0x13, 0xc7, 0x21, 0x27, - 0x05, 0x68, 0x39, 0x15, 0x67, 0xa9, 0x22, 0x94, 0x4e, 0x7f, 0x81, 0xad, 0x24, 0x3f, 0x9a, 0x7d, - 0xe3, 0x68, 0x95, 0xc9, 0x85, 0xab, 0x7c, 0x44, 0xf0, 0xdd, 0xf5, 0xcf, 0x47, 0xd0, 0x15, 0x50, - 0x37, 0x31, 0x83, 0x22, 0x27, 0xa0, 0x06, 0xca, 0x7f, 0x56, 0xe9, 0xe5, 0x9f, 0x79, 0xc8, 0x49, - 0x2c, 0x7a, 0x44, 0x20, 0x8f, 0x33, 0x81, 0x96, 0xe3, 0x10, 0x62, 0xa6, 0x4f, 0xb1, 0x92, 0x2e, - 0x54, 0xa6, 0xfa, 0xdd, 0x83, 0xef, 0xbf, 0xbf, 0x64, 0x16, 0x29, 0xe3, 0x31, 0x53, 0xae, 0xa1, - 0xc4, 0x7c, 0x4f, 0xbe, 0xac, 0x7d, 0xbe, 0x17, 0xd4, 0x7a, 0x9f, 0x7e, 0x22, 0x90, 0x93, 0xa3, - 0x83, 0xce, 0x0e, 0xf4, 0x0a, 0x8f, 0xa6, 0x62, 0x29, 0x4d, 0x86, 0x40, 0x4b, 0x12, 0xa8, 0x4a, - 0xe7, 0xe2,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, 0x35, 0xc6, 0xe4, 0x8f, 0x8f, 0x95, - 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf3, 0xed, 0xff, 0x2d, 0x1a, 0x09, 0x00, 0x00, + // 728 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x4b, 0x6f, 0xd3, 0x40, + 0x10, 0xc7, 0xbb, 0x49, 0xd3, 0xc0, 0x54, 0xe2, 0xb1, 0x54, 0x90, 0x1a, 0xb0, 0x22, 0xf7, 0x91, + 0xb4, 0x55, 0x77, 0xfb, 0x90, 0x38, 0x15, 0x0e, 0x45, 0x04, 0x71, 0x29, 0x10, 0x7a, 0x42, 0x42, + 0xc8, 0x49, 0x9c, 0x60, 0x91, 0xda, 0x69, 0xd7, 0x06, 0xaa, 0xaa, 0x07, 0x7a, 0x40, 0x54, 0x5c, + 0x90, 0xe8, 0xe7, 0xe1, 0xcc, 0xb1, 0x12, 0x17, 0x8e, 0xa8, 0xe5, 0x83, 0x20, 0xef, 0x8e, 0x53, + 0x9b, 0x3a, 0x76, 0x15, 0x71, 0xaa, 0xec, 0xfd, 0xcf, 0xfc, 0x7f, 0xde, 0x79, 0x34, 0xa0, 0x37, + 0x5d, 0xb1, 0xe5, 0x0a, 0xee, 0xb4, 0x3d, 0xfe, 0x6e, 0xb9, 0x61, 0x79, 0xe6, 0x32, 0xdf, 0xf6, + 0xad, 0x9d, 0x5d, 0xd6, 0xdb, 0x71, 0x3d, 0x97, 0x52, 0x75, 0xce, 0x9c, 0xb6, 0xc7, 0xf0, 0x5c, + 0x9b, 0xc7, 0x98, 0x86, 0x29, 0x2c, 0x25, 0xee, 0x87, 0xf6, 0xcc, 0x8e, 0xed, 0x98, 0x9e, 0xed, + 0x3a, 0x2a, 0x5e, 0xbb, 0xd3, 0x71, 0xdd, 0x4e, 0xd7, 0xe2, 0x66, 0xcf, 0xe6, 0xa6, 0xe3, 0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0x4e, 0xdb, 0x13, 0x25, 0x52, 0xce, 0x57, 0xc7, 0x57, 0x6e, 0xb1, 0xf3, + 0x2d, 0xc7, 0x36, 0x6a, 0x9b, 0x75, 0x29, 0xa2, 0x8f, 0x63, 0x28, 0x39, 0x89, 0x52, 0xc9, 0x44, + 0x51, 0x4e, 0x31, 0x96, 0x35, 0xb8, 0x1a, 0xa2, 0x0c, 0x51, 0xe3, 0xfb, 0x67, 0xd7, 0xda, 0xff, + 0x8e, 0x39, 0xc8, 0x3b, 0x6d, 0x55, 0x80, 0x94, 0xcf, 0x08, 0x34, 0x06, 0xc3, 0x7b, 0x78, 0x18, + 0xa4, 0xbf, 0x40, 0xd5, 0x1f, 0x61, 0x9b, 0xa0, 0x1e, 0x0d, 0x39, 0x14, 0xa4, 0x00, 0x2d, 0x27, + 0x93, 0x2c, 0x55, 0x84, 0xd2, 0x19, 0xaf, 0xb0, 0x79, 0xe4, 0x4b, 0xab, 0x6f, 0x1c, 0x2f, 0x2f, + 0x19, 0xba, 0xbc, 0x47, 0x04, 0x27, 0xad, 0x9f, 0x1f, 0x41, 0x57, 0x41, 0x7d, 0x89, 0x15, 0x16, + 0x39, 0x05, 0x35, 0x54, 0xfe, 0xb7, 0x4a, 0xaf, 0x7c, 0x2f, 0x42, 0x41, 0x62, 0xd1, 0x23, 0x02, + 0x45, 0xdc, 0x02, 0xb4, 0x92, 0x84, 0x90, 0xb0, 0x6f, 0xb4, 0x6a, 0xb6, 0x50, 0x99, 0x1a, 0xf7, + 0x0e, 0x7e, 0xfe, 0xf9, 0x96, 0x5b, 0xa2, 0x8c, 0x27, 0xec, 0xb5, 0x86, 0x12, 0xf3, 0x3d, 0x39, + 0x52, 0xfb, 0x7c, 0x2f, 0xac, 0xf5, 0x3e, 0x3d, 0x24, 0x50, 0x90, 0xcb, 0x82, 0xce, 0x0c, 0xf4, + 0x8a, 0x2e, 0x23, 0x6d, 0x36, 0x4b, 0x86, 0x40, 0xcb, 0x12, 0x68, 0x81, 0xce, 0x25, 0x01, 0x49, + 0x8e, 0x08, 0x06, 0xdf, 0x0b, 0x58, 0x3e, 0x13, 0x18, 0x53, 0xbb, 0x85, 0x0e, 0x76, 0x89, 0x6d, + 0x2b, 0xad, 0x92, 0xa9, 0x43, 0x9c, 0x45, 0x89, 0x53, 0xa1, 0x33, 0x49, 0x38, 0x42, 0x6a, 0xa3, + 0xd7, 0xe2, 0xc3, 0x68, 0xb0, 0x27, 0xe8, 0xf4, 0xc0, 0xfc, 0x91, 0xa5, 0xa6, 0xcd, 0x64, 0xa8, + 0x90, 0xa1, 0x2c, 0x19, 0x34, 0x5a, 0xe2, 0xc9, 0xff, 0x7b, 0x04, 0x3d, 0x20, 0x90, 0xdf, 0xa8, + 0x6d, 0xd2, 0xa9, 0xb4, 0x84, 0xa1, 0xeb, 0x74, 0xba, 0x08, 0x4d, 0x97, 0xa4, 0xe9, 0x3c, 0xad, + 0x0e, 0x32, 0x3d, 0x57, 0x86, 0x4f, 0x04, 0x0a, 0x72, 0x1e, 0x52, 0x5a, 0x22, 0xba, 0x3c, 0x52, + 0x5a, 0x22, 0xb6, 0x33, 0x0c, 0x26, 0x51, 0xaa, 0x74, 0x36, 0x09, 0x05, 0x47, 0x2f, 0x5a, 0x84, + 0x8f, 0x04, 0x8a, 0x38, 0xce, 0x29, 0x23, 0x13, 0x5f, 0x28, 0x29, 0x23, 0xf3, 0xcf, 0x66, 0x30, + 0xa6, 0x24, 0xce, 0x5d, 0x7a, 0x3b, 0x05, 0x67, 0x7d, 0xed, 0xc7, 0x89, 0x4e, 0x8e, 0x4f, 0x74, + 0xf2, 0xfb, 0x44, 0x27, 0x5f, 0x4f, 0xf5, 0x91, 0xe3, 0x53, 0x7d, 0xe4, 0xd7, 0xa9, 0x3e, 0xf2, + 0xd2, 0xe8, 0xd8, 0xde, 0x1b, 0xbf, 0xc1, 0x9a, 0xee, 0x56, 0x98, 0x40, 0xfd, 0x59, 0x14, 0xad, + 0xb7, 0xfc, 0x43, 0x90, 0xad, 0x31, 0x26, 0x7f, 0x4d, 0xac, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff, + 0x01, 0x46, 0x70, 0x1f, 0xeb, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -803,8 +803,8 @@ type QueryClient interface { Owner(ctx context.Context, in *QueryOwnerRequest, opts ...grpc.CallOption) (*QueryOwnerResponse, error) // Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. Supply(ctx context.Context, in *QuerySupplyRequest, opts ...grpc.CallOption) (*QuerySupplyResponse, error) - // NFTsOfClass queries all NFTs of a given class or optional owner, similar to tokenByIndex in ERC721Enumerable - NFTsOfClass(ctx context.Context, in *QueryNFTsOfClassRequest, opts ...grpc.CallOption) (*QueryNFTsOfClassResponse, error) + // NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in ERC721Enumerable + NFTs(ctx context.Context, in *QueryNFTsRequest, opts ...grpc.CallOption) (*QueryNFTsResponse, error) // NFT queries an NFT based on its class and id. NFT(ctx context.Context, in *QueryNFTRequest, opts ...grpc.CallOption) (*QueryNFTResponse, error) // Class queries an NFT class based on its id @@ -848,9 +848,9 @@ func (c *queryClient) Supply(ctx context.Context, in *QuerySupplyRequest, opts . return out, nil } -func (c *queryClient) NFTsOfClass(ctx context.Context, in *QueryNFTsOfClassRequest, opts ...grpc.CallOption) (*QueryNFTsOfClassResponse, error) { - out := new(QueryNFTsOfClassResponse) - err := c.cc.Invoke(ctx, "/cosmos.nft.v1beta1.Query/NFTsOfClass", in, out, opts...) +func (c *queryClient) NFTs(ctx context.Context, in *QueryNFTsRequest, opts ...grpc.CallOption) (*QueryNFTsResponse, error) { + out := new(QueryNFTsResponse) + err := c.cc.Invoke(ctx, "/cosmos.nft.v1beta1.Query/NFTs", in, out, opts...) if err != nil { return nil, err } @@ -892,8 +892,8 @@ type QueryServer interface { Owner(context.Context, *QueryOwnerRequest) (*QueryOwnerResponse, error) // Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. Supply(context.Context, *QuerySupplyRequest) (*QuerySupplyResponse, error) - // NFTsOfClass queries all NFTs of a given class or optional owner, similar to tokenByIndex in ERC721Enumerable - NFTsOfClass(context.Context, *QueryNFTsOfClassRequest) (*QueryNFTsOfClassResponse, error) + // NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in ERC721Enumerable + NFTs(context.Context, *QueryNFTsRequest) (*QueryNFTsResponse, error) // NFT queries an NFT based on its class and id. NFT(context.Context, *QueryNFTRequest) (*QueryNFTResponse, error) // Class queries an NFT class based on its id @@ -915,8 +915,8 @@ func (*UnimplementedQueryServer) Owner(ctx context.Context, req *QueryOwnerReque func (*UnimplementedQueryServer) Supply(ctx context.Context, req *QuerySupplyRequest) (*QuerySupplyResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Supply not implemented") } -func (*UnimplementedQueryServer) NFTsOfClass(ctx context.Context, req *QueryNFTsOfClassRequest) (*QueryNFTsOfClassResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method NFTsOfClass not implemented") +func (*UnimplementedQueryServer) NFTs(ctx context.Context, req *QueryNFTsRequest) (*QueryNFTsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NFTs not implemented") } func (*UnimplementedQueryServer) NFT(ctx context.Context, req *QueryNFTRequest) (*QueryNFTResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method NFT not implemented") @@ -986,20 +986,20 @@ func _Query_Supply_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } -func _Query_NFTsOfClass_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryNFTsOfClassRequest) +func _Query_NFTs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryNFTsRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).NFTsOfClass(ctx, in) + return srv.(QueryServer).NFTs(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.nft.v1beta1.Query/NFTsOfClass", + FullMethod: "/cosmos.nft.v1beta1.Query/NFTs", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).NFTsOfClass(ctx, req.(*QueryNFTsOfClassRequest)) + return srv.(QueryServer).NFTs(ctx, req.(*QueryNFTsRequest)) } return interceptor(ctx, in, info, handler) } @@ -1075,8 +1075,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_Supply_Handler, }, { - MethodName: "NFTsOfClass", - Handler: _Query_NFTsOfClass_Handler, + MethodName: "NFTs", + Handler: _Query_NFTs_Handler, }, { MethodName: "NFT", @@ -1285,7 +1285,7 @@ func (m *QuerySupplyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryNFTsOfClassRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryNFTsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1295,12 +1295,12 @@ func (m *QueryNFTsOfClassRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryNFTsOfClassRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryNFTsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryNFTsOfClassRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryNFTsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1334,7 +1334,7 @@ func (m *QueryNFTsOfClassRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryNFTsOfClassResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryNFTsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1344,12 +1344,12 @@ func (m *QueryNFTsOfClassResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryNFTsOfClassResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryNFTsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryNFTsOfClassResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryNFTsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1699,7 +1699,7 @@ func (m *QuerySupplyResponse) Size() (n int) { return n } -func (m *QueryNFTsOfClassRequest) Size() (n int) { +func (m *QueryNFTsRequest) Size() (n int) { if m == nil { return 0 } @@ -1720,7 +1720,7 @@ func (m *QueryNFTsOfClassRequest) Size() (n int) { return n } -func (m *QueryNFTsOfClassResponse) Size() (n int) { +func (m *QueryNFTsResponse) Size() (n int) { if m == nil { return 0 } @@ -2363,7 +2363,7 @@ func (m *QuerySupplyResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryNFTsOfClassRequest) Unmarshal(dAtA []byte) error { +func (m *QueryNFTsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2386,10 +2386,10 @@ func (m *QueryNFTsOfClassRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryNFTsOfClassRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryNFTsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryNFTsOfClassRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryNFTsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2513,7 +2513,7 @@ func (m *QueryNFTsOfClassRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryNFTsOfClassResponse) Unmarshal(dAtA []byte) error { +func (m *QueryNFTsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2536,10 +2536,10 @@ func (m *QueryNFTsOfClassResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryNFTsOfClassResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryNFTsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryNFTsOfClassResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryNFTsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/x/nft/query.pb.gw.go b/x/nft/query.pb.gw.go index 67a634117c1e..a2177f2eae6f 100644 --- a/x/nft/query.pb.gw.go +++ b/x/nft/query.pb.gw.go @@ -238,73 +238,37 @@ func local_request_Query_Supply_0(ctx context.Context, marshaler runtime.Marshal } var ( - filter_Query_NFTsOfClass_0 = &utilities.DoubleArray{Encoding: map[string]int{"class_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + filter_Query_NFTs_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Query_NFTsOfClass_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryNFTsOfClassRequest +func request_Query_NFTs_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryNFTsRequest var metadata runtime.ServerMetadata - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_NFTsOfClass_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_NFTs_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.NFTsOfClass(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.NFTs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_NFTsOfClass_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryNFTsOfClassRequest +func local_request_Query_NFTs_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryNFTsRequest var metadata runtime.ServerMetadata - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_NFTsOfClass_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_NFTs_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.NFTsOfClass(ctx, &protoReq) + msg, err := server.NFTs(ctx, &protoReq) return msg, metadata, err } @@ -541,7 +505,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_NFTsOfClass_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_NFTs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -550,14 +514,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_NFTsOfClass_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_NFTs_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_NFTsOfClass_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_NFTs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -722,7 +686,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_NFTsOfClass_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_NFTs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -731,14 +695,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_NFTsOfClass_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_NFTs_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_NFTsOfClass_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_NFTs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -812,7 +776,7 @@ var ( pattern_Query_Supply_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "nft", "v1beta1", "supply", "class_id"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_NFTsOfClass_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "nft", "v1beta1", "nfts", "class_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_NFTs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "nft", "v1beta1", "nfts"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_NFT_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmos", "nft", "v1beta1", "nfts", "class_id", "id"}, "", runtime.AssumeColonVerbOpt(false))) @@ -828,7 +792,7 @@ var ( forward_Query_Supply_0 = runtime.ForwardResponseMessage - forward_Query_NFTsOfClass_0 = runtime.ForwardResponseMessage + forward_Query_NFTs_0 = runtime.ForwardResponseMessage forward_Query_NFT_0 = runtime.ForwardResponseMessage From 2c3943b96a30758db0c209cc6ffa7621d9838bc4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 27 Jan 2022 16:16:17 +0000 Subject: [PATCH 4/5] build(deps): Bump google.golang.org/grpc from 1.43.0 to 1.44.0 in /api (#11030) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.43.0 to 1.44.0.
Release notes

Sourced from google.golang.org/grpc's releases.

Release 1.44.0

New Features

  • balancer: add RLS load balancing policy (#5046)
  • xds: add RLS Cluster Specifier Plugin (#5004)
  • insecure: remove experimental notice (#5069)

Bug Fixes

  • internal/balancergroup: eliminate race in exitIdle (#5012)
  • authz: fix regex expression match (#5035)

Documentation

  • grpc: minor improvement on WithInsecure() document (#5068)
  • attributes: document that some value types (e.g. maps) must implement Equal (#5109)
  • dialoptions.go: Fix WithBlock godoc (#5073)
  • grpclog.DepthLoggerV2: Correct comment: formats like fmt.Println (#5038)
Commits
  • b4c5e24 Change version to 1.44.1-dev (#5121)
  • da8e0b8 Change version to 1.44.0 (#5120)
  • 77b478d xds/federation: e2e tests (#5103)
  • 907a202 attributes: document that some value types (e.g. maps) must implement Equal...
  • 2fb1ac8 test: fix potential goroutine leak in TestUpdateAddresses_RetryFromFirstAddr ...
  • afded72 xds/federation: update xdsclient to support multi authority (#5042)
  • b069440 credentials/google: use grpctest.Tester for tests in this package (#5098)
  • fbaf7c5 authz: update representation of allow authenticated in SDK (#5052)
  • 344b93a testdata: use SHA256 as signing algorithm in testdata certs (#5074)
  • 4d58dd9 dialoptions.go: Fix WithBlock godoc (#5073)
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=google.golang.org/grpc&package-manager=go_modules&previous-version=1.43.0&new-version=1.44.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- api/go.mod | 2 +- api/go.sum | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/api/go.mod b/api/go.mod index 23c6cbae7f56..6ed6688a87a8 100644 --- a/api/go.mod +++ b/api/go.mod @@ -6,7 +6,7 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-alpha6 github.com/gogo/protobuf v1.3.2 google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb - google.golang.org/grpc v1.43.0 + google.golang.org/grpc v1.44.0 google.golang.org/protobuf v1.27.1 ) diff --git a/api/go.sum b/api/go.sum index d922ff3e4741..dceeaa25741e 100644 --- a/api/go.sum +++ b/api/go.sum @@ -14,8 +14,6 @@ github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cosmos/cosmos-proto v1.0.0-alpha4 h1:96Imv2begXbNTj/SQyPftxKOCgy4ANwbPGafLHTlGoc= -github.com/cosmos/cosmos-proto v1.0.0-alpha4/go.mod h1:msdDWOvfStHLG+Z2y2SJ0dcqimZ2vc8M1MPnZ4jOF7U= github.com/cosmos/cosmos-proto v1.0.0-alpha6 h1:N2BvV2AyzGAXCJnvlw1pMzEQ+76tj5FDBrkYQYIDCdU= github.com/cosmos/cosmos-proto v1.0.0-alpha6/go.mod h1:msdDWOvfStHLG+Z2y2SJ0dcqimZ2vc8M1MPnZ4jOF7U= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -137,8 +135,8 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= -google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= +google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= 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 428ae3c15c1729197291e2a3fe77013f255cefb5 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Thu, 27 Jan 2022 11:57:39 -0500 Subject: [PATCH 5/5] fix: add db module version to main go.mod (#11031) ## Description Using `v0.0.0` breaks things when other modules try to import the SDK. We need to tag another 0.46 alpha once this is merged. --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index aed7fe613d87..675fce622623 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/confio/ics23/go v0.6.6 github.com/cosmos/btcutil v1.0.4 github.com/cosmos/cosmos-proto v1.0.0-alpha6 - github.com/cosmos/cosmos-sdk/db v0.0.0 + github.com/cosmos/cosmos-sdk/db v1.0.0-beta.1 github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2 github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/iavl v0.17.3