feat: Add metadata field to Vote in x/gov (#11308)

## Description

Closes: #11268 

Add metadata to Vote in x/gov using the existing maxMetadataLen constraint.

---

### 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)
This commit is contained in:
likhita-809 2022-03-03 20:08:26 +05:30 committed by GitHub
parent 8296ad9592
commit 918330bcf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 810 additions and 365 deletions

View File

@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Features
* [\#11308](https://github.com/cosmos/cosmos-sdk/pull/11308) Added a mandatory metadata field to Vote in x/gov v1beta2.
* [\#10977](https://github.com/cosmos/cosmos-sdk/pull/10977) Now every cosmos message protobuf definition must be extended with a ``cosmos.msg.v1.signer`` option to signal the signer fields in a language agnostic way.
* [\#10710](https://github.com/cosmos/cosmos-sdk/pull/10710) Chain-id shouldn't be required for creating a transaction with both --generate-only and --offline flags.
* [\#10703](https://github.com/cosmos/cosmos-sdk/pull/10703) Create a new grantee account, if the grantee of an authorization does not exist.

View File

@ -2947,6 +2947,7 @@ var (
fd_Vote_proposal_id protoreflect.FieldDescriptor
fd_Vote_voter protoreflect.FieldDescriptor
fd_Vote_options protoreflect.FieldDescriptor
fd_Vote_metadata protoreflect.FieldDescriptor
)
func init() {
@ -2955,6 +2956,7 @@ func init() {
fd_Vote_proposal_id = md_Vote.Fields().ByName("proposal_id")
fd_Vote_voter = md_Vote.Fields().ByName("voter")
fd_Vote_options = md_Vote.Fields().ByName("options")
fd_Vote_metadata = md_Vote.Fields().ByName("metadata")
}
var _ protoreflect.Message = (*fastReflection_Vote)(nil)
@ -3040,6 +3042,12 @@ func (x *fastReflection_Vote) Range(f func(protoreflect.FieldDescriptor, protore
return
}
}
if x.Metadata != "" {
value := protoreflect.ValueOfString(x.Metadata)
if !f(fd_Vote_metadata, value) {
return
}
}
}
// Has reports whether a field is populated.
@ -3061,6 +3069,8 @@ func (x *fastReflection_Vote) Has(fd protoreflect.FieldDescriptor) bool {
return x.Voter != ""
case "cosmos.gov.v1beta2.Vote.options":
return len(x.Options) != 0
case "cosmos.gov.v1beta2.Vote.metadata":
return x.Metadata != ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1beta2.Vote"))
@ -3083,6 +3093,8 @@ func (x *fastReflection_Vote) Clear(fd protoreflect.FieldDescriptor) {
x.Voter = ""
case "cosmos.gov.v1beta2.Vote.options":
x.Options = nil
case "cosmos.gov.v1beta2.Vote.metadata":
x.Metadata = ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1beta2.Vote"))
@ -3111,6 +3123,9 @@ func (x *fastReflection_Vote) Get(descriptor protoreflect.FieldDescriptor) proto
}
listValue := &_Vote_4_list{list: &x.Options}
return protoreflect.ValueOfList(listValue)
case "cosmos.gov.v1beta2.Vote.metadata":
value := x.Metadata
return protoreflect.ValueOfString(value)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1beta2.Vote"))
@ -3139,6 +3154,8 @@ func (x *fastReflection_Vote) Set(fd protoreflect.FieldDescriptor, value protore
lv := value.List()
clv := lv.(*_Vote_4_list)
x.Options = *clv.list
case "cosmos.gov.v1beta2.Vote.metadata":
x.Metadata = value.Interface().(string)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1beta2.Vote"))
@ -3169,6 +3186,8 @@ 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.metadata":
panic(fmt.Errorf("field metadata 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"))
@ -3189,6 +3208,8 @@ func (x *fastReflection_Vote) NewField(fd protoreflect.FieldDescriptor) protoref
case "cosmos.gov.v1beta2.Vote.options":
list := []*WeightedVoteOption{}
return protoreflect.ValueOfList(&_Vote_4_list{list: &list})
case "cosmos.gov.v1beta2.Vote.metadata":
return protoreflect.ValueOfString("")
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1beta2.Vote"))
@ -3271,6 +3292,10 @@ func (x *fastReflection_Vote) ProtoMethods() *protoiface.Methods {
n += 1 + l + runtime.Sov(uint64(l))
}
}
l = len(x.Metadata)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
@ -3300,6 +3325,13 @@ func (x *fastReflection_Vote) ProtoMethods() *protoiface.Methods {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if len(x.Metadata) > 0 {
i -= len(x.Metadata)
copy(dAtA[i:], x.Metadata)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Metadata)))
i--
dAtA[i] = 0x2a
}
if len(x.Options) > 0 {
for iNdEx := len(x.Options) - 1; iNdEx >= 0; iNdEx-- {
encoded, err := options.Marshal(x.Options[iNdEx])
@ -3462,6 +3494,38 @@ func (x *fastReflection_Vote) ProtoMethods() *protoiface.Methods {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Metadata = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
@ -5478,6 +5542,8 @@ 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"`
Options []*WeightedVoteOption `protobuf:"bytes,4,rep,name=options,proto3" json:"options,omitempty"`
// metadata is any arbitrary metadata to attached to the vote.
Metadata string `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"`
}
func (x *Vote) Reset() {
@ -5521,6 +5587,13 @@ func (x *Vote) GetOptions() []*WeightedVoteOption {
return nil
}
func (x *Vote) GetMetadata() string {
if x != nil {
return x.Metadata
}
return ""
}
// DepositParams defines the params for deposits on governance proposals.
type DepositParams struct {
state protoimpl.MessageState
@ -5748,7 +5821,7 @@ var file_cosmos_gov_v1beta2_gov_proto_rawDesc = []byte{
0x65, 0x74, 0x6f, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42,
0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52,
0x0f, 0x6e, 0x6f, 0x57, 0x69, 0x74, 0x68, 0x56, 0x65, 0x74, 0x6f, 0x43, 0x6f, 0x75, 0x6e, 0x74,
0x22, 0x9f, 0x01, 0x0a, 0x04, 0x56, 0x6f, 0x74, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x6f,
0x22, 0xbb, 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,
@ -5757,76 +5830,78 @@ var file_cosmos_gov_v1beta2_gov_proto_rawDesc = []byte{
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, 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,
0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1a, 0x0a, 0x08,
0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 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, 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 (

View File

@ -2041,6 +2041,7 @@ var (
fd_MsgVote_proposal_id protoreflect.FieldDescriptor
fd_MsgVote_voter protoreflect.FieldDescriptor
fd_MsgVote_option protoreflect.FieldDescriptor
fd_MsgVote_metadata protoreflect.FieldDescriptor
)
func init() {
@ -2049,6 +2050,7 @@ func init() {
fd_MsgVote_proposal_id = md_MsgVote.Fields().ByName("proposal_id")
fd_MsgVote_voter = md_MsgVote.Fields().ByName("voter")
fd_MsgVote_option = md_MsgVote.Fields().ByName("option")
fd_MsgVote_metadata = md_MsgVote.Fields().ByName("metadata")
}
var _ protoreflect.Message = (*fastReflection_MsgVote)(nil)
@ -2134,6 +2136,12 @@ func (x *fastReflection_MsgVote) Range(f func(protoreflect.FieldDescriptor, prot
return
}
}
if x.Metadata != "" {
value := protoreflect.ValueOfString(x.Metadata)
if !f(fd_MsgVote_metadata, value) {
return
}
}
}
// Has reports whether a field is populated.
@ -2155,6 +2163,8 @@ func (x *fastReflection_MsgVote) Has(fd protoreflect.FieldDescriptor) bool {
return x.Voter != ""
case "cosmos.gov.v1beta2.MsgVote.option":
return x.Option != 0
case "cosmos.gov.v1beta2.MsgVote.metadata":
return x.Metadata != ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1beta2.MsgVote"))
@ -2177,6 +2187,8 @@ func (x *fastReflection_MsgVote) Clear(fd protoreflect.FieldDescriptor) {
x.Voter = ""
case "cosmos.gov.v1beta2.MsgVote.option":
x.Option = 0
case "cosmos.gov.v1beta2.MsgVote.metadata":
x.Metadata = ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1beta2.MsgVote"))
@ -2202,6 +2214,9 @@ func (x *fastReflection_MsgVote) Get(descriptor protoreflect.FieldDescriptor) pr
case "cosmos.gov.v1beta2.MsgVote.option":
value := x.Option
return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value))
case "cosmos.gov.v1beta2.MsgVote.metadata":
value := x.Metadata
return protoreflect.ValueOfString(value)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1beta2.MsgVote"))
@ -2228,6 +2243,8 @@ func (x *fastReflection_MsgVote) Set(fd protoreflect.FieldDescriptor, value prot
x.Voter = value.Interface().(string)
case "cosmos.gov.v1beta2.MsgVote.option":
x.Option = (VoteOption)(value.Enum())
case "cosmos.gov.v1beta2.MsgVote.metadata":
x.Metadata = value.Interface().(string)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1beta2.MsgVote"))
@ -2254,6 +2271,8 @@ func (x *fastReflection_MsgVote) Mutable(fd protoreflect.FieldDescriptor) protor
panic(fmt.Errorf("field voter of message cosmos.gov.v1beta2.MsgVote is not mutable"))
case "cosmos.gov.v1beta2.MsgVote.option":
panic(fmt.Errorf("field option of message cosmos.gov.v1beta2.MsgVote is not mutable"))
case "cosmos.gov.v1beta2.MsgVote.metadata":
panic(fmt.Errorf("field metadata of message cosmos.gov.v1beta2.MsgVote is not mutable"))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1beta2.MsgVote"))
@ -2273,6 +2292,8 @@ func (x *fastReflection_MsgVote) NewField(fd protoreflect.FieldDescriptor) proto
return protoreflect.ValueOfString("")
case "cosmos.gov.v1beta2.MsgVote.option":
return protoreflect.ValueOfEnum(0)
case "cosmos.gov.v1beta2.MsgVote.metadata":
return protoreflect.ValueOfString("")
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1beta2.MsgVote"))
@ -2352,6 +2373,10 @@ func (x *fastReflection_MsgVote) ProtoMethods() *protoiface.Methods {
if x.Option != 0 {
n += 1 + runtime.Sov(uint64(x.Option))
}
l = len(x.Metadata)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
@ -2381,6 +2406,13 @@ func (x *fastReflection_MsgVote) ProtoMethods() *protoiface.Methods {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if len(x.Metadata) > 0 {
i -= len(x.Metadata)
copy(dAtA[i:], x.Metadata)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Metadata)))
i--
dAtA[i] = 0x22
}
if x.Option != 0 {
i = runtime.EncodeVarint(dAtA, i, uint64(x.Option))
i--
@ -2517,6 +2549,38 @@ func (x *fastReflection_MsgVote) ProtoMethods() *protoiface.Methods {
break
}
}
case 4:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Metadata = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
@ -2964,6 +3028,7 @@ var (
fd_MsgVoteWeighted_proposal_id protoreflect.FieldDescriptor
fd_MsgVoteWeighted_voter protoreflect.FieldDescriptor
fd_MsgVoteWeighted_options protoreflect.FieldDescriptor
fd_MsgVoteWeighted_metadata protoreflect.FieldDescriptor
)
func init() {
@ -2972,6 +3037,7 @@ func init() {
fd_MsgVoteWeighted_proposal_id = md_MsgVoteWeighted.Fields().ByName("proposal_id")
fd_MsgVoteWeighted_voter = md_MsgVoteWeighted.Fields().ByName("voter")
fd_MsgVoteWeighted_options = md_MsgVoteWeighted.Fields().ByName("options")
fd_MsgVoteWeighted_metadata = md_MsgVoteWeighted.Fields().ByName("metadata")
}
var _ protoreflect.Message = (*fastReflection_MsgVoteWeighted)(nil)
@ -3057,6 +3123,12 @@ func (x *fastReflection_MsgVoteWeighted) Range(f func(protoreflect.FieldDescript
return
}
}
if x.Metadata != "" {
value := protoreflect.ValueOfString(x.Metadata)
if !f(fd_MsgVoteWeighted_metadata, value) {
return
}
}
}
// Has reports whether a field is populated.
@ -3078,6 +3150,8 @@ func (x *fastReflection_MsgVoteWeighted) Has(fd protoreflect.FieldDescriptor) bo
return x.Voter != ""
case "cosmos.gov.v1beta2.MsgVoteWeighted.options":
return len(x.Options) != 0
case "cosmos.gov.v1beta2.MsgVoteWeighted.metadata":
return x.Metadata != ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1beta2.MsgVoteWeighted"))
@ -3100,6 +3174,8 @@ func (x *fastReflection_MsgVoteWeighted) Clear(fd protoreflect.FieldDescriptor)
x.Voter = ""
case "cosmos.gov.v1beta2.MsgVoteWeighted.options":
x.Options = nil
case "cosmos.gov.v1beta2.MsgVoteWeighted.metadata":
x.Metadata = ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1beta2.MsgVoteWeighted"))
@ -3128,6 +3204,9 @@ func (x *fastReflection_MsgVoteWeighted) Get(descriptor protoreflect.FieldDescri
}
listValue := &_MsgVoteWeighted_3_list{list: &x.Options}
return protoreflect.ValueOfList(listValue)
case "cosmos.gov.v1beta2.MsgVoteWeighted.metadata":
value := x.Metadata
return protoreflect.ValueOfString(value)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1beta2.MsgVoteWeighted"))
@ -3156,6 +3235,8 @@ func (x *fastReflection_MsgVoteWeighted) Set(fd protoreflect.FieldDescriptor, va
lv := value.List()
clv := lv.(*_MsgVoteWeighted_3_list)
x.Options = *clv.list
case "cosmos.gov.v1beta2.MsgVoteWeighted.metadata":
x.Metadata = value.Interface().(string)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1beta2.MsgVoteWeighted"))
@ -3186,6 +3267,8 @@ func (x *fastReflection_MsgVoteWeighted) Mutable(fd protoreflect.FieldDescriptor
panic(fmt.Errorf("field proposal_id of message cosmos.gov.v1beta2.MsgVoteWeighted is not mutable"))
case "cosmos.gov.v1beta2.MsgVoteWeighted.voter":
panic(fmt.Errorf("field voter of message cosmos.gov.v1beta2.MsgVoteWeighted is not mutable"))
case "cosmos.gov.v1beta2.MsgVoteWeighted.metadata":
panic(fmt.Errorf("field metadata of message cosmos.gov.v1beta2.MsgVoteWeighted is not mutable"))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1beta2.MsgVoteWeighted"))
@ -3206,6 +3289,8 @@ func (x *fastReflection_MsgVoteWeighted) NewField(fd protoreflect.FieldDescripto
case "cosmos.gov.v1beta2.MsgVoteWeighted.options":
list := []*WeightedVoteOption{}
return protoreflect.ValueOfList(&_MsgVoteWeighted_3_list{list: &list})
case "cosmos.gov.v1beta2.MsgVoteWeighted.metadata":
return protoreflect.ValueOfString("")
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1beta2.MsgVoteWeighted"))
@ -3288,6 +3373,10 @@ func (x *fastReflection_MsgVoteWeighted) ProtoMethods() *protoiface.Methods {
n += 1 + l + runtime.Sov(uint64(l))
}
}
l = len(x.Metadata)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
@ -3317,6 +3406,13 @@ func (x *fastReflection_MsgVoteWeighted) ProtoMethods() *protoiface.Methods {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if len(x.Metadata) > 0 {
i -= len(x.Metadata)
copy(dAtA[i:], x.Metadata)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Metadata)))
i--
dAtA[i] = 0x22
}
if len(x.Options) > 0 {
for iNdEx := len(x.Options) - 1; iNdEx >= 0; iNdEx-- {
encoded, err := options.Marshal(x.Options[iNdEx])
@ -3479,6 +3575,38 @@ func (x *fastReflection_MsgVoteWeighted) ProtoMethods() *protoiface.Methods {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Metadata = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
@ -5028,6 +5156,7 @@ type MsgVote 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"`
Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos.gov.v1beta2.VoteOption" json:"option,omitempty"`
Metadata string `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"`
}
func (x *MsgVote) Reset() {
@ -5071,6 +5200,13 @@ func (x *MsgVote) GetOption() VoteOption {
return VoteOption_VOTE_OPTION_UNSPECIFIED
}
func (x *MsgVote) GetMetadata() string {
if x != nil {
return x.Metadata
}
return ""
}
// MsgVoteResponse defines the Msg/Vote response type.
type MsgVoteResponse struct {
state protoimpl.MessageState
@ -5107,6 +5243,7 @@ type MsgVoteWeighted 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"`
Options []*WeightedVoteOption `protobuf:"bytes,3,rep,name=options,proto3" json:"options,omitempty"`
Metadata string `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"`
}
func (x *MsgVoteWeighted) Reset() {
@ -5150,6 +5287,13 @@ func (x *MsgVoteWeighted) GetOptions() []*WeightedVoteOption {
return nil
}
func (x *MsgVoteWeighted) GetMetadata() string {
if x != nil {
return x.Metadata
}
return ""
}
// MsgVoteWeightedResponse defines the Msg/VoteWeighted response type.
type MsgVoteWeightedResponse struct {
state protoimpl.MessageState
@ -5301,7 +5445,7 @@ var file_cosmos_gov_v1beta2_tx_proto_rawDesc = []byte{
0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09,
0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x1e, 0x0a, 0x1c, 0x4d, 0x73, 0x67,
0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e,
0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xaf, 0x01, 0x0a, 0x07, 0x4d, 0x73,
0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xcb, 0x01, 0x0a, 0x07, 0x4d, 0x73,
0x67, 0x56, 0x6f, 0x74, 0x65, 0x12, 0x30, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61,
0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0f, 0xea, 0xde, 0x1f, 0x0b,
0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x52, 0x0a, 0x70, 0x72, 0x6f,
@ -5311,80 +5455,84 @@ var file_cosmos_gov_v1beta2_tx_proto_rawDesc = []byte{
0x52, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x12, 0x36, 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, 0x52, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3a,
0x0a, 0x82, 0xe7, 0xb0, 0x2a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x22, 0x11, 0x0a, 0x0f, 0x4d,
0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xc1,
0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74,
0x65, 0x64, 0x12, 0x30, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0f, 0xea, 0xde, 0x1f, 0x0b, 0x70, 0x72, 0x6f,
0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 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, 0x40, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18,
0x03, 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, 0x3a, 0x0a, 0x82, 0xe7, 0xb0, 0x2a, 0x05, 0x76, 0x6f, 0x74,
0x65, 0x72, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69,
0x67, 0x68, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xbf, 0x01,
0x0a, 0x0a, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x12, 0x30, 0x0a, 0x0b,
0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x04, 0x42, 0x0f, 0xea, 0xde, 0x1f, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f,
0x69, 0x64, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x36,
0x0a, 0x09, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 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, 0x09, 0x64, 0x65, 0x70,
0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x12, 0x37, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74,
0x18, 0x03, 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, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a,
0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x22,
0x14, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xdd, 0x03, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x66, 0x0a,
0x0e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12,
0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x62,
0x65, 0x74, 0x61, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72,
0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x1a, 0x2d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e,
0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x53,
0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6f, 0x0a, 0x11, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67,
0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x28, 0x2e, 0x63, 0x6f, 0x73,
0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, 0x2e,
0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e,
0x74, 0x65, 0x6e, 0x74, 0x1a, 0x30, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f,
0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65,
0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x04, 0x56, 0x6f, 0x74, 0x65, 0x12, 0x1b,
0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12,
0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28,
0x09, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x3a, 0x0a, 0x82, 0xe7, 0xb0,
0x2a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x22, 0x11, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x56, 0x6f,
0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xdd, 0x01, 0x0a, 0x0f, 0x4d,
0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x12, 0x30,
0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x04, 0x42, 0x0f, 0xea, 0xde, 0x1f, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61,
0x6c, 0x5f, 0x69, 0x64, 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, 0x40, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 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, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04,
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x3a, 0x0a,
0x82, 0xe7, 0xb0, 0x2a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73,
0x67, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xbf, 0x01, 0x0a, 0x0a, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70,
0x6f, 0x73, 0x69, 0x74, 0x12, 0x30, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c,
0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0f, 0xea, 0xde, 0x1f, 0x0b, 0x70,
0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70,
0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x36, 0x0a, 0x09, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69,
0x74, 0x6f, 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, 0x09, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x12, 0x37,
0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 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, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52,
0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x64, 0x65,
0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x22, 0x14, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x44, 0x65,
0x70, 0x6f, 0x73, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xdd, 0x03,
0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x66, 0x0a, 0x0e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50,
0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73,
0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, 0x2e, 0x4d, 0x73, 0x67,
0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x1a, 0x2d,
0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65,
0x74, 0x61, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x1a, 0x23, 0x2e, 0x63, 0x6f,
0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32,
0x2e, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x60, 0x0a, 0x0c, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64,
0x12, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31,
0x62, 0x65, 0x74, 0x61, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69,
0x67, 0x68, 0x74, 0x65, 0x64, 0x1a, 0x2b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67,
0x6f, 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x56, 0x6f,
0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x51, 0x0a, 0x07, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x12, 0x1e, 0x2e,
0x74, 0x61, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f,
0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6f, 0x0a,
0x11, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65,
0x6e, 0x74, 0x12, 0x28, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e,
0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x4c,
0x65, 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x1a, 0x30, 0x2e, 0x63,
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61,
0x32, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x43,
0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48,
0x0a, 0x04, 0x56, 0x6f, 0x74, 0x65, 0x12, 0x1b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e,
0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x56,
0x6f, 0x74, 0x65, 0x1a, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76,
0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x60, 0x0a, 0x0c, 0x56, 0x6f, 0x74, 0x65,
0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x12, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f,
0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, 0x2e, 0x4d, 0x73,
0x67, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x1a, 0x2b, 0x2e,
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74,
0x61, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x1a, 0x26, 0x2e,
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74,
0x61, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xcb, 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, 0x07, 0x54, 0x78, 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,
0x61, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74,
0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x07, 0x44, 0x65,
0x70, 0x6f, 0x73, 0x69, 0x74, 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67,
0x6f, 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65,
0x70, 0x6f, 0x73, 0x69, 0x74, 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67,
0x6f, 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65,
0x70, 0x6f, 0x73, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xcb, 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, 0x07, 0x54, 0x78, 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 (

View File

@ -94,6 +94,9 @@ message Vote {
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
reserved 3;
repeated WeightedVoteOption options = 4;
// metadata is any arbitrary metadata to attached to the vote.
string metadata = 5;
}
// DepositParams defines the params for deposits on governance proposals.

View File

@ -68,6 +68,7 @@ message MsgVote {
uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"];
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
VoteOption option = 3;
string metadata = 4;
}
// MsgVoteResponse defines the Msg/Vote response type.
@ -80,6 +81,7 @@ message MsgVoteWeighted {
uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"];
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated WeightedVoteOption options = 3;
string metadata = 4;
}
// MsgVoteWeightedResponse defines the Msg/VoteWeighted response type.

View File

@ -93,7 +93,7 @@ func (s *MWTestSuite) TestTips() {
ctx, accts := s.setupAcctsForTips(ctx)
tipper, feePayer := accts[0], accts[1]
msg = govtypes.NewMsgVote(tipper.acc.GetAddress(), 1, govtypes.OptionYes)
msg = govtypes.NewMsgVote(tipper.acc.GetAddress(), 1, govtypes.OptionYes, "")
auxSignerData := s.mkTipperAuxSignerData(tipper.priv, msg, tc.tip, signing.SignMode_SIGN_MODE_DIRECT_AUX, tipper.accNum, 0, ctx.ChainID())
feePayerTxBuilder := s.mkFeePayerTxBuilder(s.clientCtx, auxSignerData, feePayer.priv, signing.SignMode_SIGN_MODE_DIRECT, tx.Fee{Amount: tc.fee, GasLimit: tc.gasLimit}, feePayer.accNum, 0, ctx.ChainID())

View File

@ -310,7 +310,7 @@ func TestProposalPassedEndblocker(t *testing.T) {
deposits := initialModuleAccCoins.Add(proposal.TotalDeposit...).Add(proposalCoins...)
require.True(t, moduleAccCoins.IsEqual(deposits))
err = app.GovKeeper.AddVote(ctx, proposal.Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes))
err = app.GovKeeper.AddVote(ctx, proposal.Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), "")
require.NoError(t, err)
newHeader := ctx.BlockHeader()
@ -354,7 +354,7 @@ func TestEndBlockerProposalHandlerFailed(t *testing.T) {
require.NoError(t, err)
require.NotNil(t, res)
err = app.GovKeeper.AddVote(ctx, proposal.Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes))
err = app.GovKeeper.AddVote(ctx, proposal.Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), "")
require.NoError(t, err)
newHeader := ctx.BlockHeader()

View File

@ -31,6 +31,7 @@ const (
flagVoter = "voter"
flagDepositor = "depositor"
flagStatus = "status"
flagMetadata = "metadata"
// Deprecated: only used for v1beta1 legacy proposals.
FlagProposal = "proposal"
)
@ -282,13 +283,19 @@ $ %s tx gov vote 1 yes --from mykey
return err
}
metadata, err := cmd.Flags().GetString(flagMetadata)
if err != nil {
return err
}
// Build vote message and run basic validation
msg := v1beta2.NewMsgVote(from, proposalID, byteVoteOption)
msg := v1beta2.NewMsgVote(from, proposalID, byteVoteOption, metadata)
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
cmd.Flags().String(flagMetadata, "", "Specify metadata of the vote")
flags.AddTxFlagsToCmd(cmd)
return cmd
@ -331,12 +338,18 @@ $ %s tx gov weighted-vote 1 yes=0.6,no=0.3,abstain=0.05,no_with_veto=0.05 --from
return err
}
metadata, err := cmd.Flags().GetString(flagMetadata)
if err != nil {
return err
}
// Build vote message and run basic validation
msg := v1beta2.NewMsgVoteWeighted(from, proposalID, options)
msg := v1beta2.NewMsgVoteWeighted(from, proposalID, options, metadata)
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
cmd.Flags().String(flagMetadata, "", "Specify metadata of the weighted vote")
flags.AddTxFlagsToCmd(cmd)
return cmd

View File

@ -879,6 +879,7 @@ func (s *IntegrationTestSuite) TestNewCmdVote() {
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
fmt.Sprintf("--metadata=%s", "AQ=="),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
},
false, 2,
@ -895,6 +896,19 @@ func (s *IntegrationTestSuite) TestNewCmdVote() {
},
false, 0,
},
{
"valid vote with metadata",
[]string{
"1",
"yes",
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
fmt.Sprintf("--metadata=%s", "AQ=="),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
},
false, 0,
},
}
for _, tc := range testCases {
@ -955,6 +969,19 @@ func (s *IntegrationTestSuite) TestNewCmdWeightedVote() {
},
false, 0,
},
{
"valid vote with metadata",
[]string{
"1",
"yes",
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
fmt.Sprintf("--metadata=%s", "AQ=="),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
},
false, 0,
},
{
"invalid valid split vote string",
[]string{

View File

@ -88,12 +88,12 @@ func TestGetPaginatedVotes(t *testing.T) {
acc2 := make(sdk.AccAddress, 20)
acc2[0] = 2
acc1Msgs := []sdk.Msg{
v1beta2.NewMsgVote(acc1, 0, v1beta2.OptionYes),
v1beta2.NewMsgVote(acc1, 0, v1beta2.OptionYes),
v1beta2.NewMsgVote(acc1, 0, v1beta2.OptionYes, ""),
v1beta2.NewMsgVote(acc1, 0, v1beta2.OptionYes, ""),
}
acc2Msgs := []sdk.Msg{
v1beta2.NewMsgVote(acc2, 0, v1beta2.OptionYes),
v1beta2.NewMsgVoteWeighted(acc2, 0, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)),
v1beta2.NewMsgVote(acc2, 0, v1beta2.OptionYes, ""),
v1beta2.NewMsgVoteWeighted(acc2, 0, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""),
}
for _, tc := range []testCase{
{
@ -105,8 +105,8 @@ func TestGetPaginatedVotes(t *testing.T) {
acc2Msgs[:1],
},
votes: []v1beta2.Vote{
v1beta2.NewVote(0, acc1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)),
v1beta2.NewVote(0, acc2, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes))},
v1beta2.NewVote(0, acc1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""),
v1beta2.NewVote(0, acc2, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), "")},
},
{
description: "2MsgPerTx1Chunk",
@ -117,8 +117,8 @@ func TestGetPaginatedVotes(t *testing.T) {
acc2Msgs,
},
votes: []v1beta2.Vote{
v1beta2.NewVote(0, acc1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)),
v1beta2.NewVote(0, acc1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)),
v1beta2.NewVote(0, acc1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""),
v1beta2.NewVote(0, acc1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""),
},
},
{
@ -130,8 +130,8 @@ func TestGetPaginatedVotes(t *testing.T) {
acc2Msgs,
},
votes: []v1beta2.Vote{
v1beta2.NewVote(0, acc2, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)),
v1beta2.NewVote(0, acc2, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)),
v1beta2.NewVote(0, acc2, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""),
v1beta2.NewVote(0, acc2, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""),
},
},
{
@ -141,7 +141,7 @@ func TestGetPaginatedVotes(t *testing.T) {
msgs: [][]sdk.Msg{
acc1Msgs[:1],
},
votes: []v1beta2.Vote{v1beta2.NewVote(0, acc1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes))},
votes: []v1beta2.Vote{v1beta2.NewVote(0, acc1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), "")},
},
{
description: "InvalidPage",

View File

@ -190,7 +190,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposals() {
for i := 0; i < 5; i++ {
govAddress := app.GovKeeper.GetGovernanceAccount(suite.ctx).GetAddress()
testProposal := []sdk.Msg{
v1beta2.NewMsgVote(govAddress, uint64(i), v1beta2.OptionYes),
v1beta2.NewMsgVote(govAddress, uint64(i), v1beta2.OptionYes, ""),
}
proposal, err := app.GovKeeper.SubmitProposal(ctx, testProposal, "")
suite.Require().NotEmpty(proposal)
@ -269,7 +269,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposals() {
func() {
testProposals[1].Status = v1beta2.StatusVotingPeriod
app.GovKeeper.SetProposal(ctx, *testProposals[1])
suite.Require().NoError(app.GovKeeper.AddVote(ctx, testProposals[1].Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionAbstain)))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, testProposals[1].Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionAbstain), ""))
req = &v1beta2.QueryProposalsRequest{
Voter: addrs[0].String(),
@ -384,7 +384,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryVote() {
func() {
proposal.Status = v1beta2.StatusVotingPeriod
app.GovKeeper.SetProposal(ctx, proposal)
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionAbstain)))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionAbstain), ""))
req = &v1beta2.QueryVoteRequest{
ProposalId: proposal.Id,
@ -495,8 +495,8 @@ func (suite *KeeperTestSuite) TestGRPCQueryVotes() {
accAddr2, err2 := sdk.AccAddressFromBech32(votes[1].Voter)
suite.Require().NoError(err1)
suite.Require().NoError(err2)
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, accAddr1, votes[0].Options))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, accAddr2, votes[1].Options))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, accAddr1, votes[0].Options, ""))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, accAddr2, votes[1].Options, ""))
req = &v1beta2.QueryVotesRequest{
ProposalId: proposal.Id,
@ -596,8 +596,8 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryVotes() {
accAddr2, err2 := sdk.AccAddressFromBech32(votes[1].Voter)
suite.Require().NoError(err1)
suite.Require().NoError(err2)
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, accAddr1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionAbstain)))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, accAddr2, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, accAddr1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionAbstain), ""))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, accAddr2, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
req = &v1beta1.QueryVotesRequest{
ProposalId: proposal.Id,
@ -1055,9 +1055,9 @@ func (suite *KeeperTestSuite) TestGRPCQueryTally() {
proposal.Status = v1beta2.StatusVotingPeriod
app.GovKeeper.SetProposal(ctx, proposal)
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, addrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, addrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, addrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, addrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
req = &v1beta2.QueryTallyResultRequest{ProposalId: proposal.Id}

View File

@ -83,7 +83,7 @@ func TestHooks(t *testing.T) {
require.NoError(t, err)
require.True(t, govHooksReceiver.AfterProposalDepositValid)
err = app.GovKeeper.AddVote(ctx, p2.Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes))
err = app.GovKeeper.AddVote(ctx, p2.Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), "")
require.NoError(t, err)
require.True(t, govHooksReceiver.AfterProposalVoteValid)

View File

@ -197,3 +197,12 @@ func (keeper Keeper) InactiveProposalQueueIterator(ctx sdk.Context, endTime time
store := ctx.KVStore(keeper.storeKey)
return store.Iterator(types.InactiveProposalQueuePrefix, sdk.PrefixEndBytes(types.InactiveProposalByTimeKey(endTime)))
}
// assertMetadataLength returns an error if given metadata length
// is greater than a pre-defined maxMetadataLen.
func (k Keeper) assertMetadataLength(metadata string) error {
if metadata != "" && uint64(len(metadata)) > k.config.MaxMetadataLen {
return types.ErrMetadataTooLong.Wrapf("got metadata with length %d", len(metadata))
}
return nil
}

View File

@ -114,7 +114,7 @@ func (k msgServer) Vote(goCtx context.Context, msg *v1beta2.MsgVote) (*v1beta2.M
if accErr != nil {
return nil, accErr
}
err := k.Keeper.AddVote(ctx, msg.ProposalId, accAddr, v1beta2.NewNonSplitVoteOption(msg.Option))
err := k.Keeper.AddVote(ctx, msg.ProposalId, accAddr, v1beta2.NewNonSplitVoteOption(msg.Option), msg.Metadata)
if err != nil {
return nil, err
}
@ -144,7 +144,7 @@ func (k msgServer) VoteWeighted(goCtx context.Context, msg *v1beta2.MsgVoteWeigh
if accErr != nil {
return nil, accErr
}
err := k.Keeper.AddVote(ctx, msg.ProposalId, accAddr, msg.Options)
err := k.Keeper.AddVote(ctx, msg.ProposalId, accAddr, msg.Options, msg.Metadata)
if err != nil {
return nil, err
}

View File

@ -12,8 +12,9 @@ import (
// SubmitProposal create new proposal given an array of messages
func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadata string) (v1beta2.Proposal, error) {
if metadata != "" && uint64(len(metadata)) > keeper.config.MaxMetadataLen {
return v1beta2.Proposal{}, types.ErrMetadataTooLong.Wrapf("got metadata with length %d", len(metadata))
err := keeper.assertMetadataLength(metadata)
if err != nil {
return v1beta2.Proposal{}, err
}
// Will hold a comma-separated string of all Msg type URLs.

View File

@ -101,7 +101,7 @@ func (suite *KeeperTestSuite) TestGetProposalsFiltered() {
if i%2 == 0 {
d := v1beta2.NewDeposit(proposalID, addr1, nil)
v := v1beta2.NewVote(proposalID, addr1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes))
v := v1beta2.NewVote(proposalID, addr1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), "")
suite.app.GovKeeper.SetDeposit(suite.ctx, d)
suite.app.GovKeeper.SetVote(suite.ctx, v)
}

View File

@ -254,13 +254,13 @@ func TestQueries(t *testing.T) {
checkEqualProposal(t, proposal3, *proposals[1])
// Addrs[0] votes on proposals #2 & #3
vote1 := v1beta2.NewVote(proposal2.Id, TestAddrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes))
vote2 := v1beta2.NewVote(proposal3.Id, TestAddrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes))
vote1 := v1beta2.NewVote(proposal2.Id, TestAddrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), "")
vote2 := v1beta2.NewVote(proposal3.Id, TestAddrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), "")
app.GovKeeper.SetVote(ctx, vote1)
app.GovKeeper.SetVote(ctx, vote2)
// Addrs[1] votes on proposal #3
vote3 := v1beta2.NewVote(proposal3.Id, TestAddrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes))
vote3 := v1beta2.NewVote(proposal3.Id, TestAddrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), "")
app.GovKeeper.SetVote(ctx, vote3)
// Test query voted by TestAddrs[0]

View File

@ -50,7 +50,7 @@ func TestTallyNoQuorum(t *testing.T) {
proposal.Status = v1beta2.StatusVotingPeriod
app.GovKeeper.SetProposal(ctx, proposal)
err = app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes))
err = app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), "")
require.Nil(t, err)
proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID)
@ -73,9 +73,9 @@ func TestTallyOnlyValidatorsAllYes(t *testing.T) {
proposal.Status = v1beta2.StatusVotingPeriod
app.GovKeeper.SetProposal(ctx, proposal)
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID)
require.True(t, ok)
@ -99,8 +99,8 @@ func TestTallyOnlyValidators51No(t *testing.T) {
proposal.Status = v1beta2.StatusVotingPeriod
app.GovKeeper.SetProposal(ctx, proposal)
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo), ""))
proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID)
require.True(t, ok)
@ -123,8 +123,8 @@ func TestTallyOnlyValidators51Yes(t *testing.T) {
proposal.Status = v1beta2.StatusVotingPeriod
app.GovKeeper.SetProposal(ctx, proposal)
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID)
require.True(t, ok)
@ -148,9 +148,9 @@ func TestTallyOnlyValidatorsVetoed(t *testing.T) {
proposal.Status = v1beta2.StatusVotingPeriod
app.GovKeeper.SetProposal(ctx, proposal)
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNoWithVeto)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNoWithVeto), ""))
proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID)
require.True(t, ok)
@ -174,9 +174,9 @@ func TestTallyOnlyValidatorsAbstainPasses(t *testing.T) {
proposal.Status = v1beta2.StatusVotingPeriod
app.GovKeeper.SetProposal(ctx, proposal)
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionAbstain)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionAbstain), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID)
require.True(t, ok)
@ -200,9 +200,9 @@ func TestTallyOnlyValidatorsAbstainFails(t *testing.T) {
proposal.Status = v1beta2.StatusVotingPeriod
app.GovKeeper.SetProposal(ctx, proposal)
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionAbstain)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionAbstain), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo), ""))
proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID)
require.True(t, ok)
@ -227,8 +227,8 @@ func TestTallyOnlyValidatorsNonVoter(t *testing.T) {
proposal.Status = v1beta2.StatusVotingPeriod
app.GovKeeper.SetProposal(ctx, proposal)
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddr1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddr2, v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddr1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddr2, v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo), ""))
proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID)
require.True(t, ok)
@ -261,10 +261,10 @@ func TestTallyDelgatorOverride(t *testing.T) {
proposal.Status = v1beta2.StatusVotingPeriod
app.GovKeeper.SetProposal(ctx, proposal)
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[3], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[4], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[3], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[4], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo), ""))
proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID)
require.True(t, ok)
@ -297,9 +297,9 @@ func TestTallyDelgatorInherit(t *testing.T) {
proposal.Status = v1beta2.StatusVotingPeriod
app.GovKeeper.SetProposal(ctx, proposal)
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID)
require.True(t, ok)
@ -336,10 +336,10 @@ func TestTallyDelgatorMultipleOverride(t *testing.T) {
proposal.Status = v1beta2.StatusVotingPeriod
app.GovKeeper.SetProposal(ctx, proposal)
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[3], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[3], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo), ""))
proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID)
require.True(t, ok)
@ -378,9 +378,9 @@ func TestTallyDelgatorMultipleInherit(t *testing.T) {
proposal.Status = v1beta2.StatusVotingPeriod
app.GovKeeper.SetProposal(ctx, proposal)
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo), ""))
proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID)
require.True(t, ok)
@ -421,9 +421,9 @@ func TestTallyJailedValidator(t *testing.T) {
proposal.Status = v1beta2.StatusVotingPeriod
app.GovKeeper.SetProposal(ctx, proposal)
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo), ""))
proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID)
require.True(t, ok)
@ -454,9 +454,9 @@ func TestTallyValidatorMultipleDelegations(t *testing.T) {
proposal.Status = v1beta2.StatusVotingPeriod
app.GovKeeper.SetProposal(ctx, proposal)
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo), ""))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID)
require.True(t, ok)

View File

@ -10,7 +10,7 @@ import (
)
// AddVote adds a vote on a specific proposal
func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress, options v1beta2.WeightedVoteOptions) error {
func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress, options v1beta2.WeightedVoteOptions, metadata string) error {
proposal, ok := keeper.GetProposal(ctx, proposalID)
if !ok {
return sdkerrors.Wrapf(types.ErrUnknownProposal, "%d", proposalID)
@ -18,6 +18,10 @@ func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.A
if proposal.Status != v1beta2.StatusVotingPeriod {
return sdkerrors.Wrapf(types.ErrInactiveProposal, "%d", proposalID)
}
err := keeper.assertMetadataLength(metadata)
if err != nil {
return err
}
for _, option := range options {
if !v1beta2.ValidWeightedVoteOption(*option) {
@ -25,7 +29,7 @@ func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.A
}
}
vote := v1beta2.NewVote(proposalID, voterAddr, options)
vote := v1beta2.NewVote(proposalID, voterAddr, options, metadata)
keeper.SetVote(ctx, vote)
// called after a vote on a proposal is cast

View File

@ -21,19 +21,20 @@ func TestVotes(t *testing.T) {
proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "")
require.NoError(t, err)
proposalID := proposal.Id
metadata := "metadata"
var invalidOption v1beta2.VoteOption = 0x10
require.Error(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)), "proposal not on voting period")
require.Error(t, app.GovKeeper.AddVote(ctx, 10, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)), "invalid proposal ID")
require.Error(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), metadata), "proposal not on voting period")
require.Error(t, app.GovKeeper.AddVote(ctx, 10, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""), "invalid proposal ID")
proposal.Status = v1beta2.StatusVotingPeriod
app.GovKeeper.SetProposal(ctx, proposal)
require.Error(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(invalidOption)), "invalid option")
require.Error(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(invalidOption), ""), "invalid option")
// Test first vote
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionAbstain)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionAbstain), metadata))
vote, found := app.GovKeeper.GetVote(ctx, proposalID, addrs[0])
require.True(t, found)
require.Equal(t, addrs[0].String(), vote.Voter)
@ -42,7 +43,7 @@ func TestVotes(t *testing.T) {
require.Equal(t, v1beta2.OptionAbstain, vote.Options[0].Option)
// Test change of vote
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
vote, found = app.GovKeeper.GetVote(ctx, proposalID, addrs[0])
require.True(t, found)
require.Equal(t, addrs[0].String(), vote.Voter)
@ -56,7 +57,7 @@ func TestVotes(t *testing.T) {
v1beta2.NewWeightedVoteOption(v1beta2.OptionNo, sdk.NewDecWithPrec(30, 2)),
v1beta2.NewWeightedVoteOption(v1beta2.OptionAbstain, sdk.NewDecWithPrec(5, 2)),
v1beta2.NewWeightedVoteOption(v1beta2.OptionNoWithVeto, sdk.NewDecWithPrec(5, 2)),
}))
}, ""))
vote, found = app.GovKeeper.GetVote(ctx, proposalID, addrs[1])
require.True(t, found)
require.Equal(t, addrs[1].String(), vote.Voter)

View File

@ -125,6 +125,7 @@ func TestMigrateJSON(t *testing.T) {
},
"votes": [
{
"metadata": "",
"options": [
{
"option": "VOTE_OPTION_ABSTAIN",
@ -135,6 +136,7 @@ func TestMigrateJSON(t *testing.T) {
"voter": "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh"
},
{
"metadata": "",
"options": [
{
"option": "VOTE_OPTION_NO",

View File

@ -301,7 +301,7 @@ func operationSimulateMsgVote(ak types.AccountKeeper, bk types.BankKeeper, k kee
}
option := randomVotingOption(r)
msg := v1beta2.NewMsgVote(simAccount.Address, proposalID, option)
msg := v1beta2.NewMsgVote(simAccount.Address, proposalID, option, "")
account := ak.GetAccount(ctx, simAccount.Address)
spendable := bk.SpendableCoins(ctx, account.GetAddress())
@ -354,7 +354,7 @@ func operationSimulateMsgVoteWeighted(ak types.AccountKeeper, bk types.BankKeepe
}
options := randomWeightedVotingOptions(r)
msg := v1beta2.NewMsgVoteWeighted(simAccount.Address, proposalID, options)
msg := v1beta2.NewMsgVoteWeighted(simAccount.Address, proposalID, options, "")
account := ak.GetAccount(ctx, simAccount.Address)
spendable := bk.SpendableCoins(ctx, account.GetAddress())

View File

@ -431,6 +431,8 @@ 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"`
Options []*WeightedVoteOption `protobuf:"bytes,4,rep,name=options,proto3" json:"options,omitempty"`
// metadata is any arbitrary metadata to attached to the vote.
Metadata string `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"`
}
func (m *Vote) Reset() { *m = Vote{} }
@ -487,6 +489,13 @@ func (m *Vote) GetOptions() []*WeightedVoteOption {
return nil
}
func (m *Vote) GetMetadata() string {
if m != nil {
return m.Metadata
}
return ""
}
// DepositParams defines the params for deposits on governance proposals.
type DepositParams struct {
// Minimum deposit for a proposal to enter voting period.
@ -671,76 +680,77 @@ func init() {
func init() { proto.RegisterFile("cosmos/gov/v1beta2/gov.proto", fileDescriptor_5abf7b8852811c49) }
var fileDescriptor_5abf7b8852811c49 = []byte{
// 1101 bytes of a gzipped FileDescriptorProto
// 1108 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, 0xe6, 0x19, 0x8c, 0xba, 0xd0, 0x46, 0x10, 0x62, 0x53, 0x4f, 0x9b, 0xa1,
0xb4, 0xd8, 0x81, 0xcc, 0xa4, 0x33, 0xe9, 0xa5, 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, 0x3f, 0x91, 0x1f, 0x91, 0x53, 0x27, 0x93, 0x4b, 0xdb, 0x8b, 0x9b, 0xc2,
0x8d, 0x5f, 0x91, 0xd1, 0x6a, 0x85, 0x8d, 0x71, 0x06, 0x4e,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 0xba, 0x22, 0x6f, 0xfd, 0x25, 0x41, 0xf6, 0xea, 0xcb, 0x02, 0xe5, 0xe1, 0x6e, 0x43, 0xaf,
0x37, 0xea, 0x46, 0xf9, 0xc0, 0x32, 0xcc, 0xb2, 0xf9, 0xcc, 0x98, 0xe8, 0xa9, 0x00, 0xb9, 0x49,
0x40, 0x55, 0x6b, 0xd4, 0x8d, 0x9a, 0x69, 0x35, 0x34, 0xbd, 0x56, 0xaf, 0x2a, 0x12, 0xfa, 0x1c,
0xee, 0x4d, 0x62, 0x9a, 0x75, 0xb3, 0x76, 0xf8, 0x43, 0x0c, 0x49, 0xa0, 0x35, 0xf8, 0x6c, 0x12,
0xd2, 0x28, 0x1b, 0x86, 0x56, 0x8d, 0x9a, 0x9e, 0xcc, 0xe9, 0xda, 0xbe, 0xb6, 0x67, 0x6a, 0x55,
0x45, 0x9e, 0xc6, 0x7c, 0x52, 0xae, 0x1d, 0x68, 0x55, 0x65, 0xb6, 0xb2, 0xff, 0xe6, 0x2c, 0x27,
0xbd, 0x3d, 0xcb, 0x49, 0xef, 0xcf, 0x72, 0xd2, 0xab, 0xf3, 0xdc, 0xcc, 0xdb, 0xf3, 0xdc, 0xcc,
0x3f, 0xe7, 0xb9, 0x99, 0x9f, 0x1f, 0xb4, 0x5d, 0xd6, 0xe9, 0xb7, 0x8a, 0xc7, 0xc4, 0x13, 0x1f,
0x2d, 0xe2, 0x67, 0x9b, 0x3a, 0xbf, 0x94, 0x4e, 0xf9, 0x27, 0x19, 0x1b, 0xf4, 0x30, 0x8d, 0x3f,
0xcc, 0x5a, 0x29, 0xee, 0xd9, 0x87, 0x1f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xf1, 0x23, 0xf2, 0x27,
0xb5, 0x09, 0x00, 0x00,
}
func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) {
@ -1018,6 +1028,13 @@ func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if len(m.Metadata) > 0 {
i -= len(m.Metadata)
copy(dAtA[i:], m.Metadata)
i = encodeVarintGov(dAtA, i, uint64(len(m.Metadata)))
i--
dAtA[i] = 0x2a
}
if len(m.Options) > 0 {
for iNdEx := len(m.Options) - 1; iNdEx >= 0; iNdEx-- {
{
@ -1315,6 +1332,10 @@ func (m *Vote) Size() (n int) {
n += 1 + l + sovGov(uint64(l))
}
}
l = len(m.Metadata)
if l > 0 {
n += 1 + l + sovGov(uint64(l))
}
return n
}
@ -2273,6 +2294,38 @@ func (m *Vote) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGov
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthGov
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthGov
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Metadata = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGov(dAtA[iNdEx:])

View File

@ -140,8 +140,8 @@ func (msg MsgDeposit) GetSigners() []sdk.AccAddress {
// NewMsgVote creates a message to cast a vote on an active proposal
//nolint:interfacer
func NewMsgVote(voter sdk.AccAddress, proposalID uint64, option VoteOption) *MsgVote {
return &MsgVote{proposalID, voter.String(), option}
func NewMsgVote(voter sdk.AccAddress, proposalID uint64, option VoteOption, metadata string) *MsgVote {
return &MsgVote{proposalID, voter.String(), option, metadata}
}
// Route implements Msg
@ -176,8 +176,8 @@ func (msg MsgVote) GetSigners() []sdk.AccAddress {
// NewMsgVoteWeighted creates a message to cast a vote on an active proposal
//nolint:interfacer
func NewMsgVoteWeighted(voter sdk.AccAddress, proposalID uint64, options WeightedVoteOptions) *MsgVoteWeighted {
return &MsgVoteWeighted{proposalID, voter.String(), options}
func NewMsgVoteWeighted(voter sdk.AccAddress, proposalID uint64, options WeightedVoteOptions, metadata string) *MsgVoteWeighted {
return &MsgVoteWeighted{proposalID, voter.String(), options, metadata}
}
// Route implements Msg

View File

@ -59,22 +59,24 @@ func TestMsgDeposit(t *testing.T) {
// test ValidateBasic for MsgVote
func TestMsgVote(t *testing.T) {
metadata := "metadata"
tests := []struct {
proposalID uint64
voterAddr sdk.AccAddress
option v1beta2.VoteOption
metadata string
expectPass bool
}{
{0, addrs[0], v1beta2.OptionYes, true},
{0, sdk.AccAddress{}, v1beta2.OptionYes, false},
{0, addrs[0], v1beta2.OptionNo, true},
{0, addrs[0], v1beta2.OptionNoWithVeto, true},
{0, addrs[0], v1beta2.OptionAbstain, true},
{0, addrs[0], v1beta2.VoteOption(0x13), false},
{0, addrs[0], v1beta2.OptionYes, metadata, true},
{0, sdk.AccAddress{}, v1beta2.OptionYes, "", false},
{0, addrs[0], v1beta2.OptionNo, metadata, true},
{0, addrs[0], v1beta2.OptionNoWithVeto, "", true},
{0, addrs[0], v1beta2.OptionAbstain, "", true},
{0, addrs[0], v1beta2.VoteOption(0x13), "", false},
}
for i, tc := range tests {
msg := v1beta2.NewMsgVote(tc.voterAddr, tc.proposalID, tc.option)
msg := v1beta2.NewMsgVote(tc.voterAddr, tc.proposalID, tc.option, tc.metadata)
if tc.expectPass {
require.Nil(t, msg.ValidateBasic(), "test: %v", i)
} else {
@ -85,40 +87,42 @@ func TestMsgVote(t *testing.T) {
// test ValidateBasic for MsgVoteWeighted
func TestMsgVoteWeighted(t *testing.T) {
metadata := "metadata"
tests := []struct {
proposalID uint64
voterAddr sdk.AccAddress
options v1beta2.WeightedVoteOptions
metadata string
expectPass bool
}{
{0, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), true},
{0, sdk.AccAddress{}, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), false},
{0, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo), true},
{0, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNoWithVeto), true},
{0, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionAbstain), true},
{0, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), metadata, true},
{0, sdk.AccAddress{}, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), "", false},
{0, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNo), "", true},
{0, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionNoWithVeto), "", true},
{0, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionAbstain), "", true},
{0, addrs[0], v1beta2.WeightedVoteOptions{ // weight sum > 1
v1beta2.NewWeightedVoteOption(v1beta2.OptionYes, sdk.NewDec(1)),
v1beta2.NewWeightedVoteOption(v1beta2.OptionAbstain, sdk.NewDec(1)),
}, false},
}, "", false},
{0, addrs[0], v1beta2.WeightedVoteOptions{ // duplicate option
v1beta2.NewWeightedVoteOption(v1beta2.OptionYes, sdk.NewDecWithPrec(5, 1)),
v1beta2.NewWeightedVoteOption(v1beta2.OptionYes, sdk.NewDecWithPrec(5, 1)),
}, false},
}, "", false},
{0, addrs[0], v1beta2.WeightedVoteOptions{ // zero weight
v1beta2.NewWeightedVoteOption(v1beta2.OptionYes, sdk.NewDec(0)),
}, false},
}, "", false},
{0, addrs[0], v1beta2.WeightedVoteOptions{ // negative weight
v1beta2.NewWeightedVoteOption(v1beta2.OptionYes, sdk.NewDec(-1)),
}, false},
{0, addrs[0], v1beta2.WeightedVoteOptions{}, false},
{0, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.VoteOption(0x13)), false},
}, "", false},
{0, addrs[0], v1beta2.WeightedVoteOptions{}, "", false},
{0, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.VoteOption(0x13)), "", false},
{0, addrs[0], v1beta2.WeightedVoteOptions{ // weight sum <1
v1beta2.NewWeightedVoteOption(v1beta2.OptionYes, sdk.NewDecWithPrec(5, 1)),
}, false},
}, "", false},
}
for i, tc := range tests {
msg := v1beta2.NewMsgVoteWeighted(tc.voterAddr, tc.proposalID, tc.options)
msg := v1beta2.NewMsgVoteWeighted(tc.voterAddr, tc.proposalID, tc.options, tc.metadata)
if tc.expectPass {
require.Nil(t, msg.ValidateBasic(), "test: %v", i)
} else {
@ -165,7 +169,7 @@ func TestMsgSubmitProposal_ValidateBasic(t *testing.T) {
// this tests that Amino JSON MsgSubmitProposal.GetSignBytes() still works with Content as Any using the ModuleCdc
func TestMsgSubmitProposal_GetSignBytes(t *testing.T) {
proposal := []sdk.Msg{v1beta2.NewMsgVote(addrs[0], 1, v1beta2.OptionYes)}
proposal := []sdk.Msg{v1beta2.NewMsgVote(addrs[0], 1, v1beta2.OptionYes, "")}
msg, err := v1beta2.NewMsgSubmitProposal(proposal, sdk.NewCoins(), sdk.AccAddress{}.String(), "")
require.NoError(t, err)
var bz []byte

View File

@ -246,6 +246,7 @@ type MsgVote struct {
ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id"`
Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"`
Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos.gov.v1beta2.VoteOption" json:"option,omitempty"`
Metadata string `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"`
}
func (m *MsgVote) Reset() { *m = MsgVote{} }
@ -302,6 +303,13 @@ func (m *MsgVote) GetOption() VoteOption {
return VoteOption_VOTE_OPTION_UNSPECIFIED
}
func (m *MsgVote) GetMetadata() string {
if m != nil {
return m.Metadata
}
return ""
}
// MsgVoteResponse defines the Msg/Vote response type.
type MsgVoteResponse struct {
}
@ -344,6 +352,7 @@ type MsgVoteWeighted struct {
ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id"`
Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"`
Options []*WeightedVoteOption `protobuf:"bytes,3,rep,name=options,proto3" json:"options,omitempty"`
Metadata string `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"`
}
func (m *MsgVoteWeighted) Reset() { *m = MsgVoteWeighted{} }
@ -400,6 +409,13 @@ func (m *MsgVoteWeighted) GetOptions() []*WeightedVoteOption {
return nil
}
func (m *MsgVoteWeighted) GetMetadata() string {
if m != nil {
return m.Metadata
}
return ""
}
// MsgVoteWeightedResponse defines the Msg/VoteWeighted response type.
type MsgVoteWeightedResponse struct {
}
@ -551,53 +567,53 @@ func init() {
func init() { proto.RegisterFile("cosmos/gov/v1beta2/tx.proto", fileDescriptor_4214261f6b3f9ed4) }
var fileDescriptor_4214261f6b3f9ed4 = []byte{
// 733 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0xcf, 0x4f, 0x13, 0x41,
0x14, 0xee, 0xd2, 0x4a, 0xe1, 0xa1, 0x25, 0x4c, 0x9a, 0xb0, 0x5d, 0xc8, 0x42, 0xd6, 0x48, 0x1a,
0x4d, 0x77, 0xdb, 0x6a, 0x30, 0x41, 0x0f, 0x52, 0x34, 0x41, 0x63, 0xa3, 0x2e, 0x89, 0x26, 0x5e,
0x70, 0xdb, 0x1d, 0x86, 0x8d, 0x74, 0x67, 0xb3, 0x33, 0x6d, 0xe8, 0x51, 0xff, 0x02, 0xff, 0x13,
0x3d, 0x70, 0x37, 0xde, 0x88, 0x27, 0xe2, 0xc9, 0x8b, 0xc4, 0xc0, 0xc1, 0xc4, 0x93, 0x7f, 0x82,
0xd9, 0xdd, 0xd9, 0x2d, 0xd0, 0x1f, 0xd4, 0x8b, 0xa7, 0xce, 0xbc, 0xef, 0xfb, 0xde, 0xbc, 0x6f,
0xfa, 0xde, 0x0e, 0x2c,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x55, 0xf5, 0xfe, 0x51, 0xd0, 0x83, 0x5a, 0x9e, 0x85,
0x2c, 0x53, 0xb0, 0xd7, 0x20, 0x70, 0x15, 0xe5, 0xd0, 0xe6, 0x60, 0x56, 0x14, 0x9c, 0x98, 0xf8,
0x22, 0x25, 0xb1, 0x57, 0xd8, 0x21, 0xbb, 0x1c, 0xdb, 0xff, 0xc1, 0xcc, 0x03, 0xc8, 0x46, 0xe5,
0x31, 0x39, 0x1d, 0xf6, 0xef, 0xca, 0x20, 0x37, 0x71, 0x41, 0x67, 0x5c, 0xc5, 0xb2, 0x73, 0xb6,
0x0a, 0x30, 0x7f, 0xc1, 0x42, 0x62, 0xef, 0xb3, 0x04, 0x50, 0x67, 0x24, 0xee, 0xfa, 0x7f, 0x77,
0xb6, 0x0a, 0xd3, 0x62, 0xd2, 0xe8, 0xe5, 0xee, 0x7a, 0x54, 0x74, 0x17, 0x26, 0xad, 0x16, 0x6d,
0xbb, 0x5c, 0x18, 0xbc, 0x74, 0x40, 0x05, 0x5d, 0x74, 0x61, 0x92, 0x48, 0xcb, 0x03, 0xea, 0x19,
0x88, 0x7d, 0x55, 0x7f, 0xa4, 0x21, 0x5d, 0x67, 0x04, 0xed, 0x40, 0xee, 0xc2, 0x47, 0xe5, 0xc6,
0xa0, 0x9b, 0xec, 0x9b, 0x44, 0xa5, 0x34, 0x16, 0x2d, 0x19, 0x58, 0x0a, 0x73, 0xfd, 0xb3, 0x58,
0x1c, 0x92, 0xa3, 0x8f, 0xa9, 0x94, 0xc7, 0x65, 0x26, 0x07, 0x6e, 0x42, 0x26, 0x1c, 0xac, 0x85,
0x21, 0xca, 0x00, 0x54, 0xae, 0x8f, 0x00, 0x93, 0x4c, 0x6f, 0xe0, 0xea, 0xb9, 0xee, 0x1e, 0x25,
0x8a, 0x49, 0xca, 0xad, 0x31, 0x48, 0xc9, 0x09, 0x2f, 0x20, 0x1b, 0x37, 0x98, 0x3a, 0x44, 0x27,
0x70, 0x65, 0x65, 0x34, 0x1e, 0xa7, 0xac, 0x3d, 0x39, 0x3c, 0x51, 0xa5, 0xa3, 0x13, 0x55, 0xfa,
0x79, 0xa2, 0x4a, 0x1f, 0x4e, 0xd5, 0xd4, 0xd1, 0xa9, 0x9a, 0xfa, 0x7e, 0xaa, 0xa6, 0x5e, 0x97,
0x89, 0xc3, 0x77, 0xdb, 0x0d, 0xbd, 0x49, 0x5b, 0xe2, 0x5d, 0x12, 0x3f, 0x25, 0x66, 0xbf, 0x35,
0xf6, 0xc3, 0x57, 0x8e, 0x77, 0x3d, 0xcc, 0xe2, 0xb7, 0xae, 0x31, 0x19, 0x7e, 0x19, 0x6f, 0xff,
0x0d, 0x00, 0x00, 0xff, 0xff, 0x50, 0xa3, 0xc5, 0x32, 0x59, 0x07, 0x00, 0x00,
// 735 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0x4f, 0x6f, 0xd3, 0x4e,
0x10, 0x8d, 0x9b, 0xfc, 0x9a, 0x76, 0xfa, 0x23, 0x55, 0x57, 0x91, 0xea, 0xb8, 0x95, 0x5b, 0x19,
0x51, 0x45, 0xa0, 0xd8, 0x49, 0x40, 0x45, 0x2a, 0x1c, 0x68, 0x0a, 0x52, 0x41, 0x44, 0x80, 0x2b,
0x81, 0xc4, 0xa5, 0x38, 0xf1, 0x76, 0x6b, 0xd1, 0x78, 0x2d, 0xef, 0x26, 0x6a, 0x8e, 0xf0, 0x09,
0xf8, 0x28, 0x1c, 0x7a, 0xe7, 0x5a, 0xc1, 0xa5, 0xe2, 0xc4, 0xa5, 0x15, 0x6a, 0x0f, 0x48, 0x9c,
0xf8, 0x08, 0xc8, 0xf6, 0xda, 0x09, 0xcd, 0x9f, 0x86, 0x0b, 0x27, 0x7b, 0xe7, 0xbd, 0x37, 0x3b,
0x6f, 0xbc, 0xe3, 0x85, 0xa5, 0x26, 0x65, 0x2d, 0xca, 0x0c, 0x42, 0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 0x3c, 0x4e, 0x59, 0x7b, 0x72, 0x7c, 0xae, 0x4a, 0x27, 0xe7,
0xaa, 0xf4, 0xfd, 0x5c, 0x95, 0x3e, 0x5c, 0xa8, 0xa9, 0x93, 0x0b, 0x35, 0xf5, 0xed, 0x42, 0x4d,
0xbd, 0x2e, 0x13, 0x87, 0xef, 0xb7, 0x1b, 0x7a, 0x93, 0xb6, 0xc4, 0x7d, 0x26, 0x1e, 0x25, 0x66,
0xbf, 0x35, 0x0e, 0xc3, 0xdb, 0x91, 0x77, 0x3d, 0xcc, 0xe2, 0x3b, 0xb2, 0x31, 0x1d, 0xfe, 0x51,
0x6f, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x2b, 0xc6, 0x08, 0x2b, 0x91, 0x07, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -1014,6 +1030,13 @@ func (m *MsgVote) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if len(m.Metadata) > 0 {
i -= len(m.Metadata)
copy(dAtA[i:], m.Metadata)
i = encodeVarintTx(dAtA, i, uint64(len(m.Metadata)))
i--
dAtA[i] = 0x22
}
if m.Option != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.Option))
i--
@ -1077,6 +1100,13 @@ func (m *MsgVoteWeighted) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if len(m.Metadata) > 0 {
i -= len(m.Metadata)
copy(dAtA[i:], m.Metadata)
i = encodeVarintTx(dAtA, i, uint64(len(m.Metadata)))
i--
dAtA[i] = 0x22
}
if len(m.Options) > 0 {
for iNdEx := len(m.Options) - 1; iNdEx >= 0; iNdEx-- {
{
@ -1295,6 +1325,10 @@ func (m *MsgVote) Size() (n int) {
if m.Option != 0 {
n += 1 + sovTx(uint64(m.Option))
}
l = len(m.Metadata)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
@ -1326,6 +1360,10 @@ func (m *MsgVoteWeighted) Size() (n int) {
n += 1 + l + sovTx(uint64(l))
}
}
l = len(m.Metadata)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
@ -1893,6 +1931,38 @@ func (m *MsgVote) Unmarshal(dAtA []byte) error {
break
}
}
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Metadata = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
@ -2078,6 +2148,38 @@ func (m *MsgVoteWeighted) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Metadata = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])

View File

@ -17,8 +17,8 @@ const (
// NewVote creates a new Vote instance
//nolint:interfacer
func NewVote(proposalID uint64, voter sdk.AccAddress, options WeightedVoteOptions) Vote {
return Vote{ProposalId: proposalID, Voter: voter.String(), Options: options}
func NewVote(proposalID uint64, voter sdk.AccAddress, options WeightedVoteOptions, metadata string) Vote {
return Vote{ProposalId: proposalID, Voter: voter.String(), Options: options, Metadata: metadata}
}
// Empty returns whether a vote is empty.