From 4dccb77d6bf1078458b5255ab42959d88514549b Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Thu, 22 Dec 2022 13:58:44 +0100 Subject: [PATCH 01/10] add title, summary and proposer to proposal struct --- api/cosmos/gov/v1/gov.pulsar.go | 447 +++++++++++++++++++++------- api/cosmos/gov/v1/tx.pulsar.go | 153 +++++++++- proto/cosmos/gov/v1/gov.proto | 8 + proto/cosmos/gov/v1/tx.proto | 6 + x/gov/abci_test.go | 4 +- x/gov/keeper/deposit_test.go | 4 +- x/gov/keeper/grpc_query_test.go | 8 +- x/gov/keeper/hooks_test.go | 4 +- x/gov/keeper/keeper_test.go | 14 +- x/gov/keeper/msg_server.go | 6 +- x/gov/keeper/proposal.go | 10 +- x/gov/keeper/proposal_test.go | 10 +- x/gov/keeper/vote_test.go | 2 +- x/gov/simulation/operations_test.go | 6 +- x/gov/types/v1/gov.pb.go | 307 ++++++++++++++----- x/gov/types/v1/proposal.go | 5 +- x/gov/types/v1/proposals_test.go | 2 +- x/gov/types/v1/tx.pb.go | 218 ++++++++++---- 18 files changed, 938 insertions(+), 276 deletions(-) diff --git a/api/cosmos/gov/v1/gov.pulsar.go b/api/cosmos/gov/v1/gov.pulsar.go index 88a6743a117c..462984a73e60 100644 --- a/api/cosmos/gov/v1/gov.pulsar.go +++ b/api/cosmos/gov/v1/gov.pulsar.go @@ -1207,6 +1207,9 @@ var ( fd_Proposal_voting_start_time protoreflect.FieldDescriptor fd_Proposal_voting_end_time protoreflect.FieldDescriptor fd_Proposal_metadata protoreflect.FieldDescriptor + fd_Proposal_title protoreflect.FieldDescriptor + fd_Proposal_summary protoreflect.FieldDescriptor + fd_Proposal_proposer protoreflect.FieldDescriptor ) func init() { @@ -1222,6 +1225,9 @@ func init() { fd_Proposal_voting_start_time = md_Proposal.Fields().ByName("voting_start_time") fd_Proposal_voting_end_time = md_Proposal.Fields().ByName("voting_end_time") fd_Proposal_metadata = md_Proposal.Fields().ByName("metadata") + fd_Proposal_title = md_Proposal.Fields().ByName("title") + fd_Proposal_summary = md_Proposal.Fields().ByName("summary") + fd_Proposal_proposer = md_Proposal.Fields().ByName("proposer") } var _ protoreflect.Message = (*fastReflection_Proposal)(nil) @@ -1349,6 +1355,24 @@ func (x *fastReflection_Proposal) Range(f func(protoreflect.FieldDescriptor, pro return } } + if x.Title != "" { + value := protoreflect.ValueOfString(x.Title) + if !f(fd_Proposal_title, value) { + return + } + } + if x.Summary != "" { + value := protoreflect.ValueOfString(x.Summary) + if !f(fd_Proposal_summary, value) { + return + } + } + if x.Proposer != "" { + value := protoreflect.ValueOfString(x.Proposer) + if !f(fd_Proposal_proposer, value) { + return + } + } } // Has reports whether a field is populated. @@ -1384,6 +1408,12 @@ func (x *fastReflection_Proposal) Has(fd protoreflect.FieldDescriptor) bool { return x.VotingEndTime != nil case "cosmos.gov.v1.Proposal.metadata": return x.Metadata != "" + case "cosmos.gov.v1.Proposal.title": + return x.Title != "" + case "cosmos.gov.v1.Proposal.summary": + return x.Summary != "" + case "cosmos.gov.v1.Proposal.proposer": + return x.Proposer != "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Proposal")) @@ -1420,6 +1450,12 @@ func (x *fastReflection_Proposal) Clear(fd protoreflect.FieldDescriptor) { x.VotingEndTime = nil case "cosmos.gov.v1.Proposal.metadata": x.Metadata = "" + case "cosmos.gov.v1.Proposal.title": + x.Title = "" + case "cosmos.gov.v1.Proposal.summary": + x.Summary = "" + case "cosmos.gov.v1.Proposal.proposer": + x.Proposer = "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Proposal")) @@ -1472,6 +1508,15 @@ func (x *fastReflection_Proposal) Get(descriptor protoreflect.FieldDescriptor) p case "cosmos.gov.v1.Proposal.metadata": value := x.Metadata return protoreflect.ValueOfString(value) + case "cosmos.gov.v1.Proposal.title": + value := x.Title + return protoreflect.ValueOfString(value) + case "cosmos.gov.v1.Proposal.summary": + value := x.Summary + return protoreflect.ValueOfString(value) + case "cosmos.gov.v1.Proposal.proposer": + value := x.Proposer + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Proposal")) @@ -1516,6 +1561,12 @@ func (x *fastReflection_Proposal) Set(fd protoreflect.FieldDescriptor, value pro x.VotingEndTime = value.Message().Interface().(*timestamppb.Timestamp) case "cosmos.gov.v1.Proposal.metadata": x.Metadata = value.Interface().(string) + case "cosmos.gov.v1.Proposal.title": + x.Title = value.Interface().(string) + case "cosmos.gov.v1.Proposal.summary": + x.Summary = value.Interface().(string) + case "cosmos.gov.v1.Proposal.proposer": + x.Proposer = value.Interface().(string) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Proposal")) @@ -1579,6 +1630,12 @@ func (x *fastReflection_Proposal) Mutable(fd protoreflect.FieldDescriptor) proto panic(fmt.Errorf("field status of message cosmos.gov.v1.Proposal is not mutable")) case "cosmos.gov.v1.Proposal.metadata": panic(fmt.Errorf("field metadata of message cosmos.gov.v1.Proposal is not mutable")) + case "cosmos.gov.v1.Proposal.title": + panic(fmt.Errorf("field title of message cosmos.gov.v1.Proposal is not mutable")) + case "cosmos.gov.v1.Proposal.summary": + panic(fmt.Errorf("field summary of message cosmos.gov.v1.Proposal is not mutable")) + case "cosmos.gov.v1.Proposal.proposer": + panic(fmt.Errorf("field proposer of message cosmos.gov.v1.Proposal is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Proposal")) @@ -1619,6 +1676,12 @@ func (x *fastReflection_Proposal) NewField(fd protoreflect.FieldDescriptor) prot return protoreflect.ValueOfMessage(m.ProtoReflect()) case "cosmos.gov.v1.Proposal.metadata": return protoreflect.ValueOfString("") + case "cosmos.gov.v1.Proposal.title": + return protoreflect.ValueOfString("") + case "cosmos.gov.v1.Proposal.summary": + return protoreflect.ValueOfString("") + case "cosmos.gov.v1.Proposal.proposer": + return protoreflect.ValueOfString("") default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Proposal")) @@ -1730,6 +1793,18 @@ func (x *fastReflection_Proposal) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + l = len(x.Title) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Summary) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Proposer) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -1759,6 +1834,27 @@ func (x *fastReflection_Proposal) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.Proposer) > 0 { + i -= len(x.Proposer) + copy(dAtA[i:], x.Proposer) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Proposer))) + i-- + dAtA[i] = 0x6a + } + if len(x.Summary) > 0 { + i -= len(x.Summary) + copy(dAtA[i:], x.Summary) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Summary))) + i-- + dAtA[i] = 0x62 + } + if len(x.Title) > 0 { + i -= len(x.Title) + copy(dAtA[i:], x.Title) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Title))) + i-- + dAtA[i] = 0x5a + } if len(x.Metadata) > 0 { i -= len(x.Metadata) copy(dAtA[i:], x.Metadata) @@ -2245,6 +2341,102 @@ func (x *fastReflection_Proposal) ProtoMethods() *protoiface.Methods { } x.Metadata = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 11: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Title", 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.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 12: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Summary", 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.Summary = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 13: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Proposer", 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.Proposer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -6302,6 +6494,11 @@ type Proposal struct { VotingEndTime *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=voting_end_time,json=votingEndTime,proto3" json:"voting_end_time,omitempty"` // metadata is any arbitrary metadata attached to the proposal. Metadata string `protobuf:"bytes,10,opt,name=metadata,proto3" json:"metadata,omitempty"` + // title is the title of the proposal + Title string `protobuf:"bytes,11,opt,name=title,proto3" json:"title,omitempty"` + // summary is a short summary of the proposal + Summary string `protobuf:"bytes,12,opt,name=summary,proto3" json:"summary,omitempty"` + Proposer string `protobuf:"bytes,13,opt,name=proposer,proto3" json:"proposer,omitempty"` } func (x *Proposal) Reset() { @@ -6394,6 +6591,27 @@ func (x *Proposal) GetMetadata() string { return "" } +func (x *Proposal) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *Proposal) GetSummary() string { + if x != nil { + return x.Summary + } + return "" +} + +func (x *Proposal) GetProposer() string { + if x != nil { + return x.Proposer + } + return "" +} + // TallyResult defines a standard tally for a governance proposal. type TallyResult struct { state protoimpl.MessageState @@ -6794,7 +7012,7 @@ var file_cosmos_gov_v1_gov_proto_rawDesc = []byte{ 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, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, - 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xdb, 0x04, 0x0a, + 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xc1, 0x05, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x30, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, @@ -6832,121 +7050,128 @@ var file_cosmos_gov_v1_gov_proto_rawDesc = []byte{ 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x04, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x0d, 0x76, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0xd7, 0x01, 0x0a, 0x0b, 0x54, - 0x61, 0x6c, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x2b, 0x0a, 0x09, 0x79, 0x65, - 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, - 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x08, 0x79, - 0x65, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x33, 0x0a, 0x0d, 0x61, 0x62, 0x73, 0x74, 0x61, - 0x69, 0x6e, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, - 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0c, - 0x61, 0x62, 0x73, 0x74, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x29, 0x0a, 0x08, - 0x6e, 0x6f, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, - 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x07, - 0x6e, 0x6f, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3b, 0x0a, 0x12, 0x6e, 0x6f, 0x5f, 0x77, 0x69, - 0x74, 0x68, 0x5f, 0x76, 0x65, 0x74, 0x6f, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, + 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, + 0x74, 0x6c, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, + 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x0c, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x34, 0x0a, 0x08, 0x70, 0x72, + 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x18, 0x0d, 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, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, + 0x22, 0xd7, 0x01, 0x0a, 0x0b, 0x54, 0x61, 0x6c, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x12, 0x2b, 0x0a, 0x09, 0x79, 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 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, 0xb6, 0x01, 0x0a, 0x04, 0x56, 0x6f, 0x74, 0x65, 0x12, 0x1f, 0x0a, - 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x2e, - 0x0a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, - 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x12, 0x3b, - 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 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, 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, + 0x49, 0x6e, 0x74, 0x52, 0x08, 0x79, 0x65, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x33, 0x0a, + 0x0d, 0x61, 0x62, 0x73, 0x74, 0x61, 0x69, 0x6e, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0c, 0x61, 0x62, 0x73, 0x74, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x12, 0x29, 0x0a, 0x08, 0x6e, 0x6f, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x07, 0x6e, 0x6f, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3b, 0x0a, + 0x12, 0x6e, 0x6f, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x76, 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, 0xb6, 0x01, 0x0a, 0x04, 0x56, + 0x6f, 0x74, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, + 0x61, 0x6c, 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x76, + 0x6f, 0x74, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, + 0x6f, 0x76, 0x2e, 0x76, 0x31, 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, 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, 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, + 0x6e, 0x42, 0x04, 0x98, 0xdf, 0x1f, 0x01, 0x52, 0x0c, 0x76, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x50, + 0x65, 0x72, 0x69, 0x6f, 0x64, 0x22, 0x9a, 0x01, 0x0a, 0x0b, 0x54, 0x61, 0x6c, 0x6c, 0x79, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x26, 0x0a, 0x06, 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x06, 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x12, 0x2c, 0x0a, + 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x0e, 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, 0x35, 0x0a, 0x0e, 0x76, + 0x65, 0x74, 0x6f, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x0e, 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, 0x22, 0xbc, 0x03, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x45, 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, 0x09, 0xc8, + 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0a, 0x6d, 0x69, 0x6e, 0x44, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x12, 0x4d, 0x0a, 0x12, 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x04, 0x98, 0xdf, 0x1f, - 0x01, 0x52, 0x0c, 0x76, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x22, - 0x9a, 0x01, 0x0a, 0x0b, 0x54, 0x61, 0x6c, 0x6c, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, - 0x26, 0x0a, 0x06, 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, - 0x06, 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x12, 0x2c, 0x0a, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, - 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 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, 0x35, 0x0a, 0x0e, 0x76, 0x65, 0x74, 0x6f, 0x5f, 0x74, 0x68, - 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 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, 0x22, 0xbc, 0x03, 0x0a, - 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x45, 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, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, - 0x2a, 0x01, 0x52, 0x0a, 0x6d, 0x69, 0x6e, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x12, 0x4d, - 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, + 0x01, 0x52, 0x10, 0x6d, 0x61, 0x78, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x50, 0x65, 0x72, + 0x69, 0x6f, 0x64, 0x12, 0x44, 0x0a, 0x0d, 0x76, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, + 0x72, 0x69, 0x6f, 0x64, 0x18, 0x03, 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, 0x10, 0x6d, 0x61, 0x78, - 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, 0x44, 0x0a, - 0x0d, 0x76, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x03, - 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, 0x12, 0x26, 0x0a, 0x06, 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x44, 0x65, 0x63, 0x52, 0x06, 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x12, 0x2c, 0x0a, 0x09, 0x74, - 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, - 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, 0x35, 0x0a, 0x0e, 0x76, 0x65, 0x74, - 0x6f, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x0e, 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, - 0x12, 0x49, 0x0a, 0x19, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x5f, - 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x5f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x44, 0x65, 0x63, 0x52, 0x16, 0x6d, 0x69, 0x6e, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x44, - 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x52, 0x61, 0x74, 0x69, 0x6f, 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, 0x99, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, - 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x42, 0x08, - 0x47, 0x6f, 0x76, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2f, 0x67, 0x6f, 0x76, 0x2f, 0x76, 0x31, 0x3b, 0x67, 0x6f, 0x76, 0x76, 0x31, - 0xa2, 0x02, 0x03, 0x43, 0x47, 0x58, 0xaa, 0x02, 0x0d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x47, 0x6f, 0x76, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, - 0x47, 0x6f, 0x76, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, - 0x47, 0x6f, 0x76, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x0f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x47, 0x6f, 0x76, - 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 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, 0x12, 0x26, 0x0a, 0x06, 0x71, 0x75, 0x6f, + 0x72, 0x75, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x06, 0x71, 0x75, 0x6f, 0x72, 0x75, + 0x6d, 0x12, 0x2c, 0x0a, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 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, + 0x35, 0x0a, 0x0e, 0x76, 0x65, 0x74, 0x6f, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, + 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 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, 0x12, 0x49, 0x0a, 0x19, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x6e, + 0x69, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x5f, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x16, 0x6d, 0x69, 0x6e, 0x49, 0x6e, + 0x69, 0x74, 0x69, 0x61, 0x6c, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x52, 0x61, 0x74, 0x69, + 0x6f, 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, 0x99, + 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, + 0x76, 0x2e, 0x76, 0x31, 0x42, 0x08, 0x47, 0x6f, 0x76, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x67, 0x6f, 0x76, 0x2f, 0x76, 0x31, + 0x3b, 0x67, 0x6f, 0x76, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x47, 0x58, 0xaa, 0x02, 0x0d, 0x43, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x47, 0x6f, 0x76, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x43, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x6f, 0x76, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x43, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x6f, 0x76, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x3a, 0x3a, 0x47, 0x6f, 0x76, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/api/cosmos/gov/v1/tx.pulsar.go b/api/cosmos/gov/v1/tx.pulsar.go index 50e083538d98..82d7fe0d5cff 100644 --- a/api/cosmos/gov/v1/tx.pulsar.go +++ b/api/cosmos/gov/v1/tx.pulsar.go @@ -126,6 +126,8 @@ var ( fd_MsgSubmitProposal_initial_deposit protoreflect.FieldDescriptor fd_MsgSubmitProposal_proposer protoreflect.FieldDescriptor fd_MsgSubmitProposal_metadata protoreflect.FieldDescriptor + fd_MsgSubmitProposal_title protoreflect.FieldDescriptor + fd_MsgSubmitProposal_summary protoreflect.FieldDescriptor ) func init() { @@ -135,6 +137,8 @@ func init() { fd_MsgSubmitProposal_initial_deposit = md_MsgSubmitProposal.Fields().ByName("initial_deposit") fd_MsgSubmitProposal_proposer = md_MsgSubmitProposal.Fields().ByName("proposer") fd_MsgSubmitProposal_metadata = md_MsgSubmitProposal.Fields().ByName("metadata") + fd_MsgSubmitProposal_title = md_MsgSubmitProposal.Fields().ByName("title") + fd_MsgSubmitProposal_summary = md_MsgSubmitProposal.Fields().ByName("summary") } var _ protoreflect.Message = (*fastReflection_MsgSubmitProposal)(nil) @@ -226,6 +230,18 @@ func (x *fastReflection_MsgSubmitProposal) Range(f func(protoreflect.FieldDescri return } } + if x.Title != "" { + value := protoreflect.ValueOfString(x.Title) + if !f(fd_MsgSubmitProposal_title, value) { + return + } + } + if x.Summary != "" { + value := protoreflect.ValueOfString(x.Summary) + if !f(fd_MsgSubmitProposal_summary, value) { + return + } + } } // Has reports whether a field is populated. @@ -249,6 +265,10 @@ func (x *fastReflection_MsgSubmitProposal) Has(fd protoreflect.FieldDescriptor) return x.Proposer != "" case "cosmos.gov.v1.MsgSubmitProposal.metadata": return x.Metadata != "" + case "cosmos.gov.v1.MsgSubmitProposal.title": + return x.Title != "" + case "cosmos.gov.v1.MsgSubmitProposal.summary": + return x.Summary != "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.MsgSubmitProposal")) @@ -273,6 +293,10 @@ func (x *fastReflection_MsgSubmitProposal) Clear(fd protoreflect.FieldDescriptor x.Proposer = "" case "cosmos.gov.v1.MsgSubmitProposal.metadata": x.Metadata = "" + case "cosmos.gov.v1.MsgSubmitProposal.title": + x.Title = "" + case "cosmos.gov.v1.MsgSubmitProposal.summary": + x.Summary = "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.MsgSubmitProposal")) @@ -307,6 +331,12 @@ func (x *fastReflection_MsgSubmitProposal) Get(descriptor protoreflect.FieldDesc case "cosmos.gov.v1.MsgSubmitProposal.metadata": value := x.Metadata return protoreflect.ValueOfString(value) + case "cosmos.gov.v1.MsgSubmitProposal.title": + value := x.Title + return protoreflect.ValueOfString(value) + case "cosmos.gov.v1.MsgSubmitProposal.summary": + value := x.Summary + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.MsgSubmitProposal")) @@ -339,6 +369,10 @@ func (x *fastReflection_MsgSubmitProposal) Set(fd protoreflect.FieldDescriptor, x.Proposer = value.Interface().(string) case "cosmos.gov.v1.MsgSubmitProposal.metadata": x.Metadata = value.Interface().(string) + case "cosmos.gov.v1.MsgSubmitProposal.title": + x.Title = value.Interface().(string) + case "cosmos.gov.v1.MsgSubmitProposal.summary": + x.Summary = value.Interface().(string) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.MsgSubmitProposal")) @@ -375,6 +409,10 @@ func (x *fastReflection_MsgSubmitProposal) Mutable(fd protoreflect.FieldDescript panic(fmt.Errorf("field proposer of message cosmos.gov.v1.MsgSubmitProposal is not mutable")) case "cosmos.gov.v1.MsgSubmitProposal.metadata": panic(fmt.Errorf("field metadata of message cosmos.gov.v1.MsgSubmitProposal is not mutable")) + case "cosmos.gov.v1.MsgSubmitProposal.title": + panic(fmt.Errorf("field title of message cosmos.gov.v1.MsgSubmitProposal is not mutable")) + case "cosmos.gov.v1.MsgSubmitProposal.summary": + panic(fmt.Errorf("field summary of message cosmos.gov.v1.MsgSubmitProposal is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.MsgSubmitProposal")) @@ -398,6 +436,10 @@ func (x *fastReflection_MsgSubmitProposal) NewField(fd protoreflect.FieldDescrip return protoreflect.ValueOfString("") case "cosmos.gov.v1.MsgSubmitProposal.metadata": return protoreflect.ValueOfString("") + case "cosmos.gov.v1.MsgSubmitProposal.title": + return protoreflect.ValueOfString("") + case "cosmos.gov.v1.MsgSubmitProposal.summary": + return protoreflect.ValueOfString("") default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.MsgSubmitProposal")) @@ -487,6 +529,14 @@ func (x *fastReflection_MsgSubmitProposal) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + l = len(x.Title) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Summary) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -516,6 +566,20 @@ func (x *fastReflection_MsgSubmitProposal) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.Summary) > 0 { + i -= len(x.Summary) + copy(dAtA[i:], x.Summary) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Summary))) + i-- + dAtA[i] = 0x32 + } + if len(x.Title) > 0 { + i -= len(x.Title) + copy(dAtA[i:], x.Title) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Title))) + i-- + dAtA[i] = 0x2a + } if len(x.Metadata) > 0 { i -= len(x.Metadata) copy(dAtA[i:], x.Metadata) @@ -743,6 +807,70 @@ func (x *fastReflection_MsgSubmitProposal) ProtoMethods() *protoiface.Methods { } x.Metadata = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Title", 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.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Summary", 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.Summary = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -5846,6 +5974,10 @@ type MsgSubmitProposal struct { Proposer string `protobuf:"bytes,3,opt,name=proposer,proto3" json:"proposer,omitempty"` // metadata is any arbitrary metadata attached to the proposal. Metadata string `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"` + // title is the title of the proposal. + Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"` + // summary is the summary of the proposal + Summary string `protobuf:"bytes,6,opt,name=summary,proto3" json:"summary,omitempty"` } func (x *MsgSubmitProposal) Reset() { @@ -5896,6 +6028,20 @@ func (x *MsgSubmitProposal) GetMetadata() string { return "" } +func (x *MsgSubmitProposal) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *MsgSubmitProposal) GetSummary() string { + if x != nil { + return x.Summary + } + return "" +} + // MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. type MsgSubmitProposalResponse struct { state protoimpl.MessageState @@ -6367,7 +6513,7 @@ var file_cosmos_gov_v1_tx_proto_rawDesc = []byte{ 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, - 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x99, 0x02, 0x0a, 0x11, 0x4d, 0x73, 0x67, + 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc9, 0x02, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x30, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, @@ -6382,7 +6528,10 @@ var file_cosmos_gov_v1_tx_proto_rawDesc = []byte{ 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 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, 0x31, 0x82, 0xe7, 0xb0, 0x2a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, + 0x61, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, + 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, + 0x79, 0x3a, 0x31, 0x82, 0xe7, 0xb0, 0x2a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x22, 0x3c, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, diff --git a/proto/cosmos/gov/v1/gov.proto b/proto/cosmos/gov/v1/gov.proto index a0ab8c0bf352..f4c7c6f34819 100644 --- a/proto/cosmos/gov/v1/gov.proto +++ b/proto/cosmos/gov/v1/gov.proto @@ -81,6 +81,14 @@ message Proposal { // metadata is any arbitrary metadata attached to the proposal. string metadata = 10; + + // title is the title of the proposal + string title = 11; + + // summary is a short summary of the proposal + string summary = 12; + + string proposer = 13 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } // ProposalStatus enumerates the valid statuses of a proposal. diff --git a/proto/cosmos/gov/v1/tx.proto b/proto/cosmos/gov/v1/tx.proto index adb421c84be9..d263c97b28d7 100644 --- a/proto/cosmos/gov/v1/tx.proto +++ b/proto/cosmos/gov/v1/tx.proto @@ -56,6 +56,12 @@ message MsgSubmitProposal { // metadata is any arbitrary metadata attached to the proposal. string metadata = 4; + + // title is the title of the proposal. + string title = 5; + + // summary is the summary of the proposal + string summary = 6; } // MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. diff --git a/x/gov/abci_test.go b/x/gov/abci_test.go index 828962c12211..289cce690ffd 100644 --- a/x/gov/abci_test.go +++ b/x/gov/abci_test.go @@ -299,7 +299,7 @@ func TestProposalPassedEndblocker(t *testing.T) { require.NotNil(t, macc) initialModuleAccCoins := suite.BankKeeper.GetAllBalances(ctx, macc.GetAddress()) - proposal, err := suite.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)}, "") + proposal, err := suite.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)}, "", "title", "summary", addrs[0]) require.NoError(t, err) proposalCoins := sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, suite.StakingKeeper.TokensFromConsensusPower(ctx, 10))} @@ -348,7 +348,7 @@ func TestEndBlockerProposalHandlerFailed(t *testing.T) { staking.EndBlocker(ctx, suite.StakingKeeper) msg := banktypes.NewMsgSend(authtypes.NewModuleAddress(types.ModuleName), addrs[0], sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000)))) - proposal, err := suite.GovKeeper.SubmitProposal(ctx, []sdk.Msg{msg}, "") + proposal, err := suite.GovKeeper.SubmitProposal(ctx, []sdk.Msg{msg}, "", "Bank Msg Send", "send message", addrs[0]) require.NoError(t, err) proposalCoins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, suite.StakingKeeper.TokensFromConsensusPower(ctx, 10))) diff --git a/x/gov/keeper/deposit_test.go b/x/gov/keeper/deposit_test.go index 2f057d792201..edac1a62b89e 100644 --- a/x/gov/keeper/deposit_test.go +++ b/x/gov/keeper/deposit_test.go @@ -21,7 +21,7 @@ func TestDeposits(t *testing.T) { TestAddrs := simtestutil.AddTestAddrsIncremental(bankKeeper, stakingKeeper, ctx, 2, sdk.NewInt(10000000)) tp := TestProposal - proposal, err := govKeeper.SubmitProposal(ctx, tp, "") + proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "title", "description", TestAddrs[0]) require.NoError(t, err) proposalID := proposal.Id @@ -105,7 +105,7 @@ func TestDeposits(t *testing.T) { require.Equal(t, addr1Initial, bankKeeper.GetAllBalances(ctx, TestAddrs[1])) // Test delete and burn deposits - proposal, err = govKeeper.SubmitProposal(ctx, tp, "") + proposal, err = govKeeper.SubmitProposal(ctx, tp, "", "title", "description", TestAddrs[0]) require.NoError(t, err) proposalID = proposal.Id _, err = govKeeper.AddDeposit(ctx, proposalID, TestAddrs[0], fourStake) diff --git a/x/gov/keeper/grpc_query_test.go b/x/gov/keeper/grpc_query_test.go index 059b921ff23c..a07df04b4890 100644 --- a/x/gov/keeper/grpc_query_test.go +++ b/x/gov/keeper/grpc_query_test.go @@ -57,7 +57,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposal() { testProposal := v1beta1.NewTextProposal("Proposal", "testing proposal") msgContent, err := v1.NewLegacyContent(testProposal, govAcct.String()) suite.Require().NoError(err) - submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "") + submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "test", "summary") suite.Require().NoError(err) suite.Require().NotEmpty(submittedProposal) @@ -127,7 +127,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryProposal() { testProposal := v1beta1.NewTextProposal("Proposal", "testing proposal") msgContent, err := v1.NewLegacyContent(testProposal, govAcct.String()) suite.Require().NoError(err) - submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "") + submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "test", "summary") suite.Require().NoError(err) suite.Require().NotEmpty(submittedProposal) @@ -188,7 +188,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposals() { testProposal := []sdk.Msg{ v1.NewMsgVote(govAddress, uint64(i), v1.OptionYes, ""), } - proposal, err := suite.govKeeper.SubmitProposal(ctx, testProposal, "") + proposal, err := suite.govKeeper.SubmitProposal(ctx, testProposal, "", "test", "summary") suite.Require().NotEmpty(proposal) suite.Require().NoError(err) testProposals = append(testProposals, &proposal) @@ -321,7 +321,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryProposals() { testProposal := v1beta1.NewTextProposal("Proposal", "testing proposal") msgContent, err := v1.NewLegacyContent(testProposal, govAcct.String()) suite.Require().NoError(err) - submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "") + submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "test", "summary") suite.Require().NoError(err) suite.Require().NotEmpty(submittedProposal) }, diff --git a/x/gov/keeper/hooks_test.go b/x/gov/keeper/hooks_test.go index 6df5c3088c90..cf07cd121329 100644 --- a/x/gov/keeper/hooks_test.go +++ b/x/gov/keeper/hooks_test.go @@ -63,7 +63,7 @@ func TestHooks(t *testing.T) { require.False(t, govHooksReceiver.AfterProposalVotingPeriodEndedValid) tp := TestProposal - _, err := govKeeper.SubmitProposal(ctx, tp, "") + _, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) require.NoError(t, err) require.True(t, govHooksReceiver.AfterProposalSubmissionValid) @@ -74,7 +74,7 @@ func TestHooks(t *testing.T) { require.True(t, govHooksReceiver.AfterProposalFailedMinDepositValid) - p2, err := govKeeper.SubmitProposal(ctx, tp, "") + p2, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) require.NoError(t, err) activated, err := govKeeper.AddDeposit(ctx, p2.Id, addrs[0], minDeposit) diff --git a/x/gov/keeper/keeper_test.go b/x/gov/keeper/keeper_test.go index abe9ac792015..03004ade804f 100644 --- a/x/gov/keeper/keeper_test.go +++ b/x/gov/keeper/keeper_test.go @@ -74,17 +74,17 @@ func TestIncrementProposalNumber(t *testing.T) { govKeeper, _, _, _, _, ctx := setupGovKeeper(t) //nolint:dogsled tp := TestProposal - _, err := govKeeper.SubmitProposal(ctx, tp, "") + _, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) require.NoError(t, err) - _, err = govKeeper.SubmitProposal(ctx, tp, "") + _, err = govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) require.NoError(t, err) - _, err = govKeeper.SubmitProposal(ctx, tp, "") + _, err = govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) require.NoError(t, err) - _, err = govKeeper.SubmitProposal(ctx, tp, "") + _, err = govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) require.NoError(t, err) - _, err = govKeeper.SubmitProposal(ctx, tp, "") + _, err = govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) require.NoError(t, err) - proposal6, err := govKeeper.SubmitProposal(ctx, tp, "") + proposal6, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) require.NoError(t, err) require.Equal(t, uint64(6), proposal6.Id) @@ -95,7 +95,7 @@ func TestProposalQueues(t *testing.T) { // create test proposals tp := TestProposal - proposal, err := govKeeper.SubmitProposal(ctx, tp, "") + proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) require.NoError(t, err) inactiveIterator := govKeeper.InactiveProposalQueueIterator(ctx, *proposal.DepositEndTime) diff --git a/x/gov/keeper/msg_server.go b/x/gov/keeper/msg_server.go index 2c1a9c356124..40f25da20fc8 100644 --- a/x/gov/keeper/msg_server.go +++ b/x/gov/keeper/msg_server.go @@ -41,7 +41,10 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *v1.MsgSubmitPropos if err != nil { return nil, err } - proposal, err := k.Keeper.SubmitProposal(ctx, proposalMsgs, msg.Metadata) + + proposer, _ := sdk.AccAddressFromBech32(msg.GetProposer()) + + proposal, err := k.Keeper.SubmitProposal(ctx, proposalMsgs, msg.Metadata, msg.Title, msg.Summary, proposer) if err != nil { return nil, err } @@ -59,7 +62,6 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *v1.MsgSubmitPropos defer telemetry.IncrCounter(1, govtypes.ModuleName, "proposal") - proposer, _ := sdk.AccAddressFromBech32(msg.GetProposer()) votingStarted, err := k.Keeper.AddDeposit(ctx, proposal.Id, proposer, msg.GetInitialDeposit()) if err != nil { return nil, err diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index 014b33b9fd83..bda1f7467250 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -12,12 +12,18 @@ import ( ) // SubmitProposal creates a new proposal given an array of messages -func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadata string) (v1.Proposal, error) { +func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadata, title, summary string, proposer sdk.AccAddress) (v1.Proposal, error) { err := keeper.assertMetadataLength(metadata) if err != nil { return v1.Proposal{}, err } + // assert summary is no longer than predefined max length of metdata + err = keeper.assertMetadataLength(summary) + if err != nil { + return v1.Proposal{}, err + } + // Will hold a comma-separated string of all Msg type URLs. msgsStr := "" @@ -72,7 +78,7 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat submitTime := ctx.BlockHeader().Time depositPeriod := keeper.GetParams(ctx).MaxDepositPeriod - proposal, err := v1.NewProposal(messages, proposalID, metadata, submitTime, submitTime.Add(*depositPeriod)) + proposal, err := v1.NewProposal(messages, proposalID, metadata, submitTime, submitTime.Add(*depositPeriod), title, summary, proposer) if err != nil { return v1.Proposal{}, err } diff --git a/x/gov/keeper/proposal_test.go b/x/gov/keeper/proposal_test.go index e26212190672..d135c954bc26 100644 --- a/x/gov/keeper/proposal_test.go +++ b/x/gov/keeper/proposal_test.go @@ -18,7 +18,7 @@ import ( func (suite *KeeperTestSuite) TestGetSetProposal() { tp := TestProposal - proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "") + proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) suite.Require().NoError(err) proposalID := proposal.Id suite.govKeeper.SetProposal(suite.ctx, proposal) @@ -36,7 +36,7 @@ func (suite *KeeperTestSuite) TestDeleteProposal() { }, ) tp := TestProposal - proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "") + proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) suite.Require().NoError(err) proposalID := proposal.Id suite.govKeeper.SetProposal(suite.ctx, proposal) @@ -47,7 +47,7 @@ func (suite *KeeperTestSuite) TestDeleteProposal() { func (suite *KeeperTestSuite) TestActivateVotingPeriod() { tp := TestProposal - proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "") + proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) suite.Require().NoError(err) suite.Require().Nil(proposal.VotingStartTime) @@ -98,7 +98,7 @@ func (suite *KeeperTestSuite) TestSubmitProposal() { for i, tc := range testCases { prop, err := v1.NewLegacyContent(tc.content, tc.authority) suite.Require().NoError(err) - _, err = suite.govKeeper.SubmitProposal(suite.ctx, []sdk.Msg{prop}, tc.metadata) + _, err = suite.govKeeper.SubmitProposal(suite.ctx, []sdk.Msg{prop}, tc.metadata, "title", "", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) suite.Require().True(errors.Is(tc.expectedErr, err), "tc #%d; got: %v, expected: %v", i, err, tc.expectedErr) } } @@ -111,7 +111,7 @@ func (suite *KeeperTestSuite) TestGetProposalsFiltered() { for _, s := range status { for i := 0; i < 50; i++ { - p, err := v1.NewProposal(TestProposal, proposalID, "", time.Now(), time.Now()) + p, err := v1.NewProposal(TestProposal, proposalID, "", time.Now(), time.Now(), "title", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) suite.Require().NoError(err) p.Status = s diff --git a/x/gov/keeper/vote_test.go b/x/gov/keeper/vote_test.go index 10720045dc7e..048b75c38d0c 100644 --- a/x/gov/keeper/vote_test.go +++ b/x/gov/keeper/vote_test.go @@ -15,7 +15,7 @@ func TestVotes(t *testing.T) { addrs := simtestutil.AddTestAddrsIncremental(bankKeeper, stakingKeeper, ctx, 2, sdk.NewInt(10000000)) tp := TestProposal - proposal, err := govKeeper.SubmitProposal(ctx, tp, "") + proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "title", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) require.NoError(t, err) proposalID := proposal.Id metadata := "metadata" diff --git a/x/gov/simulation/operations_test.go b/x/gov/simulation/operations_test.go index 9e42c95c5cc8..809fabde49f2 100644 --- a/x/gov/simulation/operations_test.go +++ b/x/gov/simulation/operations_test.go @@ -164,7 +164,7 @@ func TestSimulateMsgDeposit(t *testing.T) { submitTime := ctx.BlockHeader().Time depositPeriod := suite.GovKeeper.GetParams(ctx).MaxDepositPeriod - proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, "", submitTime, submitTime.Add(*depositPeriod)) + proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, "", submitTime, submitTime.Add(*depositPeriod), "text proposal", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) require.NoError(t, err) suite.GovKeeper.SetProposal(ctx, proposal) @@ -211,7 +211,7 @@ func TestSimulateMsgVote(t *testing.T) { submitTime := ctx.BlockHeader().Time depositPeriod := suite.GovKeeper.GetParams(ctx).MaxDepositPeriod - proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, "", submitTime, submitTime.Add(*depositPeriod)) + proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, "", submitTime, submitTime.Add(*depositPeriod), "text proposal", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) require.NoError(t, err) suite.GovKeeper.ActivateVotingPeriod(ctx, proposal) @@ -255,7 +255,7 @@ func TestSimulateMsgVoteWeighted(t *testing.T) { submitTime := ctx.BlockHeader().Time depositPeriod := suite.GovKeeper.GetParams(ctx).MaxDepositPeriod - proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, "", submitTime, submitTime.Add(*depositPeriod)) + proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, "", submitTime, submitTime.Add(*depositPeriod), "text proposal", "test", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) require.NoError(t, err) suite.GovKeeper.ActivateVotingPeriod(ctx, proposal) diff --git a/x/gov/types/v1/gov.pb.go b/x/gov/types/v1/gov.pb.go index c5019147cd67..c8ae0021a72c 100644 --- a/x/gov/types/v1/gov.pb.go +++ b/x/gov/types/v1/gov.pb.go @@ -265,6 +265,11 @@ type Proposal struct { VotingEndTime *time.Time `protobuf:"bytes,9,opt,name=voting_end_time,json=votingEndTime,proto3,stdtime" json:"voting_end_time,omitempty"` // metadata is any arbitrary metadata attached to the proposal. Metadata string `protobuf:"bytes,10,opt,name=metadata,proto3" json:"metadata,omitempty"` + // title is the title of the proposal + Title string `protobuf:"bytes,11,opt,name=title,proto3" json:"title,omitempty"` + // summary is a short summary of the proposal + Summary string `protobuf:"bytes,12,opt,name=summary,proto3" json:"summary,omitempty"` + Proposer string `protobuf:"bytes,13,opt,name=proposer,proto3" json:"proposer,omitempty"` } func (m *Proposal) Reset() { *m = Proposal{} } @@ -370,6 +375,27 @@ func (m *Proposal) GetMetadata() string { return "" } +func (m *Proposal) GetTitle() string { + if m != nil { + return m.Title + } + return "" +} + +func (m *Proposal) GetSummary() string { + if m != nil { + return m.Summary + } + return "" +} + +func (m *Proposal) GetProposer() string { + if m != nil { + return m.Proposer + } + return "" +} + // TallyResult defines a standard tally for a governance proposal. type TallyResult struct { // yes_count is the number of yes votes on a proposal. @@ -807,81 +833,83 @@ func init() { func init() { proto.RegisterFile("cosmos/gov/v1/gov.proto", fileDescriptor_e05cb1c0d030febb) } var fileDescriptor_e05cb1c0d030febb = []byte{ - // 1173 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcf, 0x8f, 0xd3, 0xc6, - 0x17, 0x5f, 0x27, 0xde, 0x6c, 0xf2, 0xb2, 0x09, 0x66, 0xe0, 0x0b, 0xde, 0x05, 0x92, 0x25, 0xfa, - 0x0a, 0x6d, 0xf9, 0x91, 0x74, 0x41, 0xf4, 0x42, 0x2f, 0xc9, 0xc6, 0x14, 0x23, 0xba, 0x89, 0x6c, - 0x13, 0x44, 0x2f, 0x96, 0xb3, 0x36, 0xc9, 0xa8, 0xb1, 0x27, 0xf5, 0x4c, 0x02, 0xf9, 0x13, 0x7a, - 0xe3, 0x58, 0xf5, 0xd4, 0x63, 0x8f, 0x3d, 0xa0, 0x9e, 0xfa, 0x07, 0x70, 0xaa, 0x10, 0x97, 0xb6, - 0xaa, 0x44, 0x2b, 0x38, 0x54, 0xe2, 0xaf, 0xa8, 0x3c, 0x1e, 0x6f, 0xb2, 0xde, 0x54, 0xbb, 0x70, - 0x49, 0xec, 0xf7, 0x3e, 0x9f, 0xf7, 0xde, 0xbc, 0xf7, 0x99, 0xf1, 0xc0, 0xf9, 0x7d, 0x42, 0x7d, - 0x42, 0x1b, 0x03, 0x32, 0x6d, 0x4c, 0x77, 0xa2, 0xbf, 0xfa, 0x38, 0x24, 0x8c, 0xa0, 0x52, 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x92, 0x50, 0xc4, 0x55, 0x5f, 0xbf, 0xb8, 0x71, 0x56, 0xc4, 0x6d, 0xba, - 0x6e, 0xe8, 0x51, 0x6a, 0xb2, 0x10, 0x07, 0x03, 0x63, 0x0e, 0x45, 0x9f, 0x43, 0xce, 0xf1, 0xc9, - 0x24, 0x60, 0x6a, 0x76, 0x2b, 0xbb, 0x5d, 0x9c, 0xd7, 0x1f, 0x8d, 0xa9, 0x2e, 0xc6, 0x54, 0xdf, - 0x25, 0x38, 0x68, 0x15, 0x5e, 0xbe, 0xa9, 0xae, 0xfc, 0xf8, 0xcf, 0x4f, 0x57, 0x25, 0x43, 0x70, - 0x6a, 0x7f, 0xca, 0x90, 0xef, 0x8a, 0x22, 0x50, 0x19, 0x32, 0x07, 0xa5, 0x65, 0xb0, 0x8b, 0x3e, - 0x85, 0xbc, 0xef, 0x51, 0xea, 0x0c, 0x3c, 0xaa, 0x66, 0x78, 0xf0, 0xb3, 0xf5, 0x78, 0x22, 0xf5, - 0x64, 0x22, 0xf5, 0x66, 0x30, 0x33, 0x0e, 0x50, 0xe8, 0x36, 0xe4, 0x28, 0x73, 0xd8, 0x84, 0xaa, - 0x59, 0xde, 0xcc, 0x4b, 0xa9, 0x66, 0x26, 0xa9, 0x4c, 0x0e, 0x32, 0x04, 0x18, 0xdd, 0x03, 0xf4, - 0x04, 0x07, 0xce, 0xc8, 0x66, 0xce, 0x68, 0x34, 0xb3, 0x43, 0x8f, 0x4e, 0x46, 0x4c, 0x95, 0xb7, - 0xa4, 0xed, 0xe2, 0xcd, 0xcd, 0x54, 0x08, 0x2b, 0x82, 0x18, 0x1c, 0x61, 0x28, 0x9c, 0xb5, 0x60, - 0x41, 0x4d, 0x28, 0xd2, 0x49, 0xdf, 0xc7, 0xcc, 0x8e, 0x64, 0xa6, 0xae, 0x8a, 0x10, 0xe9, 0xaa, - 0xad, 0x44, 0x83, 0x2d, 0xf9, 0xf9, 0x5f, 0x55, 0xc9, 0x80, 0x98, 0x14, 0x99, 0xd1, 0x7d, 0x50, - 0x44, 0x77, 0x6d, 0x2f, 0x70, 0xe3, 0x38, 0xb9, 0x13, 0xc6, 0x29, 0x0b, 0xa6, 0x16, 0xb8, 0x3c, - 0x96, 0x0e, 0x25, 0x46, 0x98, 0x33, 0xb2, 0x85, 0x5d, 0x5d, 0xfb, 0x80, 0x19, 0xad, 0x73, 0x6a, - 0x22, 0xa0, 0x07, 0x70, 0x7a, 0x4a, 0x18, 0x0e, 0x06, 0x36, 0x65, 0x4e, 0x28, 0xd6, 0x97, 0x3f, - 0x61, 0x5d, 0xa7, 0x62, 0xaa, 0x19, 0x31, 0x79, 0x61, 0xf7, 0x40, 0x98, 0xe6, 0x6b, 0x2c, 0x9c, - 0x30, 0x56, 0x29, 0x26, 0x26, 0x4b, 0xdc, 0x8c, 0x44, 0xc2, 0x1c, 0xd7, 0x61, 0x8e, 0x0a, 0x91, - 0x6c, 0x8d, 0x83, 0xf7, 0xda, 0x6f, 0x12, 0x14, 0x17, 0xa7, 0x73, 0x0d, 0x0a, 0x33, 0x8f, 0xda, - 0xfb, 0x5c, 0xae, 0xd2, 0x91, 0xbd, 0xa3, 0x07, 0xcc, 0xc8, 0xcf, 0x3c, 0xba, 0x1b, 0xf9, 0xd1, - 0x2d, 0x28, 0x39, 0x7d, 0xca, 0x1c, 0x1c, 0x08, 0x42, 0x66, 0x29, 0x61, 0x5d, 0x80, 0x62, 0xd2, - 0x27, 0x90, 0x0f, 0x88, 0xc0, 0x67, 0x97, 0xe2, 0xd7, 0x02, 0x12, 0x43, 0xef, 0x00, 0x0a, 0x88, - 0xfd, 0x14, 0xb3, 0xa1, 0x3d, 0xf5, 0x58, 0x42, 0x92, 0x97, 0x92, 0x4e, 0x05, 0xe4, 0x11, 0x66, - 0xc3, 0x9e, 0xc7, 0x62, 0x72, 0xed, 0x67, 0x09, 0xe4, 0xe8, 0x64, 0x38, 0x7e, 0x5f, 0xd7, 0x61, - 0x75, 0x4a, 0x98, 0x77, 0xfc, 0x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, 0x06, 0xb4, 0xb5, 0x6e, 0xc7, 0xd4, 0x2d, 0xbb, 0xab, 0x19, 0x7a, 0xa7, 0xad, 0x48, - 0xe8, 0x32, 0x5c, 0x4a, 0x63, 0x7a, 0x1d, 0x4b, 0xdf, 0xfb, 0x22, 0x81, 0x64, 0xd0, 0x26, 0x9c, - 0x4b, 0x43, 0xba, 0x4d, 0xd3, 0xd4, 0xda, 0x71, 0xd1, 0x69, 0x9f, 0xa1, 0xdd, 0xd7, 0x76, 0x2d, - 0xad, 0xad, 0xc8, 0xcb, 0x98, 0x77, 0x9b, 0xfa, 0x03, 0xad, 0xad, 0xac, 0xb6, 0xb4, 0x97, 0x6f, - 0x2b, 0xd2, 0xab, 0xb7, 0x15, 0xe9, 0xef, 0xb7, 0x15, 0xe9, 0xf9, 0xbb, 0xca, 0xca, 0xab, 0x77, - 0x95, 0x95, 0xdf, 0xdf, 0x55, 0x56, 0xbe, 0xba, 0x36, 0xc0, 0x6c, 0x38, 0xe9, 0xd7, 0xf7, 0x89, - 0x2f, 0x6e, 0x8d, 0xe2, 0xef, 0x06, 0x75, 0xbf, 0x6e, 0x3c, 0xe3, 0x37, 0x61, 0x36, 0x1b, 0x7b, - 0x34, 0xba, 0xe6, 0xe6, 0xb8, 0x44, 0x6f, 0xfd, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x2e, 0xe3, 0xbc, - 0x91, 0x27, 0x0b, 0x00, 0x00, + // 1212 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x3f, 0x73, 0x13, 0x47, + 0x14, 0xf7, 0x49, 0x27, 0x59, 0x7e, 0xb2, 0x84, 0x58, 0x1c, 0x38, 0x1b, 0x90, 0x8c, 0x26, 0xc3, + 0x38, 0xfc, 0x91, 0x62, 0x08, 0x69, 0x48, 0x23, 0x5b, 0x47, 0x38, 0x86, 0x58, 0x9a, 0xd3, 0x61, + 0x86,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 0xc6, 0x36, + 0xf8, 0x34, 0x48, 0x26, 0xc3, 0x07, 0xe4, 0xe3, 0xa7, 0x09, 0xc8, 0x1d, 0x90, 0x90, 0x32, 0x4f, + 0x26, 0x22, 0xf2, 0x30, 0xdb, 0xce, 0x4d, 0x75, 0x85, 0x6c, 0x7d, 0xfc, 0xee, 0x75, 0xe5, 0xc2, + 0x51, 0xe2, 0xc4, 0xc9, 0xf7, 0x51, 0xb7, 0x97, 0x7c, 0xfc, 0x34, 0xd9, 0x89, 0xd4, 0x57, 0x1d, + 0x58, 0xde, 0x95, 0x13, 0xa0, 0x76, 0xd6, 0x04, 0x35, 0x11, 0x89, 0x67, 0xed, 0x38, 0xcf, 0xba, + 0xb4, 0xbc, 0x1c, 0xb3, 0x94, 0xd5, 0x1f, 0x92, 0x26, 0x56, 0x56, 0x2f, 0x43, 0xf6, 0xdb, 0x21, + 0x0b, 0x87, 0xfe, 0x9c, 0x0e, 0x96, 0x77, 0x4c, 0xac, 0x45, 0xd7, 0x60, 0x49, 0xf4, 0x42, 0xc2, + 0x7b, 0xac, 0xef, 0xfd, 0xcf, 0x75, 0x34, 0x01, 0xa0, 0x5b, 0x50, 0x94, 0x5d, 0x38, 0xa1, 0xa4, + 0xe7, 0x52, 0x0a, 0x11, 0xca, 0x49, 0x40, 0xd5, 0x5f, 0xd3, 0x90, 0x55, 0x71, 0x99, 0xef, 0x59, + 0xc7, 0xa9, 0xf3, 0x6c, 0xba, 0x66, 0x5f, 0x7d, 0x58, 0xcd, 0xf4, 0xf9, 0x35, 0x39, 0x5a, 0x83, + 0xf4, 0x07, 0xd4, 0x60, 0x2a, 0xe7, 0xfa, 0xc9, 0x73, 0x9e, 0x79, 0xff, 0x9c, 0x67, 0x4f, 0x90, + 0x73, 0x64, 0xc1, 0x6a, 0x94, 0x68, 0x1a, 0x50, 0x41, 0x27, 0x17, 0x88, 0x2b, 0xc3, 0x37, 0x16, + 0xe7, 0x5a, 0x38, 0xeb, 0xd3, 0xc0, 0x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6f, 0xca, 0xda, + 0xb3, 0xb7, 0xe5, 0x85, 0x97, 0x6f, 0xcb, 0x0b, 0x7f, 0xbe, 0x2d, 0x2f, 0x7c, 0x7d, 0xb5, 0x4b, + 0x45, 0x6f, 0xb8, 0x57, 0xdb, 0x67, 0xbe, 0x7a, 0x9b, 0xaa, 0xbf, 0xeb, 0xdc, 0xfb, 0xa6, 0xfe, + 0x54, 0xbe, 0xb7, 0xc5, 0x78, 0x40, 0x78, 0xf4, 0x98, 0xce, 0xca, 0x16, 0xbd, 0xf9, 0x5f, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x31, 0x0a, 0x72, 0x23, 0x8d, 0x0b, 0x00, 0x00, } func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) { @@ -988,6 +1016,27 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Proposer) > 0 { + i -= len(m.Proposer) + copy(dAtA[i:], m.Proposer) + i = encodeVarintGov(dAtA, i, uint64(len(m.Proposer))) + i-- + dAtA[i] = 0x6a + } + if len(m.Summary) > 0 { + i -= len(m.Summary) + copy(dAtA[i:], m.Summary) + i = encodeVarintGov(dAtA, i, uint64(len(m.Summary))) + i-- + dAtA[i] = 0x62 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintGov(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0x5a + } if len(m.Metadata) > 0 { i -= len(m.Metadata) copy(dAtA[i:], m.Metadata) @@ -1501,6 +1550,18 @@ func (m *Proposal) Size() (n int) { if l > 0 { n += 1 + l + sovGov(uint64(l)) } + l = len(m.Title) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Summary) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Proposer) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } return n } @@ -2236,6 +2297,102 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { } m.Metadata = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", 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.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Summary", 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.Summary = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposer", 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.Proposer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGov(dAtA[iNdEx:]) diff --git a/x/gov/types/v1/proposal.go b/x/gov/types/v1/proposal.go index 88b067d955aa..161c898e2540 100644 --- a/x/gov/types/v1/proposal.go +++ b/x/gov/types/v1/proposal.go @@ -23,7 +23,7 @@ const ( ) // NewProposal creates a new Proposal instance -func NewProposal(messages []sdk.Msg, id uint64, metadata string, submitTime, depositEndTime time.Time) (Proposal, error) { +func NewProposal(messages []sdk.Msg, id uint64, metadata string, submitTime, depositEndTime time.Time, title, summary string, proposer sdk.AccAddress) (Proposal, error) { msgs, err := sdktx.SetMsgs(messages) if err != nil { return Proposal{}, err @@ -39,6 +39,9 @@ func NewProposal(messages []sdk.Msg, id uint64, metadata string, submitTime, dep FinalTallyResult: &tally, SubmitTime: &submitTime, DepositEndTime: &depositEndTime, + Title: title, + Summary: summary, + Proposer: proposer.String(), } return p, nil diff --git a/x/gov/types/v1/proposals_test.go b/x/gov/types/v1/proposals_test.go index 19edae05af47..7678ba1834ed 100644 --- a/x/gov/types/v1/proposals_test.go +++ b/x/gov/types/v1/proposals_test.go @@ -35,7 +35,7 @@ func TestNestedAnys(t *testing.T) { testProposal := v1beta1.NewTextProposal("Proposal", "testing proposal") msgContent, err := v1.NewLegacyContent(testProposal, "cosmos1govacct") require.NoError(t, err) - proposal, err := v1.NewProposal([]sdk.Msg{msgContent}, 1, "", time.Now(), time.Now()) + proposal, err := v1.NewProposal([]sdk.Msg{msgContent}, 1, "", time.Now(), time.Now(), "title", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) require.NoError(t, err) require.NotPanics(t, func() { _ = proposal.String() }) diff --git a/x/gov/types/v1/tx.pb.go b/x/gov/types/v1/tx.pb.go index 27be0c87f481..19daadd24d2d 100644 --- a/x/gov/types/v1/tx.pb.go +++ b/x/gov/types/v1/tx.pb.go @@ -44,6 +44,10 @@ type MsgSubmitProposal struct { Proposer string `protobuf:"bytes,3,opt,name=proposer,proto3" json:"proposer,omitempty"` // metadata is any arbitrary metadata attached to the proposal. Metadata string `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"` + // title is the title of the proposal. + Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"` + // summary is the summary of the proposal + Summary string `protobuf:"bytes,6,opt,name=summary,proto3" json:"summary,omitempty"` } func (m *MsgSubmitProposal) Reset() { *m = MsgSubmitProposal{} } @@ -107,6 +111,20 @@ func (m *MsgSubmitProposal) GetMetadata() string { return "" } +func (m *MsgSubmitProposal) GetTitle() string { + if m != nil { + return m.Title + } + return "" +} + +func (m *MsgSubmitProposal) GetSummary() string { + if m != nil { + return m.Summary + } + return "" +} + // MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. type MsgSubmitProposalResponse struct { // proposal_id defines the unique id of the proposal. @@ -684,62 +702,64 @@ func init() { func init() { proto.RegisterFile("cosmos/gov/v1/tx.proto", fileDescriptor_9ff8f4a63b6fc9a9) } var fileDescriptor_9ff8f4a63b6fc9a9 = []byte{ - // 878 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcf, 0x6f, 0xe3, 0x44, - 0x14, 0x8e, 0x9b, 0x6c, 0xb2, 0x99, 0x40, 0x57, 0xb1, 0xb2, 0xbb, 0x8e, 0xb5, 0x38, 0x59, 0x2f, - 0x42, 0x51, 0x4b, 0x6d, 0x52, 0xd8, 0x15, 0xca, 0xae, 0x90, 0x36, 0x4b, 0x85, 0x90, 0x88, 0xa8, - 0x5c, 0x51, 0x24, 0x84, 0x54, 0x4d, 0xe2, 0x61, 0x6a, 0x51, 0x7b, 0x2c, 0xcf, 0x24, 0x6a, 0x6e, - 0x88, 0x63, 0x4f, 0x5c, 0xf9, 0x0f, 0x7a, 0xec, 0xa1, 0x37, 0xfe, 0x81, 0x8a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xbd, 0x1f, 0xf8, 0x39, 0xeb, 0x6e, 0x9d, - 0x5d, 0x1a, 0xca, 0xf9, 0xa5, 0xa1, 0xfc, 0x71, 0x69, 0x28, 0x3f, 0x5d, 0x19, 0xb9, 0xf3, 0x2b, - 0x23, 0xf7, 0xfb, 0x95, 0x91, 0xfb, 0x66, 0x1d, 0x7b, 0x6c, 0x7f, 0xd8, 0xb7, 0x06, 0xc4, 0x97, - 0xff, 0x4d, 0xec, 0xcc, 0xc1, 0x63, 0xe3, 0x10, 0x51, 0xfe, 0x4f, 0xa8, 0x18, 0x7f, 0xdc, 0x3e, - 0xfc, 0x37, 0x00, 0x00, 0xff, 0xff, 0x2c, 0x45, 0xda, 0x06, 0x49, 0x09, 0x00, 0x00, + // 904 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0xe6, 0x8f, 0xdd, 0xbc, 0x40, 0xaa, 0x8c, 0xdc, 0x76, 0xbd, 0x2a, 0x9b, 0x74, 0x8b, + 0x50, 0x94, 0x90, 0x5d, 0x1c, 0x68, 0x85, 0xdc, 0x0a, 0xa9, 0x2e, 0x15, 0x42, 0xc2, 0xa2, 0x72, + 0x45, 0x91, 0x10, 0x52, 0x34, 0xf6, 0x0e, 0x93, 0x15, 0xd9, 0x9d, 0xd5, 0xce, 0xd8, 0x8a, 0x6f, + 0x88, 0x63, 0x4f, 0x7c, 0x8c, 0x1e, 0x73, 0xe8, 0x8d, 0x2f, 0x50, 0x38, 0x55, 0x9c, 0x38, 0x55, + 0x28, 0x11, 0x44, 0xe2, 0x4b, 0x80, 0xe6, 0xcf, 0xae, 0xff, 0xac, 0xe3, 0x54, 0x1c, 0xb8, 0x58, + 0x33, 0xef, 0xfd, 0xde, 0x9b, 0xf7, 0xfb, 0xcd, 0x7b, 0xb3, 0x86, 0xeb, 0x3d, 0xc6, 0x63, 0xc6, + 0x03, 0xca, 0x06, 0xc1, 0xa0, 0x11, 0x88, 0x63, 0x3f, 0xcd, 0x98, 0x60, 0xe8, 0x6d, 0x6d, 0xf7, + 0x29, 0x1b, 0xf8, 0x83, 0x86, 0xe3, 0x1a, 0x58, 0x17, 0x73, 0x12, 0x0c, 0x1a, 0x5d, 0x22, 0x70, + 0x23, 0xe8, 0xb1, 0x28, 0xd1, 0x70, 0xe7, 0xc6, 0x64, 0x1a, 0x19, 0xa5, 0x1d, 0x35, 0xca, 0x28, + 0x53, 0xcb, 0x40, 0xae, 0x8c, 0xb5, 0xae, 0xe1, 0x07, 0xda, 0x61, 0x8e, 0x32, 0x2e, 0xca, 0x18, + 0x3d, 0x22, 0x81, 0xda, 0x75, 0xfb, 0xdf, 0x05, 0x38, 0x19, 0x4e, 0x1d, 0x12, 0x73, 0x2a, 0x0f, + 0x89, 0x39, 0x35, 0x8e, 0x0d, 0x1c, 0x47, 0x09, 0x0b, 0xd4, 0xaf, 0x36, 0x79, 0xbf, 0x2c, 0xc2, + 0x46, 0x9b, 0xd3, 0x27, 0xfd, 0x6e, 0x1c, 0x89, 0xc7, 0x19, 0x4b, 0x19, 0xc7, 0x47, 0xe8, 0x03, + 0xb8, 0x12, 0x13, 0xce, 0x31, 0x25, 0xdc, 0xb6, 0xb6, 0x96, 0xb6, 0xd7, 0xf6, 0x6b, 0xbe, 0x3e, + 0xcf, 0xcf, 0xcf, 0xf3, 0x1f, 0x24, 0xc3, 0x4e, 0x81, 0x42, 0x6d, 0xb8, 0x1a, 0x25, 0x91, 0x88, + 0xf0, 0xd1, 0x41, 0x48, 0x52, 0xc6, 0x23, 0x61, 0x2f, 0xaa, 0xc0, 0xba, 0x6f, 0xca, 0x96, 0x92, + 0xf8, 0x46, 0x12, 0xff, 0x21, 0x8b, 0x92, 0xd6, 0xea, 0xcb, 0xd7, 0x9b, 0x0b, 0xcf, 0xcf, 0x4f, + 0x76, 0xac, 0xce, 0xba, 0x09, 0xf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e, 0x24, 0x39, 0xda, 0x4b, 0x96, + 0x5e, 0x89, 0x65, 0xa9, 0x22, 0xcf, 0x85, 0x9b, 0xb3, 0xec, 0x39, 0x57, 0xef, 0x4f, 0x0b, 0xaa, + 0x6d, 0x4e, 0x9f, 0x32, 0x41, 0xd0, 0x9d, 0x19, 0xbc, 0x5b, 0xb5, 0xbf, 0x5f, 0x6f, 0x8e, 0x9b, + 0x75, 0x13, 0x8c, 0xa9, 0x81, 0x7c, 0x58, 0x19, 0x30, 0x41, 0x32, 0x5d, 0xf3, 0x9c, 0xdb, 0xd7, + 0x30, 0xd4, 0x80, 0x0a, 0x4b, 0x45, 0xc4, 0x12, 0xd5, 0x2e, 0xeb, 0xa3, 0xb6, 0xd3, 0x83, 0xe9, + 0xcb, 0x5a, 0xbe, 0x54, 0x80, 0x8e, 0x01, 0xce, 0xeb, 0x96, 0xe6, 0xbb, 0x52, 0x18, 0x9d, 0x5a, + 0x8a, 0x72, 0xad, 0x24, 0x8a, 0xcc, 0xe7, 0x6d, 0xc0, 0x55, 0xb3, 0x2c, 0xa8, 0xff, 0x63, 0x15, + 0xb6, 0xaf, 0x49, 0x44, 0x0f, 0x05, 0x09, 0xff, 0x2f, 0x09, 0xee, 0x41, 0x55, 0x33, 0xe3, 0xf6, + 0x92, 0x1a, 0xbd, 0x5b, 0x53, 0x1a, 0xe4, 0x05, 0x8d, 0x69, 0x91, 0x47, 0xcc, 0x15, 0xe3, 0xfd, + 0x49, 0x31, 0xde, 0x99, 0x29, 0x46, 0x9e, 0xdc, 0xab, 0xc3, 0x8d, 0x29, 0x53, 0x21, 0xce, 0x5f, + 0x16, 0x40, 0x9b, 0xd3, 0x7c, 0xc8, 0xff, 0xa3, 0x2e, 0x77, 0x61, 0xd5, 0x3c, 0x31, 0xec, 0x72, + 0x6d, 0x46, 0x50, 0x74, 0x1f, 0x2a, 0x38, 0x66, 0xfd, 0x44, 0x18, 0x79, 0xde, 0xec, 0x65, 0x32, + 0x31, 0xcd, 0x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5a, 0x8f, 0x5e, 0x9e, 0xba, 0xd6, 0xab, 0x53, 0xd7, 0xfa, + 0xe3, 0xd4, 0xb5, 0x7e, 0x3a, 0x73, 0x17, 0x5e, 0x9d, 0xb9, 0x0b, 0xbf, 0x9f, 0xb9, 0x0b, 0xdf, + 0xec, 0xd2, 0x48, 0x1c, 0xf6, 0xbb, 0x7e, 0x8f, 0xc5, 0xe6, 0xbf, 0x4c, 0x50, 0x6a, 0x3c, 0x31, + 0x4c, 0x09, 0x97, 0xff, 0x9c, 0x2a, 0xea, 0xe3, 0xf6, 0xe1, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, + 0xa1, 0xb4, 0x35, 0x16, 0x79, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1042,6 +1062,20 @@ func (m *MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Summary) > 0 { + i -= len(m.Summary) + copy(dAtA[i:], m.Summary) + i = encodeVarintTx(dAtA, i, uint64(len(m.Summary))) + i-- + dAtA[i] = 0x32 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintTx(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0x2a + } if len(m.Metadata) > 0 { i -= len(m.Metadata) copy(dAtA[i:], m.Metadata) @@ -1501,6 +1535,14 @@ func (m *MsgSubmitProposal) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + l = len(m.Title) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Summary) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -1831,6 +1873,70 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { } m.Metadata = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", 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.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Summary", 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.Summary = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) From 6eafefe1588fa15e0b46e7138b41123e691dca12 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Fri, 23 Dec 2022 13:12:37 +0100 Subject: [PATCH 02/10] fix migration --- x/gov/keeper/grpc_query_test.go | 24 ++++++++++++------------ x/gov/migrations/v3/convert.go | 2 ++ x/gov/migrations/v3/json_test.go | 3 +++ x/gov/migrations/v4/store_test.go | 4 ++-- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/x/gov/keeper/grpc_query_test.go b/x/gov/keeper/grpc_query_test.go index a07df04b4890..96dd1921cd1f 100644 --- a/x/gov/keeper/grpc_query_test.go +++ b/x/gov/keeper/grpc_query_test.go @@ -57,7 +57,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposal() { testProposal := v1beta1.NewTextProposal("Proposal", "testing proposal") msgContent, err := v1.NewLegacyContent(testProposal, govAcct.String()) suite.Require().NoError(err) - submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "test", "summary") + submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) suite.Require().NoError(err) suite.Require().NotEmpty(submittedProposal) @@ -127,7 +127,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryProposal() { testProposal := v1beta1.NewTextProposal("Proposal", "testing proposal") msgContent, err := v1.NewLegacyContent(testProposal, govAcct.String()) suite.Require().NoError(err) - submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "test", "summary") + submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) suite.Require().NoError(err) suite.Require().NotEmpty(submittedProposal) @@ -188,7 +188,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposals() { testProposal := []sdk.Msg{ v1.NewMsgVote(govAddress, uint64(i), v1.OptionYes, ""), } - proposal, err := suite.govKeeper.SubmitProposal(ctx, testProposal, "", "test", "summary") + proposal, err := suite.govKeeper.SubmitProposal(ctx, testProposal, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) suite.Require().NotEmpty(proposal) suite.Require().NoError(err) testProposals = append(testProposals, &proposal) @@ -321,7 +321,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryProposals() { testProposal := v1beta1.NewTextProposal("Proposal", "testing proposal") msgContent, err := v1.NewLegacyContent(testProposal, govAcct.String()) suite.Require().NoError(err) - submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "test", "summary") + submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) suite.Require().NoError(err) suite.Require().NotEmpty(submittedProposal) }, @@ -402,7 +402,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryVote() { "no votes present", func() { var err error - proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "") + proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "test", "summary", addrs[0]) suite.Require().NoError(err) req = &v1.QueryVoteRequest{ @@ -516,7 +516,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryVote() { "no votes present", func() { var err error - proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "") + proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "test", "summary", addrs[0]) suite.Require().NoError(err) req = &v1beta1.QueryVoteRequest{ @@ -622,7 +622,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryVotes() { "create a proposal and get votes", func() { var err error - proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "") + proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "test", "summary", addrs[0]) suite.Require().NoError(err) req = &v1.QueryVotesRequest{ @@ -724,7 +724,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryVotes() { "create a proposal and get votes", func() { var err error - proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "") + proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "test", "summary", addrs[0]) suite.Require().NoError(err) req = &v1beta1.QueryVotesRequest{ @@ -1009,7 +1009,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryDeposit() { "no deposits proposal", func() { var err error - proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "") + proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "test", "summary", addrs[0]) suite.Require().NoError(err) suite.Require().NotNil(proposal) @@ -1110,7 +1110,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryDeposit() { "no deposits proposal", func() { var err error - proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "") + proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "test", "summary", addrs[0]) suite.Require().NoError(err) suite.Require().NotNil(proposal) @@ -1200,7 +1200,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryDeposits() { "create a proposal and get deposits", func() { var err error - proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "") + proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "test", "summary", addrs[0]) suite.Require().NoError(err) req = &v1.QueryDepositsRequest{ @@ -1295,7 +1295,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryDeposits() { "create a proposal and get deposits", func() { var err error - proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "") + proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "test", "summary", addrs[0]) suite.Require().NoError(err) req = &v1beta1.QueryDepositsRequest{ diff --git a/x/gov/migrations/v3/convert.go b/x/gov/migrations/v3/convert.go index bef6cc157df0..1c9879c0cf51 100644 --- a/x/gov/migrations/v3/convert.go +++ b/x/gov/migrations/v3/convert.go @@ -222,6 +222,8 @@ func convertToNewProposal(oldProp v1beta1.Proposal) (v1.Proposal, error) { TotalDeposit: oldProp.TotalDeposit, VotingStartTime: &oldProp.VotingStartTime, VotingEndTime: &oldProp.VotingEndTime, + Title: oldProp.GetContent().GetTitle(), + Summary: oldProp.GetContent().GetDescription(), }, nil } diff --git a/x/gov/migrations/v3/json_test.go b/x/gov/migrations/v3/json_test.go index 3801c8d4df85..29f70ff5f715 100644 --- a/x/gov/migrations/v3/json_test.go +++ b/x/gov/migrations/v3/json_test.go @@ -106,8 +106,11 @@ func TestMigrateJSON(t *testing.T) { } ], "metadata": "", + "proposer": "", "status": "PROPOSAL_STATUS_DEPOSIT_PERIOD", "submit_time": "2001-09-09T01:46:40Z", + "summary": "my desc", + "title": "my title", "total_deposit": [ { "amount": "123", diff --git a/x/gov/migrations/v4/store_test.go b/x/gov/migrations/v4/store_test.go index cb6cd9bab48a..92f2601af7a0 100644 --- a/x/gov/migrations/v4/store_test.go +++ b/x/gov/migrations/v4/store_test.go @@ -75,13 +75,13 @@ func TestMigrateStore(t *testing.T) { // Create 2 proposals prop1Content, err := v1.NewLegacyContent(v1beta1.NewTextProposal("Test", "description"), authtypes.NewModuleAddress("gov").String()) require.NoError(t, err) - proposal1, err := v1.NewProposal([]sdk.Msg{prop1Content}, 1, "some metadata for the legacy content", propTime, propTime) + proposal1, err := v1.NewProposal([]sdk.Msg{prop1Content}, 1, "some metadata for the legacy content", propTime, propTime, "Test", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) require.NoError(t, err) prop1Bz, err := cdc.Marshal(&proposal1) require.NoError(t, err) store.Set(v1gov.ProposalKey(proposal1.Id), prop1Bz) - proposal2, err := v1.NewProposal(getTestProposal(), 2, "some metadata for the legacy content", propTime, propTime) + proposal2, err := v1.NewProposal(getTestProposal(), 2, "some metadata for the legacy content", propTime, propTime, "Test", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) proposal2.Status = v1.StatusVotingPeriod require.NoError(t, err) prop2Bz, err := cdc.Marshal(&proposal2) From ca10c2d60df2c48e2fee45f3bc071a79ebe91739 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Fri, 23 Dec 2022 17:08:50 +0100 Subject: [PATCH 03/10] fix integration tests --- tests/integration/gov/genesis_test.go | 4 +-- .../integration/gov/keeper/grpc_query_test.go | 4 +-- tests/integration/gov/keeper/keeper_test.go | 4 +-- tests/integration/gov/keeper/tally_test.go | 30 +++++++++---------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/integration/gov/genesis_test.go b/tests/integration/gov/genesis_test.go index 4fb466a70e0b..f417bdb17323 100644 --- a/tests/integration/gov/genesis_test.go +++ b/tests/integration/gov/genesis_test.go @@ -74,11 +74,11 @@ func TestImportExportQueues(t *testing.T) { ctx = s1.app.BaseApp.NewContext(false, tmproto.Header{}) // Create two proposals, put the second into the voting period - proposal1, err := s1.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)}, "") + proposal1, err := s1.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)}, "", "test", "description", addrs[0]) require.NoError(t, err) proposalID1 := proposal1.Id - proposal2, err := s1.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)}, "") + proposal2, err := s1.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)}, "", "test", "description", addrs[0]) require.NoError(t, err) proposalID2 := proposal2.Id diff --git a/tests/integration/gov/keeper/grpc_query_test.go b/tests/integration/gov/keeper/grpc_query_test.go index 0fd64e2a0ce3..d0e47cdc98fd 100644 --- a/tests/integration/gov/keeper/grpc_query_test.go +++ b/tests/integration/gov/keeper/grpc_query_test.go @@ -50,7 +50,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryTally() { "create a proposal and get tally", func() { var err error - proposal, err = app.GovKeeper.SubmitProposal(ctx, TestProposal, "") + proposal, err = app.GovKeeper.SubmitProposal(ctx, TestProposal, "", "test", "description", addrs[0]) suite.Require().NoError(err) suite.Require().NotNil(proposal) @@ -161,7 +161,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryTally() { "create a proposal and get tally", func() { var err error - proposal, err = app.GovKeeper.SubmitProposal(ctx, TestProposal, "") + proposal, err = app.GovKeeper.SubmitProposal(ctx, TestProposal, "", "test", "description", addrs[0]) suite.Require().NoError(err) suite.Require().NotNil(proposal) diff --git a/tests/integration/gov/keeper/keeper_test.go b/tests/integration/gov/keeper/keeper_test.go index ba0271e805a5..92bc021681b2 100644 --- a/tests/integration/gov/keeper/keeper_test.go +++ b/tests/integration/gov/keeper/keeper_test.go @@ -48,7 +48,7 @@ func (suite *KeeperTestSuite) SetupTest() { queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry()) v1.RegisterQueryServer(queryHelper, app.GovKeeper) legacyQueryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry()) - v1beta1.RegisterQueryServer(legacyQueryHelper, keeper.NewLegacyQueryServer(app.GovKeeper)) + v1beta1.RegisterQueryServer(legacyQueryHelper, keeper.NewLegacyQueryServer(&app.GovKeeper)) queryClient := v1.NewQueryClient(queryHelper) legacyQueryClient := v1beta1.NewQueryClient(legacyQueryHelper) @@ -56,7 +56,7 @@ func (suite *KeeperTestSuite) SetupTest() { suite.ctx = ctx suite.queryClient = queryClient suite.legacyQueryClient = legacyQueryClient - suite.msgSrvr = keeper.NewMsgServerImpl(suite.app.GovKeeper) + suite.msgSrvr = keeper.NewMsgServerImpl(&suite.app.GovKeeper) govAcct := suite.app.GovKeeper.GetGovernanceAccount(suite.ctx).GetAddress() suite.legacyMsgSrvr = keeper.NewLegacyMsgServerImpl(govAcct.String(), suite.msgSrvr) diff --git a/tests/integration/gov/keeper/tally_test.go b/tests/integration/gov/keeper/tally_test.go index 35024cfcc535..ade686744cbe 100644 --- a/tests/integration/gov/keeper/tally_test.go +++ b/tests/integration/gov/keeper/tally_test.go @@ -20,7 +20,7 @@ func TestTallyNoOneVotes(t *testing.T) { createValidators(t, ctx, app, []int64{5, 5, 5}) tp := TestProposal - proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "") + proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "", "test", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) require.NoError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -44,7 +44,7 @@ func TestTallyNoQuorum(t *testing.T) { addrs := simapp.AddTestAddrsIncremental(app, ctx, 1, sdk.NewInt(10000000)) tp := TestProposal - proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "") + proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0]) require.NoError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -67,7 +67,7 @@ func TestTallyOnlyValidatorsAllYes(t *testing.T) { addrs, _ := createValidators(t, ctx, app, []int64{5, 5, 5}) tp := TestProposal - proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "") + proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0]) require.NoError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -93,7 +93,7 @@ func TestTallyOnlyValidators51No(t *testing.T) { valAccAddrs, _ := createValidators(t, ctx, app, []int64{5, 6, 0}) tp := TestProposal - proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "") + proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "", "test", "description", valAccAddrs[0]) require.NoError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -117,7 +117,7 @@ func TestTallyOnlyValidators51Yes(t *testing.T) { valAccAddrs, _ := createValidators(t, ctx, app, []int64{5, 6, 0}) tp := TestProposal - proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "") + proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "", "test", "description", valAccAddrs[0]) require.NoError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -142,7 +142,7 @@ func TestTallyOnlyValidatorsVetoed(t *testing.T) { valAccAddrs, _ := createValidators(t, ctx, app, []int64{6, 6, 7}) tp := TestProposal - proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "") + proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "", "test", "description", valAccAddrs[0]) require.NoError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -168,7 +168,7 @@ func TestTallyOnlyValidatorsAbstainPasses(t *testing.T) { valAccAddrs, _ := createValidators(t, ctx, app, []int64{6, 6, 7}) tp := TestProposal - proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "") + proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "", "test", "description", valAccAddrs[0]) require.NoError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -194,7 +194,7 @@ func TestTallyOnlyValidatorsAbstainFails(t *testing.T) { valAccAddrs, _ := createValidators(t, ctx, app, []int64{6, 6, 7}) tp := TestProposal - proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "") + proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "", "test", "description", valAccAddrs[0]) require.NoError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -221,7 +221,7 @@ func TestTallyOnlyValidatorsNonVoter(t *testing.T) { valAccAddr1, valAccAddr2 := valAccAddrs[0], valAccAddrs[1] tp := TestProposal - proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "") + proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "", "test", "description", valAccAddrs[0]) require.NoError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -255,7 +255,7 @@ func TestTallyDelgatorOverride(t *testing.T) { _ = staking.EndBlocker(ctx, app.StakingKeeper) tp := TestProposal - proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "") + proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0]) require.NoError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -291,7 +291,7 @@ func TestTallyDelgatorInherit(t *testing.T) { _ = staking.EndBlocker(ctx, app.StakingKeeper) tp := TestProposal - proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "") + proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0]) require.NoError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -330,7 +330,7 @@ func TestTallyDelgatorMultipleOverride(t *testing.T) { _ = staking.EndBlocker(ctx, app.StakingKeeper) tp := TestProposal - proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "") + proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0]) require.NoError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -372,7 +372,7 @@ func TestTallyDelgatorMultipleInherit(t *testing.T) { _ = staking.EndBlocker(ctx, app.StakingKeeper) tp := TestProposal - proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "") + proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0]) require.NoError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -415,7 +415,7 @@ func TestTallyJailedValidator(t *testing.T) { app.StakingKeeper.Jail(ctx, sdk.ConsAddress(consAddr.Bytes())) tp := TestProposal - proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "") + proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0]) require.NoError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -448,7 +448,7 @@ func TestTallyValidatorMultipleDelegations(t *testing.T) { require.NoError(t, err) tp := TestProposal - proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "") + proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0]) require.NoError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod From 9e824e835a9691eff96edc153a85c01179c7442a Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Sat, 24 Dec 2022 15:52:27 +0100 Subject: [PATCH 04/10] clean up --- x/bank/app_test.go | 4 ++++ x/gov/abci_test.go | 10 +++++++- x/gov/client/cli/tx.go | 6 +++-- x/gov/client/cli/util.go | 14 ++++++----- x/gov/client/cli/util_test.go | 12 ++++++---- x/gov/keeper/msg_server.go | 15 +++++++++++- x/gov/keeper/msg_server_test.go | 42 ++++++++++++++++++++++++++++++++- x/gov/simulation/operations.go | 2 +- x/gov/types/v1/msgs.go | 11 ++++++++- x/gov/types/v1/msgs_test.go | 25 +++++++++++++------- 10 files changed, 116 insertions(+), 25 deletions(-) diff --git a/x/bank/app_test.go b/x/bank/app_test.go index f598d88e8533..4ae31ebca748 100644 --- a/x/bank/app_test.go +++ b/x/bank/app_test.go @@ -359,6 +359,8 @@ func TestMsgSetSendEnabled(t *testing.T) { sdk.Coins{{Denom: "foocoin", Amount: sdk.NewInt(5)}}, addr1Str, "set default send enabled to true", + "Change send enabled", + "Modify send enabled and set to true", ) require.NoError(t, err, "making goodGovProp") badGovProp, err := govv1.NewMsgSubmitProposal( @@ -368,6 +370,8 @@ func TestMsgSetSendEnabled(t *testing.T) { sdk.Coins{{Denom: "foocoin", Amount: sdk.NewInt(5)}}, addr1Str, "set default send enabled to true", + "Change send enabled", + "Modify send enabled and set to true", ) require.NoError(t, err, "making badGovProp") diff --git a/x/gov/abci_test.go b/x/gov/abci_test.go index 289cce690ffd..fbb523f0b0db 100644 --- a/x/gov/abci_test.go +++ b/x/gov/abci_test.go @@ -42,6 +42,8 @@ func TestTickExpiredDepositPeriod(t *testing.T) { sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, addrs[0].String(), "", + "Proposal", + "description of proposal", ) require.NoError(t, err) @@ -96,6 +98,8 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) { sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, addrs[0].String(), "", + "Proposal", + "description of proposal", ) require.NoError(t, err) @@ -120,6 +124,8 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) { sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, addrs[0].String(), "", + "Proposal", + "description of proposal", ) require.NoError(t, err) @@ -179,6 +185,8 @@ func TestTickPassedDepositPeriod(t *testing.T) { sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, addrs[0].String(), "", + "Proposal", + "description of proposal", ) require.NoError(t, err) @@ -232,7 +240,7 @@ func TestTickPassedVotingPeriod(t *testing.T) { activeQueue.Close() proposalCoins := sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, suite.StakingKeeper.TokensFromConsensusPower(ctx, 5))} - newProposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{mkTestLegacyContent(t)}, proposalCoins, addrs[0].String(), "") + newProposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{mkTestLegacyContent(t)}, proposalCoins, addrs[0].String(), "", "Proposal", "description of proposal") require.NoError(t, err) res, err := govMsgSvr.SubmitProposal(ctx, newProposalMsg) diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index 1e7e1c572aa1..6b0e576460d9 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -106,6 +106,8 @@ Where proposal.json contains: ], "metadata: "4pIMOgIGx1vZGU=", // base64-encoded metadata "deposit": "10stake" + "title: "My proposal" + "summary": "A short summary of my proposal" } `, version.AppName, @@ -117,12 +119,12 @@ Where proposal.json contains: return err } - msgs, metadata, deposit, err := parseSubmitProposal(clientCtx.Codec, args[0]) + msgs, metadata, title, summary, deposit, err := parseSubmitProposal(clientCtx.Codec, args[0]) if err != nil { return err } - msg, err := v1.NewMsgSubmitProposal(msgs, deposit, clientCtx.GetFromAddress().String(), metadata) + msg, err := v1.NewMsgSubmitProposal(msgs, deposit, clientCtx.GetFromAddress().String(), metadata, title, summary) if err != nil { return fmt.Errorf("invalid message: %w", err) } diff --git a/x/gov/client/cli/util.go b/x/gov/client/cli/util.go index 0b3dd193d215..2873b3082fda 100644 --- a/x/gov/client/cli/util.go +++ b/x/gov/client/cli/util.go @@ -82,20 +82,22 @@ type proposal struct { Messages []json.RawMessage `json:"messages,omitempty"` Metadata string `json:"metadata"` Deposit string `json:"deposit"` + Title string `json:"title"` + Summary string `json:"summary"` } // parseSubmitProposal reads and parses the proposal. -func parseSubmitProposal(cdc codec.Codec, path string) ([]sdk.Msg, string, sdk.Coins, error) { +func parseSubmitProposal(cdc codec.Codec, path string) ([]sdk.Msg, string, string, string, sdk.Coins, error) { var proposal proposal contents, err := os.ReadFile(path) if err != nil { - return nil, "", nil, err + return nil, "", "", "", nil, err } err = json.Unmarshal(contents, &proposal) if err != nil { - return nil, "", nil, err + return nil, "", "", "", nil, err } msgs := make([]sdk.Msg, len(proposal.Messages)) @@ -103,7 +105,7 @@ func parseSubmitProposal(cdc codec.Codec, path string) ([]sdk.Msg, string, sdk.C var msg sdk.Msg err := cdc.UnmarshalInterfaceJSON(anyJSON, &msg) if err != nil { - return nil, "", nil, err + return nil, "", "", "", nil, err } msgs[i] = msg @@ -111,8 +113,8 @@ func parseSubmitProposal(cdc codec.Codec, path string) ([]sdk.Msg, string, sdk.C deposit, err := sdk.ParseCoinsNormalized(proposal.Deposit) if err != nil { - return nil, "", nil, err + return nil, "", "", "", nil, err } - return msgs, proposal.Metadata, deposit, nil + return msgs, proposal.Metadata, proposal.Title, proposal.Summary, deposit, nil } diff --git a/x/gov/client/cli/util_test.go b/x/gov/client/cli/util_test.go index ba55c59ec2e0..842ed297fb67 100644 --- a/x/gov/client/cli/util_test.go +++ b/x/gov/client/cli/util_test.go @@ -150,7 +150,9 @@ func TestParseSubmitProposal(t *testing.T) { "@type": "/cosmos.gov.v1beta1.TextProposal", "title": "My awesome title", "description": "My awesome description" - } + }, + title: "My awesome title", + "summary": "My awesome summary" } ], "metadata": "%s", @@ -161,15 +163,15 @@ func TestParseSubmitProposal(t *testing.T) { badJSON := testutil.WriteToNewTempFile(t, "bad json") // nonexistent json - _, _, _, err := parseSubmitProposal(cdc, "fileDoesNotExist") + _, _, _, _, _, err := parseSubmitProposal(cdc, "fileDoesNotExist") //nolint: dogsled require.Error(t, err) // invalid json - _, _, _, err = parseSubmitProposal(cdc, badJSON.Name()) + _, _, _, _, _, err = parseSubmitProposal(cdc, badJSON.Name()) //nolint: dogsled require.Error(t, err) // ok json - msgs, metadata, deposit, err := parseSubmitProposal(cdc, okJSON.Name()) + msgs, metadata, title, summary, deposit, err := parseSubmitProposal(cdc, okJSON.Name()) require.NoError(t, err, "unexpected error") require.Equal(t, sdk.NewCoins(sdk.NewCoin("test", sdk.NewInt(1000))), deposit) require.Equal(t, base64.StdEncoding.EncodeToString(expectedMetadata), metadata) @@ -191,6 +193,8 @@ func TestParseSubmitProposal(t *testing.T) { require.True(t, ok) require.Equal(t, "My awesome title", textProp.Title) require.Equal(t, "My awesome description", textProp.Description) + require.Equal(t, "My awesome title", title) + require.Equal(t, "My awesome summary", summary) err = okJSON.Close() require.Nil(t, err, "unexpected error") diff --git a/x/gov/keeper/msg_server.go b/x/gov/keeper/msg_server.go index 40f25da20fc8..f22b04570442 100644 --- a/x/gov/keeper/msg_server.go +++ b/x/gov/keeper/msg_server.go @@ -2,6 +2,7 @@ package keeper import ( "context" + goerrors "errors" "fmt" "strconv" @@ -42,7 +43,17 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *v1.MsgSubmitPropos return nil, err } - proposer, _ := sdk.AccAddressFromBech32(msg.GetProposer()) + proposer, err := sdk.AccAddressFromBech32(msg.GetProposer()) + if err != nil { + return nil, err + } + + if msg.Title == "" { + return nil, goerrors.New("proposal title cannot be empty") + } + if msg.Summary == "" { + return nil, goerrors.New("proposal summary cannot be empty") + } proposal, err := k.Keeper.SubmitProposal(ctx, proposalMsgs, msg.Metadata, msg.Title, msg.Summary, proposer) if err != nil { @@ -223,6 +234,8 @@ func (k legacyMsgServer) SubmitProposal(goCtx context.Context, msg *v1beta1.MsgS msg.InitialDeposit, msg.Proposer, "", + msg.GetContent().GetTitle(), + msg.GetContent().GetDescription(), ) if err != nil { return nil, err diff --git a/x/gov/keeper/msg_server_test.go b/x/gov/keeper/msg_server_test.go index b8408c9214b4..ebef08cf2da0 100644 --- a/x/gov/keeper/msg_server_test.go +++ b/x/gov/keeper/msg_server_test.go @@ -39,6 +39,8 @@ func (suite *KeeperTestSuite) TestSubmitProposalReq() { initialDeposit, proposer.String(), strings.Repeat("1", 300), + "Proposal", + "description of proposal", ) }, expErr: true, @@ -51,6 +53,8 @@ func (suite *KeeperTestSuite) TestSubmitProposalReq() { initialDeposit, proposer.String(), "", + "Proposal", + "description of proposal", ) }, expErr: true, @@ -63,6 +67,8 @@ func (suite *KeeperTestSuite) TestSubmitProposalReq() { initialDeposit, proposer.String(), "", + "Proposal", + "description of proposal", ) }, expErr: true, @@ -75,6 +81,8 @@ func (suite *KeeperTestSuite) TestSubmitProposalReq() { initialDeposit, proposer.String(), "", + "Proposal", + "description of proposal", ) }, expErr: true, @@ -87,6 +95,8 @@ func (suite *KeeperTestSuite) TestSubmitProposalReq() { initialDeposit, proposer.String(), "", + "Proposal", + "description of proposal", ) }, expErr: false, @@ -98,6 +108,8 @@ func (suite *KeeperTestSuite) TestSubmitProposalReq() { minDeposit, proposer.String(), "", + "Proposal", + "description of proposal", ) }, expErr: false, @@ -139,6 +151,8 @@ func (suite *KeeperTestSuite) TestVoteReq() { minDeposit, proposer.String(), "", + "Proposal", + "description of proposal", ) suite.Require().NoError(err) @@ -162,6 +176,8 @@ func (suite *KeeperTestSuite) TestVoteReq() { coins, proposer.String(), "", + "Proposal", + "description of proposal", ) suite.Require().NoError(err) @@ -203,6 +219,8 @@ func (suite *KeeperTestSuite) TestVoteReq() { minDeposit, proposer.String(), "", + "Proposal", + "description of proposal", ) suite.Require().NoError(err) @@ -252,6 +270,8 @@ func (suite *KeeperTestSuite) TestVoteWeightedReq() { minDeposit, proposer.String(), "", + "Proposal", + "description of proposal", ) suite.Require().NoError(err) @@ -276,6 +296,8 @@ func (suite *KeeperTestSuite) TestVoteWeightedReq() { coins, proposer.String(), "", + "Proposal", + "description of proposal", ) suite.Require().NoError(err) @@ -317,6 +339,8 @@ func (suite *KeeperTestSuite) TestVoteWeightedReq() { minDeposit, proposer.String(), "", + "Proposal", + "description of proposal", ) suite.Require().NoError(err) @@ -365,6 +389,8 @@ func (suite *KeeperTestSuite) TestDepositReq() { coins, proposer.String(), "", + "Proposal", + "description of proposal", ) suite.Require().NoError(err) @@ -483,6 +509,8 @@ func (suite *KeeperTestSuite) TestLegacyMsgVote() { minDeposit, proposer.String(), "", + "Proposal", + "description of proposal", ) suite.Require().NoError(err) @@ -506,6 +534,8 @@ func (suite *KeeperTestSuite) TestLegacyMsgVote() { coins, proposer.String(), "", + "Proposal", + "description of proposal", ) suite.Require().NoError(err) @@ -537,6 +567,8 @@ func (suite *KeeperTestSuite) TestLegacyMsgVote() { minDeposit, proposer.String(), "", + "Proposal", + "description of proposal", ) suite.Require().NoError(err) @@ -586,6 +618,8 @@ func (suite *KeeperTestSuite) TestLegacyVoteWeighted() { minDeposit, proposer.String(), "", + "Proposal", + "description of proposal", ) suite.Require().NoError(err) @@ -610,6 +644,8 @@ func (suite *KeeperTestSuite) TestLegacyVoteWeighted() { coins, proposer.String(), "", + "Proposal", + "description of proposal", ) suite.Require().NoError(err) @@ -641,6 +677,8 @@ func (suite *KeeperTestSuite) TestLegacyVoteWeighted() { minDeposit, proposer.String(), "", + "Proposal", + "description of proposal", ) suite.Require().NoError(err) @@ -689,6 +727,8 @@ func (suite *KeeperTestSuite) TestLegacyMsgDeposit() { coins, proposer.String(), "", + "Proposal", + "description of proposal", ) suite.Require().NoError(err) @@ -1067,7 +1107,7 @@ func (suite *KeeperTestSuite) TestSubmitProposal_InitialDeposit() { params.MinInitialDepositRatio = tc.minInitialDepositRatio.String() govKeeper.SetParams(ctx, params) - msg, err := v1.NewMsgSubmitProposal(TestProposal, tc.initialDeposit, address.String(), "test") + msg, err := v1.NewMsgSubmitProposal(TestProposal, tc.initialDeposit, address.String(), "test", "Proposal", "description of proposal") suite.Require().NoError(err) // System under test diff --git a/x/gov/simulation/operations.go b/x/gov/simulation/operations.go index 4d6b5e6fd27a..09a56b444542 100644 --- a/x/gov/simulation/operations.go +++ b/x/gov/simulation/operations.go @@ -153,7 +153,7 @@ func SimulateMsgSubmitProposal(ak types.AccountKeeper, bk types.BankKeeper, k *k return simtypes.NoOpMsg(types.ModuleName, TypeMsgSubmitProposal, "error converting legacy content into proposal message"), nil, err } - msg, err := v1.NewMsgSubmitProposal([]sdk.Msg{contentMsg}, deposit, simAccount.Address.String(), "") + msg, err := v1.NewMsgSubmitProposal([]sdk.Msg{contentMsg}, deposit, simAccount.Address.String(), "", "Title of proposal", "Short description of proposal") if err != nil { return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to generate a submit proposal msg"), nil, err } diff --git a/x/gov/types/v1/msgs.go b/x/gov/types/v1/msgs.go index a9e95661723b..f1b1667d59d5 100644 --- a/x/gov/types/v1/msgs.go +++ b/x/gov/types/v1/msgs.go @@ -22,11 +22,13 @@ var ( // NewMsgSubmitProposal creates a new MsgSubmitProposal. // //nolint:interfacer -func NewMsgSubmitProposal(messages []sdk.Msg, initialDeposit sdk.Coins, proposer string, metadata string) (*MsgSubmitProposal, error) { +func NewMsgSubmitProposal(messages []sdk.Msg, initialDeposit sdk.Coins, proposer, metadata, title, summary string) (*MsgSubmitProposal, error) { m := &MsgSubmitProposal{ InitialDeposit: initialDeposit, Proposer: proposer, Metadata: metadata, + Title: title, + Summary: summary, } anys, err := sdktx.SetMsgs(messages) @@ -52,6 +54,13 @@ func (m MsgSubmitProposal) Type() string { return sdk.MsgTypeURL(&m) } // ValidateBasic implements the sdk.Msg interface. func (m MsgSubmitProposal) ValidateBasic() error { + if m.Title == "" { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "proposal title cannot be empty") + } + if m.Summary == "" { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "proposal summary cannot be empty") + } + if _, err := sdk.AccAddressFromBech32(m.Proposer); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf("invalid proposer address: %s", err) } diff --git a/x/gov/types/v1/msgs_test.go b/x/gov/types/v1/msgs_test.go index 0bb2ce924c4b..e618622f33dc 100644 --- a/x/gov/types/v1/msgs_test.go +++ b/x/gov/types/v1/msgs_test.go @@ -149,18 +149,21 @@ func TestMsgSubmitProposal_ValidateBasic(t *testing.T) { initialDeposit sdk.Coins messages []sdk.Msg metadata string + title string + summary string expErr bool }{ - {"invalid addr", "", coinsPos, []sdk.Msg{msg1}, metadata, true}, - {"empty msgs and metadata", addrs[0].String(), coinsPos, nil, "", true}, - {"invalid msg", addrs[0].String(), coinsPos, []sdk.Msg{msg1, msg2}, metadata, true}, - {"valid with no Msg", addrs[0].String(), coinsPos, nil, metadata, false}, - {"valid with no metadata", addrs[0].String(), coinsPos, []sdk.Msg{msg1}, "", false}, - {"valid with everything", addrs[0].String(), coinsPos, []sdk.Msg{msg1}, metadata, false}, + {"invalid addr", "", coinsPos, []sdk.Msg{msg1}, metadata, "Title", "Summary", true}, + {"empty msgs and metadata", addrs[0].String(), coinsPos, nil, "", "Title", "Summary", true}, + {"empty title and summary", addrs[0].String(), coinsPos, nil, "", "", "", true}, + {"invalid msg", addrs[0].String(), coinsPos, []sdk.Msg{msg1, msg2}, metadata, "Title", "Summary", true}, + {"valid with no Msg", addrs[0].String(), coinsPos, nil, metadata, "Title", "Summary", false}, + {"valid with no metadata", addrs[0].String(), coinsPos, []sdk.Msg{msg1}, "", "Title", "Summary", false}, + {"valid with everything", addrs[0].String(), coinsPos, []sdk.Msg{msg1}, metadata, "Title", "Summary", false}, } for _, tc := range tests { - msg, err := v1.NewMsgSubmitProposal(tc.messages, tc.initialDeposit, tc.proposer, tc.metadata) + msg, err := v1.NewMsgSubmitProposal(tc.messages, tc.initialDeposit, tc.proposer, tc.metadata, tc.title, tc.summary) require.NoError(t, err) if tc.expErr { require.Error(t, msg.ValidateBasic(), "test: %s", tc.name) @@ -175,23 +178,29 @@ func TestMsgSubmitProposal_GetSignBytes(t *testing.T) { testcases := []struct { name string proposal []sdk.Msg + title string + summary string expSignBz string }{ { "MsgVote", []sdk.Msg{v1.NewMsgVote(addrs[0], 1, v1.OptionYes, "")}, + "gov/MsgVote", + "Proposal for a governance vote msg", `{"type":"cosmos-sdk/v1/MsgSubmitProposal","value":{"initial_deposit":[],"messages":[{"type":"cosmos-sdk/v1/MsgVote","value":{"option":1,"proposal_id":"1","voter":"cosmos1w3jhxap3gempvr"}}]}}`, }, { "MsgSend", []sdk.Msg{banktypes.NewMsgSend(addrs[0], addrs[0], sdk.NewCoins())}, + "bank/MsgSend", + "Proposal for a bank msg send", fmt.Sprintf(`{"type":"cosmos-sdk/v1/MsgSubmitProposal","value":{"initial_deposit":[],"messages":[{"type":"cosmos-sdk/MsgSend","value":{"amount":[],"from_address":"%s","to_address":"%s"}}]}}`, addrs[0], addrs[0]), }, } for _, tc := range testcases { t.Run(tc.name, func(t *testing.T) { - msg, err := v1.NewMsgSubmitProposal(tc.proposal, sdk.NewCoins(), sdk.AccAddress{}.String(), "") + msg, err := v1.NewMsgSubmitProposal(tc.proposal, sdk.NewCoins(), sdk.AccAddress{}.String(), "", tc.title, tc.summary) require.NoError(t, err) var bz []byte require.NotPanics(t, func() { From 90ee27dc3f153b7aa9e6c53d5da59cfd8aca36a4 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Sat, 24 Dec 2022 16:34:30 +0100 Subject: [PATCH 05/10] fix tests and add in metadata summary and title to proposal --- x/gov/client/cli/prompt.go | 4 ++++ x/gov/client/cli/util_test.go | 6 +++--- x/gov/types/v1/msgs_test.go | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/x/gov/client/cli/prompt.go b/x/gov/client/cli/prompt.go index 2b1833b4afa9..1005e73e9b35 100644 --- a/x/gov/client/cli/prompt.go +++ b/x/gov/client/cli/prompt.go @@ -155,6 +155,10 @@ func (p *proposalType) Prompt(cdc codec.Codec) (*proposal, types.ProposalMetadat return nil, metadata, fmt.Errorf("failed to set proposal deposit: %w", err) } + // set title and summary from metadata in the proposal + proposal.Title = metadata.Title + proposal.Summary = metadata.Summary + if p.Msg == nil { return proposal, metadata, nil } diff --git a/x/gov/client/cli/util_test.go b/x/gov/client/cli/util_test.go index 842ed297fb67..dc22c691d544 100644 --- a/x/gov/client/cli/util_test.go +++ b/x/gov/client/cli/util_test.go @@ -150,12 +150,12 @@ func TestParseSubmitProposal(t *testing.T) { "@type": "/cosmos.gov.v1beta1.TextProposal", "title": "My awesome title", "description": "My awesome description" - }, - title: "My awesome title", - "summary": "My awesome summary" + } } ], "metadata": "%s", + "title": "My awesome title", + "summary": "My awesome summary", "deposit": "1000test" } `, addr, addr, addr, addr, addr, base64.StdEncoding.EncodeToString(expectedMetadata))) diff --git a/x/gov/types/v1/msgs_test.go b/x/gov/types/v1/msgs_test.go index e618622f33dc..0ef189dac188 100644 --- a/x/gov/types/v1/msgs_test.go +++ b/x/gov/types/v1/msgs_test.go @@ -187,14 +187,14 @@ func TestMsgSubmitProposal_GetSignBytes(t *testing.T) { []sdk.Msg{v1.NewMsgVote(addrs[0], 1, v1.OptionYes, "")}, "gov/MsgVote", "Proposal for a governance vote msg", - `{"type":"cosmos-sdk/v1/MsgSubmitProposal","value":{"initial_deposit":[],"messages":[{"type":"cosmos-sdk/v1/MsgVote","value":{"option":1,"proposal_id":"1","voter":"cosmos1w3jhxap3gempvr"}}]}}`, + `{"type":"cosmos-sdk/v1/MsgSubmitProposal","value":{"initial_deposit":[],"messages":[{"type":"cosmos-sdk/v1/MsgVote","value":{"option":1,"proposal_id":"1","voter":"cosmos1w3jhxap3gempvr"}}],"summary":"Proposal for a governance vote msg","title":"gov/MsgVote"}}`, }, { "MsgSend", []sdk.Msg{banktypes.NewMsgSend(addrs[0], addrs[0], sdk.NewCoins())}, "bank/MsgSend", "Proposal for a bank msg send", - fmt.Sprintf(`{"type":"cosmos-sdk/v1/MsgSubmitProposal","value":{"initial_deposit":[],"messages":[{"type":"cosmos-sdk/MsgSend","value":{"amount":[],"from_address":"%s","to_address":"%s"}}]}}`, addrs[0], addrs[0]), + fmt.Sprintf(`{"type":"cosmos-sdk/v1/MsgSubmitProposal","value":{"initial_deposit":[],"messages":[{"type":"cosmos-sdk/MsgSend","value":{"amount":[],"from_address":"%s","to_address":"%s"}}],"summary":"Proposal for a bank msg send","title":"bank/MsgSend"}}`, addrs[0], addrs[0]), }, } From 77fbc207915f6bf3523a7d94dd3bca3a0566a482 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Mon, 26 Dec 2022 11:03:53 +0100 Subject: [PATCH 06/10] address comments --- x/gov/README.md | 14 +++++++++++--- x/gov/client/cli/prompt.go | 14 ++++++-------- x/gov/keeper/proposal.go | 2 +- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/x/gov/README.md b/x/gov/README.md index b1a313d5d43e..1ad9e623b55c 100644 --- a/x/gov/README.md +++ b/x/gov/README.md @@ -1149,10 +1149,14 @@ where `proposal.json` contains: } ], "metadata": "AQ==", - "deposit": "10stake" + "deposit": "10stake", + "title": "Proposal Title", + "summary": "Proposal Summary" } ``` +> Note: By default the metadata and the proposal are both limited by 255 characters, this can be overridden by the application developer + ##### submit-legacy-proposal The `submit-legacy-proposal` command allows users to submit a governance legacy proposal along with an initial deposit. @@ -1290,7 +1294,9 @@ Example Output: } ], "votingStartTime": "2021-09-16T19:40:08.712440474Z", - "votingEndTime": "2021-09-18T19:40:08.712440474Z" + "votingEndTime": "2021-09-18T19:40:08.712440474Z", + "title": "Test Proposal", + "summary": "testing, testing, 1, 2, 3" } } ``` @@ -1336,7 +1342,9 @@ Example Output: ], "votingStartTime": "2022-03-28T14:25:26.644857113Z", "votingEndTime": "2022-03-30T14:25:26.644857113Z", - "metadata": "AQ==" + "metadata": "AQ==", + "title": "Test Proposal", + "summary": "testing, testing, 1, 2, 3" } } ``` diff --git a/x/gov/client/cli/prompt.go b/x/gov/client/cli/prompt.go index 1005e73e9b35..c4b48c27b4ec 100644 --- a/x/gov/client/cli/prompt.go +++ b/x/gov/client/cli/prompt.go @@ -135,15 +135,17 @@ type proposalType struct { // Prompt the proposal type values and return the proposal and its metadata func (p *proposalType) Prompt(cdc codec.Codec) (*proposal, types.ProposalMetadata, error) { - proposal := &proposal{} - // set metadata metadata, err := Prompt(types.ProposalMetadata{}, "proposal") if err != nil { return nil, metadata, fmt.Errorf("failed to set proposal metadata: %w", err) } - // the metadata must be saved on IPFS, set placeholder - proposal.Metadata = "ipfs://CID" + + proposal := &proposal{ + Metadata: "ipfs://CID", + Title: metadata.Title, + Summary: metadata.Summary, + } // set deposit depositPrompt := promptui.Prompt{ @@ -155,10 +157,6 @@ func (p *proposalType) Prompt(cdc codec.Codec) (*proposal, types.ProposalMetadat return nil, metadata, fmt.Errorf("failed to set proposal deposit: %w", err) } - // set title and summary from metadata in the proposal - proposal.Title = metadata.Title - proposal.Summary = metadata.Summary - if p.Msg == nil { return proposal, metadata, nil } diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index bda1f7467250..51173f622889 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -18,7 +18,7 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat return v1.Proposal{}, err } - // assert summary is no longer than predefined max length of metdata + // assert summary is no longer than predefined max length of metadata err = keeper.assertMetadataLength(summary) if err != nil { return v1.Proposal{}, err From cbd03b892aa64d531bf9a0dd7f8fb73d8527a11a Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Mon, 26 Dec 2022 14:18:22 +0100 Subject: [PATCH 07/10] changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b8d1061af73..bee7ce9c04ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -107,6 +107,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#14019](https://github.com/cosmos/cosmos-sdk/issues/14019) Remove the interface casting to allow other implementations of a `CommitMultiStore`. * [#13881](https://github.com/cosmos/cosmos-sdk/pull/13881) Optimize iteration on nested cached KV stores and other operations in general. * (x/gov) [#14347](https://github.com/cosmos/cosmos-sdk/pull/14347) Support `v1.Proposal` message in `v1beta1.Proposal.Content`. +* (x/gov) [#14390](https://github.com/cosmos/cosmos-sdk/pull/14390) Add title, proposer and summary to proposal struct ### State Machine Breaking From fc93b4f10a1734b9f60cd5eca43c678311cc7ff5 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Mon, 26 Dec 2022 14:22:10 +0100 Subject: [PATCH 08/10] remove extra checks --- x/gov/keeper/msg_server.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/x/gov/keeper/msg_server.go b/x/gov/keeper/msg_server.go index f22b04570442..c66d011552ca 100644 --- a/x/gov/keeper/msg_server.go +++ b/x/gov/keeper/msg_server.go @@ -2,7 +2,6 @@ package keeper import ( "context" - goerrors "errors" "fmt" "strconv" @@ -48,13 +47,6 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *v1.MsgSubmitPropos return nil, err } - if msg.Title == "" { - return nil, goerrors.New("proposal title cannot be empty") - } - if msg.Summary == "" { - return nil, goerrors.New("proposal summary cannot be empty") - } - proposal, err := k.Keeper.SubmitProposal(ctx, proposalMsgs, msg.Metadata, msg.Title, msg.Summary, proposer) if err != nil { return nil, err From 8590ae69d5cd616d66cdb67493b47e284fdea54f Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 27 Dec 2022 00:02:53 +0100 Subject: [PATCH 09/10] fix tests and comments. --- tests/e2e/gov/tx.go | 2 ++ tests/integration/gov/keeper/keeper_test.go | 4 ++-- x/gov/README.md | 4 +++- x/gov/client/cli/prompt.go | 2 +- x/gov/client/cli/tx_test.go | 2 ++ 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/e2e/gov/tx.go b/tests/e2e/gov/tx.go index 82259dc1e2ee..6a5cf913ba7f 100644 --- a/tests/e2e/gov/tx.go +++ b/tests/e2e/gov/tx.go @@ -107,6 +107,8 @@ func (s *E2ETestSuite) TestNewCmdSubmitProposal() { } } ], + "title": "My awesome title", + "summary": "My awesome description", "metadata": "%s", "deposit": "%s" }`, authtypes.NewModuleAddress(types.ModuleName), base64.StdEncoding.EncodeToString(propMetadata), sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(5431))) diff --git a/tests/integration/gov/keeper/keeper_test.go b/tests/integration/gov/keeper/keeper_test.go index 92bc021681b2..ba0271e805a5 100644 --- a/tests/integration/gov/keeper/keeper_test.go +++ b/tests/integration/gov/keeper/keeper_test.go @@ -48,7 +48,7 @@ func (suite *KeeperTestSuite) SetupTest() { queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry()) v1.RegisterQueryServer(queryHelper, app.GovKeeper) legacyQueryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry()) - v1beta1.RegisterQueryServer(legacyQueryHelper, keeper.NewLegacyQueryServer(&app.GovKeeper)) + v1beta1.RegisterQueryServer(legacyQueryHelper, keeper.NewLegacyQueryServer(app.GovKeeper)) queryClient := v1.NewQueryClient(queryHelper) legacyQueryClient := v1beta1.NewQueryClient(legacyQueryHelper) @@ -56,7 +56,7 @@ func (suite *KeeperTestSuite) SetupTest() { suite.ctx = ctx suite.queryClient = queryClient suite.legacyQueryClient = legacyQueryClient - suite.msgSrvr = keeper.NewMsgServerImpl(&suite.app.GovKeeper) + suite.msgSrvr = keeper.NewMsgServerImpl(suite.app.GovKeeper) govAcct := suite.app.GovKeeper.GetGovernanceAccount(suite.ctx).GetAddress() suite.legacyMsgSrvr = keeper.NewLegacyMsgServerImpl(govAcct.String(), suite.msgSrvr) diff --git a/x/gov/README.md b/x/gov/README.md index 1ad9e623b55c..dd1ed16788dc 100644 --- a/x/gov/README.md +++ b/x/gov/README.md @@ -1155,7 +1155,9 @@ where `proposal.json` contains: } ``` -> Note: By default the metadata and the proposal are both limited by 255 characters, this can be overridden by the application developer +:::note +By default the metadata and the proposal are both limited by 255 characters, this can be overridden by the application developer. +::: ##### submit-legacy-proposal diff --git a/x/gov/client/cli/prompt.go b/x/gov/client/cli/prompt.go index c4b48c27b4ec..bb9b0936979a 100644 --- a/x/gov/client/cli/prompt.go +++ b/x/gov/client/cli/prompt.go @@ -142,7 +142,7 @@ func (p *proposalType) Prompt(cdc codec.Codec) (*proposal, types.ProposalMetadat } proposal := &proposal{ - Metadata: "ipfs://CID", + Metadata: "ipfs://CID", // the metadata must be saved on IPFS, set placeholder Title: metadata.Title, Summary: metadata.Summary, } diff --git a/x/gov/client/cli/tx_test.go b/x/gov/client/cli/tx_test.go index 35fde2a3da72..50406d3c1d23 100644 --- a/x/gov/client/cli/tx_test.go +++ b/x/gov/client/cli/tx_test.go @@ -120,6 +120,8 @@ func (s *CLITestSuite) TestNewCmdSubmitProposal() { } } ], + "title": "My awesome title", + "summary": "My awesome description", "metadata": "%s", "deposit": "%s" }`, authtypes.NewModuleAddress(types.ModuleName), base64.StdEncoding.EncodeToString(propMetadata), sdk.NewCoin("stake", sdk.NewInt(5431))) From db7f26dea30bc186d84af0902eb7195aa1c83a6a Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 27 Dec 2022 00:04:50 +0100 Subject: [PATCH 10/10] fix padding in cli --- x/gov/client/cli/tx.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index 6b0e576460d9..9a94f765a3d4 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -106,8 +106,8 @@ Where proposal.json contains: ], "metadata: "4pIMOgIGx1vZGU=", // base64-encoded metadata "deposit": "10stake" - "title: "My proposal" - "summary": "A short summary of my proposal" + "title: "My proposal" + "summary": "A short summary of my proposal" } `, version.AppName,