From fe6aca3e4ebabe0a9074dd7a2fe57b441d436679 Mon Sep 17 00:00:00 2001 From: Jeancarlo Date: Tue, 16 May 2023 15:14:37 -0600 Subject: [PATCH 01/19] feat(group): add event at tally update with tally result --- api/cosmos/group/v1/events.pulsar.go | 675 +++++++++++++++++++++++++-- proto/cosmos/group/v1/events.proto | 13 + proto/cosmos/group/v1/query.proto | 6 +- x/group/README.md | 9 + x/group/events.pb.go | 308 +++++++++++- x/group/keeper/msg_server.go | 5 + 6 files changed, 958 insertions(+), 58 deletions(-) diff --git a/api/cosmos/group/v1/events.pulsar.go b/api/cosmos/group/v1/events.pulsar.go index 5352013f75c7..21bf5a3aefe2 100644 --- a/api/cosmos/group/v1/events.pulsar.go +++ b/api/cosmos/group/v1/events.pulsar.go @@ -3857,6 +3857,537 @@ func (x *fastReflection_EventLeaveGroup) ProtoMethods() *protoiface.Methods { } } +var ( + md_EventProposalTallyFinalized protoreflect.MessageDescriptor + fd_EventProposalTallyFinalized_proposal_id protoreflect.FieldDescriptor + fd_EventProposalTallyFinalized_status protoreflect.FieldDescriptor + fd_EventProposalTallyFinalized_tally_result protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_group_v1_events_proto_init() + md_EventProposalTallyFinalized = File_cosmos_group_v1_events_proto.Messages().ByName("EventProposalTallyFinalized") + fd_EventProposalTallyFinalized_proposal_id = md_EventProposalTallyFinalized.Fields().ByName("proposal_id") + fd_EventProposalTallyFinalized_status = md_EventProposalTallyFinalized.Fields().ByName("status") + fd_EventProposalTallyFinalized_tally_result = md_EventProposalTallyFinalized.Fields().ByName("tally_result") +} + +var _ protoreflect.Message = (*fastReflection_EventProposalTallyFinalized)(nil) + +type fastReflection_EventProposalTallyFinalized EventProposalTallyFinalized + +func (x *EventProposalTallyFinalized) ProtoReflect() protoreflect.Message { + return (*fastReflection_EventProposalTallyFinalized)(x) +} + +func (x *EventProposalTallyFinalized) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_group_v1_events_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_EventProposalTallyFinalized_messageType fastReflection_EventProposalTallyFinalized_messageType +var _ protoreflect.MessageType = fastReflection_EventProposalTallyFinalized_messageType{} + +type fastReflection_EventProposalTallyFinalized_messageType struct{} + +func (x fastReflection_EventProposalTallyFinalized_messageType) Zero() protoreflect.Message { + return (*fastReflection_EventProposalTallyFinalized)(nil) +} +func (x fastReflection_EventProposalTallyFinalized_messageType) New() protoreflect.Message { + return new(fastReflection_EventProposalTallyFinalized) +} +func (x fastReflection_EventProposalTallyFinalized_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EventProposalTallyFinalized +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_EventProposalTallyFinalized) Descriptor() protoreflect.MessageDescriptor { + return md_EventProposalTallyFinalized +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_EventProposalTallyFinalized) Type() protoreflect.MessageType { + return _fastReflection_EventProposalTallyFinalized_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_EventProposalTallyFinalized) New() protoreflect.Message { + return new(fastReflection_EventProposalTallyFinalized) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_EventProposalTallyFinalized) Interface() protoreflect.ProtoMessage { + return (*EventProposalTallyFinalized)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_EventProposalTallyFinalized) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.ProposalId != uint64(0) { + value := protoreflect.ValueOfUint64(x.ProposalId) + if !f(fd_EventProposalTallyFinalized_proposal_id, value) { + return + } + } + if x.Status != 0 { + value := protoreflect.ValueOfEnum((protoreflect.EnumNumber)(x.Status)) + if !f(fd_EventProposalTallyFinalized_status, value) { + return + } + } + if x.TallyResult != nil { + value := protoreflect.ValueOfMessage(x.TallyResult.ProtoReflect()) + if !f(fd_EventProposalTallyFinalized_tally_result, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_EventProposalTallyFinalized) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.group.v1.EventProposalTallyFinalized.proposal_id": + return x.ProposalId != uint64(0) + case "cosmos.group.v1.EventProposalTallyFinalized.status": + return x.Status != 0 + case "cosmos.group.v1.EventProposalTallyFinalized.tally_result": + return x.TallyResult != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalTallyFinalized")) + } + panic(fmt.Errorf("message cosmos.group.v1.EventProposalTallyFinalized does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventProposalTallyFinalized) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.group.v1.EventProposalTallyFinalized.proposal_id": + x.ProposalId = uint64(0) + case "cosmos.group.v1.EventProposalTallyFinalized.status": + x.Status = 0 + case "cosmos.group.v1.EventProposalTallyFinalized.tally_result": + x.TallyResult = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalTallyFinalized")) + } + panic(fmt.Errorf("message cosmos.group.v1.EventProposalTallyFinalized does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_EventProposalTallyFinalized) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.group.v1.EventProposalTallyFinalized.proposal_id": + value := x.ProposalId + return protoreflect.ValueOfUint64(value) + case "cosmos.group.v1.EventProposalTallyFinalized.status": + value := x.Status + return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) + case "cosmos.group.v1.EventProposalTallyFinalized.tally_result": + value := x.TallyResult + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalTallyFinalized")) + } + panic(fmt.Errorf("message cosmos.group.v1.EventProposalTallyFinalized does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventProposalTallyFinalized) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.group.v1.EventProposalTallyFinalized.proposal_id": + x.ProposalId = value.Uint() + case "cosmos.group.v1.EventProposalTallyFinalized.status": + x.Status = (ProposalStatus)(value.Enum()) + case "cosmos.group.v1.EventProposalTallyFinalized.tally_result": + x.TallyResult = value.Message().Interface().(*TallyResult) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalTallyFinalized")) + } + panic(fmt.Errorf("message cosmos.group.v1.EventProposalTallyFinalized does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventProposalTallyFinalized) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.group.v1.EventProposalTallyFinalized.tally_result": + if x.TallyResult == nil { + x.TallyResult = new(TallyResult) + } + return protoreflect.ValueOfMessage(x.TallyResult.ProtoReflect()) + case "cosmos.group.v1.EventProposalTallyFinalized.proposal_id": + panic(fmt.Errorf("field proposal_id of message cosmos.group.v1.EventProposalTallyFinalized is not mutable")) + case "cosmos.group.v1.EventProposalTallyFinalized.status": + panic(fmt.Errorf("field status of message cosmos.group.v1.EventProposalTallyFinalized is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalTallyFinalized")) + } + panic(fmt.Errorf("message cosmos.group.v1.EventProposalTallyFinalized does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_EventProposalTallyFinalized) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.group.v1.EventProposalTallyFinalized.proposal_id": + return protoreflect.ValueOfUint64(uint64(0)) + case "cosmos.group.v1.EventProposalTallyFinalized.status": + return protoreflect.ValueOfEnum(0) + case "cosmos.group.v1.EventProposalTallyFinalized.tally_result": + m := new(TallyResult) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalTallyFinalized")) + } + panic(fmt.Errorf("message cosmos.group.v1.EventProposalTallyFinalized does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_EventProposalTallyFinalized) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.group.v1.EventProposalTallyFinalized", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_EventProposalTallyFinalized) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventProposalTallyFinalized) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_EventProposalTallyFinalized) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_EventProposalTallyFinalized) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*EventProposalTallyFinalized) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.ProposalId != 0 { + n += 1 + runtime.Sov(uint64(x.ProposalId)) + } + if x.Status != 0 { + n += 1 + runtime.Sov(uint64(x.Status)) + } + if x.TallyResult != nil { + l = options.Size(x.TallyResult) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*EventProposalTallyFinalized) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.TallyResult != nil { + encoded, err := options.Marshal(x.TallyResult) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + if x.Status != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Status)) + i-- + dAtA[i] = 0x10 + } + if x.ProposalId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.ProposalId)) + i-- + dAtA[i] = 0x8 + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*EventProposalTallyFinalized) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire 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++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventProposalTallyFinalized: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventProposalTallyFinalized: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + x.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + x.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.Status |= ProposalStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field TallyResult", wireType) + } + var msglen int + 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++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + 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 + } + if x.TallyResult == nil { + x.TallyResult = &TallyResult{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.TallyResult); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Since: cosmos-sdk 0.46 // Code generated by protoc-gen-go. DO NOT EDIT. @@ -4232,6 +4763,61 @@ func (x *EventLeaveGroup) GetAddress() string { return "" } +// EventProposalTallyFinalized is an event emitted when a proposal tally is finalized. +type EventProposalTallyFinalized struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // proposal_id is the unique ID of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + // result is the proposal tally result. + Status ProposalStatus `protobuf:"varint,2,opt,name=status,proto3,enum=cosmos.group.v1.ProposalStatus" json:"status,omitempty"` + // tally_result is the proposal tally result. + TallyResult *TallyResult `protobuf:"bytes,3,opt,name=tally_result,json=tallyResult,proto3" json:"tally_result,omitempty"` +} + +func (x *EventProposalTallyFinalized) Reset() { + *x = EventProposalTallyFinalized{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_group_v1_events_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EventProposalTallyFinalized) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventProposalTallyFinalized) ProtoMessage() {} + +// Deprecated: Use EventProposalTallyFinalized.ProtoReflect.Descriptor instead. +func (*EventProposalTallyFinalized) Descriptor() ([]byte, []int) { + return file_cosmos_group_v1_events_proto_rawDescGZIP(), []int{9} +} + +func (x *EventProposalTallyFinalized) GetProposalId() uint64 { + if x != nil { + return x.ProposalId + } + return 0 +} + +func (x *EventProposalTallyFinalized) GetStatus() ProposalStatus { + if x != nil { + return x.Status + } + return ProposalStatus_PROPOSAL_STATUS_UNSPECIFIED +} + +func (x *EventProposalTallyFinalized) GetTallyResult() *TallyResult { + if x != nil { + return x.TallyResult + } + return nil +} + var File_cosmos_group_v1_events_proto protoreflect.FileDescriptor var file_cosmos_group_v1_events_proto_rawDesc = []byte{ @@ -4281,18 +4867,30 @@ var file_cosmos_group_v1_events_proto_rawDesc = []byte{ 0x70, 0x49, 0x64, 0x12, 0x32, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 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, 0x07, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, 0xaa, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x76, 0x31, 0x42, - 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, - 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, 0x72, 0x6f, 0x75, 0x70, 0x2f, 0x76, 0x31, - 0x3b, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x47, 0x58, 0xaa, 0x02, - 0x0f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x56, 0x31, - 0xca, 0x02, 0x0f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x5c, - 0x56, 0x31, 0xe2, 0x02, 0x1b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x72, 0x6f, 0x75, - 0x70, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x11, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0xb8, 0x01, 0x0a, 0x1b, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x54, 0x61, 0x6c, 0x6c, 0x79, 0x46, 0x69, + 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 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, 0x37, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, + 0x73, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x3f, 0x0a, 0x0c, 0x74, 0x61, 0x6c, 0x6c, 0x79, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x6c, 0x6c, 0x79, 0x52, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x0b, 0x74, 0x61, 0x6c, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x42, 0xaa, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 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, 0x72, 0x6f, 0x75, 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x47, 0x58, 0xaa, 0x02, 0x0f, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0f, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1b, + 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x5c, 0x56, 0x31, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x3a, 0x3a, 0x56, 0x31, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -4307,26 +4905,31 @@ func file_cosmos_group_v1_events_proto_rawDescGZIP() []byte { return file_cosmos_group_v1_events_proto_rawDescData } -var file_cosmos_group_v1_events_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_cosmos_group_v1_events_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_cosmos_group_v1_events_proto_goTypes = []interface{}{ - (*EventCreateGroup)(nil), // 0: cosmos.group.v1.EventCreateGroup - (*EventUpdateGroup)(nil), // 1: cosmos.group.v1.EventUpdateGroup - (*EventCreateGroupPolicy)(nil), // 2: cosmos.group.v1.EventCreateGroupPolicy - (*EventUpdateGroupPolicy)(nil), // 3: cosmos.group.v1.EventUpdateGroupPolicy - (*EventSubmitProposal)(nil), // 4: cosmos.group.v1.EventSubmitProposal - (*EventWithdrawProposal)(nil), // 5: cosmos.group.v1.EventWithdrawProposal - (*EventVote)(nil), // 6: cosmos.group.v1.EventVote - (*EventExec)(nil), // 7: cosmos.group.v1.EventExec - (*EventLeaveGroup)(nil), // 8: cosmos.group.v1.EventLeaveGroup - (ProposalExecutorResult)(0), // 9: cosmos.group.v1.ProposalExecutorResult + (*EventCreateGroup)(nil), // 0: cosmos.group.v1.EventCreateGroup + (*EventUpdateGroup)(nil), // 1: cosmos.group.v1.EventUpdateGroup + (*EventCreateGroupPolicy)(nil), // 2: cosmos.group.v1.EventCreateGroupPolicy + (*EventUpdateGroupPolicy)(nil), // 3: cosmos.group.v1.EventUpdateGroupPolicy + (*EventSubmitProposal)(nil), // 4: cosmos.group.v1.EventSubmitProposal + (*EventWithdrawProposal)(nil), // 5: cosmos.group.v1.EventWithdrawProposal + (*EventVote)(nil), // 6: cosmos.group.v1.EventVote + (*EventExec)(nil), // 7: cosmos.group.v1.EventExec + (*EventLeaveGroup)(nil), // 8: cosmos.group.v1.EventLeaveGroup + (*EventProposalTallyFinalized)(nil), // 9: cosmos.group.v1.EventProposalTallyFinalized + (ProposalExecutorResult)(0), // 10: cosmos.group.v1.ProposalExecutorResult + (ProposalStatus)(0), // 11: cosmos.group.v1.ProposalStatus + (*TallyResult)(nil), // 12: cosmos.group.v1.TallyResult } var file_cosmos_group_v1_events_proto_depIdxs = []int32{ - 9, // 0: cosmos.group.v1.EventExec.result:type_name -> cosmos.group.v1.ProposalExecutorResult - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 10, // 0: cosmos.group.v1.EventExec.result:type_name -> cosmos.group.v1.ProposalExecutorResult + 11, // 1: cosmos.group.v1.EventProposalTallyFinalized.status:type_name -> cosmos.group.v1.ProposalStatus + 12, // 2: cosmos.group.v1.EventProposalTallyFinalized.tally_result:type_name -> cosmos.group.v1.TallyResult + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_cosmos_group_v1_events_proto_init() } @@ -4444,6 +5047,18 @@ func file_cosmos_group_v1_events_proto_init() { return nil } } + file_cosmos_group_v1_events_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EventProposalTallyFinalized); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -4451,7 +5066,7 @@ func file_cosmos_group_v1_events_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_group_v1_events_proto_rawDesc, NumEnums: 0, - NumMessages: 9, + NumMessages: 10, NumExtensions: 0, NumServices: 0, }, diff --git a/proto/cosmos/group/v1/events.proto b/proto/cosmos/group/v1/events.proto index c2cfe8728f72..3474d3c53785 100644 --- a/proto/cosmos/group/v1/events.proto +++ b/proto/cosmos/group/v1/events.proto @@ -79,3 +79,16 @@ message EventLeaveGroup { // address is the account address of the group member. string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } + +// EventProposalTallyFinalized is an event emitted when a proposal tally is finalized. +message EventProposalTallyFinalized { + + // proposal_id is the unique ID of the proposal. + uint64 proposal_id = 1; + + // result is the proposal tally result. + ProposalStatus status = 2; + + // tally_result is the proposal tally result. + TallyResult tally_result = 3; +} diff --git a/proto/cosmos/group/v1/query.proto b/proto/cosmos/group/v1/query.proto index f141d26b9352..80b09255afed 100644 --- a/proto/cosmos/group/v1/query.proto +++ b/proto/cosmos/group/v1/query.proto @@ -85,7 +85,7 @@ service Query { }; // Groups queries all groups in state. - // + // // Since: cosmos-sdk 0.47.1 rpc Groups(QueryGroupsRequest) returns (QueryGroupsResponse) { option (google.api.http).get = "/cosmos/group/v1/groups"; @@ -300,7 +300,7 @@ message QueryTallyResultResponse { } // QueryGroupsRequest is the Query/Groups request type. -// +// // Since: cosmos-sdk 0.47.1 message QueryGroupsRequest { @@ -309,7 +309,7 @@ message QueryGroupsRequest { } // QueryGroupsResponse is the Query/Groups response type. -// +// // Since: cosmos-sdk 0.47.1 message QueryGroupsResponse { // `groups` is all the groups present in state. diff --git a/x/group/README.md b/x/group/README.md index b94fec728650..bc3d8c5c8407 100644 --- a/x/group/README.md +++ b/x/group/README.md @@ -578,6 +578,15 @@ The group module emits the following events: | cosmos.group.v1.EventLeaveGroup | proposal_id | {proposalId} | | cosmos.group.v1.EventLeaveGroup | address | {address} | +### EventProposalTallyFinalized + +| Type | Attribute Key | Attribute Value | +|---------------------------------------------|---------------| ------------------------------- | +| message | action | /cosmos.group.v1.Msg/LeaveGroup | +| cosmos.group.v1.EventProposalTallyFinalized | proposal_id | {proposalId} | +| cosmos.group.v1.EventProposalTallyFinalized | status | {ProposalStatus} | +| cosmos.group.v1.EventProposalTallyFinalized | tally_result | {TallyResult} | + ## Client diff --git a/x/group/events.pb.go b/x/group/events.pb.go index 1e30b1f06c9d..608e690b3e5f 100644 --- a/x/group/events.pb.go +++ b/x/group/events.pb.go @@ -464,6 +464,70 @@ func (m *EventLeaveGroup) GetAddress() string { return "" } +// EventProposalTallyFinalized is an event emitted when a proposal tally is finalized. +type EventProposalTallyFinalized struct { + // proposal_id is the unique ID of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + // result is the proposal tally result. + Status ProposalStatus `protobuf:"varint,2,opt,name=status,proto3,enum=cosmos.group.v1.ProposalStatus" json:"status,omitempty"` + // tally_result is the proposal tally result. + TallyResult *TallyResult `protobuf:"bytes,3,opt,name=tally_result,json=tallyResult,proto3" json:"tally_result,omitempty"` +} + +func (m *EventProposalTallyFinalized) Reset() { *m = EventProposalTallyFinalized{} } +func (m *EventProposalTallyFinalized) String() string { return proto.CompactTextString(m) } +func (*EventProposalTallyFinalized) ProtoMessage() {} +func (*EventProposalTallyFinalized) Descriptor() ([]byte, []int) { + return fileDescriptor_e8d753981546f032, []int{9} +} +func (m *EventProposalTallyFinalized) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventProposalTallyFinalized) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventProposalTallyFinalized.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventProposalTallyFinalized) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventProposalTallyFinalized.Merge(m, src) +} +func (m *EventProposalTallyFinalized) XXX_Size() int { + return m.Size() +} +func (m *EventProposalTallyFinalized) XXX_DiscardUnknown() { + xxx_messageInfo_EventProposalTallyFinalized.DiscardUnknown(m) +} + +var xxx_messageInfo_EventProposalTallyFinalized proto.InternalMessageInfo + +func (m *EventProposalTallyFinalized) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +func (m *EventProposalTallyFinalized) GetStatus() ProposalStatus { + if m != nil { + return m.Status + } + return PROPOSAL_STATUS_UNSPECIFIED +} + +func (m *EventProposalTallyFinalized) GetTallyResult() *TallyResult { + if m != nil { + return m.TallyResult + } + return nil +} + func init() { proto.RegisterType((*EventCreateGroup)(nil), "cosmos.group.v1.EventCreateGroup") proto.RegisterType((*EventUpdateGroup)(nil), "cosmos.group.v1.EventUpdateGroup") @@ -474,36 +538,42 @@ func init() { proto.RegisterType((*EventVote)(nil), "cosmos.group.v1.EventVote") proto.RegisterType((*EventExec)(nil), "cosmos.group.v1.EventExec") proto.RegisterType((*EventLeaveGroup)(nil), "cosmos.group.v1.EventLeaveGroup") + proto.RegisterType((*EventProposalTallyFinalized)(nil), "cosmos.group.v1.EventProposalTallyFinalized") } func init() { proto.RegisterFile("cosmos/group/v1/events.proto", fileDescriptor_e8d753981546f032) } var fileDescriptor_e8d753981546f032 = []byte{ - // 382 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x2f, 0xca, 0x2f, 0x2d, 0xd0, 0x2f, 0x33, 0xd4, 0x4f, 0x2d, 0x4b, 0xcd, - 0x2b, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x87, 0xc8, 0xea, 0x81, 0x65, 0xf5, - 0xca, 0x0c, 0xa5, 0x24, 0x21, 0x02, 0xf1, 0x60, 0x69, 0x7d, 0xa8, 0x2c, 0x98, 0x23, 0x25, 0x8d, - 0x6e, 0x52, 0x49, 0x65, 0x41, 0x2a, 0x54, 0x52, 0x49, 0x97, 0x4b, 0xc0, 0x15, 0x64, 0xb0, 0x73, - 0x51, 0x6a, 0x62, 0x49, 0xaa, 0x3b, 0x48, 0x89, 0x90, 0x24, 0x17, 0x07, 0x58, 0x6d, 0x7c, 0x66, - 0x8a, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x4b, 0x10, 0x3b, 0x98, 0xef, 0x99, 0x02, 0x57, 0x1e, 0x5a, - 0x90, 0x42, 0x8c, 0x72, 0x1f, 0x2e, 0x31, 0x74, 0xd3, 0x03, 0xf2, 0x73, 0x32, 0x93, 0x2b, 0x85, - 0x8c, 0xb8, 0xd8, 0x13, 0x53, 0x52, 0x8a, 0x52, 0x8b, 0x8b, 0xc1, 0x7a, 0x38, 0x9d, 0x24, 0x2e, - 0x6d, 0xd1, 0x15, 0x81, 0xba, 0xdb, 0x11, 0x22, 0x13, 0x5c, 0x52, 0x94, 0x99, 0x97, 0x1e, 0x04, - 0x53, 0x08, 0x37, 0x0d, 0xc9, 0x72, 0x0a, 0x4c, 0x33, 0xe3, 0x12, 0x06, 0x9b, 0x16, 0x5c, 0x9a, - 0x94, 0x9b, 0x59, 0x12, 0x50, 0x94, 0x5f, 0x90, 0x5f, 0x9c, 0x98, 0x23, 0x24, 0xcf, 0xc5, 0x5d, - 0x00, 0x65, 0x23, 0x3c, 0xc4, 0x05, 0x13, 0xf2, 0x4c, 0x51, 0xb2, 0xe0, 0x12, 0x05, 0xeb, 0x0b, - 0xcf, 0x2c, 0xc9, 0x48, 0x29, 0x4a, 0x2c, 0x27, 0x5e, 0xa7, 0x0e, 0x17, 0x27, 0x58, 0x67, 0x58, - 0x7e, 0x49, 0x2a, 0x61, 0xd5, 0x8d, 0x8c, 0x50, 0xe5, 0xae, 0x15, 0xa9, 0xc9, 0x04, 0x95, 0x0b, - 0xd9, 0x73, 0xb1, 0x15, 0xa5, 0x16, 0x97, 0xe6, 0x94, 0x48, 0x30, 0x29, 0x30, 0x6a, 0xf0, 0x19, - 0xa9, 0xeb, 0xa1, 0x25, 0x11, 0x3d, 0x98, 0x43, 0x41, 0xe6, 0x95, 0x96, 0xe4, 0x17, 0x05, 0x81, - 0x95, 0x07, 0x41, 0xb5, 0x09, 0x09, 0x71, 0xb1, 0xe4, 0xe4, 0xa7, 0x17, 0x4b, 0x30, 0x83, 0x02, - 0x30, 0x08, 0xcc, 0x56, 0x4a, 0xe0, 0xe2, 0x07, 0x3b, 0xc1, 0x27, 0x35, 0xb1, 0x8c, 0x60, 0x6c, - 0x23, 0xc7, 0x02, 0x13, 0x91, 0xb1, 0xe0, 0x64, 0x77, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, - 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, - 0x72, 0x0c, 0x51, 0x2a, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xd0, 0xf4, - 0x0c, 0xa5, 0x74, 0x8b, 0x53, 0xb2, 0xf5, 0x2b, 0x20, 0xc9, 0x39, 0x89, 0x0d, 0x9c, 0x8c, 0x8d, - 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x5b, 0xc0, 0x98, 0xf8, 0x2f, 0x03, 0x00, 0x00, + // 450 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0x4b, 0x6b, 0x13, 0x41, + 0x1c, 0xcf, 0xd4, 0x92, 0xda, 0x7f, 0xc4, 0xca, 0xf8, 0x20, 0x7d, 0xb0, 0x2d, 0x41, 0xb0, 0x07, + 0xb3, 0x4b, 0x23, 0xa8, 0x27, 0x8b, 0x95, 0x2a, 0x85, 0x1e, 0xca, 0xc6, 0x07, 0x78, 0x89, 0x93, + 0x9d, 0x61, 0x3b, 0xb8, 0xc9, 0x2c, 0x33, 0xb3, 0x6b, 0xe3, 0xcd, 0x6f, 0xe0, 0x87, 0xf1, 0xe0, + 0x47, 0xf0, 0x58, 0x3c, 0x79, 0x94, 0xe4, 0x8b, 0xc8, 0xfe, 0x77, 0xb6, 0x2d, 0x11, 0xd9, 0x80, + 0xa7, 0x9d, 0x99, 0xdf, 0xe3, 0xff, 0xda, 0x3f, 0x6c, 0x45, 0xca, 0x8c, 0x94, 0x09, 0x62, 0xad, + 0xb2, 0x34, 0xc8, 0xf7, 0x02, 0x91, 0x8b, 0xb1, 0x35, 0x7e, 0xaa, 0x95, 0x55, 0x74, 0xad, 0x44, + 0x7d, 0x44, 0xfd, 0x7c, 0x6f, 0x63, 0xbd, 0x7c, 0x18, 0x20, 0x1c, 0x38, 0x14, 0x2f, 0x1b, 0x9b, + 0xf3, 0x4e, 0x76, 0x92, 0x0a, 0x07, 0x76, 0xba, 0x70, 0xeb, 0xb0, 0x30, 0x7e, 0xa1, 0x05, 0xb3, + 0xe2, 0x55, 0x41, 0xa1, 0xeb, 0x70, 0x1d, 0xb9, 0x03, 0xc9, 0xdb, 0x64, 0x87, 0xec, 0x2e, 0x87, + 0x2b, 0x78, 0x3f, 0xe2, 0x17, 0xf4, 0x37, 0x29, 0x5f, 0x84, 0x7e, 0x0c, 0xf7, 0xe6, 0xdd, 0x4f, + 0x54, 0x22, 0xa3, 0x09, 0xed, 0xc1, 0x0a, 0xe3, 0x5c, 0x0b, 0x63, 0x50, 0xb3, 0x7a, 0xd0, 0xfe, + 0xf9, 0xad, 0x7b, 0xc7, 0xe5, 0xfd, 0xbc, 0x44, 0xfa, 0x56, 0xcb, 0x71, 0x1c, 0x56, 0xc4, 0x0b, + 0xb7, 0x2b, 0xc1, 0xff, 0xc3, 0xed, 0x31, 0xdc, 0x46, 0xb7, 0x7e, 0x36, 0x1c, 0x49, 0x7b, 0xa2, + 0x55, 0xaa, 0x0c, 0x4b, 0xe8, 0x36, 0xb4, 0x52, 0x77, 0xbe, 0x2c, 0x08, 0xaa, 0xa7, 0x23, 0xde, + 0x79, 0x0a, 0x77, 0x51, 0xf7, 0x4e, 0xda, 0x53, 0xae, 0xd9, 0xa7, 0xc5, 0x95, 0x0f, 0x61, 0x15, + 0x95, 0x6f, 0x95, 0x15, 0xf5, 0xec, 0x2f, 0xc4, 0xd1, 0x0f, 0xcf, 0x44, 0x54, 0x4b, 0xa7, 0xfb, + 0xd0, 0xd4, 0xc2, 0x64, 0x89, 0x6d, 0x2f, 0xed, 0x90, 0xdd, 0x9b, 0xbd, 0x07, 0xfe, 0xdc, 0x2f, + 0xe2, 0x57, 0x89, 0x16, 0x7e, 0x99, 0x55, 0x3a, 0x44, 0x7a, 0xe8, 0x64, 0x94, 0xc2, 0x72, 0xa2, + 0x62, 0xd3, 0xbe, 0x56, 0x34, 0x30, 0xc4, 0x73, 0xe7, 0x03, 0xac, 0x61, 0x0a, 0xc7, 0x82, 0xe5, + 0xb5, 0xd3, 0xbe, 0x3a, 0x85, 0xa5, 0x45, 0xa7, 0xf0, 0x9d, 0xc0, 0x26, 0x86, 0xa8, 0xb2, 0x7b, + 0xcd, 0x92, 0x64, 0xf2, 0x52, 0x8e, 0x59, 0x22, 0x3f, 0x0b, 0x5e, 0x5f, 0xf7, 0x13, 0x68, 0x1a, + 0xcb, 0x6c, 0x66, 0x5c, 0xdd, 0xdb, 0xff, 0xac, 0xbb, 0x8f, 0xb4, 0xd0, 0xd1, 0xe9, 0x3e, 0xdc, + 0xb0, 0x45, 0xac, 0x81, 0x6b, 0x5b, 0x51, 0x77, 0xab, 0xb7, 0xf5, 0x97, 0x1c, 0x13, 0x72, 0xbd, + 0x6a, 0xd9, 0xcb, 0xcb, 0xc1, 0xb3, 0x1f, 0x53, 0x8f, 0x9c, 0x4f, 0x3d, 0xf2, 0x7b, 0xea, 0x91, + 0xaf, 0x33, 0xaf, 0x71, 0x3e, 0xf3, 0x1a, 0xbf, 0x66, 0x5e, 0xe3, 0xfd, 0xfd, 0x58, 0xda, 0xd3, + 0x6c, 0xe8, 0x47, 0x6a, 0xe4, 0x56, 0xd1, 0x7d, 0xba, 0x86, 0x7f, 0x0c, 0xce, 0xca, 0x4d, 0x1c, + 0x36, 0x71, 0x03, 0x1f, 0xfd, 0x09, 0x00, 0x00, 0xff, 0xff, 0x8f, 0xd0, 0xca, 0xef, 0xea, 0x03, + 0x00, 0x00, } func (m *EventCreateGroup) Marshal() (dAtA []byte, err error) { @@ -781,6 +851,51 @@ func (m *EventLeaveGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *EventProposalTallyFinalized) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventProposalTallyFinalized) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventProposalTallyFinalized) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.TallyResult != nil { + { + size, err := m.TallyResult.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.Status != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x10 + } + if m.ProposalId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { offset -= sovEvents(v) base := offset @@ -913,6 +1028,25 @@ func (m *EventLeaveGroup) Size() (n int) { return n } +func (m *EventProposalTallyFinalized) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovEvents(uint64(m.ProposalId)) + } + if m.Status != 0 { + n += 1 + sovEvents(uint64(m.Status)) + } + if m.TallyResult != nil { + l = m.TallyResult.Size() + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + func sovEvents(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1649,6 +1783,130 @@ func (m *EventLeaveGroup) Unmarshal(dAtA []byte) error { } return nil } +func (m *EventProposalTallyFinalized) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventProposalTallyFinalized: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventProposalTallyFinalized: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= ProposalStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TallyResult", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TallyResult == nil { + m.TallyResult = &TallyResult{} + } + if err := m.TallyResult.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipEvents(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/group/keeper/msg_server.go b/x/group/keeper/msg_server.go index 0619e0e7098b..55cb0da68d31 100644 --- a/x/group/keeper/msg_server.go +++ b/x/group/keeper/msg_server.go @@ -782,6 +782,11 @@ func (k Keeper) doTallyAndUpdate(ctx sdk.Context, p *group.Proposal, groupInfo g } else { p.Status = group.PROPOSAL_STATUS_REJECTED } + err = ctx.EventManager().EmitTypedEvent(&group.EventProposalTallyFinalized{ProposalId: p.Id, Status: p.Status, TallyResult: &tallyResult}) + if err != nil { + return err + } + } return nil From 504d63b00241bf8504fca047ee92e1e013231e24 Mon Sep 17 00:00:00 2001 From: Jeancarlo Date: Tue, 16 May 2023 15:20:59 -0600 Subject: [PATCH 02/19] linter fixes --- x/group/keeper/genesis.go | 2 +- x/group/keeper/proposal_executor.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x/group/keeper/genesis.go b/x/group/keeper/genesis.go index 26d016a1f1be..457fd461f7da 100644 --- a/x/group/keeper/genesis.go +++ b/x/group/keeper/genesis.go @@ -45,7 +45,7 @@ func (k Keeper) InitGenesis(ctx types.Context, cdc codec.JSONCodec, data json.Ra } // ExportGenesis returns the group module's exported genesis. -func (k Keeper) ExportGenesis(ctx types.Context, cdc codec.JSONCodec) *group.GenesisState { +func (k Keeper) ExportGenesis(ctx types.Context, _ codec.JSONCodec) *group.GenesisState { genesisState := group.NewGenesisState() var groups []*group.GroupInfo diff --git a/x/group/keeper/proposal_executor.go b/x/group/keeper/proposal_executor.go index abc2d86d8ba2..e5b88b27990c 100644 --- a/x/group/keeper/proposal_executor.go +++ b/x/group/keeper/proposal_executor.go @@ -14,7 +14,7 @@ import ( // doExecuteMsgs routes the messages to the registered handlers. Messages are limited to those that require no authZ or // by the account of group policy only. Otherwise this gives access to other peoples accounts as the sdk middlewares are bypassed -func (s Keeper) doExecuteMsgs(ctx sdk.Context, router baseapp.MessageRouter, proposal group.Proposal, groupPolicyAcc sdk.AccAddress, decisionPolicy group.DecisionPolicy) ([]sdk.Result, error) { +func (s Keeper) doExecuteMsgs(ctx sdk.Context, _ baseapp.MessageRouter, proposal group.Proposal, groupPolicyAcc sdk.AccAddress, decisionPolicy group.DecisionPolicy) ([]sdk.Result, error) { // Ensure it's not too early to execute the messages. minExecutionDate := proposal.SubmitTime.Add(decisionPolicy.GetMinExecutionPeriod()) if ctx.BlockTime().Before(minExecutionDate) { From f085f317b1065249081a095b08a0412a593a2bd6 Mon Sep 17 00:00:00 2001 From: Jeancarlo Date: Tue, 16 May 2023 16:02:20 -0600 Subject: [PATCH 03/19] added tests --- x/group/README.md | 1 + x/group/keeper/msg_server_test.go | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/x/group/README.md b/x/group/README.md index bc3d8c5c8407..dec989aedf52 100644 --- a/x/group/README.md +++ b/x/group/README.md @@ -49,6 +49,7 @@ This module allows the creation and management of on-chain multisig accounts and * [EventVote](#eventvote) * [EventExec](#eventexec) * [EventLeaveGroup](#eventleavegroup) + * [EventProposalTallyFinalized](#eventproposaltallyfinalized) * [Client](#client) * [CLI](#cli) * [gRPC](#grpc) diff --git a/x/group/keeper/msg_server_test.go b/x/group/keeper/msg_server_test.go index d3f42a4bb5ac..7d05870f26e3 100644 --- a/x/group/keeper/msg_server_test.go +++ b/x/group/keeper/msg_server_test.go @@ -20,6 +20,8 @@ import ( "github.com/golang/mock/gomock" ) +var EventTallyResult = "cosmos.group.v1.EventProposalTallyFinalized" + func (s *TestSuite) TestCreateGroupWithLotsOfMembers() { for i := 50; i < 70; i++ { membersResp := s.createGroupAndGetMembers(i) @@ -1806,6 +1808,15 @@ func (s *TestSuite) TestSubmitProposal() { s.Require().Contains(fromBalances, sdk.NewInt64Coin("test", 9900)) toBalances := s.bankKeeper.GetAllBalances(sdkCtx, addr2) s.Require().Contains(toBalances, sdk.NewInt64Coin("test", 100)) + events := sdkCtx.EventManager().ABCIEvents() + tallyEventFound := false + for _, e := range events { + if e.Type == EventTallyResult { + tallyEventFound = true + break + } + } + s.Require().True(tallyEventFound) }, }, "with try exec, not enough yes votes for proposal to pass": { @@ -2866,6 +2877,15 @@ func (s *TestSuite) TestExecPrunedProposalsAndVotes() { res, err := s.groupKeeper.VotesByProposal(sdkCtx, &group.QueryVotesByProposalRequest{ProposalId: proposalID}) s.Require().NoError(err) s.Require().Empty(res.GetVotes()) + events := sdkCtx.EventManager().ABCIEvents() + tallyEventFound := false + for _, e := range events { + if e.Type == EventTallyResult { + tallyEventFound = true + break + } + } + s.Require().True(tallyEventFound) } else { // Check that proposal and votes exists From b36acc7362aaba864964694796cb8d38c7015a3a Mon Sep 17 00:00:00 2001 From: Jeancarlo Date: Wed, 17 May 2023 09:52:17 -0600 Subject: [PATCH 04/19] added events --- api/cosmos/group/v1/events.pulsar.go | 266 +++++++++++++-------------- x/group/events.pb.go | 109 ++++++----- x/group/keeper/keeper.go | 17 ++ x/group/keeper/msg_server.go | 18 +- 4 files changed, 220 insertions(+), 190 deletions(-) diff --git a/api/cosmos/group/v1/events.pulsar.go b/api/cosmos/group/v1/events.pulsar.go index 21bf5a3aefe2..20ac0a54c6e7 100644 --- a/api/cosmos/group/v1/events.pulsar.go +++ b/api/cosmos/group/v1/events.pulsar.go @@ -3858,29 +3858,29 @@ func (x *fastReflection_EventLeaveGroup) ProtoMethods() *protoiface.Methods { } var ( - md_EventProposalTallyFinalized protoreflect.MessageDescriptor - fd_EventProposalTallyFinalized_proposal_id protoreflect.FieldDescriptor - fd_EventProposalTallyFinalized_status protoreflect.FieldDescriptor - fd_EventProposalTallyFinalized_tally_result protoreflect.FieldDescriptor + md_EventProposalFinalized protoreflect.MessageDescriptor + fd_EventProposalFinalized_proposal_id protoreflect.FieldDescriptor + fd_EventProposalFinalized_status protoreflect.FieldDescriptor + fd_EventProposalFinalized_tally_result protoreflect.FieldDescriptor ) func init() { file_cosmos_group_v1_events_proto_init() - md_EventProposalTallyFinalized = File_cosmos_group_v1_events_proto.Messages().ByName("EventProposalTallyFinalized") - fd_EventProposalTallyFinalized_proposal_id = md_EventProposalTallyFinalized.Fields().ByName("proposal_id") - fd_EventProposalTallyFinalized_status = md_EventProposalTallyFinalized.Fields().ByName("status") - fd_EventProposalTallyFinalized_tally_result = md_EventProposalTallyFinalized.Fields().ByName("tally_result") + md_EventProposalFinalized = File_cosmos_group_v1_events_proto.Messages().ByName("EventProposalFinalized") + fd_EventProposalFinalized_proposal_id = md_EventProposalFinalized.Fields().ByName("proposal_id") + fd_EventProposalFinalized_status = md_EventProposalFinalized.Fields().ByName("status") + fd_EventProposalFinalized_tally_result = md_EventProposalFinalized.Fields().ByName("tally_result") } -var _ protoreflect.Message = (*fastReflection_EventProposalTallyFinalized)(nil) +var _ protoreflect.Message = (*fastReflection_EventProposalFinalized)(nil) -type fastReflection_EventProposalTallyFinalized EventProposalTallyFinalized +type fastReflection_EventProposalFinalized EventProposalFinalized -func (x *EventProposalTallyFinalized) ProtoReflect() protoreflect.Message { - return (*fastReflection_EventProposalTallyFinalized)(x) +func (x *EventProposalFinalized) ProtoReflect() protoreflect.Message { + return (*fastReflection_EventProposalFinalized)(x) } -func (x *EventProposalTallyFinalized) slowProtoReflect() protoreflect.Message { +func (x *EventProposalFinalized) slowProtoReflect() protoreflect.Message { mi := &file_cosmos_group_v1_events_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -3892,43 +3892,43 @@ func (x *EventProposalTallyFinalized) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_EventProposalTallyFinalized_messageType fastReflection_EventProposalTallyFinalized_messageType -var _ protoreflect.MessageType = fastReflection_EventProposalTallyFinalized_messageType{} +var _fastReflection_EventProposalFinalized_messageType fastReflection_EventProposalFinalized_messageType +var _ protoreflect.MessageType = fastReflection_EventProposalFinalized_messageType{} -type fastReflection_EventProposalTallyFinalized_messageType struct{} +type fastReflection_EventProposalFinalized_messageType struct{} -func (x fastReflection_EventProposalTallyFinalized_messageType) Zero() protoreflect.Message { - return (*fastReflection_EventProposalTallyFinalized)(nil) +func (x fastReflection_EventProposalFinalized_messageType) Zero() protoreflect.Message { + return (*fastReflection_EventProposalFinalized)(nil) } -func (x fastReflection_EventProposalTallyFinalized_messageType) New() protoreflect.Message { - return new(fastReflection_EventProposalTallyFinalized) +func (x fastReflection_EventProposalFinalized_messageType) New() protoreflect.Message { + return new(fastReflection_EventProposalFinalized) } -func (x fastReflection_EventProposalTallyFinalized_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_EventProposalTallyFinalized +func (x fastReflection_EventProposalFinalized_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EventProposalFinalized } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_EventProposalTallyFinalized) Descriptor() protoreflect.MessageDescriptor { - return md_EventProposalTallyFinalized +func (x *fastReflection_EventProposalFinalized) Descriptor() protoreflect.MessageDescriptor { + return md_EventProposalFinalized } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_EventProposalTallyFinalized) Type() protoreflect.MessageType { - return _fastReflection_EventProposalTallyFinalized_messageType +func (x *fastReflection_EventProposalFinalized) Type() protoreflect.MessageType { + return _fastReflection_EventProposalFinalized_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_EventProposalTallyFinalized) New() protoreflect.Message { - return new(fastReflection_EventProposalTallyFinalized) +func (x *fastReflection_EventProposalFinalized) New() protoreflect.Message { + return new(fastReflection_EventProposalFinalized) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_EventProposalTallyFinalized) Interface() protoreflect.ProtoMessage { - return (*EventProposalTallyFinalized)(x) +func (x *fastReflection_EventProposalFinalized) Interface() protoreflect.ProtoMessage { + return (*EventProposalFinalized)(x) } // Range iterates over every populated field in an undefined order, @@ -3936,22 +3936,22 @@ func (x *fastReflection_EventProposalTallyFinalized) Interface() protoreflect.Pr // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_EventProposalTallyFinalized) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_EventProposalFinalized) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { if x.ProposalId != uint64(0) { value := protoreflect.ValueOfUint64(x.ProposalId) - if !f(fd_EventProposalTallyFinalized_proposal_id, value) { + if !f(fd_EventProposalFinalized_proposal_id, value) { return } } if x.Status != 0 { value := protoreflect.ValueOfEnum((protoreflect.EnumNumber)(x.Status)) - if !f(fd_EventProposalTallyFinalized_status, value) { + if !f(fd_EventProposalFinalized_status, value) { return } } if x.TallyResult != nil { value := protoreflect.ValueOfMessage(x.TallyResult.ProtoReflect()) - if !f(fd_EventProposalTallyFinalized_tally_result, value) { + if !f(fd_EventProposalFinalized_tally_result, value) { return } } @@ -3968,19 +3968,19 @@ func (x *fastReflection_EventProposalTallyFinalized) Range(f func(protoreflect.F // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_EventProposalTallyFinalized) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_EventProposalFinalized) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "cosmos.group.v1.EventProposalTallyFinalized.proposal_id": + case "cosmos.group.v1.EventProposalFinalized.proposal_id": return x.ProposalId != uint64(0) - case "cosmos.group.v1.EventProposalTallyFinalized.status": + case "cosmos.group.v1.EventProposalFinalized.status": return x.Status != 0 - case "cosmos.group.v1.EventProposalTallyFinalized.tally_result": + case "cosmos.group.v1.EventProposalFinalized.tally_result": return x.TallyResult != nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalTallyFinalized")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalFinalized")) } - panic(fmt.Errorf("message cosmos.group.v1.EventProposalTallyFinalized does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.group.v1.EventProposalFinalized does not contain field %s", fd.FullName())) } } @@ -3990,19 +3990,19 @@ func (x *fastReflection_EventProposalTallyFinalized) Has(fd protoreflect.FieldDe // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventProposalTallyFinalized) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_EventProposalFinalized) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "cosmos.group.v1.EventProposalTallyFinalized.proposal_id": + case "cosmos.group.v1.EventProposalFinalized.proposal_id": x.ProposalId = uint64(0) - case "cosmos.group.v1.EventProposalTallyFinalized.status": + case "cosmos.group.v1.EventProposalFinalized.status": x.Status = 0 - case "cosmos.group.v1.EventProposalTallyFinalized.tally_result": + case "cosmos.group.v1.EventProposalFinalized.tally_result": x.TallyResult = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalTallyFinalized")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalFinalized")) } - panic(fmt.Errorf("message cosmos.group.v1.EventProposalTallyFinalized does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.group.v1.EventProposalFinalized does not contain field %s", fd.FullName())) } } @@ -4012,22 +4012,22 @@ func (x *fastReflection_EventProposalTallyFinalized) Clear(fd protoreflect.Field // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_EventProposalTallyFinalized) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_EventProposalFinalized) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "cosmos.group.v1.EventProposalTallyFinalized.proposal_id": + case "cosmos.group.v1.EventProposalFinalized.proposal_id": value := x.ProposalId return protoreflect.ValueOfUint64(value) - case "cosmos.group.v1.EventProposalTallyFinalized.status": + case "cosmos.group.v1.EventProposalFinalized.status": value := x.Status return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) - case "cosmos.group.v1.EventProposalTallyFinalized.tally_result": + case "cosmos.group.v1.EventProposalFinalized.tally_result": value := x.TallyResult return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalTallyFinalized")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalFinalized")) } - panic(fmt.Errorf("message cosmos.group.v1.EventProposalTallyFinalized does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message cosmos.group.v1.EventProposalFinalized does not contain field %s", descriptor.FullName())) } } @@ -4041,19 +4041,19 @@ func (x *fastReflection_EventProposalTallyFinalized) Get(descriptor protoreflect // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventProposalTallyFinalized) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_EventProposalFinalized) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "cosmos.group.v1.EventProposalTallyFinalized.proposal_id": + case "cosmos.group.v1.EventProposalFinalized.proposal_id": x.ProposalId = value.Uint() - case "cosmos.group.v1.EventProposalTallyFinalized.status": + case "cosmos.group.v1.EventProposalFinalized.status": x.Status = (ProposalStatus)(value.Enum()) - case "cosmos.group.v1.EventProposalTallyFinalized.tally_result": + case "cosmos.group.v1.EventProposalFinalized.tally_result": x.TallyResult = value.Message().Interface().(*TallyResult) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalTallyFinalized")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalFinalized")) } - panic(fmt.Errorf("message cosmos.group.v1.EventProposalTallyFinalized does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.group.v1.EventProposalFinalized does not contain field %s", fd.FullName())) } } @@ -4067,52 +4067,52 @@ func (x *fastReflection_EventProposalTallyFinalized) Set(fd protoreflect.FieldDe // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventProposalTallyFinalized) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_EventProposalFinalized) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "cosmos.group.v1.EventProposalTallyFinalized.tally_result": + case "cosmos.group.v1.EventProposalFinalized.tally_result": if x.TallyResult == nil { x.TallyResult = new(TallyResult) } return protoreflect.ValueOfMessage(x.TallyResult.ProtoReflect()) - case "cosmos.group.v1.EventProposalTallyFinalized.proposal_id": - panic(fmt.Errorf("field proposal_id of message cosmos.group.v1.EventProposalTallyFinalized is not mutable")) - case "cosmos.group.v1.EventProposalTallyFinalized.status": - panic(fmt.Errorf("field status of message cosmos.group.v1.EventProposalTallyFinalized is not mutable")) + case "cosmos.group.v1.EventProposalFinalized.proposal_id": + panic(fmt.Errorf("field proposal_id of message cosmos.group.v1.EventProposalFinalized is not mutable")) + case "cosmos.group.v1.EventProposalFinalized.status": + panic(fmt.Errorf("field status of message cosmos.group.v1.EventProposalFinalized is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalTallyFinalized")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalFinalized")) } - panic(fmt.Errorf("message cosmos.group.v1.EventProposalTallyFinalized does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.group.v1.EventProposalFinalized does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_EventProposalTallyFinalized) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_EventProposalFinalized) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "cosmos.group.v1.EventProposalTallyFinalized.proposal_id": + case "cosmos.group.v1.EventProposalFinalized.proposal_id": return protoreflect.ValueOfUint64(uint64(0)) - case "cosmos.group.v1.EventProposalTallyFinalized.status": + case "cosmos.group.v1.EventProposalFinalized.status": return protoreflect.ValueOfEnum(0) - case "cosmos.group.v1.EventProposalTallyFinalized.tally_result": + case "cosmos.group.v1.EventProposalFinalized.tally_result": m := new(TallyResult) return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalTallyFinalized")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalFinalized")) } - panic(fmt.Errorf("message cosmos.group.v1.EventProposalTallyFinalized does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.group.v1.EventProposalFinalized does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_EventProposalTallyFinalized) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_EventProposalFinalized) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in cosmos.group.v1.EventProposalTallyFinalized", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in cosmos.group.v1.EventProposalFinalized", d.FullName())) } panic("unreachable") } @@ -4120,7 +4120,7 @@ func (x *fastReflection_EventProposalTallyFinalized) WhichOneof(d protoreflect.O // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_EventProposalTallyFinalized) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_EventProposalFinalized) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -4131,7 +4131,7 @@ func (x *fastReflection_EventProposalTallyFinalized) GetUnknown() protoreflect.R // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventProposalTallyFinalized) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_EventProposalFinalized) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -4143,7 +4143,7 @@ func (x *fastReflection_EventProposalTallyFinalized) SetUnknown(fields protorefl // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_EventProposalTallyFinalized) IsValid() bool { +func (x *fastReflection_EventProposalFinalized) IsValid() bool { return x != nil } @@ -4153,9 +4153,9 @@ func (x *fastReflection_EventProposalTallyFinalized) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_EventProposalTallyFinalized) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_EventProposalFinalized) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*EventProposalTallyFinalized) + x := input.Message.Interface().(*EventProposalFinalized) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -4187,7 +4187,7 @@ func (x *fastReflection_EventProposalTallyFinalized) ProtoMethods() *protoiface. } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*EventProposalTallyFinalized) + x := input.Message.Interface().(*EventProposalFinalized) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -4241,7 +4241,7 @@ func (x *fastReflection_EventProposalTallyFinalized) ProtoMethods() *protoiface. }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*EventProposalTallyFinalized) + x := input.Message.Interface().(*EventProposalFinalized) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -4273,10 +4273,10 @@ func (x *fastReflection_EventProposalTallyFinalized) ProtoMethods() *protoiface. fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventProposalTallyFinalized: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventProposalFinalized: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventProposalTallyFinalized: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventProposalFinalized: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4764,7 +4764,7 @@ func (x *EventLeaveGroup) GetAddress() string { } // EventProposalTallyFinalized is an event emitted when a proposal tally is finalized. -type EventProposalTallyFinalized struct { +type EventProposalFinalized struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -4777,8 +4777,8 @@ type EventProposalTallyFinalized struct { TallyResult *TallyResult `protobuf:"bytes,3,opt,name=tally_result,json=tallyResult,proto3" json:"tally_result,omitempty"` } -func (x *EventProposalTallyFinalized) Reset() { - *x = EventProposalTallyFinalized{} +func (x *EventProposalFinalized) Reset() { + *x = EventProposalFinalized{} if protoimpl.UnsafeEnabled { mi := &file_cosmos_group_v1_events_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -4786,32 +4786,32 @@ func (x *EventProposalTallyFinalized) Reset() { } } -func (x *EventProposalTallyFinalized) String() string { +func (x *EventProposalFinalized) String() string { return protoimpl.X.MessageStringOf(x) } -func (*EventProposalTallyFinalized) ProtoMessage() {} +func (*EventProposalFinalized) ProtoMessage() {} -// Deprecated: Use EventProposalTallyFinalized.ProtoReflect.Descriptor instead. -func (*EventProposalTallyFinalized) Descriptor() ([]byte, []int) { +// Deprecated: Use EventProposalFinalized.ProtoReflect.Descriptor instead. +func (*EventProposalFinalized) Descriptor() ([]byte, []int) { return file_cosmos_group_v1_events_proto_rawDescGZIP(), []int{9} } -func (x *EventProposalTallyFinalized) GetProposalId() uint64 { +func (x *EventProposalFinalized) GetProposalId() uint64 { if x != nil { return x.ProposalId } return 0 } -func (x *EventProposalTallyFinalized) GetStatus() ProposalStatus { +func (x *EventProposalFinalized) GetStatus() ProposalStatus { if x != nil { return x.Status } return ProposalStatus_PROPOSAL_STATUS_UNSPECIFIED } -func (x *EventProposalTallyFinalized) GetTallyResult() *TallyResult { +func (x *EventProposalFinalized) GetTallyResult() *TallyResult { if x != nil { return x.TallyResult } @@ -4867,30 +4867,30 @@ var file_cosmos_group_v1_events_proto_rawDesc = []byte{ 0x70, 0x49, 0x64, 0x12, 0x32, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 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, 0x07, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0xb8, 0x01, 0x0a, 0x1b, 0x45, 0x76, 0x65, 0x6e, - 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x54, 0x61, 0x6c, 0x6c, 0x79, 0x46, 0x69, - 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 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, 0x37, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, - 0x73, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x3f, 0x0a, 0x0c, 0x74, 0x61, 0x6c, 0x6c, 0x79, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x6c, 0x6c, 0x79, 0x52, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x0b, 0x74, 0x61, 0x6c, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x42, 0xaa, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x45, 0x76, 0x65, 0x6e, - 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 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, 0x72, 0x6f, 0x75, 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x67, 0x72, 0x6f, 0x75, - 0x70, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x47, 0x58, 0xaa, 0x02, 0x0f, 0x43, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0f, 0x43, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1b, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x5c, 0x56, 0x31, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x43, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x3a, 0x3a, 0x56, 0x31, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0xb3, 0x01, 0x0a, 0x16, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, + 0x65, 0x64, 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, 0x37, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x72, 0x6f, + 0x75, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x3f, 0x0a, 0x0c, + 0x74, 0x61, 0x6c, 0x6c, 0x79, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x6c, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x52, 0x0b, 0x74, 0x61, 0x6c, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0xaa, 0x01, + 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x72, 0x6f, + 0x75, 0x70, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 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, 0x72, + 0x6f, 0x75, 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x76, 0x31, 0xa2, 0x02, + 0x03, 0x43, 0x47, 0x58, 0xaa, 0x02, 0x0f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x5c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, + 0x3a, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -4907,24 +4907,24 @@ func file_cosmos_group_v1_events_proto_rawDescGZIP() []byte { var file_cosmos_group_v1_events_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_cosmos_group_v1_events_proto_goTypes = []interface{}{ - (*EventCreateGroup)(nil), // 0: cosmos.group.v1.EventCreateGroup - (*EventUpdateGroup)(nil), // 1: cosmos.group.v1.EventUpdateGroup - (*EventCreateGroupPolicy)(nil), // 2: cosmos.group.v1.EventCreateGroupPolicy - (*EventUpdateGroupPolicy)(nil), // 3: cosmos.group.v1.EventUpdateGroupPolicy - (*EventSubmitProposal)(nil), // 4: cosmos.group.v1.EventSubmitProposal - (*EventWithdrawProposal)(nil), // 5: cosmos.group.v1.EventWithdrawProposal - (*EventVote)(nil), // 6: cosmos.group.v1.EventVote - (*EventExec)(nil), // 7: cosmos.group.v1.EventExec - (*EventLeaveGroup)(nil), // 8: cosmos.group.v1.EventLeaveGroup - (*EventProposalTallyFinalized)(nil), // 9: cosmos.group.v1.EventProposalTallyFinalized - (ProposalExecutorResult)(0), // 10: cosmos.group.v1.ProposalExecutorResult - (ProposalStatus)(0), // 11: cosmos.group.v1.ProposalStatus - (*TallyResult)(nil), // 12: cosmos.group.v1.TallyResult + (*EventCreateGroup)(nil), // 0: cosmos.group.v1.EventCreateGroup + (*EventUpdateGroup)(nil), // 1: cosmos.group.v1.EventUpdateGroup + (*EventCreateGroupPolicy)(nil), // 2: cosmos.group.v1.EventCreateGroupPolicy + (*EventUpdateGroupPolicy)(nil), // 3: cosmos.group.v1.EventUpdateGroupPolicy + (*EventSubmitProposal)(nil), // 4: cosmos.group.v1.EventSubmitProposal + (*EventWithdrawProposal)(nil), // 5: cosmos.group.v1.EventWithdrawProposal + (*EventVote)(nil), // 6: cosmos.group.v1.EventVote + (*EventExec)(nil), // 7: cosmos.group.v1.EventExec + (*EventLeaveGroup)(nil), // 8: cosmos.group.v1.EventLeaveGroup + (*EventProposalFinalized)(nil), // 9: cosmos.group.v1.EventProposalFinalized + (ProposalExecutorResult)(0), // 10: cosmos.group.v1.ProposalExecutorResult + (ProposalStatus)(0), // 11: cosmos.group.v1.ProposalStatus + (*TallyResult)(nil), // 12: cosmos.group.v1.TallyResult } var file_cosmos_group_v1_events_proto_depIdxs = []int32{ 10, // 0: cosmos.group.v1.EventExec.result:type_name -> cosmos.group.v1.ProposalExecutorResult - 11, // 1: cosmos.group.v1.EventProposalTallyFinalized.status:type_name -> cosmos.group.v1.ProposalStatus - 12, // 2: cosmos.group.v1.EventProposalTallyFinalized.tally_result:type_name -> cosmos.group.v1.TallyResult + 11, // 1: cosmos.group.v1.EventProposalFinalized.status:type_name -> cosmos.group.v1.ProposalStatus + 12, // 2: cosmos.group.v1.EventProposalFinalized.tally_result:type_name -> cosmos.group.v1.TallyResult 3, // [3:3] is the sub-list for method output_type 3, // [3:3] is the sub-list for method input_type 3, // [3:3] is the sub-list for extension type_name @@ -5048,7 +5048,7 @@ func file_cosmos_group_v1_events_proto_init() { } } file_cosmos_group_v1_events_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EventProposalTallyFinalized); i { + switch v := v.(*EventProposalFinalized); i { case 0: return &v.state case 1: diff --git a/x/group/events.pb.go b/x/group/events.pb.go index 608e690b3e5f..f3271155ab17 100644 --- a/x/group/events.pb.go +++ b/x/group/events.pb.go @@ -465,7 +465,7 @@ func (m *EventLeaveGroup) GetAddress() string { } // EventProposalTallyFinalized is an event emitted when a proposal tally is finalized. -type EventProposalTallyFinalized struct { +type EventProposalFinalized struct { // proposal_id is the unique ID of the proposal. ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` // result is the proposal tally result. @@ -474,18 +474,18 @@ type EventProposalTallyFinalized struct { TallyResult *TallyResult `protobuf:"bytes,3,opt,name=tally_result,json=tallyResult,proto3" json:"tally_result,omitempty"` } -func (m *EventProposalTallyFinalized) Reset() { *m = EventProposalTallyFinalized{} } -func (m *EventProposalTallyFinalized) String() string { return proto.CompactTextString(m) } -func (*EventProposalTallyFinalized) ProtoMessage() {} -func (*EventProposalTallyFinalized) Descriptor() ([]byte, []int) { +func (m *EventProposalFinalized) Reset() { *m = EventProposalFinalized{} } +func (m *EventProposalFinalized) String() string { return proto.CompactTextString(m) } +func (*EventProposalFinalized) ProtoMessage() {} +func (*EventProposalFinalized) Descriptor() ([]byte, []int) { return fileDescriptor_e8d753981546f032, []int{9} } -func (m *EventProposalTallyFinalized) XXX_Unmarshal(b []byte) error { +func (m *EventProposalFinalized) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EventProposalTallyFinalized) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EventProposalFinalized) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EventProposalTallyFinalized.Marshal(b, m, deterministic) + return xxx_messageInfo_EventProposalFinalized.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -495,33 +495,33 @@ func (m *EventProposalTallyFinalized) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *EventProposalTallyFinalized) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventProposalTallyFinalized.Merge(m, src) +func (m *EventProposalFinalized) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventProposalFinalized.Merge(m, src) } -func (m *EventProposalTallyFinalized) XXX_Size() int { +func (m *EventProposalFinalized) XXX_Size() int { return m.Size() } -func (m *EventProposalTallyFinalized) XXX_DiscardUnknown() { - xxx_messageInfo_EventProposalTallyFinalized.DiscardUnknown(m) +func (m *EventProposalFinalized) XXX_DiscardUnknown() { + xxx_messageInfo_EventProposalFinalized.DiscardUnknown(m) } -var xxx_messageInfo_EventProposalTallyFinalized proto.InternalMessageInfo +var xxx_messageInfo_EventProposalFinalized proto.InternalMessageInfo -func (m *EventProposalTallyFinalized) GetProposalId() uint64 { +func (m *EventProposalFinalized) GetProposalId() uint64 { if m != nil { return m.ProposalId } return 0 } -func (m *EventProposalTallyFinalized) GetStatus() ProposalStatus { +func (m *EventProposalFinalized) GetStatus() ProposalStatus { if m != nil { return m.Status } return PROPOSAL_STATUS_UNSPECIFIED } -func (m *EventProposalTallyFinalized) GetTallyResult() *TallyResult { +func (m *EventProposalFinalized) GetTallyResult() *TallyResult { if m != nil { return m.TallyResult } @@ -538,42 +538,41 @@ func init() { proto.RegisterType((*EventVote)(nil), "cosmos.group.v1.EventVote") proto.RegisterType((*EventExec)(nil), "cosmos.group.v1.EventExec") proto.RegisterType((*EventLeaveGroup)(nil), "cosmos.group.v1.EventLeaveGroup") - proto.RegisterType((*EventProposalTallyFinalized)(nil), "cosmos.group.v1.EventProposalTallyFinalized") + proto.RegisterType((*EventProposalFinalized)(nil), "cosmos.group.v1.EventProposalFinalized") } func init() { proto.RegisterFile("cosmos/group/v1/events.proto", fileDescriptor_e8d753981546f032) } var fileDescriptor_e8d753981546f032 = []byte{ - // 450 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0x4b, 0x6b, 0x13, 0x41, - 0x1c, 0xcf, 0xd4, 0x92, 0xda, 0x7f, 0xc4, 0xca, 0xf8, 0x20, 0x7d, 0xb0, 0x2d, 0x41, 0xb0, 0x07, - 0xb3, 0x4b, 0x23, 0xa8, 0x27, 0x8b, 0x95, 0x2a, 0x85, 0x1e, 0xca, 0xc6, 0x07, 0x78, 0x89, 0x93, - 0x9d, 0x61, 0x3b, 0xb8, 0xc9, 0x2c, 0x33, 0xb3, 0x6b, 0xe3, 0xcd, 0x6f, 0xe0, 0x87, 0xf1, 0xe0, - 0x47, 0xf0, 0x58, 0x3c, 0x79, 0x94, 0xe4, 0x8b, 0xc8, 0xfe, 0x77, 0xb6, 0x2d, 0x11, 0xd9, 0x80, - 0xa7, 0x9d, 0x99, 0xdf, 0xe3, 0xff, 0xda, 0x3f, 0x6c, 0x45, 0xca, 0x8c, 0x94, 0x09, 0x62, 0xad, - 0xb2, 0x34, 0xc8, 0xf7, 0x02, 0x91, 0x8b, 0xb1, 0x35, 0x7e, 0xaa, 0x95, 0x55, 0x74, 0xad, 0x44, - 0x7d, 0x44, 0xfd, 0x7c, 0x6f, 0x63, 0xbd, 0x7c, 0x18, 0x20, 0x1c, 0x38, 0x14, 0x2f, 0x1b, 0x9b, - 0xf3, 0x4e, 0x76, 0x92, 0x0a, 0x07, 0x76, 0xba, 0x70, 0xeb, 0xb0, 0x30, 0x7e, 0xa1, 0x05, 0xb3, - 0xe2, 0x55, 0x41, 0xa1, 0xeb, 0x70, 0x1d, 0xb9, 0x03, 0xc9, 0xdb, 0x64, 0x87, 0xec, 0x2e, 0x87, - 0x2b, 0x78, 0x3f, 0xe2, 0x17, 0xf4, 0x37, 0x29, 0x5f, 0x84, 0x7e, 0x0c, 0xf7, 0xe6, 0xdd, 0x4f, - 0x54, 0x22, 0xa3, 0x09, 0xed, 0xc1, 0x0a, 0xe3, 0x5c, 0x0b, 0x63, 0x50, 0xb3, 0x7a, 0xd0, 0xfe, - 0xf9, 0xad, 0x7b, 0xc7, 0xe5, 0xfd, 0xbc, 0x44, 0xfa, 0x56, 0xcb, 0x71, 0x1c, 0x56, 0xc4, 0x0b, - 0xb7, 0x2b, 0xc1, 0xff, 0xc3, 0xed, 0x31, 0xdc, 0x46, 0xb7, 0x7e, 0x36, 0x1c, 0x49, 0x7b, 0xa2, - 0x55, 0xaa, 0x0c, 0x4b, 0xe8, 0x36, 0xb4, 0x52, 0x77, 0xbe, 0x2c, 0x08, 0xaa, 0xa7, 0x23, 0xde, - 0x79, 0x0a, 0x77, 0x51, 0xf7, 0x4e, 0xda, 0x53, 0xae, 0xd9, 0xa7, 0xc5, 0x95, 0x0f, 0x61, 0x15, - 0x95, 0x6f, 0x95, 0x15, 0xf5, 0xec, 0x2f, 0xc4, 0xd1, 0x0f, 0xcf, 0x44, 0x54, 0x4b, 0xa7, 0xfb, - 0xd0, 0xd4, 0xc2, 0x64, 0x89, 0x6d, 0x2f, 0xed, 0x90, 0xdd, 0x9b, 0xbd, 0x07, 0xfe, 0xdc, 0x2f, - 0xe2, 0x57, 0x89, 0x16, 0x7e, 0x99, 0x55, 0x3a, 0x44, 0x7a, 0xe8, 0x64, 0x94, 0xc2, 0x72, 0xa2, - 0x62, 0xd3, 0xbe, 0x56, 0x34, 0x30, 0xc4, 0x73, 0xe7, 0x03, 0xac, 0x61, 0x0a, 0xc7, 0x82, 0xe5, - 0xb5, 0xd3, 0xbe, 0x3a, 0x85, 0xa5, 0x45, 0xa7, 0xf0, 0x9d, 0xc0, 0x26, 0x86, 0xa8, 0xb2, 0x7b, - 0xcd, 0x92, 0x64, 0xf2, 0x52, 0x8e, 0x59, 0x22, 0x3f, 0x0b, 0x5e, 0x5f, 0xf7, 0x13, 0x68, 0x1a, - 0xcb, 0x6c, 0x66, 0x5c, 0xdd, 0xdb, 0xff, 0xac, 0xbb, 0x8f, 0xb4, 0xd0, 0xd1, 0xe9, 0x3e, 0xdc, - 0xb0, 0x45, 0xac, 0x81, 0x6b, 0x5b, 0x51, 0x77, 0xab, 0xb7, 0xf5, 0x97, 0x1c, 0x13, 0x72, 0xbd, - 0x6a, 0xd9, 0xcb, 0xcb, 0xc1, 0xb3, 0x1f, 0x53, 0x8f, 0x9c, 0x4f, 0x3d, 0xf2, 0x7b, 0xea, 0x91, - 0xaf, 0x33, 0xaf, 0x71, 0x3e, 0xf3, 0x1a, 0xbf, 0x66, 0x5e, 0xe3, 0xfd, 0xfd, 0x58, 0xda, 0xd3, - 0x6c, 0xe8, 0x47, 0x6a, 0xe4, 0x56, 0xd1, 0x7d, 0xba, 0x86, 0x7f, 0x0c, 0xce, 0xca, 0x4d, 0x1c, - 0x36, 0x71, 0x03, 0x1f, 0xfd, 0x09, 0x00, 0x00, 0xff, 0xff, 0x8f, 0xd0, 0xca, 0xef, 0xea, 0x03, - 0x00, 0x00, + // 448 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0x4f, 0x8f, 0x12, 0x31, + 0x18, 0xc6, 0xe9, 0xba, 0x61, 0xdd, 0x62, 0x5c, 0x53, 0xff, 0x64, 0x76, 0xdd, 0xcc, 0x6e, 0x88, + 0x89, 0x1c, 0x64, 0x26, 0x60, 0xa2, 0x9e, 0x24, 0x62, 0xd0, 0x90, 0x70, 0x20, 0x83, 0x7f, 0x12, + 0x2f, 0x58, 0xa6, 0xcd, 0xd0, 0x38, 0xd0, 0x49, 0xdb, 0x19, 0xc1, 0x9b, 0xdf, 0xc0, 0xef, 0xa2, + 0x1f, 0xc2, 0x23, 0xf1, 0xe4, 0xd1, 0xc0, 0x17, 0x31, 0xd3, 0xe9, 0x00, 0xc1, 0x98, 0x21, 0xd9, + 0x13, 0x6d, 0x9f, 0xdf, 0xf3, 0xf0, 0xbe, 0x7d, 0xa7, 0xf0, 0xdc, 0xe7, 0x72, 0xc2, 0xa5, 0x1b, + 0x08, 0x1e, 0x47, 0x6e, 0xd2, 0x70, 0x69, 0x42, 0xa7, 0x4a, 0x3a, 0x91, 0xe0, 0x8a, 0xa3, 0x93, + 0x4c, 0x75, 0xb4, 0xea, 0x24, 0x8d, 0xb3, 0xd3, 0xec, 0x60, 0xa8, 0x65, 0xd7, 0xa8, 0x7a, 0x73, + 0x76, 0x7f, 0x37, 0x49, 0xcd, 0x23, 0x6a, 0xc4, 0x6a, 0x1d, 0xde, 0xea, 0xa4, 0xc1, 0x2f, 0x05, + 0xc5, 0x8a, 0xbe, 0x4e, 0x11, 0x74, 0x0a, 0xaf, 0x6b, 0x76, 0xc8, 0x88, 0x05, 0x2e, 0x41, 0xed, + 0xd0, 0x3b, 0xd2, 0xfb, 0x2e, 0x59, 0xe3, 0x6f, 0x23, 0xb2, 0x0f, 0xde, 0x83, 0xf7, 0x76, 0xd3, + 0xfb, 0x3c, 0x64, 0xfe, 0x1c, 0x35, 0xe1, 0x11, 0x26, 0x44, 0x50, 0x29, 0xb5, 0xe7, 0xb8, 0x6d, + 0xfd, 0xfa, 0x51, 0xbf, 0x63, 0xea, 0x7e, 0x91, 0x29, 0x03, 0x25, 0xd8, 0x34, 0xf0, 0x72, 0x70, + 0x9d, 0xb6, 0xf5, 0xe7, 0x57, 0x48, 0x7b, 0x02, 0x6f, 0xeb, 0xb4, 0x41, 0x3c, 0x9a, 0x30, 0xd5, + 0x17, 0x3c, 0xe2, 0x12, 0x87, 0xe8, 0x02, 0x56, 0x22, 0xb3, 0xde, 0x34, 0x04, 0xf3, 0xa3, 0x2e, + 0xa9, 0x3e, 0x83, 0x77, 0xb5, 0xef, 0x3d, 0x53, 0x63, 0x22, 0xf0, 0xe7, 0xfd, 0x9d, 0x8f, 0xe0, + 0xb1, 0x76, 0xbe, 0xe3, 0x8a, 0x16, 0xd3, 0x5f, 0x81, 0xc1, 0x3b, 0x33, 0xea, 0x17, 0xe2, 0xa8, + 0x05, 0xcb, 0x82, 0xca, 0x38, 0x54, 0xd6, 0xc1, 0x25, 0xa8, 0xdd, 0x6c, 0x3e, 0x74, 0x76, 0x3e, + 0x11, 0x27, 0x2f, 0x34, 0xcd, 0x8b, 0x15, 0x17, 0x9e, 0xc6, 0x3d, 0x63, 0x43, 0x08, 0x1e, 0x86, + 0x3c, 0x90, 0xd6, 0xb5, 0xf4, 0x02, 0x3d, 0xbd, 0xae, 0x7e, 0x84, 0x27, 0xba, 0x84, 0x1e, 0xc5, + 0x49, 0xe1, 0xb4, 0xb7, 0xa7, 0x70, 0xb0, 0xef, 0x14, 0xbe, 0x03, 0x33, 0xd4, 0xbc, 0xba, 0x57, + 0x6c, 0x8a, 0x43, 0xf6, 0x85, 0x92, 0xe2, 0x96, 0x9f, 0xc2, 0xb2, 0x54, 0x58, 0xc5, 0xd2, 0xb4, + 0x7c, 0xf1, 0xdf, 0x96, 0x07, 0x1a, 0xf3, 0x0c, 0x8e, 0x5a, 0xf0, 0x86, 0xc2, 0x61, 0x38, 0x1f, + 0x9a, 0x1b, 0x4b, 0x5b, 0xae, 0x34, 0xcf, 0xff, 0xb1, 0xbf, 0x49, 0x21, 0x73, 0x4d, 0x15, 0xb5, + 0xd9, 0xb4, 0x9f, 0xff, 0x5c, 0xda, 0x60, 0xb1, 0xb4, 0xc1, 0x9f, 0xa5, 0x0d, 0xbe, 0xad, 0xec, + 0xd2, 0x62, 0x65, 0x97, 0x7e, 0xaf, 0xec, 0xd2, 0x87, 0x07, 0x01, 0x53, 0xe3, 0x78, 0xe4, 0xf8, + 0x7c, 0x62, 0x5e, 0xa1, 0xf9, 0xa9, 0x4b, 0xf2, 0xc9, 0x9d, 0x65, 0x8f, 0x70, 0x54, 0xd6, 0x8f, + 0xef, 0xf1, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8f, 0x91, 0x58, 0x4f, 0xe5, 0x03, 0x00, 0x00, } func (m *EventCreateGroup) Marshal() (dAtA []byte, err error) { @@ -851,7 +850,7 @@ func (m *EventLeaveGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *EventProposalTallyFinalized) Marshal() (dAtA []byte, err error) { +func (m *EventProposalFinalized) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -861,12 +860,12 @@ func (m *EventProposalTallyFinalized) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EventProposalTallyFinalized) MarshalTo(dAtA []byte) (int, error) { +func (m *EventProposalFinalized) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventProposalTallyFinalized) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventProposalFinalized) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1028,7 +1027,7 @@ func (m *EventLeaveGroup) Size() (n int) { return n } -func (m *EventProposalTallyFinalized) Size() (n int) { +func (m *EventProposalFinalized) Size() (n int) { if m == nil { return 0 } @@ -1783,7 +1782,7 @@ func (m *EventLeaveGroup) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventProposalTallyFinalized) Unmarshal(dAtA []byte) error { +func (m *EventProposalFinalized) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1806,10 +1805,10 @@ func (m *EventProposalTallyFinalized) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventProposalTallyFinalized: wiretype end group for non-group") + return fmt.Errorf("proto: EventProposalFinalized: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventProposalTallyFinalized: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventProposalFinalized: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/x/group/keeper/keeper.go b/x/group/keeper/keeper.go index c3b705b2c369..250331946c28 100644 --- a/x/group/keeper/keeper.go +++ b/x/group/keeper/keeper.go @@ -375,6 +375,15 @@ func (k Keeper) PruneProposals(ctx sdk.Context) error { if err != nil { return err } + // Emit event for proposal finalized with its result + if err := ctx.EventManager().EmitTypedEvent( + &group.EventProposalFinalized{ + ProposalId: proposal.Id, + Status: proposal.Status, + TallyResult: &proposal.FinalTallyResult, + }); err != nil { + return err + } } return nil @@ -408,6 +417,14 @@ func (k Keeper) TallyProposalsAtVPEnd(ctx sdk.Context) error { if err := k.pruneVotes(ctx, proposalID); err != nil { return err } + // Emit event for proposal finalized with its result + if err := ctx.EventManager().EmitTypedEvent( + &group.EventProposalFinalized{ + ProposalId: proposal.Id, + Status: proposal.Status, + }); err != nil { + return err + } } else if proposal.Status == group.PROPOSAL_STATUS_SUBMITTED { if err := k.doTallyAndUpdate(ctx, &proposal, electorate, policyInfo); err != nil { return errorsmod.Wrap(err, "doTallyAndUpdate") diff --git a/x/group/keeper/msg_server.go b/x/group/keeper/msg_server.go index 55cb0da68d31..6f652bace3fd 100644 --- a/x/group/keeper/msg_server.go +++ b/x/group/keeper/msg_server.go @@ -663,6 +663,10 @@ func (k Keeper) WithdrawProposal(goCtx context.Context, msg *group.MsgWithdrawPr return nil, err } + if err := ctx.EventManager().EmitTypedEvent(&group.EventProposalFinalized{ProposalId: proposal.Id, Status: proposal.Status}); err != nil { + return nil, err + } + if err := ctx.EventManager().EmitTypedEvent(&group.EventWithdrawProposal{ProposalId: msg.ProposalId}); err != nil { return nil, err } @@ -782,7 +786,7 @@ func (k Keeper) doTallyAndUpdate(ctx sdk.Context, p *group.Proposal, groupInfo g } else { p.Status = group.PROPOSAL_STATUS_REJECTED } - err = ctx.EventManager().EmitTypedEvent(&group.EventProposalTallyFinalized{ProposalId: p.Id, Status: p.Status, TallyResult: &tallyResult}) + if err != nil { return err } @@ -822,7 +826,7 @@ func (k Keeper) Exec(goCtx context.Context, msg *group.MsgExec) (*group.MsgExecR return nil, errorsmod.Wrap(err, "load group") } - if err := k.doTallyAndUpdate(ctx, &proposal, groupInfo, policyInfo); err != nil { + if err = k.doTallyAndUpdate(ctx, &proposal, groupInfo, policyInfo); err != nil { return nil, err } } @@ -860,6 +864,16 @@ func (k Keeper) Exec(goCtx context.Context, msg *group.MsgExec) (*group.MsgExecR if err := k.pruneProposal(ctx, proposal.Id); err != nil { return nil, err } + + // Emit event for proposal finalized with its result + if err := ctx.EventManager().EmitTypedEvent( + &group.EventProposalFinalized{ + ProposalId: proposal.Id, + Status: proposal.Status, + TallyResult: &proposal.FinalTallyResult, + }); err != nil { + return nil, err + } } else { store := ctx.KVStore(k.key) if err := k.proposalTable.Update(store, proposal.Id, &proposal); err != nil { From f2f6c0b8bd9cd38bdb360cf3e7f3409ce05f88f5 Mon Sep 17 00:00:00 2001 From: Jeancarlo Date: Wed, 17 May 2023 09:55:02 -0600 Subject: [PATCH 05/19] added events --- x/group/keeper/msg_server_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/group/keeper/msg_server_test.go b/x/group/keeper/msg_server_test.go index 7d05870f26e3..2192016a942e 100644 --- a/x/group/keeper/msg_server_test.go +++ b/x/group/keeper/msg_server_test.go @@ -20,7 +20,7 @@ import ( "github.com/golang/mock/gomock" ) -var EventTallyResult = "cosmos.group.v1.EventProposalTallyFinalized" +var EventTallyResult = "cosmos.group.v1.EventProposalFinalized" func (s *TestSuite) TestCreateGroupWithLotsOfMembers() { for i := 50; i < 70; i++ { From 891631c16aa4edd67f95658ea1f42bbbc8f6d0bc Mon Sep 17 00:00:00 2001 From: Jeancarlo Date: Wed, 17 May 2023 11:29:38 -0600 Subject: [PATCH 06/19] added events --- proto/cosmos/group/v1/events.proto | 2 +- x/group/keeper/msg_server_test.go | 75 ++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletion(-) diff --git a/proto/cosmos/group/v1/events.proto b/proto/cosmos/group/v1/events.proto index 3474d3c53785..e35ff215e2ba 100644 --- a/proto/cosmos/group/v1/events.proto +++ b/proto/cosmos/group/v1/events.proto @@ -81,7 +81,7 @@ message EventLeaveGroup { } // EventProposalTallyFinalized is an event emitted when a proposal tally is finalized. -message EventProposalTallyFinalized { +message EventProposalFinalized { // proposal_id is the unique ID of the proposal. uint64 proposal_id = 1; diff --git a/x/group/keeper/msg_server_test.go b/x/group/keeper/msg_server_test.go index 2192016a942e..3e048ad495f0 100644 --- a/x/group/keeper/msg_server_test.go +++ b/x/group/keeper/msg_server_test.go @@ -1909,6 +1909,7 @@ func (s *TestSuite) TestWithdrawProposal() { proposalID uint64 admin string expErrMsg string + postRun func(sdkCtx sdk.Context) }{ "wrong admin": { preRun: func(sdkCtx sdk.Context) uint64 { @@ -1916,6 +1917,7 @@ func (s *TestSuite) TestWithdrawProposal() { }, admin: addr5.String(), expErrMsg: "unauthorized", + postRun: func(sdkCtx sdk.Context) {}, }, "wrong proposal id": { preRun: func(sdkCtx sdk.Context) uint64 { @@ -1923,6 +1925,7 @@ func (s *TestSuite) TestWithdrawProposal() { }, admin: proposers[0], expErrMsg: "not found", + postRun: func(sdkCtx sdk.Context) {}, }, "happy case with proposer": { preRun: func(sdkCtx sdk.Context) uint64 { @@ -1930,6 +1933,7 @@ func (s *TestSuite) TestWithdrawProposal() { }, proposalID: proposalID, admin: proposers[0], + postRun: func(sdkCtx sdk.Context) {}, }, "already closed proposal": { preRun: func(sdkCtx sdk.Context) uint64 { @@ -1944,6 +1948,7 @@ func (s *TestSuite) TestWithdrawProposal() { proposalID: proposalID, admin: proposers[0], expErrMsg: "cannot withdraw a proposal with the status of PROPOSAL_STATUS_WITHDRAWN", + postRun: func(sdkCtx sdk.Context) {}, }, "happy case with group admin address": { preRun: func(sdkCtx sdk.Context) uint64 { @@ -1951,6 +1956,17 @@ func (s *TestSuite) TestWithdrawProposal() { }, proposalID: proposalID, admin: proposers[0], + postRun: func(sdkCtx sdk.Context) { + events := sdkCtx.EventManager().ABCIEvents() + tallyEventFound := false + for _, e := range events { + if e.Type == EventTallyResult { + tallyEventFound = true + break + } + } + s.Require().True(tallyEventFound) + }, }, } for msg, spec := range specs { @@ -1974,6 +1990,7 @@ func (s *TestSuite) TestWithdrawProposal() { s.Require().NoError(err) s.Require().Equal(resp.GetProposal().Status, group.PROPOSAL_STATUS_WITHDRAWN) }) + spec.postRun(s.sdkCtx) } } @@ -2501,6 +2518,7 @@ func (s *TestSuite) TestExecProposal() { expBalance bool expFromBalances sdk.Coin expToBalances sdk.Coin + checkEvents func(sdkCtx sdk.Context) }{ "proposal executed when accepted": { setupProposal: func(ctx context.Context) uint64 { @@ -2514,6 +2532,17 @@ func (s *TestSuite) TestExecProposal() { expBalance: true, expFromBalances: sdk.NewInt64Coin("test", 9900), expToBalances: sdk.NewInt64Coin("test", 100), + checkEvents: func(sdkCtx sdk.Context) { + events := sdkCtx.EventManager().ABCIEvents() + tallyEventFound := false + for _, e := range events { + if e.Type == EventTallyResult { + tallyEventFound = true + break + } + } + s.Require().True(tallyEventFound) + }, }, "proposal with multiple messages executed when accepted": { setupProposal: func(ctx context.Context) uint64 { @@ -2528,6 +2557,17 @@ func (s *TestSuite) TestExecProposal() { expBalance: true, expFromBalances: sdk.NewInt64Coin("test", 9800), expToBalances: sdk.NewInt64Coin("test", 200), + checkEvents: func(sdkCtx sdk.Context) { + events := sdkCtx.EventManager().ABCIEvents() + tallyEventFound := false + for _, e := range events { + if e.Type == EventTallyResult { + tallyEventFound = true + break + } + } + s.Require().True(tallyEventFound) + }, }, "proposal not executed when rejected": { setupProposal: func(ctx context.Context) uint64 { @@ -2537,6 +2577,17 @@ func (s *TestSuite) TestExecProposal() { srcBlockTime: s.blockTime.Add(minExecutionPeriod), // After min execution period end expProposalStatus: group.PROPOSAL_STATUS_REJECTED, expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_NOT_RUN, + checkEvents: func(sdkCtx sdk.Context) { + events := sdkCtx.EventManager().ABCIEvents() + tallyEventFound := false + for _, e := range events { + if e.Type == EventTallyResult { + tallyEventFound = true + break + } + } + s.Require().False(tallyEventFound) + }, }, "open proposal must not fail": { setupProposal: func(ctx context.Context) uint64 { @@ -2544,6 +2595,17 @@ func (s *TestSuite) TestExecProposal() { }, expProposalStatus: group.PROPOSAL_STATUS_SUBMITTED, expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_NOT_RUN, + checkEvents: func(sdkCtx sdk.Context) { + events := sdkCtx.EventManager().ABCIEvents() + tallyEventFound := false + for _, e := range events { + if e.Type == EventTallyResult { + tallyEventFound = true + break + } + } + s.Require().False(tallyEventFound) + }, }, "invalid proposal id": { setupProposal: func(ctx context.Context) uint64 { @@ -2567,6 +2629,17 @@ func (s *TestSuite) TestExecProposal() { srcBlockTime: s.blockTime.Add(time.Second), // Voting period is 1s expProposalStatus: group.PROPOSAL_STATUS_REJECTED, expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_NOT_RUN, + checkEvents: func(sdkCtx sdk.Context) { + events := sdkCtx.EventManager().ABCIEvents() + tallyEventFound := false + for _, e := range events { + if e.Type == EventTallyResult { + tallyEventFound = true + break + } + } + s.Require().True(tallyEventFound) + }, }, "Decision policy also applied after voting period end": { setupProposal: func(ctx context.Context) uint64 { @@ -2694,7 +2767,9 @@ func (s *TestSuite) TestExecProposal() { toBalances := s.bankKeeper.GetAllBalances(sdkCtx, addr2) s.Require().Contains(toBalances, spec.expToBalances) } + spec.checkEvents(sdkCtx) }) + } } From d25d5ecee241159721306bed333a002324a2d605 Mon Sep 17 00:00:00 2001 From: Jeancarlo Date: Wed, 17 May 2023 14:52:37 -0600 Subject: [PATCH 07/19] added events --- x/group/keeper/msg_server_test.go | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/x/group/keeper/msg_server_test.go b/x/group/keeper/msg_server_test.go index 3e048ad495f0..79df612ad8b5 100644 --- a/x/group/keeper/msg_server_test.go +++ b/x/group/keeper/msg_server_test.go @@ -2629,17 +2629,7 @@ func (s *TestSuite) TestExecProposal() { srcBlockTime: s.blockTime.Add(time.Second), // Voting period is 1s expProposalStatus: group.PROPOSAL_STATUS_REJECTED, expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_NOT_RUN, - checkEvents: func(sdkCtx sdk.Context) { - events := sdkCtx.EventManager().ABCIEvents() - tallyEventFound := false - for _, e := range events { - if e.Type == EventTallyResult { - tallyEventFound = true - break - } - } - s.Require().True(tallyEventFound) - }, + checkEvents: func(sdkCtx sdk.Context) {}, }, "Decision policy also applied after voting period end": { setupProposal: func(ctx context.Context) uint64 { @@ -2649,6 +2639,7 @@ func (s *TestSuite) TestExecProposal() { srcBlockTime: s.blockTime.Add(time.Second).Add(time.Millisecond), // Voting period is 1s expProposalStatus: group.PROPOSAL_STATUS_REJECTED, expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_NOT_RUN, + checkEvents: func(sdkCtx sdk.Context) {}, }, "exec proposal before MinExecutionPeriod should fail": { setupProposal: func(ctx context.Context) uint64 { @@ -2658,6 +2649,7 @@ func (s *TestSuite) TestExecProposal() { srcBlockTime: s.blockTime.Add(4 * time.Second), // min execution date is 5s later after s.blockTime expProposalStatus: group.PROPOSAL_STATUS_ACCEPTED, expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_FAILURE, // Because MinExecutionPeriod has not passed + checkEvents: func(sdkCtx sdk.Context) {}, }, "exec proposal at exactly MinExecutionPeriod should pass": { setupProposal: func(ctx context.Context) uint64 { @@ -2668,6 +2660,17 @@ func (s *TestSuite) TestExecProposal() { srcBlockTime: s.blockTime.Add(5 * time.Second), // min execution date is 5s later after s.blockTime expProposalStatus: group.PROPOSAL_STATUS_ACCEPTED, expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_SUCCESS, + checkEvents: func(sdkCtx sdk.Context) { + events := sdkCtx.EventManager().ABCIEvents() + execEventFound := false + for _, e := range events { + if e.Type == EventTallyResult { + execEventFound = true + break + } + } + s.Require().True(execEventFound) + }, }, "prevent double execution when successful": { setupProposal: func(ctx context.Context) uint64 { From af0e90961ad2112679844ad5fdd9a68d68cfa918 Mon Sep 17 00:00:00 2001 From: Jeancarlo Date: Wed, 17 May 2023 14:53:53 -0600 Subject: [PATCH 08/19] updated readme --- x/group/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/x/group/README.md b/x/group/README.md index dec989aedf52..e3728b98b2bb 100644 --- a/x/group/README.md +++ b/x/group/README.md @@ -49,7 +49,7 @@ This module allows the creation and management of on-chain multisig accounts and * [EventVote](#eventvote) * [EventExec](#eventexec) * [EventLeaveGroup](#eventleavegroup) - * [EventProposalTallyFinalized](#eventproposaltallyfinalized) + * [EventProposalFinalized](#eventProposalFinalized) * [Client](#client) * [CLI](#cli) * [gRPC](#grpc) @@ -579,14 +579,14 @@ The group module emits the following events: | cosmos.group.v1.EventLeaveGroup | proposal_id | {proposalId} | | cosmos.group.v1.EventLeaveGroup | address | {address} | -### EventProposalTallyFinalized +### EventProposalFinalized -| Type | Attribute Key | Attribute Value | -|---------------------------------------------|---------------| ------------------------------- | -| message | action | /cosmos.group.v1.Msg/LeaveGroup | -| cosmos.group.v1.EventProposalTallyFinalized | proposal_id | {proposalId} | -| cosmos.group.v1.EventProposalTallyFinalized | status | {ProposalStatus} | -| cosmos.group.v1.EventProposalTallyFinalized | tally_result | {TallyResult} | +| Type | Attribute Key | Attribute Value | +|----------------------------------------|---------------| ------------------------------- | +| message | action | /cosmos.group.v1.Msg/LeaveGroup | +| cosmos.group.v1.EventProposalFinalized | proposal_id | {proposalId} | +| cosmos.group.v1.EventProposalFinalized | status | {ProposalStatus} | +| cosmos.group.v1.EventProposalFinalized | tally_result | {TallyResult} | ## Client From 165a2b2a36307ffee8a5fbdcf7ee44a407364482 Mon Sep 17 00:00:00 2001 From: Jeancarlo Date: Wed, 17 May 2023 14:57:06 -0600 Subject: [PATCH 09/19] updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd6e4f612921..a5130e55d731 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (core) [#14860](https://github.com/cosmos/cosmos-sdk/pull/14860) Add `Precommit` and `PrepareCheckState` AppModule callbacks. * (tx) [#15992](https://github.com/cosmos/cosmos-sdk/pull/15992) Add `WithExtensionOptions` in tx Factory to allow `SetExtensionOptions` with given extension options. * (types/simulation) [#16074](https://github.com/cosmos/cosmos-sdk/pull/16074) Add generic SimulationStoreDecoder for modules using collections. +* (x/group) [#16191](https://github.com/cosmos/cosmos-sdk/pull/16191) Add EventProposalFinalized event to group module whenever a proposal is prune. ### Improvements From 30f5cd5ab1764b4c47ad8cacfe7d7724f9b1bd13 Mon Sep 17 00:00:00 2001 From: Jeancarlo Date: Wed, 17 May 2023 14:58:33 -0600 Subject: [PATCH 10/19] rever change --- x/group/keeper/proposal_executor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/group/keeper/proposal_executor.go b/x/group/keeper/proposal_executor.go index e5b88b27990c..abc2d86d8ba2 100644 --- a/x/group/keeper/proposal_executor.go +++ b/x/group/keeper/proposal_executor.go @@ -14,7 +14,7 @@ import ( // doExecuteMsgs routes the messages to the registered handlers. Messages are limited to those that require no authZ or // by the account of group policy only. Otherwise this gives access to other peoples accounts as the sdk middlewares are bypassed -func (s Keeper) doExecuteMsgs(ctx sdk.Context, _ baseapp.MessageRouter, proposal group.Proposal, groupPolicyAcc sdk.AccAddress, decisionPolicy group.DecisionPolicy) ([]sdk.Result, error) { +func (s Keeper) doExecuteMsgs(ctx sdk.Context, router baseapp.MessageRouter, proposal group.Proposal, groupPolicyAcc sdk.AccAddress, decisionPolicy group.DecisionPolicy) ([]sdk.Result, error) { // Ensure it's not too early to execute the messages. minExecutionDate := proposal.SubmitTime.Add(decisionPolicy.GetMinExecutionPeriod()) if ctx.BlockTime().Before(minExecutionDate) { From 7168f35e23db553638fc29c28bf5adf33156330c Mon Sep 17 00:00:00 2001 From: Jeancarlo Date: Wed, 17 May 2023 15:03:56 -0600 Subject: [PATCH 11/19] rever change --- proto/cosmos/group/v1/query.proto | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proto/cosmos/group/v1/query.proto b/proto/cosmos/group/v1/query.proto index 80b09255afed..f141d26b9352 100644 --- a/proto/cosmos/group/v1/query.proto +++ b/proto/cosmos/group/v1/query.proto @@ -85,7 +85,7 @@ service Query { }; // Groups queries all groups in state. - // + // // Since: cosmos-sdk 0.47.1 rpc Groups(QueryGroupsRequest) returns (QueryGroupsResponse) { option (google.api.http).get = "/cosmos/group/v1/groups"; @@ -300,7 +300,7 @@ message QueryTallyResultResponse { } // QueryGroupsRequest is the Query/Groups request type. -// +// // Since: cosmos-sdk 0.47.1 message QueryGroupsRequest { @@ -309,7 +309,7 @@ message QueryGroupsRequest { } // QueryGroupsResponse is the Query/Groups response type. -// +// // Since: cosmos-sdk 0.47.1 message QueryGroupsResponse { // `groups` is all the groups present in state. From e106c1a24b1dbfbacb4d682b52e1d1825f30ce5e Mon Sep 17 00:00:00 2001 From: Jeancarlo Date: Wed, 17 May 2023 15:07:14 -0600 Subject: [PATCH 12/19] fix test --- x/group/keeper/msg_server_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/x/group/keeper/msg_server_test.go b/x/group/keeper/msg_server_test.go index 79df612ad8b5..7bd01f440e99 100644 --- a/x/group/keeper/msg_server_test.go +++ b/x/group/keeper/msg_server_test.go @@ -2692,6 +2692,7 @@ func (s *TestSuite) TestExecProposal() { expBalance: true, expFromBalances: sdk.NewInt64Coin("test", 9900), expToBalances: sdk.NewInt64Coin("test", 100), + checkEvents: func(sdkCtx sdk.Context) {}, }, "rollback all msg updates on failure": { setupProposal: func(ctx context.Context) uint64 { @@ -2704,6 +2705,7 @@ func (s *TestSuite) TestExecProposal() { srcBlockTime: s.blockTime.Add(minExecutionPeriod), // After min execution period end expProposalStatus: group.PROPOSAL_STATUS_ACCEPTED, expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_FAILURE, + checkEvents: func(sdkCtx sdk.Context) {}, }, "executable when failed before": { setupProposal: func(ctx context.Context) uint64 { @@ -2725,6 +2727,7 @@ func (s *TestSuite) TestExecProposal() { srcBlockTime: s.blockTime.Add(minExecutionPeriod), // After min execution period end expProposalStatus: group.PROPOSAL_STATUS_ACCEPTED, expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_SUCCESS, + checkEvents: func(sdkCtx sdk.Context) {}, }, } for msg, spec := range specs { From b4951a224ef2c0f801b562fbf0cdb060dd072c81 Mon Sep 17 00:00:00 2001 From: Jeancarlo Date: Wed, 24 May 2023 02:12:10 -0600 Subject: [PATCH 13/19] improve tests --- x/group/README.md | 235 +++++++++++++++++------------- x/group/keeper/msg_server.go | 4 - x/group/keeper/msg_server_test.go | 88 ++++------- 3 files changed, 166 insertions(+), 161 deletions(-) diff --git a/x/group/README.md b/x/group/README.md index e3728b98b2bb..e73b9311cbce 100644 --- a/x/group/README.md +++ b/x/group/README.md @@ -8,52 +8,53 @@ sidebar_position: 1 The following documents specify the group module. -This module allows the creation and management of on-chain multisig accounts and enables voting for message execution based on configurable decision policies. +This module allows the creation and management of on-chain multisig accounts and enables voting for message execution +based on configurable decision policies. ## Contents * [Concepts](#concepts) - * [Group](#group) - * [Group Policy](#group-policy) - * [Decision Policy](#decision-policy) - * [Proposal](#proposal) - * [Pruning](#pruning) + * [Group](#group) + * [Group Policy](#group-policy) + * [Decision Policy](#decision-policy) + * [Proposal](#proposal) + * [Pruning](#pruning) * [State](#state) - * [Group Table](#group-table) - * [Group Member Table](#group-member-table) - * [Group Policy Table](#group-policy-table) - * [Proposal Table](#proposal-table) - * [Vote Table](#vote-table) + * [Group Table](#group-table) + * [Group Member Table](#group-member-table) + * [Group Policy Table](#group-policy-table) + * [Proposal Table](#proposal-table) + * [Vote Table](#vote-table) * [Msg Service](#msg-service) - * [Msg/CreateGroup](#msgcreategroup) - * [Msg/UpdateGroupMembers](#msgupdategroupmembers) - * [Msg/UpdateGroupAdmin](#msgupdategroupadmin) - * [Msg/UpdateGroupMetadata](#msgupdategroupmetadata) - * [Msg/CreateGroupPolicy](#msgcreategrouppolicy) - * [Msg/CreateGroupWithPolicy](#msgcreategroupwithpolicy) - * [Msg/UpdateGroupPolicyAdmin](#msgupdategrouppolicyadmin) - * [Msg/UpdateGroupPolicyDecisionPolicy](#msgupdategrouppolicydecisionpolicy) - * [Msg/UpdateGroupPolicyMetadata](#msgupdategrouppolicymetadata) - * [Msg/SubmitProposal](#msgsubmitproposal) - * [Msg/WithdrawProposal](#msgwithdrawproposal) - * [Msg/Vote](#msgvote) - * [Msg/Exec](#msgexec) - * [Msg/LeaveGroup](#msgleavegroup) + * [Msg/CreateGroup](#msgcreategroup) + * [Msg/UpdateGroupMembers](#msgupdategroupmembers) + * [Msg/UpdateGroupAdmin](#msgupdategroupadmin) + * [Msg/UpdateGroupMetadata](#msgupdategroupmetadata) + * [Msg/CreateGroupPolicy](#msgcreategrouppolicy) + * [Msg/CreateGroupWithPolicy](#msgcreategroupwithpolicy) + * [Msg/UpdateGroupPolicyAdmin](#msgupdategrouppolicyadmin) + * [Msg/UpdateGroupPolicyDecisionPolicy](#msgupdategrouppolicydecisionpolicy) + * [Msg/UpdateGroupPolicyMetadata](#msgupdategrouppolicymetadata) + * [Msg/SubmitProposal](#msgsubmitproposal) + * [Msg/WithdrawProposal](#msgwithdrawproposal) + * [Msg/Vote](#msgvote) + * [Msg/Exec](#msgexec) + * [Msg/LeaveGroup](#msgleavegroup) * [Events](#events) - * [EventCreateGroup](#eventcreategroup) - * [EventUpdateGroup](#eventupdategroup) - * [EventCreateGroupPolicy](#eventcreategrouppolicy) - * [EventUpdateGroupPolicy](#eventupdategrouppolicy) - * [EventCreateProposal](#eventcreateproposal) - * [EventWithdrawProposal](#eventwithdrawproposal) - * [EventVote](#eventvote) - * [EventExec](#eventexec) - * [EventLeaveGroup](#eventleavegroup) - * [EventProposalFinalized](#eventProposalFinalized) + * [EventCreateGroup](#eventcreategroup) + * [EventUpdateGroup](#eventupdategroup) + * [EventCreateGroupPolicy](#eventcreategrouppolicy) + * [EventUpdateGroupPolicy](#eventupdategrouppolicy) + * [EventCreateProposal](#eventcreateproposal) + * [EventWithdrawProposal](#eventwithdrawproposal) + * [EventVote](#eventvote) + * [EventExec](#eventexec) + * [EventLeaveGroup](#eventleavegroup) + * [EventProposalFinalized](#eventProposalFinalized) * [Client](#client) - * [CLI](#cli) - * [gRPC](#grpc) - * [REST](#rest) + * [CLI](#cli) + * [gRPC](#grpc) + * [REST](#rest) * [Metadata](#metadata) ## Concepts @@ -101,7 +102,7 @@ custom decision policies, as long as they adhere to the `DecisionPolicy` interface: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/group/types.go#L27-L45 +https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/group/types.go#L27-L45 ``` #### Threshold decision policy @@ -212,7 +213,8 @@ Votes are pruned: * either after a successful tally, i.e. a tally whose result passes the decision policy's rules, which can be trigged by a `Msg/Exec` or a `Msg/{SubmitProposal,Vote}` with the `Exec` field set, -* or on `EndBlock` right after the proposal's voting period end. This applies to proposals with status `aborted` or `withdrawn` too. +* or on `EndBlock` right after the proposal's voting period end. This applies to proposals with status `aborted` + or `withdrawn` too. whichever happens first. @@ -228,7 +230,8 @@ whichever happens first. ## State The `group` module uses the `orm` package which provides table storage with support for -primary keys and secondary indexes. `orm` also defines `Sequence` which is a persistent unique key generator based on a counter that can be used along with `Table`s. +primary keys and secondary indexes. `orm` also defines `Sequence` which is a persistent unique key generator based on a +counter that can be used along with `Table`s. Here's the list of tables and associated sequences and indexes stored as part of the `group` module. @@ -238,7 +241,8 @@ The `groupTable` stores `GroupInfo`: `0x0 | BigEndian(GroupId) -> ProtocolBuffer #### groupSeq -The value of `groupSeq` is incremented when creating a new group and corresponds to the new `GroupId`: `0x1 | 0x1 -> BigEndian`. +The value of `groupSeq` is incremented when creating a new group and corresponds to the +new `GroupId`: `0x1 | 0x1 -> BigEndian`. The second `0x1` corresponds to the ORM `sequenceStorageKey`. @@ -249,7 +253,8 @@ The second `0x1` corresponds to the ORM `sequenceStorageKey`. ### Group Member Table -The `groupMemberTable` stores `GroupMember`s: `0x10 | BigEndian(GroupId) | []byte(member.Address) -> ProtocolBuffer(GroupMember)`. +The `groupMemberTable` stores `GroupMember` +s: `0x10 | BigEndian(GroupId) | []byte(member.Address) -> ProtocolBuffer(GroupMember)`. The `groupMemberTable` is a primary key table and its `PrimaryKey` is given by `BigEndian(GroupId) | []byte(member.Address)` which is used by the following indexes. @@ -266,14 +271,16 @@ The `groupMemberTable` is a primary key table and its `PrimaryKey` is given by ### Group Policy Table -The `groupPolicyTable` stores `GroupPolicyInfo`: `0x20 | len([]byte(Address)) | []byte(Address) -> ProtocolBuffer(GroupPolicyInfo)`. +The `groupPolicyTable` +stores `GroupPolicyInfo`: `0x20 | len([]byte(Address)) | []byte(Address) -> ProtocolBuffer(GroupPolicyInfo)`. The `groupPolicyTable` is a primary key table and its `PrimaryKey` is given by `len([]byte(Address)) | []byte(Address)` which is used by the following indexes. #### groupPolicySeq -The value of `groupPolicySeq` is incremented when creating a new group policy and is used to generate the new group policy account `Address`: +The value of `groupPolicySeq` is incremented when creating a new group policy and is used to generate the new group +policy account `Address`: `0x21 | 0x1 -> BigEndian`. The second `0x1` corresponds to the ORM `sequenceStorageKey`. @@ -294,7 +301,8 @@ The `proposalTable` stores `Proposal`s: `0x30 | BigEndian(ProposalId) -> Protoco #### proposalSeq -The value of `proposalSeq` is incremented when creating a new proposal and corresponds to the new `ProposalId`: `0x31 | 0x1 -> BigEndian`. +The value of `proposalSeq` is incremented when creating a new proposal and corresponds to the +new `ProposalId`: `0x31 | 0x1 -> BigEndian`. The second `0x1` corresponds to the ORM `sequenceStorageKey`. @@ -308,7 +316,8 @@ The second `0x1` corresponds to the ORM `sequenceStorageKey`. `proposalsByVotingPeriodEndIndex` allows to retrieve proposals sorted by chronological `voting_period_end`: `0x33 | sdk.FormatTimeBytes(proposal.VotingPeriodEnd) | BigEndian(ProposalId) -> []byte()`. -This index is used when tallying the proposal votes at the end of the voting period, and for pruning proposals at `VotingPeriodEnd + MaxExecutionPeriod`. +This index is used when tallying the proposal votes at the end of the voting period, and for pruning proposals +at `VotingPeriodEnd + MaxExecutionPeriod`. ### Vote Table @@ -331,13 +340,14 @@ The `voteTable` is a primary key table and its `PrimaryKey` is given by ### Msg/CreateGroup -A new group can be created with the `MsgCreateGroup`, which has an admin address, a list of members and some optional metadata. +A new group can be created with the `MsgCreateGroup`, which has an admin address, a list of members and some optional +metadata. The metadata has a maximum length that is chosen by the app developer, and passed into the group keeper as a config. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L67-L80 +https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L67-L80 ``` It's expected to fail if @@ -350,7 +360,7 @@ It's expected to fail if Group members can be updated with the `UpdateGroupMembers`. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L88-L102 +https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L88-L102 ``` In the list of `MemberUpdates`, an existing member can be removed by setting its weight to 0. @@ -358,14 +368,15 @@ In the list of `MemberUpdates`, an existing member can be removed by setting its It's expected to fail if: * the signer is not the admin of the group. -* for any one of the associated group policies, if its decision policy's `Validate()` method fails against the updated group. +* for any one of the associated group policies, if its decision policy's `Validate()` method fails against the updated + group. ### Msg/UpdateGroupAdmin The `UpdateGroupAdmin` can be used to update a group admin. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L107-L120 +https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L107-L120 ``` It's expected to fail if the signer is not the admin of the group. @@ -375,7 +386,7 @@ It's expected to fail if the signer is not the admin of the group. The `UpdateGroupMetadata` can be used to update a group metadata. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L125-L138 +https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L125-L138 ``` It's expected to fail if: @@ -385,10 +396,11 @@ It's expected to fail if: ### Msg/CreateGroupPolicy -A new group policy can be created with the `MsgCreateGroupPolicy`, which has an admin address, a group id, a decision policy and some optional metadata. +A new group policy can be created with the `MsgCreateGroupPolicy`, which has an admin address, a group id, a decision +policy and some optional metadata. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L147-L165 +https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L147-L165 ``` It's expected to fail if: @@ -399,10 +411,12 @@ It's expected to fail if: ### Msg/CreateGroupWithPolicy -A new group with policy can be created with the `MsgCreateGroupWithPolicy`, which has an admin address, a list of members, a decision policy, a `group_policy_as_admin` field to optionally set group and group policy admin with group policy address and some optional metadata for group and group policy. +A new group with policy can be created with the `MsgCreateGroupWithPolicy`, which has an admin address, a list of +members, a decision policy, a `group_policy_as_admin` field to optionally set group and group policy admin with group +policy address and some optional metadata for group and group policy. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L191-L215 +https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L191-L215 ``` It's expected to fail for the same reasons as `Msg/CreateGroup` and `Msg/CreateGroupPolicy`. @@ -412,7 +426,7 @@ It's expected to fail for the same reasons as `Msg/CreateGroup` and `Msg/CreateG The `UpdateGroupPolicyAdmin` can be used to update a group policy admin. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L173-L186 +https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L173-L186 ``` It's expected to fail if the signer is not the admin of the group policy. @@ -422,7 +436,7 @@ It's expected to fail if the signer is not the admin of the group policy. The `UpdateGroupPolicyDecisionPolicy` can be used to update a decision policy. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L226-L241 +https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L226-L241 ``` It's expected to fail if: @@ -435,7 +449,7 @@ It's expected to fail if: The `UpdateGroupPolicyMetadata` can be used to update a group policy metadata. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L246-L259 +https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L246-L259 ``` It's expected to fail if: @@ -445,11 +459,13 @@ It's expected to fail if: ### Msg/SubmitProposal -A new proposal can be created with the `MsgSubmitProposal`, which has a group policy account address, a list of proposers addresses, a list of messages to execute if the proposal is accepted and some optional metadata. -An optional `Exec` value can be provided to try to execute the proposal immediately after proposal creation. Proposers signatures are considered as yes votes in this case. +A new proposal can be created with the `MsgSubmitProposal`, which has a group policy account address, a list of +proposers addresses, a list of messages to execute if the proposal is accepted and some optional metadata. +An optional `Exec` value can be provided to try to execute the proposal immediately after proposal creation. Proposers +signatures are considered as yes votes in this case. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L281-L315 +https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L281-L315 ``` It's expected to fail if: @@ -459,10 +475,11 @@ It's expected to fail if: ### Msg/WithdrawProposal -A proposal can be withdrawn using `MsgWithdrawProposal` which has an `address` (can be either a proposer or the group policy admin) and a `proposal_id` (which has to be withdrawn). +A proposal can be withdrawn using `MsgWithdrawProposal` which has an `address` (can be either a proposer or the group +policy admin) and a `proposal_id` (which has to be withdrawn). ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L323-L333 +https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L323-L333 ``` It's expected to fail if: @@ -472,11 +489,12 @@ It's expected to fail if: ### Msg/Vote -A new vote can be created with the `MsgVote`, given a proposal id, a voter address, a choice (yes, no, veto or abstain) and some optional metadata. +A new vote can be created with the `MsgVote`, given a proposal id, a voter address, a choice (yes, no, veto or abstain) +and some optional metadata. An optional `Exec` value can be provided to try to execute the proposal immediately after voting. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L338-L358 +https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L338-L358 ``` It's expected to fail if: @@ -489,7 +507,7 @@ It's expected to fail if: A proposal can be executed with the `MsgExec`. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L363-L373 +https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L363-L373 ``` The messages that are part of this proposal won't be executed if: @@ -502,13 +520,14 @@ The messages that are part of this proposal won't be executed if: The `MsgLeaveGroup` allows group member to leave a group. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L381-L391 +https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L381-L391 ``` It's expected to fail if: * the group member is not part of the group. -* for any one of the associated group policies, if its decision policy's `Validate()` method fails against the updated group. +* for any one of the associated group policies, if its decision policy's `Validate()` method fails against the updated + group. ## Events @@ -517,56 +536,56 @@ The group module emits the following events: ### EventCreateGroup | Type | Attribute Key | Attribute Value | -| -------------------------------- | ------------- | -------------------------------- | +|----------------------------------|---------------|----------------------------------| | message | action | /cosmos.group.v1.Msg/CreateGroup | | cosmos.group.v1.EventCreateGroup | group_id | {groupId} | ### EventUpdateGroup | Type | Attribute Key | Attribute Value | -| -------------------------------- | ------------- | ---------------------------------------------------------- | +|----------------------------------|---------------|------------------------------------------------------------| | message | action | /cosmos.group.v1.Msg/UpdateGroup{Admin\|Metadata\|Members} | | cosmos.group.v1.EventUpdateGroup | group_id | {groupId} | ### EventCreateGroupPolicy | Type | Attribute Key | Attribute Value | -| -------------------------------------- | ------------- | -------------------------------------- | +|----------------------------------------|---------------|----------------------------------------| | message | action | /cosmos.group.v1.Msg/CreateGroupPolicy | | cosmos.group.v1.EventCreateGroupPolicy | address | {groupPolicyAddress} | ### EventUpdateGroupPolicy | Type | Attribute Key | Attribute Value | -| -------------------------------------- | ------------- | ----------------------------------------------------------------------- | +|----------------------------------------|---------------|-------------------------------------------------------------------------| | message | action | /cosmos.group.v1.Msg/UpdateGroupPolicy{Admin\|Metadata\|DecisionPolicy} | | cosmos.group.v1.EventUpdateGroupPolicy | address | {groupPolicyAddress} | ### EventCreateProposal | Type | Attribute Key | Attribute Value | -| ----------------------------------- | ------------- | ----------------------------------- | +|-------------------------------------|---------------|-------------------------------------| | message | action | /cosmos.group.v1.Msg/CreateProposal | | cosmos.group.v1.EventCreateProposal | proposal_id | {proposalId} | ### EventWithdrawProposal | Type | Attribute Key | Attribute Value | -| ------------------------------------- | ------------- | ------------------------------------- | +|---------------------------------------|---------------|---------------------------------------| | message | action | /cosmos.group.v1.Msg/WithdrawProposal | | cosmos.group.v1.EventWithdrawProposal | proposal_id | {proposalId} | ### EventVote | Type | Attribute Key | Attribute Value | -| ------------------------- | ------------- | ------------------------- | +|---------------------------|---------------|---------------------------| | message | action | /cosmos.group.v1.Msg/Vote | | cosmos.group.v1.EventVote | proposal_id | {proposalId} | ## EventExec | Type | Attribute Key | Attribute Value | -| ------------------------- | ------------- | ------------------------- | +|---------------------------|---------------|---------------------------| | message | action | /cosmos.group.v1.Msg/Exec | | cosmos.group.v1.EventExec | proposal_id | {proposalId} | | cosmos.group.v1.EventExec | logs | {logs_string} | @@ -574,7 +593,7 @@ The group module emits the following events: ### EventLeaveGroup | Type | Attribute Key | Attribute Value | -| ------------------------------- | ------------- | ------------------------------- | +|---------------------------------|---------------|---------------------------------| | message | action | /cosmos.group.v1.Msg/LeaveGroup | | cosmos.group.v1.EventLeaveGroup | proposal_id | {proposalId} | | cosmos.group.v1.EventLeaveGroup | address | {address} | @@ -582,12 +601,11 @@ The group module emits the following events: ### EventProposalFinalized | Type | Attribute Key | Attribute Value | -|----------------------------------------|---------------| ------------------------------- | +|----------------------------------------|---------------|---------------------------------| | message | action | /cosmos.group.v1.Msg/LeaveGroup | | cosmos.group.v1.EventProposalFinalized | proposal_id | {proposalId} | -| cosmos.group.v1.EventProposalFinalized | status | {ProposalStatus} | -| cosmos.group.v1.EventProposalFinalized | tally_result | {TallyResult} | - +| cosmos.group.v1.EventProposalFinalized | status | {ProposalStatus} | +| cosmos.group.v1.EventProposalFinalized | tally_result | {TallyResult} | ## Client @@ -770,7 +788,8 @@ pagination: ##### group-policies-by-admin -The `group-policies-by-admin` command allows users to query for group policies by admin account address with pagination flags. +The `group-policies-by-admin` command allows users to query for group policies by admin account address with pagination +flags. ```bash simd query group group-policies-by-admin [admin] [flags] @@ -863,7 +882,8 @@ proposal: ##### proposals-by-group-policy -The `proposals-by-group-policy` command allows users to query for proposals by account address of group policy with pagination flags. +The `proposals-by-group-policy` command allows users to query for proposals by account address of group policy with +pagination flags. ```bash simd query group proposals-by-group-policy [group-policy-account] [flags] @@ -1003,7 +1023,8 @@ simd tx group --help #### create-group -The `create-group` command allows users to create a group which is an aggregation of member accounts with associated weights and +The `create-group` command allows users to create a group which is an aggregation of member accounts with associated +weights and an administrator account. ```bash @@ -1060,7 +1081,8 @@ simd tx group update-group-metadata cosmos1.. 1 "AQ==" #### create-group-policy -The `create-group-policy` command allows users to create a group policy which is an account associated with a group and a decision policy. +The `create-group-policy` command allows users to create a group policy which is an account associated with a group and +a decision policy. ```bash simd tx group create-group-policy [admin] [group-id] [metadata] [decision-policy] [flags] @@ -1074,7 +1096,9 @@ simd tx group create-group-policy cosmos1.. 1 "AQ==" '{"@type":"/cosmos.group.v1 #### create-group-with-policy -The `create-group-with-policy` command allows users to create a group which is an aggregation of member accounts with associated weights and an administrator account with decision policy. If the `--group-policy-as-admin` flag is set to `true`, the group policy address becomes the group and group policy admin. +The `create-group-with-policy` command allows users to create a group which is an aggregation of member accounts with +associated weights and an administrator account with decision policy. If the `--group-policy-as-admin` flag is set +to `true`, the group policy address becomes the group and group policy admin. ```bash simd tx group create-group-with-policy [admin] [group-metadata] [group-policy-metadata] [members-json-file] [decision-policy] [flags] @@ -1385,7 +1409,8 @@ Example Output: #### GroupPoliciesByAdmin -The `GroupPoliciesByAdmin` endpoint allows users to query for group policies by admin account address with pagination flags. +The `GroupPoliciesByAdmin` endpoint allows users to query for group policies by admin account address with pagination +flags. ```bash cosmos.group.v1.Query/GroupPoliciesByAdmin @@ -1476,7 +1501,8 @@ Example Output: #### ProposalsByGroupPolicy -The `ProposalsByGroupPolicy` endpoint allows users to query for proposals by account address of group policy with pagination flags. +The `ProposalsByGroupPolicy` endpoint allows users to query for proposals by account address of group policy with +pagination flags. ```bash cosmos.group.v1.Query/ProposalsByGroupPolicy @@ -1833,7 +1859,8 @@ Example Output: #### GroupPoliciesByAdmin -The `GroupPoliciesByAdmin` endpoint allows users to query for group policies by admin account address with pagination flags. +The `GroupPoliciesByAdmin` endpoint allows users to query for group policies by admin account address with pagination +flags. ```bash /cosmos/group/v1/group_policies_by_admin/{admin} @@ -1949,7 +1976,8 @@ Example Output: #### ProposalsByGroupPolicy -The `ProposalsByGroupPolicy` endpoint allows users to query for proposals by account address of group policy with pagination flags. +The `ProposalsByGroupPolicy` endpoint allows users to query for proposals by account address of group policy with +pagination flags. ```bash /cosmos/group/v1/proposals_by_group_policy/{address} @@ -2109,7 +2137,13 @@ Example Output: ## Metadata -The group module has four locations for metadata where users can provide further context about the on-chain actions they are taking. By default all metadata fields have a 255 character length field where metadata can be stored in json format, either on-chain or off-chain depending on the amount of data required. Here we provide a recommendation for the json structure and where the data should be stored. There are two important factors in making these recommendations. First, that the group and gov modules are consistent with one another, note the number of proposals made by all groups may be quite large. Second, that client applications such as block explorers and governance interfaces have confidence in the consistency of metadata structure accross chains. +The group module has four locations for metadata where users can provide further context about the on-chain actions they +are taking. By default all metadata fields have a 255 character length field where metadata can be stored in json +format, either on-chain or off-chain depending on the amount of data required. Here we provide a recommendation for the +json structure and where the data should be stored. There are two important factors in making these recommendations. +First, that the group and gov modules are consistent with one another, note the number of proposals made by all groups +may be quite large. Second, that client applications such as block explorers and governance interfaces have confidence +in the consistency of metadata structure accross chains. ### Proposal @@ -2118,17 +2152,20 @@ Location: off-chain as json object stored on IPFS (mirrors [gov proposal](../gov ```json { "title": "", - "authors": [""], + "authors": [ + "" + ], "summary": "", "details": "", "proposal_forum_url": "", - "vote_option_context": "", + "vote_option_context": "" } ``` :::note The `authors` field is an array of strings, this is to allow for multiple authors to be listed in the metadata. -In v0.46, the `authors` field is a comma-separated string. Frontends are encouraged to support both formats for backwards compatibility. +In v0.46, the `authors` field is a comma-separated string. Frontends are encouraged to support both formats for +backwards compatibility. ::: ### Vote @@ -2137,7 +2174,7 @@ Location: on-chain as json within 255 character limit (mirrors [gov vote](../gov ```json { - "justification": "", + "justification": "" } ``` @@ -2150,7 +2187,7 @@ Location: off-chain as json object stored on IPFS "name": "", "description": "", "group_website_url": "", - "group_forum_url": "", + "group_forum_url": "" } ``` @@ -2161,6 +2198,6 @@ Location: on-chain as json within 255 character limit ```json { "name": "", - "description": "", + "description": "" } ``` diff --git a/x/group/keeper/msg_server.go b/x/group/keeper/msg_server.go index a040d60c2937..cadf95418462 100644 --- a/x/group/keeper/msg_server.go +++ b/x/group/keeper/msg_server.go @@ -683,10 +683,6 @@ func (k Keeper) WithdrawProposal(goCtx context.Context, msg *group.MsgWithdrawPr return nil, err } - if err := ctx.EventManager().EmitTypedEvent(&group.EventProposalFinalized{ProposalId: proposal.Id, Status: proposal.Status}); err != nil { - return nil, err - } - if err := ctx.EventManager().EmitTypedEvent(&group.EventWithdrawProposal{ProposalId: msg.ProposalId}); err != nil { return nil, err } diff --git a/x/group/keeper/msg_server_test.go b/x/group/keeper/msg_server_test.go index f89c3da15ade..39b764ad9ee1 100644 --- a/x/group/keeper/msg_server_test.go +++ b/x/group/keeper/msg_server_test.go @@ -8,6 +8,10 @@ import ( "strings" "time" + "github.com/golang/mock/gomock" + + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cosmos/cosmos-sdk/codec/address" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" "github.com/cosmos/cosmos-sdk/testutil/testdata" @@ -17,7 +21,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/group/internal/math" "github.com/cosmos/cosmos-sdk/x/group/keeper" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - "github.com/golang/mock/gomock" ) var EventTallyResult = "cosmos.group.v1.EventProposalFinalized" @@ -1831,14 +1834,7 @@ func (s *TestSuite) TestSubmitProposal() { toBalances := s.bankKeeper.GetAllBalances(sdkCtx, addr2) s.Require().Contains(toBalances, sdk.NewInt64Coin("test", 100)) events := sdkCtx.EventManager().ABCIEvents() - tallyEventFound := false - for _, e := range events { - if e.Type == EventTallyResult { - tallyEventFound = true - break - } - } - s.Require().True(tallyEventFound) + s.Require().True(eventTypeFound(events, EventTallyResult)) }, }, "with try exec, not enough yes votes for proposal to pass": { @@ -1979,15 +1975,15 @@ func (s *TestSuite) TestWithdrawProposal() { proposalID: proposalID, admin: proposers[0], postRun: func(sdkCtx sdk.Context) { - events := sdkCtx.EventManager().ABCIEvents() - tallyEventFound := false - for _, e := range events { - if e.Type == EventTallyResult { - tallyEventFound = true - break - } - } - s.Require().True(tallyEventFound) + resp, err := s.groupKeeper.Proposal(s.ctx, &group.QueryProposalRequest{ProposalId: proposalID}) + s.Require().NoError(err) + vpe := resp.Proposal.VotingPeriodEnd + timeDiff := vpe.Sub(s.sdkCtx.BlockTime()) + ctxVPE := sdkCtx.WithBlockTime(s.sdkCtx.BlockTime().Add(timeDiff).Add(time.Second * 1)) + s.Require().NoError(s.groupKeeper.TallyProposalsAtVPEnd(ctxVPE)) + events := ctxVPE.EventManager().ABCIEvents() + + s.Require().True(eventTypeFound(events, EventTallyResult)) }, }, } @@ -2553,14 +2549,7 @@ func (s *TestSuite) TestExecProposal() { expToBalances: sdk.NewInt64Coin("test", 100), checkEvents: func(sdkCtx sdk.Context) { events := sdkCtx.EventManager().ABCIEvents() - tallyEventFound := false - for _, e := range events { - if e.Type == EventTallyResult { - tallyEventFound = true - break - } - } - s.Require().True(tallyEventFound) + s.Require().True(eventTypeFound(events, EventTallyResult)) }, }, "proposal with multiple messages executed when accepted": { @@ -2578,14 +2567,7 @@ func (s *TestSuite) TestExecProposal() { expToBalances: sdk.NewInt64Coin("test", 200), checkEvents: func(sdkCtx sdk.Context) { events := sdkCtx.EventManager().ABCIEvents() - tallyEventFound := false - for _, e := range events { - if e.Type == EventTallyResult { - tallyEventFound = true - break - } - } - s.Require().True(tallyEventFound) + s.Require().True(eventTypeFound(events, EventTallyResult)) }, }, "proposal not executed when rejected": { @@ -2598,14 +2580,7 @@ func (s *TestSuite) TestExecProposal() { expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_NOT_RUN, checkEvents: func(sdkCtx sdk.Context) { events := sdkCtx.EventManager().ABCIEvents() - tallyEventFound := false - for _, e := range events { - if e.Type == EventTallyResult { - tallyEventFound = true - break - } - } - s.Require().False(tallyEventFound) + s.Require().False(eventTypeFound(events, EventTallyResult)) }, }, "open proposal must not fail": { @@ -2616,14 +2591,7 @@ func (s *TestSuite) TestExecProposal() { expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_NOT_RUN, checkEvents: func(sdkCtx sdk.Context) { events := sdkCtx.EventManager().ABCIEvents() - tallyEventFound := false - for _, e := range events { - if e.Type == EventTallyResult { - tallyEventFound = true - break - } - } - s.Require().False(tallyEventFound) + s.Require().False(eventTypeFound(events, EventTallyResult)) }, }, "invalid proposal id": { @@ -2978,14 +2946,7 @@ func (s *TestSuite) TestExecPrunedProposalsAndVotes() { s.Require().NoError(err) s.Require().Empty(res.GetVotes()) events := sdkCtx.EventManager().ABCIEvents() - tallyEventFound := false - for _, e := range events { - if e.Type == EventTallyResult { - tallyEventFound = true - break - } - } - s.Require().True(tallyEventFound) + s.Require().True(eventTypeFound(events, EventTallyResult)) } else { // Check that proposal and votes exists @@ -3413,3 +3374,14 @@ func (s *TestSuite) TestExecProposalsWhenMemberLeavesOrIsUpdated() { }) } } + +func eventTypeFound(events []abci.Event, eventType string) bool { + eventTypeFound := false + for _, e := range events { + if e.Type == eventType { + eventTypeFound = true + break + } + } + return eventTypeFound +} From aae6f7c131c26559c65d6eaadf77bdac5591b1f5 Mon Sep 17 00:00:00 2001 From: Jeancarlo Date: Wed, 24 May 2023 02:20:43 -0600 Subject: [PATCH 14/19] improve naming --- api/cosmos/group/v1/events.pulsar.go | 243 +++++++++++++-------------- api/cosmos/group/v1/types.pulsar.go | 6 +- proto/cosmos/group/v1/events.proto | 4 +- proto/cosmos/group/v1/query.proto | 6 +- proto/cosmos/group/v1/types.proto | 6 +- x/group/README.md | 88 +++++----- x/group/events.pb.go | 110 ++++++------ x/group/keeper/keeper.go | 5 +- x/group/types.pb.go | 6 +- 9 files changed, 240 insertions(+), 234 deletions(-) diff --git a/api/cosmos/group/v1/events.pulsar.go b/api/cosmos/group/v1/events.pulsar.go index 20ac0a54c6e7..f800c7d979b5 100644 --- a/api/cosmos/group/v1/events.pulsar.go +++ b/api/cosmos/group/v1/events.pulsar.go @@ -3858,29 +3858,29 @@ func (x *fastReflection_EventLeaveGroup) ProtoMethods() *protoiface.Methods { } var ( - md_EventProposalFinalized protoreflect.MessageDescriptor - fd_EventProposalFinalized_proposal_id protoreflect.FieldDescriptor - fd_EventProposalFinalized_status protoreflect.FieldDescriptor - fd_EventProposalFinalized_tally_result protoreflect.FieldDescriptor + md_EventProposalPruned protoreflect.MessageDescriptor + fd_EventProposalPruned_proposal_id protoreflect.FieldDescriptor + fd_EventProposalPruned_status protoreflect.FieldDescriptor + fd_EventProposalPruned_tally_result protoreflect.FieldDescriptor ) func init() { file_cosmos_group_v1_events_proto_init() - md_EventProposalFinalized = File_cosmos_group_v1_events_proto.Messages().ByName("EventProposalFinalized") - fd_EventProposalFinalized_proposal_id = md_EventProposalFinalized.Fields().ByName("proposal_id") - fd_EventProposalFinalized_status = md_EventProposalFinalized.Fields().ByName("status") - fd_EventProposalFinalized_tally_result = md_EventProposalFinalized.Fields().ByName("tally_result") + md_EventProposalPruned = File_cosmos_group_v1_events_proto.Messages().ByName("EventProposalPruned") + fd_EventProposalPruned_proposal_id = md_EventProposalPruned.Fields().ByName("proposal_id") + fd_EventProposalPruned_status = md_EventProposalPruned.Fields().ByName("status") + fd_EventProposalPruned_tally_result = md_EventProposalPruned.Fields().ByName("tally_result") } -var _ protoreflect.Message = (*fastReflection_EventProposalFinalized)(nil) +var _ protoreflect.Message = (*fastReflection_EventProposalPruned)(nil) -type fastReflection_EventProposalFinalized EventProposalFinalized +type fastReflection_EventProposalPruned EventProposalPruned -func (x *EventProposalFinalized) ProtoReflect() protoreflect.Message { - return (*fastReflection_EventProposalFinalized)(x) +func (x *EventProposalPruned) ProtoReflect() protoreflect.Message { + return (*fastReflection_EventProposalPruned)(x) } -func (x *EventProposalFinalized) slowProtoReflect() protoreflect.Message { +func (x *EventProposalPruned) slowProtoReflect() protoreflect.Message { mi := &file_cosmos_group_v1_events_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -3892,43 +3892,43 @@ func (x *EventProposalFinalized) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_EventProposalFinalized_messageType fastReflection_EventProposalFinalized_messageType -var _ protoreflect.MessageType = fastReflection_EventProposalFinalized_messageType{} +var _fastReflection_EventProposalPruned_messageType fastReflection_EventProposalPruned_messageType +var _ protoreflect.MessageType = fastReflection_EventProposalPruned_messageType{} -type fastReflection_EventProposalFinalized_messageType struct{} +type fastReflection_EventProposalPruned_messageType struct{} -func (x fastReflection_EventProposalFinalized_messageType) Zero() protoreflect.Message { - return (*fastReflection_EventProposalFinalized)(nil) +func (x fastReflection_EventProposalPruned_messageType) Zero() protoreflect.Message { + return (*fastReflection_EventProposalPruned)(nil) } -func (x fastReflection_EventProposalFinalized_messageType) New() protoreflect.Message { - return new(fastReflection_EventProposalFinalized) +func (x fastReflection_EventProposalPruned_messageType) New() protoreflect.Message { + return new(fastReflection_EventProposalPruned) } -func (x fastReflection_EventProposalFinalized_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_EventProposalFinalized +func (x fastReflection_EventProposalPruned_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EventProposalPruned } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_EventProposalFinalized) Descriptor() protoreflect.MessageDescriptor { - return md_EventProposalFinalized +func (x *fastReflection_EventProposalPruned) Descriptor() protoreflect.MessageDescriptor { + return md_EventProposalPruned } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_EventProposalFinalized) Type() protoreflect.MessageType { - return _fastReflection_EventProposalFinalized_messageType +func (x *fastReflection_EventProposalPruned) Type() protoreflect.MessageType { + return _fastReflection_EventProposalPruned_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_EventProposalFinalized) New() protoreflect.Message { - return new(fastReflection_EventProposalFinalized) +func (x *fastReflection_EventProposalPruned) New() protoreflect.Message { + return new(fastReflection_EventProposalPruned) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_EventProposalFinalized) Interface() protoreflect.ProtoMessage { - return (*EventProposalFinalized)(x) +func (x *fastReflection_EventProposalPruned) Interface() protoreflect.ProtoMessage { + return (*EventProposalPruned)(x) } // Range iterates over every populated field in an undefined order, @@ -3936,22 +3936,22 @@ func (x *fastReflection_EventProposalFinalized) Interface() protoreflect.ProtoMe // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_EventProposalFinalized) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_EventProposalPruned) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { if x.ProposalId != uint64(0) { value := protoreflect.ValueOfUint64(x.ProposalId) - if !f(fd_EventProposalFinalized_proposal_id, value) { + if !f(fd_EventProposalPruned_proposal_id, value) { return } } if x.Status != 0 { value := protoreflect.ValueOfEnum((protoreflect.EnumNumber)(x.Status)) - if !f(fd_EventProposalFinalized_status, value) { + if !f(fd_EventProposalPruned_status, value) { return } } if x.TallyResult != nil { value := protoreflect.ValueOfMessage(x.TallyResult.ProtoReflect()) - if !f(fd_EventProposalFinalized_tally_result, value) { + if !f(fd_EventProposalPruned_tally_result, value) { return } } @@ -3968,19 +3968,19 @@ func (x *fastReflection_EventProposalFinalized) Range(f func(protoreflect.FieldD // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_EventProposalFinalized) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_EventProposalPruned) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "cosmos.group.v1.EventProposalFinalized.proposal_id": + case "cosmos.group.v1.EventProposalPruned.proposal_id": return x.ProposalId != uint64(0) - case "cosmos.group.v1.EventProposalFinalized.status": + case "cosmos.group.v1.EventProposalPruned.status": return x.Status != 0 - case "cosmos.group.v1.EventProposalFinalized.tally_result": + case "cosmos.group.v1.EventProposalPruned.tally_result": return x.TallyResult != nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalFinalized")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalPruned")) } - panic(fmt.Errorf("message cosmos.group.v1.EventProposalFinalized does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.group.v1.EventProposalPruned does not contain field %s", fd.FullName())) } } @@ -3990,19 +3990,19 @@ func (x *fastReflection_EventProposalFinalized) Has(fd protoreflect.FieldDescrip // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventProposalFinalized) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_EventProposalPruned) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "cosmos.group.v1.EventProposalFinalized.proposal_id": + case "cosmos.group.v1.EventProposalPruned.proposal_id": x.ProposalId = uint64(0) - case "cosmos.group.v1.EventProposalFinalized.status": + case "cosmos.group.v1.EventProposalPruned.status": x.Status = 0 - case "cosmos.group.v1.EventProposalFinalized.tally_result": + case "cosmos.group.v1.EventProposalPruned.tally_result": x.TallyResult = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalFinalized")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalPruned")) } - panic(fmt.Errorf("message cosmos.group.v1.EventProposalFinalized does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.group.v1.EventProposalPruned does not contain field %s", fd.FullName())) } } @@ -4012,22 +4012,22 @@ func (x *fastReflection_EventProposalFinalized) Clear(fd protoreflect.FieldDescr // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_EventProposalFinalized) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_EventProposalPruned) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "cosmos.group.v1.EventProposalFinalized.proposal_id": + case "cosmos.group.v1.EventProposalPruned.proposal_id": value := x.ProposalId return protoreflect.ValueOfUint64(value) - case "cosmos.group.v1.EventProposalFinalized.status": + case "cosmos.group.v1.EventProposalPruned.status": value := x.Status return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) - case "cosmos.group.v1.EventProposalFinalized.tally_result": + case "cosmos.group.v1.EventProposalPruned.tally_result": value := x.TallyResult return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalFinalized")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalPruned")) } - panic(fmt.Errorf("message cosmos.group.v1.EventProposalFinalized does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message cosmos.group.v1.EventProposalPruned does not contain field %s", descriptor.FullName())) } } @@ -4041,19 +4041,19 @@ func (x *fastReflection_EventProposalFinalized) Get(descriptor protoreflect.Fiel // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventProposalFinalized) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_EventProposalPruned) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "cosmos.group.v1.EventProposalFinalized.proposal_id": + case "cosmos.group.v1.EventProposalPruned.proposal_id": x.ProposalId = value.Uint() - case "cosmos.group.v1.EventProposalFinalized.status": + case "cosmos.group.v1.EventProposalPruned.status": x.Status = (ProposalStatus)(value.Enum()) - case "cosmos.group.v1.EventProposalFinalized.tally_result": + case "cosmos.group.v1.EventProposalPruned.tally_result": x.TallyResult = value.Message().Interface().(*TallyResult) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalFinalized")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalPruned")) } - panic(fmt.Errorf("message cosmos.group.v1.EventProposalFinalized does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.group.v1.EventProposalPruned does not contain field %s", fd.FullName())) } } @@ -4067,52 +4067,52 @@ func (x *fastReflection_EventProposalFinalized) Set(fd protoreflect.FieldDescrip // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventProposalFinalized) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_EventProposalPruned) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "cosmos.group.v1.EventProposalFinalized.tally_result": + case "cosmos.group.v1.EventProposalPruned.tally_result": if x.TallyResult == nil { x.TallyResult = new(TallyResult) } return protoreflect.ValueOfMessage(x.TallyResult.ProtoReflect()) - case "cosmos.group.v1.EventProposalFinalized.proposal_id": - panic(fmt.Errorf("field proposal_id of message cosmos.group.v1.EventProposalFinalized is not mutable")) - case "cosmos.group.v1.EventProposalFinalized.status": - panic(fmt.Errorf("field status of message cosmos.group.v1.EventProposalFinalized is not mutable")) + case "cosmos.group.v1.EventProposalPruned.proposal_id": + panic(fmt.Errorf("field proposal_id of message cosmos.group.v1.EventProposalPruned is not mutable")) + case "cosmos.group.v1.EventProposalPruned.status": + panic(fmt.Errorf("field status of message cosmos.group.v1.EventProposalPruned is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalFinalized")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalPruned")) } - panic(fmt.Errorf("message cosmos.group.v1.EventProposalFinalized does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.group.v1.EventProposalPruned does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_EventProposalFinalized) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_EventProposalPruned) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "cosmos.group.v1.EventProposalFinalized.proposal_id": + case "cosmos.group.v1.EventProposalPruned.proposal_id": return protoreflect.ValueOfUint64(uint64(0)) - case "cosmos.group.v1.EventProposalFinalized.status": + case "cosmos.group.v1.EventProposalPruned.status": return protoreflect.ValueOfEnum(0) - case "cosmos.group.v1.EventProposalFinalized.tally_result": + case "cosmos.group.v1.EventProposalPruned.tally_result": m := new(TallyResult) return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalFinalized")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1.EventProposalPruned")) } - panic(fmt.Errorf("message cosmos.group.v1.EventProposalFinalized does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.group.v1.EventProposalPruned does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_EventProposalFinalized) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_EventProposalPruned) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in cosmos.group.v1.EventProposalFinalized", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in cosmos.group.v1.EventProposalPruned", d.FullName())) } panic("unreachable") } @@ -4120,7 +4120,7 @@ func (x *fastReflection_EventProposalFinalized) WhichOneof(d protoreflect.OneofD // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_EventProposalFinalized) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_EventProposalPruned) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -4131,7 +4131,7 @@ func (x *fastReflection_EventProposalFinalized) GetUnknown() protoreflect.RawFie // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventProposalFinalized) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_EventProposalPruned) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -4143,7 +4143,7 @@ func (x *fastReflection_EventProposalFinalized) SetUnknown(fields protoreflect.R // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_EventProposalFinalized) IsValid() bool { +func (x *fastReflection_EventProposalPruned) IsValid() bool { return x != nil } @@ -4153,9 +4153,9 @@ func (x *fastReflection_EventProposalFinalized) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_EventProposalFinalized) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_EventProposalPruned) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*EventProposalFinalized) + x := input.Message.Interface().(*EventProposalPruned) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -4187,7 +4187,7 @@ func (x *fastReflection_EventProposalFinalized) ProtoMethods() *protoiface.Metho } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*EventProposalFinalized) + x := input.Message.Interface().(*EventProposalPruned) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -4241,7 +4241,7 @@ func (x *fastReflection_EventProposalFinalized) ProtoMethods() *protoiface.Metho }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*EventProposalFinalized) + x := input.Message.Interface().(*EventProposalPruned) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -4273,10 +4273,10 @@ func (x *fastReflection_EventProposalFinalized) ProtoMethods() *protoiface.Metho fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventProposalFinalized: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventProposalPruned: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventProposalFinalized: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventProposalPruned: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4764,21 +4764,21 @@ func (x *EventLeaveGroup) GetAddress() string { } // EventProposalTallyFinalized is an event emitted when a proposal tally is finalized. -type EventProposalFinalized struct { +type EventProposalPruned struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // proposal_id is the unique ID of the proposal. ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - // result is the proposal tally result. + // status is the proposal status (UNSPECIFIED, SUBMITTED, ACCEPTED, REJECTED, ABORTED, WITHDRAWN). Status ProposalStatus `protobuf:"varint,2,opt,name=status,proto3,enum=cosmos.group.v1.ProposalStatus" json:"status,omitempty"` // tally_result is the proposal tally result. TallyResult *TallyResult `protobuf:"bytes,3,opt,name=tally_result,json=tallyResult,proto3" json:"tally_result,omitempty"` } -func (x *EventProposalFinalized) Reset() { - *x = EventProposalFinalized{} +func (x *EventProposalPruned) Reset() { + *x = EventProposalPruned{} if protoimpl.UnsafeEnabled { mi := &file_cosmos_group_v1_events_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -4786,32 +4786,32 @@ func (x *EventProposalFinalized) Reset() { } } -func (x *EventProposalFinalized) String() string { +func (x *EventProposalPruned) String() string { return protoimpl.X.MessageStringOf(x) } -func (*EventProposalFinalized) ProtoMessage() {} +func (*EventProposalPruned) ProtoMessage() {} -// Deprecated: Use EventProposalFinalized.ProtoReflect.Descriptor instead. -func (*EventProposalFinalized) Descriptor() ([]byte, []int) { +// Deprecated: Use EventProposalPruned.ProtoReflect.Descriptor instead. +func (*EventProposalPruned) Descriptor() ([]byte, []int) { return file_cosmos_group_v1_events_proto_rawDescGZIP(), []int{9} } -func (x *EventProposalFinalized) GetProposalId() uint64 { +func (x *EventProposalPruned) GetProposalId() uint64 { if x != nil { return x.ProposalId } return 0 } -func (x *EventProposalFinalized) GetStatus() ProposalStatus { +func (x *EventProposalPruned) GetStatus() ProposalStatus { if x != nil { return x.Status } return ProposalStatus_PROPOSAL_STATUS_UNSPECIFIED } -func (x *EventProposalFinalized) GetTallyResult() *TallyResult { +func (x *EventProposalPruned) GetTallyResult() *TallyResult { if x != nil { return x.TallyResult } @@ -4867,30 +4867,29 @@ var file_cosmos_group_v1_events_proto_rawDesc = []byte{ 0x70, 0x49, 0x64, 0x12, 0x32, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 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, 0x07, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0xb3, 0x01, 0x0a, 0x16, 0x45, 0x76, 0x65, 0x6e, - 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, - 0x65, 0x64, 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, 0x37, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x72, 0x6f, - 0x75, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x3f, 0x0a, 0x0c, - 0x74, 0x61, 0x6c, 0x6c, 0x79, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x72, 0x6f, 0x75, - 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x6c, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x52, 0x0b, 0x74, 0x61, 0x6c, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0xaa, 0x01, - 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x72, 0x6f, - 0x75, 0x70, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 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, 0x72, - 0x6f, 0x75, 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x76, 0x31, 0xa2, 0x02, - 0x03, 0x43, 0x47, 0x58, 0xaa, 0x02, 0x0f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x5c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, - 0x3a, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0xb0, 0x01, 0x0a, 0x13, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x50, 0x72, 0x75, 0x6e, 0x65, 0x64, 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, 0x37, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2e, + 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x3f, 0x0a, 0x0c, 0x74, 0x61, 0x6c, + 0x6c, 0x79, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x76, + 0x31, 0x2e, 0x54, 0x61, 0x6c, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x0b, 0x74, + 0x61, 0x6c, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0xaa, 0x01, 0x0a, 0x13, 0x63, + 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2e, + 0x76, 0x31, 0x42, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x28, 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, 0x72, 0x6f, 0x75, 0x70, + 0x2f, 0x76, 0x31, 0x3b, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x47, + 0x58, 0xaa, 0x02, 0x0f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -4916,15 +4915,15 @@ var file_cosmos_group_v1_events_proto_goTypes = []interface{}{ (*EventVote)(nil), // 6: cosmos.group.v1.EventVote (*EventExec)(nil), // 7: cosmos.group.v1.EventExec (*EventLeaveGroup)(nil), // 8: cosmos.group.v1.EventLeaveGroup - (*EventProposalFinalized)(nil), // 9: cosmos.group.v1.EventProposalFinalized + (*EventProposalPruned)(nil), // 9: cosmos.group.v1.EventProposalPruned (ProposalExecutorResult)(0), // 10: cosmos.group.v1.ProposalExecutorResult (ProposalStatus)(0), // 11: cosmos.group.v1.ProposalStatus (*TallyResult)(nil), // 12: cosmos.group.v1.TallyResult } var file_cosmos_group_v1_events_proto_depIdxs = []int32{ 10, // 0: cosmos.group.v1.EventExec.result:type_name -> cosmos.group.v1.ProposalExecutorResult - 11, // 1: cosmos.group.v1.EventProposalFinalized.status:type_name -> cosmos.group.v1.ProposalStatus - 12, // 2: cosmos.group.v1.EventProposalFinalized.tally_result:type_name -> cosmos.group.v1.TallyResult + 11, // 1: cosmos.group.v1.EventProposalPruned.status:type_name -> cosmos.group.v1.ProposalStatus + 12, // 2: cosmos.group.v1.EventProposalPruned.tally_result:type_name -> cosmos.group.v1.TallyResult 3, // [3:3] is the sub-list for method output_type 3, // [3:3] is the sub-list for method input_type 3, // [3:3] is the sub-list for extension type_name @@ -5048,7 +5047,7 @@ func file_cosmos_group_v1_events_proto_init() { } } file_cosmos_group_v1_events_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EventProposalFinalized); i { + switch v := v.(*EventProposalPruned); i { case 0: return &v.state case 1: diff --git a/api/cosmos/group/v1/types.pulsar.go b/api/cosmos/group/v1/types.pulsar.go index 3b8ad5779310..dfd4d45c7b3f 100644 --- a/api/cosmos/group/v1/types.pulsar.go +++ b/api/cosmos/group/v1/types.pulsar.go @@ -7966,7 +7966,8 @@ type GroupPolicyInfo struct { // admin is the account address of the group admin. Admin string `protobuf:"bytes,3,opt,name=admin,proto3" json:"admin,omitempty"` // metadata is any arbitrary metadata attached to the group policy. - // the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 + // the recommended format of the metadata is to be found here: + // https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 Metadata string `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"` // version is used to track changes to a group's GroupPolicyInfo structure that // would create a different result on a running proposal. @@ -8060,7 +8061,8 @@ type Proposal struct { // group_policy_address is the account address of group policy. GroupPolicyAddress string `protobuf:"bytes,2,opt,name=group_policy_address,json=groupPolicyAddress,proto3" json:"group_policy_address,omitempty"` // metadata is any arbitrary metadata attached to the proposal. - // the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#proposal-4 + // the recommended format of the metadata is to be found here: + // https://docs.cosmos.network/v0.47/modules/group#proposal-4 Metadata string `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata,omitempty"` // proposers are the account addresses of the proposers. Proposers []string `protobuf:"bytes,4,rep,name=proposers,proto3" json:"proposers,omitempty"` diff --git a/proto/cosmos/group/v1/events.proto b/proto/cosmos/group/v1/events.proto index e35ff215e2ba..6bc3e9574d4d 100644 --- a/proto/cosmos/group/v1/events.proto +++ b/proto/cosmos/group/v1/events.proto @@ -81,12 +81,12 @@ message EventLeaveGroup { } // EventProposalTallyFinalized is an event emitted when a proposal tally is finalized. -message EventProposalFinalized { +message EventProposalPruned { // proposal_id is the unique ID of the proposal. uint64 proposal_id = 1; - // result is the proposal tally result. + // status is the proposal status (UNSPECIFIED, SUBMITTED, ACCEPTED, REJECTED, ABORTED, WITHDRAWN). ProposalStatus status = 2; // tally_result is the proposal tally result. diff --git a/proto/cosmos/group/v1/query.proto b/proto/cosmos/group/v1/query.proto index f141d26b9352..80b09255afed 100644 --- a/proto/cosmos/group/v1/query.proto +++ b/proto/cosmos/group/v1/query.proto @@ -85,7 +85,7 @@ service Query { }; // Groups queries all groups in state. - // + // // Since: cosmos-sdk 0.47.1 rpc Groups(QueryGroupsRequest) returns (QueryGroupsResponse) { option (google.api.http).get = "/cosmos/group/v1/groups"; @@ -300,7 +300,7 @@ message QueryTallyResultResponse { } // QueryGroupsRequest is the Query/Groups request type. -// +// // Since: cosmos-sdk 0.47.1 message QueryGroupsRequest { @@ -309,7 +309,7 @@ message QueryGroupsRequest { } // QueryGroupsResponse is the Query/Groups response type. -// +// // Since: cosmos-sdk 0.47.1 message QueryGroupsResponse { // `groups` is all the groups present in state. diff --git a/proto/cosmos/group/v1/types.proto b/proto/cosmos/group/v1/types.proto index 2126b2334561..97af45fff7a7 100644 --- a/proto/cosmos/group/v1/types.proto +++ b/proto/cosmos/group/v1/types.proto @@ -172,7 +172,8 @@ message GroupPolicyInfo { string admin = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // metadata is any arbitrary metadata attached to the group policy. - // the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 + // the recommended format of the metadata is to be found here: + // https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 string metadata = 4; // version is used to track changes to a group's GroupPolicyInfo structure that @@ -201,7 +202,8 @@ message Proposal { string group_policy_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // metadata is any arbitrary metadata attached to the proposal. - // the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#proposal-4 + // the recommended format of the metadata is to be found here: + // https://docs.cosmos.network/v0.47/modules/group#proposal-4 string metadata = 3; // proposers are the account addresses of the proposers. diff --git a/x/group/README.md b/x/group/README.md index e73b9311cbce..dfb928fad898 100644 --- a/x/group/README.md +++ b/x/group/README.md @@ -14,47 +14,47 @@ based on configurable decision policies. ## Contents * [Concepts](#concepts) - * [Group](#group) - * [Group Policy](#group-policy) - * [Decision Policy](#decision-policy) - * [Proposal](#proposal) - * [Pruning](#pruning) + * [Group](#group) + * [Group Policy](#group-policy) + * [Decision Policy](#decision-policy) + * [Proposal](#proposal) + * [Pruning](#pruning) * [State](#state) - * [Group Table](#group-table) - * [Group Member Table](#group-member-table) - * [Group Policy Table](#group-policy-table) - * [Proposal Table](#proposal-table) - * [Vote Table](#vote-table) + * [Group Table](#group-table) + * [Group Member Table](#group-member-table) + * [Group Policy Table](#group-policy-table) + * [Proposal Table](#proposal-table) + * [Vote Table](#vote-table) * [Msg Service](#msg-service) - * [Msg/CreateGroup](#msgcreategroup) - * [Msg/UpdateGroupMembers](#msgupdategroupmembers) - * [Msg/UpdateGroupAdmin](#msgupdategroupadmin) - * [Msg/UpdateGroupMetadata](#msgupdategroupmetadata) - * [Msg/CreateGroupPolicy](#msgcreategrouppolicy) - * [Msg/CreateGroupWithPolicy](#msgcreategroupwithpolicy) - * [Msg/UpdateGroupPolicyAdmin](#msgupdategrouppolicyadmin) - * [Msg/UpdateGroupPolicyDecisionPolicy](#msgupdategrouppolicydecisionpolicy) - * [Msg/UpdateGroupPolicyMetadata](#msgupdategrouppolicymetadata) - * [Msg/SubmitProposal](#msgsubmitproposal) - * [Msg/WithdrawProposal](#msgwithdrawproposal) - * [Msg/Vote](#msgvote) - * [Msg/Exec](#msgexec) - * [Msg/LeaveGroup](#msgleavegroup) + * [Msg/CreateGroup](#msgcreategroup) + * [Msg/UpdateGroupMembers](#msgupdategroupmembers) + * [Msg/UpdateGroupAdmin](#msgupdategroupadmin) + * [Msg/UpdateGroupMetadata](#msgupdategroupmetadata) + * [Msg/CreateGroupPolicy](#msgcreategrouppolicy) + * [Msg/CreateGroupWithPolicy](#msgcreategroupwithpolicy) + * [Msg/UpdateGroupPolicyAdmin](#msgupdategrouppolicyadmin) + * [Msg/UpdateGroupPolicyDecisionPolicy](#msgupdategrouppolicydecisionpolicy) + * [Msg/UpdateGroupPolicyMetadata](#msgupdategrouppolicymetadata) + * [Msg/SubmitProposal](#msgsubmitproposal) + * [Msg/WithdrawProposal](#msgwithdrawproposal) + * [Msg/Vote](#msgvote) + * [Msg/Exec](#msgexec) + * [Msg/LeaveGroup](#msgleavegroup) * [Events](#events) - * [EventCreateGroup](#eventcreategroup) - * [EventUpdateGroup](#eventupdategroup) - * [EventCreateGroupPolicy](#eventcreategrouppolicy) - * [EventUpdateGroupPolicy](#eventupdategrouppolicy) - * [EventCreateProposal](#eventcreateproposal) - * [EventWithdrawProposal](#eventwithdrawproposal) - * [EventVote](#eventvote) - * [EventExec](#eventexec) - * [EventLeaveGroup](#eventleavegroup) - * [EventProposalFinalized](#eventProposalFinalized) + * [EventCreateGroup](#eventcreategroup) + * [EventUpdateGroup](#eventupdategroup) + * [EventCreateGroupPolicy](#eventcreategrouppolicy) + * [EventUpdateGroupPolicy](#eventupdategrouppolicy) + * [EventCreateProposal](#eventcreateproposal) + * [EventWithdrawProposal](#eventwithdrawproposal) + * [EventVote](#eventvote) + * [EventExec](#eventexec) + * [EventLeaveGroup](#eventleavegroup) + * [EventProposalPruned](#eventProposalPruned) * [Client](#client) - * [CLI](#cli) - * [gRPC](#grpc) - * [REST](#rest) + * [CLI](#cli) + * [gRPC](#grpc) + * [REST](#rest) * [Metadata](#metadata) ## Concepts @@ -598,14 +598,14 @@ The group module emits the following events: | cosmos.group.v1.EventLeaveGroup | proposal_id | {proposalId} | | cosmos.group.v1.EventLeaveGroup | address | {address} | -### EventProposalFinalized +### EventProposalPruned -| Type | Attribute Key | Attribute Value | -|----------------------------------------|---------------|---------------------------------| -| message | action | /cosmos.group.v1.Msg/LeaveGroup | -| cosmos.group.v1.EventProposalFinalized | proposal_id | {proposalId} | -| cosmos.group.v1.EventProposalFinalized | status | {ProposalStatus} | -| cosmos.group.v1.EventProposalFinalized | tally_result | {TallyResult} | +| Type | Attribute Key | Attribute Value | +|-------------------------------------|---------------|---------------------------------| +| message | action | /cosmos.group.v1.Msg/LeaveGroup | +| cosmos.group.v1.EventProposalPruned | proposal_id | {proposalId} | +| cosmos.group.v1.EventProposalPruned | status | {ProposalStatus} | +| cosmos.group.v1.EventProposalPruned | tally_result | {TallyResult} | ## Client diff --git a/x/group/events.pb.go b/x/group/events.pb.go index f3271155ab17..9654898cbe2d 100644 --- a/x/group/events.pb.go +++ b/x/group/events.pb.go @@ -465,27 +465,27 @@ func (m *EventLeaveGroup) GetAddress() string { } // EventProposalTallyFinalized is an event emitted when a proposal tally is finalized. -type EventProposalFinalized struct { +type EventProposalPruned struct { // proposal_id is the unique ID of the proposal. ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - // result is the proposal tally result. + // status is the proposal status (UNSPECIFIED, SUBMITTED, ACCEPTED, REJECTED, ABORTED, WITHDRAWN). Status ProposalStatus `protobuf:"varint,2,opt,name=status,proto3,enum=cosmos.group.v1.ProposalStatus" json:"status,omitempty"` // tally_result is the proposal tally result. TallyResult *TallyResult `protobuf:"bytes,3,opt,name=tally_result,json=tallyResult,proto3" json:"tally_result,omitempty"` } -func (m *EventProposalFinalized) Reset() { *m = EventProposalFinalized{} } -func (m *EventProposalFinalized) String() string { return proto.CompactTextString(m) } -func (*EventProposalFinalized) ProtoMessage() {} -func (*EventProposalFinalized) Descriptor() ([]byte, []int) { +func (m *EventProposalPruned) Reset() { *m = EventProposalPruned{} } +func (m *EventProposalPruned) String() string { return proto.CompactTextString(m) } +func (*EventProposalPruned) ProtoMessage() {} +func (*EventProposalPruned) Descriptor() ([]byte, []int) { return fileDescriptor_e8d753981546f032, []int{9} } -func (m *EventProposalFinalized) XXX_Unmarshal(b []byte) error { +func (m *EventProposalPruned) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EventProposalFinalized) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EventProposalPruned) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EventProposalFinalized.Marshal(b, m, deterministic) + return xxx_messageInfo_EventProposalPruned.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -495,33 +495,33 @@ func (m *EventProposalFinalized) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *EventProposalFinalized) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventProposalFinalized.Merge(m, src) +func (m *EventProposalPruned) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventProposalPruned.Merge(m, src) } -func (m *EventProposalFinalized) XXX_Size() int { +func (m *EventProposalPruned) XXX_Size() int { return m.Size() } -func (m *EventProposalFinalized) XXX_DiscardUnknown() { - xxx_messageInfo_EventProposalFinalized.DiscardUnknown(m) +func (m *EventProposalPruned) XXX_DiscardUnknown() { + xxx_messageInfo_EventProposalPruned.DiscardUnknown(m) } -var xxx_messageInfo_EventProposalFinalized proto.InternalMessageInfo +var xxx_messageInfo_EventProposalPruned proto.InternalMessageInfo -func (m *EventProposalFinalized) GetProposalId() uint64 { +func (m *EventProposalPruned) GetProposalId() uint64 { if m != nil { return m.ProposalId } return 0 } -func (m *EventProposalFinalized) GetStatus() ProposalStatus { +func (m *EventProposalPruned) GetStatus() ProposalStatus { if m != nil { return m.Status } return PROPOSAL_STATUS_UNSPECIFIED } -func (m *EventProposalFinalized) GetTallyResult() *TallyResult { +func (m *EventProposalPruned) GetTallyResult() *TallyResult { if m != nil { return m.TallyResult } @@ -538,41 +538,41 @@ func init() { proto.RegisterType((*EventVote)(nil), "cosmos.group.v1.EventVote") proto.RegisterType((*EventExec)(nil), "cosmos.group.v1.EventExec") proto.RegisterType((*EventLeaveGroup)(nil), "cosmos.group.v1.EventLeaveGroup") - proto.RegisterType((*EventProposalFinalized)(nil), "cosmos.group.v1.EventProposalFinalized") + proto.RegisterType((*EventProposalPruned)(nil), "cosmos.group.v1.EventProposalPruned") } func init() { proto.RegisterFile("cosmos/group/v1/events.proto", fileDescriptor_e8d753981546f032) } var fileDescriptor_e8d753981546f032 = []byte{ - // 448 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0x4f, 0x8f, 0x12, 0x31, - 0x18, 0xc6, 0xe9, 0xba, 0x61, 0xdd, 0x62, 0x5c, 0x53, 0xff, 0x64, 0x76, 0xdd, 0xcc, 0x6e, 0x88, - 0x89, 0x1c, 0x64, 0x26, 0x60, 0xa2, 0x9e, 0x24, 0x62, 0xd0, 0x90, 0x70, 0x20, 0x83, 0x7f, 0x12, - 0x2f, 0x58, 0xa6, 0xcd, 0xd0, 0x38, 0xd0, 0x49, 0xdb, 0x19, 0xc1, 0x9b, 0xdf, 0xc0, 0xef, 0xa2, - 0x1f, 0xc2, 0x23, 0xf1, 0xe4, 0xd1, 0xc0, 0x17, 0x31, 0xd3, 0xe9, 0x00, 0xc1, 0x98, 0x21, 0xd9, - 0x13, 0x6d, 0x9f, 0xdf, 0xf3, 0xf0, 0xbe, 0x7d, 0xa7, 0xf0, 0xdc, 0xe7, 0x72, 0xc2, 0xa5, 0x1b, - 0x08, 0x1e, 0x47, 0x6e, 0xd2, 0x70, 0x69, 0x42, 0xa7, 0x4a, 0x3a, 0x91, 0xe0, 0x8a, 0xa3, 0x93, - 0x4c, 0x75, 0xb4, 0xea, 0x24, 0x8d, 0xb3, 0xd3, 0xec, 0x60, 0xa8, 0x65, 0xd7, 0xa8, 0x7a, 0x73, - 0x76, 0x7f, 0x37, 0x49, 0xcd, 0x23, 0x6a, 0xc4, 0x6a, 0x1d, 0xde, 0xea, 0xa4, 0xc1, 0x2f, 0x05, - 0xc5, 0x8a, 0xbe, 0x4e, 0x11, 0x74, 0x0a, 0xaf, 0x6b, 0x76, 0xc8, 0x88, 0x05, 0x2e, 0x41, 0xed, - 0xd0, 0x3b, 0xd2, 0xfb, 0x2e, 0x59, 0xe3, 0x6f, 0x23, 0xb2, 0x0f, 0xde, 0x83, 0xf7, 0x76, 0xd3, - 0xfb, 0x3c, 0x64, 0xfe, 0x1c, 0x35, 0xe1, 0x11, 0x26, 0x44, 0x50, 0x29, 0xb5, 0xe7, 0xb8, 0x6d, - 0xfd, 0xfa, 0x51, 0xbf, 0x63, 0xea, 0x7e, 0x91, 0x29, 0x03, 0x25, 0xd8, 0x34, 0xf0, 0x72, 0x70, - 0x9d, 0xb6, 0xf5, 0xe7, 0x57, 0x48, 0x7b, 0x02, 0x6f, 0xeb, 0xb4, 0x41, 0x3c, 0x9a, 0x30, 0xd5, - 0x17, 0x3c, 0xe2, 0x12, 0x87, 0xe8, 0x02, 0x56, 0x22, 0xb3, 0xde, 0x34, 0x04, 0xf3, 0xa3, 0x2e, - 0xa9, 0x3e, 0x83, 0x77, 0xb5, 0xef, 0x3d, 0x53, 0x63, 0x22, 0xf0, 0xe7, 0xfd, 0x9d, 0x8f, 0xe0, - 0xb1, 0x76, 0xbe, 0xe3, 0x8a, 0x16, 0xd3, 0x5f, 0x81, 0xc1, 0x3b, 0x33, 0xea, 0x17, 0xe2, 0xa8, - 0x05, 0xcb, 0x82, 0xca, 0x38, 0x54, 0xd6, 0xc1, 0x25, 0xa8, 0xdd, 0x6c, 0x3e, 0x74, 0x76, 0x3e, - 0x11, 0x27, 0x2f, 0x34, 0xcd, 0x8b, 0x15, 0x17, 0x9e, 0xc6, 0x3d, 0x63, 0x43, 0x08, 0x1e, 0x86, - 0x3c, 0x90, 0xd6, 0xb5, 0xf4, 0x02, 0x3d, 0xbd, 0xae, 0x7e, 0x84, 0x27, 0xba, 0x84, 0x1e, 0xc5, - 0x49, 0xe1, 0xb4, 0xb7, 0xa7, 0x70, 0xb0, 0xef, 0x14, 0xbe, 0x03, 0x33, 0xd4, 0xbc, 0xba, 0x57, - 0x6c, 0x8a, 0x43, 0xf6, 0x85, 0x92, 0xe2, 0x96, 0x9f, 0xc2, 0xb2, 0x54, 0x58, 0xc5, 0xd2, 0xb4, - 0x7c, 0xf1, 0xdf, 0x96, 0x07, 0x1a, 0xf3, 0x0c, 0x8e, 0x5a, 0xf0, 0x86, 0xc2, 0x61, 0x38, 0x1f, - 0x9a, 0x1b, 0x4b, 0x5b, 0xae, 0x34, 0xcf, 0xff, 0xb1, 0xbf, 0x49, 0x21, 0x73, 0x4d, 0x15, 0xb5, - 0xd9, 0xb4, 0x9f, 0xff, 0x5c, 0xda, 0x60, 0xb1, 0xb4, 0xc1, 0x9f, 0xa5, 0x0d, 0xbe, 0xad, 0xec, - 0xd2, 0x62, 0x65, 0x97, 0x7e, 0xaf, 0xec, 0xd2, 0x87, 0x07, 0x01, 0x53, 0xe3, 0x78, 0xe4, 0xf8, - 0x7c, 0x62, 0x5e, 0xa1, 0xf9, 0xa9, 0x4b, 0xf2, 0xc9, 0x9d, 0x65, 0x8f, 0x70, 0x54, 0xd6, 0x8f, - 0xef, 0xf1, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8f, 0x91, 0x58, 0x4f, 0xe5, 0x03, 0x00, 0x00, + // 442 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0x4f, 0xef, 0xd2, 0x30, + 0x18, 0xc7, 0xe9, 0x4f, 0x02, 0x52, 0x8c, 0x98, 0xfa, 0x27, 0x03, 0xc9, 0x20, 0xc4, 0x44, 0x0e, + 0xb2, 0x05, 0x4c, 0xd4, 0x93, 0x44, 0x0c, 0x31, 0x24, 0x1c, 0xc8, 0xf0, 0x4f, 0xe2, 0x05, 0xc7, + 0xda, 0x8c, 0xc5, 0x41, 0x97, 0xb6, 0x9b, 0x70, 0xf4, 0x1d, 0xf8, 0x52, 0x3c, 0xf8, 0x22, 0x3c, + 0x12, 0x4f, 0x1e, 0x0d, 0xbc, 0x11, 0xb3, 0xae, 0x03, 0x82, 0x31, 0x23, 0xf9, 0x9d, 0x68, 0xfb, + 0xfd, 0x7c, 0xbf, 0x3c, 0x4f, 0x9f, 0x15, 0xd6, 0x1d, 0xca, 0x97, 0x94, 0x9b, 0x2e, 0xa3, 0x61, + 0x60, 0x46, 0x5d, 0x93, 0x44, 0x64, 0x25, 0xb8, 0x11, 0x30, 0x2a, 0x28, 0xaa, 0x24, 0xaa, 0x21, + 0x55, 0x23, 0xea, 0xd6, 0xaa, 0xc9, 0xc1, 0x4c, 0xca, 0xa6, 0x52, 0xe5, 0xa6, 0xf6, 0xf0, 0x3c, + 0x49, 0x6c, 0x02, 0xa2, 0xc4, 0x56, 0x07, 0xde, 0x19, 0xc6, 0xc1, 0xaf, 0x19, 0xb1, 0x05, 0x79, + 0x13, 0x23, 0xa8, 0x0a, 0x6f, 0x4a, 0x76, 0xe6, 0x61, 0x0d, 0x34, 0x41, 0x3b, 0x6f, 0x15, 0xe5, + 0x7e, 0x84, 0x0f, 0xf8, 0xbb, 0x00, 0x5f, 0x82, 0x8f, 0xe1, 0x83, 0xf3, 0xf4, 0x09, 0xf5, 0x3d, + 0x67, 0x83, 0x7a, 0xb0, 0x68, 0x63, 0xcc, 0x08, 0xe7, 0xd2, 0x53, 0x1a, 0x68, 0xbf, 0x7e, 0x74, + 0xee, 0xa9, 0xba, 0x5f, 0x25, 0xca, 0x54, 0x30, 0x6f, 0xe5, 0x5a, 0x29, 0x78, 0x48, 0x3b, 0xf9, + 0xf3, 0x6b, 0xa4, 0x3d, 0x83, 0x77, 0x65, 0xda, 0x34, 0x9c, 0x2f, 0x3d, 0x31, 0x61, 0x34, 0xa0, + 0xdc, 0xf6, 0x51, 0x03, 0x96, 0x03, 0xb5, 0x3e, 0x36, 0x04, 0xd3, 0xa3, 0x11, 0x6e, 0xbd, 0x80, + 0xf7, 0xa5, 0xef, 0x83, 0x27, 0x16, 0x98, 0xd9, 0x5f, 0x2e, 0x77, 0x3e, 0x81, 0x25, 0xe9, 0x7c, + 0x4f, 0x05, 0xc9, 0xa6, 0xbf, 0x02, 0x85, 0x0f, 0xd7, 0xc4, 0xc9, 0xc4, 0x51, 0x1f, 0x16, 0x18, + 0xe1, 0xa1, 0x2f, 0xb4, 0xab, 0x26, 0x68, 0xdf, 0xee, 0x3d, 0x36, 0xce, 0x3e, 0x11, 0x23, 0x2d, + 0x34, 0xce, 0x0b, 0x05, 0x65, 0x96, 0xc4, 0x2d, 0x65, 0x43, 0x08, 0xe6, 0x7d, 0xea, 0x72, 0xed, + 0x46, 0x7c, 0x81, 0x96, 0x5c, 0xb7, 0x3e, 0xc1, 0x8a, 0x2c, 0x61, 0x4c, 0xec, 0x28, 0x73, 0xda, + 0xa7, 0x53, 0xb8, 0xba, 0x74, 0x0a, 0xdf, 0x81, 0x1a, 0x43, 0x5a, 0xdd, 0x84, 0x85, 0x2b, 0x82, + 0xb3, 0xfb, 0x7d, 0x0e, 0x0b, 0x5c, 0xd8, 0x22, 0xe4, 0xaa, 0xdf, 0xc6, 0x7f, 0xfb, 0x9d, 0x4a, + 0xcc, 0x52, 0x38, 0xea, 0xc3, 0x5b, 0xc2, 0xf6, 0xfd, 0xcd, 0x4c, 0x5d, 0x57, 0xdc, 0x6f, 0xb9, + 0x57, 0xff, 0xc7, 0xfe, 0x36, 0x86, 0xd4, 0x1d, 0x95, 0xc5, 0x71, 0x33, 0x78, 0xf9, 0x73, 0xa7, + 0x83, 0xed, 0x4e, 0x07, 0x7f, 0x76, 0x3a, 0xf8, 0xb6, 0xd7, 0x73, 0xdb, 0xbd, 0x9e, 0xfb, 0xbd, + 0xd7, 0x73, 0x1f, 0x1f, 0xb9, 0x9e, 0x58, 0x84, 0x73, 0xc3, 0xa1, 0x4b, 0xf5, 0x04, 0xd5, 0x4f, + 0x87, 0xe3, 0xcf, 0xe6, 0x3a, 0x79, 0x81, 0xf3, 0x82, 0x7c, 0x79, 0x4f, 0xff, 0x06, 0x00, 0x00, + 0xff, 0xff, 0xa5, 0x1a, 0x1c, 0xb9, 0xe2, 0x03, 0x00, 0x00, } func (m *EventCreateGroup) Marshal() (dAtA []byte, err error) { @@ -850,7 +850,7 @@ func (m *EventLeaveGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *EventProposalFinalized) Marshal() (dAtA []byte, err error) { +func (m *EventProposalPruned) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -860,12 +860,12 @@ func (m *EventProposalFinalized) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EventProposalFinalized) MarshalTo(dAtA []byte) (int, error) { +func (m *EventProposalPruned) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventProposalFinalized) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventProposalPruned) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1027,7 +1027,7 @@ func (m *EventLeaveGroup) Size() (n int) { return n } -func (m *EventProposalFinalized) Size() (n int) { +func (m *EventProposalPruned) Size() (n int) { if m == nil { return 0 } @@ -1782,7 +1782,7 @@ func (m *EventLeaveGroup) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventProposalFinalized) Unmarshal(dAtA []byte) error { +func (m *EventProposalPruned) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1805,10 +1805,10 @@ func (m *EventProposalFinalized) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventProposalFinalized: wiretype end group for non-group") + return fmt.Errorf("proto: EventProposalPruned: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventProposalFinalized: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventProposalPruned: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/x/group/keeper/keeper.go b/x/group/keeper/keeper.go index 9021042b5c49..6813317cfd83 100644 --- a/x/group/keeper/keeper.go +++ b/x/group/keeper/keeper.go @@ -5,6 +5,7 @@ import ( "time" "cosmossdk.io/log" + storetypes "cosmossdk.io/store/types" errorsmod "cosmossdk.io/errors" @@ -377,7 +378,7 @@ func (k Keeper) PruneProposals(ctx sdk.Context) error { } // Emit event for proposal finalized with its result if err := ctx.EventManager().EmitTypedEvent( - &group.EventProposalFinalized{ + &group.EventProposalPruned{ ProposalId: proposal.Id, Status: proposal.Status, TallyResult: &proposal.FinalTallyResult, @@ -419,7 +420,7 @@ func (k Keeper) TallyProposalsAtVPEnd(ctx sdk.Context) error { } // Emit event for proposal finalized with its result if err := ctx.EventManager().EmitTypedEvent( - &group.EventProposalFinalized{ + &group.EventProposalPruned{ ProposalId: proposal.Id, Status: proposal.Status, }); err != nil { diff --git a/x/group/types.pb.go b/x/group/types.pb.go index dfa7b37e388f..378e1189d86b 100644 --- a/x/group/types.pb.go +++ b/x/group/types.pb.go @@ -643,7 +643,8 @@ type GroupPolicyInfo struct { // admin is the account address of the group admin. Admin string `protobuf:"bytes,3,opt,name=admin,proto3" json:"admin,omitempty"` // metadata is any arbitrary metadata attached to the group policy. - // the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 + // the recommended format of the metadata is to be found here: + // https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 Metadata string `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"` // version is used to track changes to a group's GroupPolicyInfo structure that // would create a different result on a running proposal. @@ -697,7 +698,8 @@ type Proposal struct { // group_policy_address is the account address of group policy. GroupPolicyAddress string `protobuf:"bytes,2,opt,name=group_policy_address,json=groupPolicyAddress,proto3" json:"group_policy_address,omitempty"` // metadata is any arbitrary metadata attached to the proposal. - // the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#proposal-4 + // the recommended format of the metadata is to be found here: + // https://docs.cosmos.network/v0.47/modules/group#proposal-4 Metadata string `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata,omitempty"` // proposers are the account addresses of the proposers. Proposers []string `protobuf:"bytes,4,rep,name=proposers,proto3" json:"proposers,omitempty"` From 3de27ec3f58ae4415ccc5177a33febd9c246a77e Mon Sep 17 00:00:00 2001 From: Jeancarlo Date: Wed, 24 May 2023 02:26:14 -0600 Subject: [PATCH 15/19] fix test --- x/group/keeper/msg_server.go | 6 +---- x/group/keeper/msg_server_test.go | 37 +++++++++++++------------------ 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/x/group/keeper/msg_server.go b/x/group/keeper/msg_server.go index cadf95418462..9d1d26e61053 100644 --- a/x/group/keeper/msg_server.go +++ b/x/group/keeper/msg_server.go @@ -803,10 +803,6 @@ func (k Keeper) doTallyAndUpdate(ctx sdk.Context, p *group.Proposal, groupInfo g p.Status = group.PROPOSAL_STATUS_REJECTED } - if err != nil { - return err - } - } return nil @@ -883,7 +879,7 @@ func (k Keeper) Exec(goCtx context.Context, msg *group.MsgExec) (*group.MsgExecR // Emit event for proposal finalized with its result if err := ctx.EventManager().EmitTypedEvent( - &group.EventProposalFinalized{ + &group.EventProposalPruned{ ProposalId: proposal.Id, Status: proposal.Status, TallyResult: &proposal.FinalTallyResult, diff --git a/x/group/keeper/msg_server_test.go b/x/group/keeper/msg_server_test.go index 39b764ad9ee1..78ecc5226b57 100644 --- a/x/group/keeper/msg_server_test.go +++ b/x/group/keeper/msg_server_test.go @@ -23,7 +23,7 @@ import ( minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" ) -var EventTallyResult = "cosmos.group.v1.EventProposalFinalized" +var EventTallyResult = "cosmos.group.v1.EventProposalPruned" func (s *TestSuite) TestCreateGroupWithLotsOfMembers() { for i := 50; i < 70; i++ { @@ -2533,7 +2533,7 @@ func (s *TestSuite) TestExecProposal() { expBalance bool expFromBalances sdk.Coin expToBalances sdk.Coin - checkEvents func(sdkCtx sdk.Context) + postRun func(sdkCtx sdk.Context) }{ "proposal executed when accepted": { setupProposal: func(ctx context.Context) uint64 { @@ -2547,7 +2547,7 @@ func (s *TestSuite) TestExecProposal() { expBalance: true, expFromBalances: sdk.NewInt64Coin("test", 9900), expToBalances: sdk.NewInt64Coin("test", 100), - checkEvents: func(sdkCtx sdk.Context) { + postRun: func(sdkCtx sdk.Context) { events := sdkCtx.EventManager().ABCIEvents() s.Require().True(eventTypeFound(events, EventTallyResult)) }, @@ -2565,7 +2565,7 @@ func (s *TestSuite) TestExecProposal() { expBalance: true, expFromBalances: sdk.NewInt64Coin("test", 9800), expToBalances: sdk.NewInt64Coin("test", 200), - checkEvents: func(sdkCtx sdk.Context) { + postRun: func(sdkCtx sdk.Context) { events := sdkCtx.EventManager().ABCIEvents() s.Require().True(eventTypeFound(events, EventTallyResult)) }, @@ -2578,7 +2578,7 @@ func (s *TestSuite) TestExecProposal() { srcBlockTime: s.blockTime.Add(minExecutionPeriod), // After min execution period end expProposalStatus: group.PROPOSAL_STATUS_REJECTED, expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_NOT_RUN, - checkEvents: func(sdkCtx sdk.Context) { + postRun: func(sdkCtx sdk.Context) { events := sdkCtx.EventManager().ABCIEvents() s.Require().False(eventTypeFound(events, EventTallyResult)) }, @@ -2589,7 +2589,7 @@ func (s *TestSuite) TestExecProposal() { }, expProposalStatus: group.PROPOSAL_STATUS_SUBMITTED, expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_NOT_RUN, - checkEvents: func(sdkCtx sdk.Context) { + postRun: func(sdkCtx sdk.Context) { events := sdkCtx.EventManager().ABCIEvents() s.Require().False(eventTypeFound(events, EventTallyResult)) }, @@ -2616,7 +2616,7 @@ func (s *TestSuite) TestExecProposal() { srcBlockTime: s.blockTime.Add(time.Second), // Voting period is 1s expProposalStatus: group.PROPOSAL_STATUS_REJECTED, expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_NOT_RUN, - checkEvents: func(sdkCtx sdk.Context) {}, + postRun: func(sdkCtx sdk.Context) {}, }, "Decision policy also applied after voting period end": { setupProposal: func(ctx context.Context) uint64 { @@ -2626,7 +2626,7 @@ func (s *TestSuite) TestExecProposal() { srcBlockTime: s.blockTime.Add(time.Second).Add(time.Millisecond), // Voting period is 1s expProposalStatus: group.PROPOSAL_STATUS_REJECTED, expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_NOT_RUN, - checkEvents: func(sdkCtx sdk.Context) {}, + postRun: func(sdkCtx sdk.Context) {}, }, "exec proposal before MinExecutionPeriod should fail": { setupProposal: func(ctx context.Context) uint64 { @@ -2636,7 +2636,7 @@ func (s *TestSuite) TestExecProposal() { srcBlockTime: s.blockTime.Add(4 * time.Second), // min execution date is 5s later after s.blockTime expProposalStatus: group.PROPOSAL_STATUS_ACCEPTED, expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_FAILURE, // Because MinExecutionPeriod has not passed - checkEvents: func(sdkCtx sdk.Context) {}, + postRun: func(sdkCtx sdk.Context) {}, }, "exec proposal at exactly MinExecutionPeriod should pass": { setupProposal: func(ctx context.Context) uint64 { @@ -2647,16 +2647,9 @@ func (s *TestSuite) TestExecProposal() { srcBlockTime: s.blockTime.Add(5 * time.Second), // min execution date is 5s later after s.blockTime expProposalStatus: group.PROPOSAL_STATUS_ACCEPTED, expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_SUCCESS, - checkEvents: func(sdkCtx sdk.Context) { + postRun: func(sdkCtx sdk.Context) { events := sdkCtx.EventManager().ABCIEvents() - execEventFound := false - for _, e := range events { - if e.Type == EventTallyResult { - execEventFound = true - break - } - } - s.Require().True(execEventFound) + s.Require().True(eventTypeFound(events, EventTallyResult)) }, }, "prevent double execution when successful": { @@ -2679,7 +2672,7 @@ func (s *TestSuite) TestExecProposal() { expBalance: true, expFromBalances: sdk.NewInt64Coin("test", 9900), expToBalances: sdk.NewInt64Coin("test", 100), - checkEvents: func(sdkCtx sdk.Context) {}, + postRun: func(sdkCtx sdk.Context) {}, }, "rollback all msg updates on failure": { setupProposal: func(ctx context.Context) uint64 { @@ -2692,7 +2685,7 @@ func (s *TestSuite) TestExecProposal() { srcBlockTime: s.blockTime.Add(minExecutionPeriod), // After min execution period end expProposalStatus: group.PROPOSAL_STATUS_ACCEPTED, expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_FAILURE, - checkEvents: func(sdkCtx sdk.Context) {}, + postRun: func(sdkCtx sdk.Context) {}, }, "executable when failed before": { setupProposal: func(ctx context.Context) uint64 { @@ -2714,7 +2707,7 @@ func (s *TestSuite) TestExecProposal() { srcBlockTime: s.blockTime.Add(minExecutionPeriod), // After min execution period end expProposalStatus: group.PROPOSAL_STATUS_ACCEPTED, expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_SUCCESS, - checkEvents: func(sdkCtx sdk.Context) {}, + postRun: func(sdkCtx sdk.Context) {}, }, } for msg, spec := range specs { @@ -2760,7 +2753,7 @@ func (s *TestSuite) TestExecProposal() { toBalances := s.bankKeeper.GetAllBalances(sdkCtx, addr2) s.Require().Contains(toBalances, spec.expToBalances) } - spec.checkEvents(sdkCtx) + spec.postRun(sdkCtx) }) } From 620ae1836283b2140bcf758d9cb63a31b03ff001 Mon Sep 17 00:00:00 2001 From: Jeancarlo Date: Wed, 24 May 2023 02:31:01 -0600 Subject: [PATCH 16/19] manual fix readme --- x/group/README.md | 157 ++++++++++++++++++---------------------------- 1 file changed, 60 insertions(+), 97 deletions(-) diff --git a/x/group/README.md b/x/group/README.md index dfb928fad898..29e5478b5fb2 100644 --- a/x/group/README.md +++ b/x/group/README.md @@ -8,8 +8,7 @@ sidebar_position: 1 The following documents specify the group module. -This module allows the creation and management of on-chain multisig accounts and enables voting for message execution -based on configurable decision policies. +This module allows the creation and management of on-chain multisig accounts and enables voting for message execution based on configurable decision policies. ## Contents @@ -50,7 +49,7 @@ based on configurable decision policies. * [EventVote](#eventvote) * [EventExec](#eventexec) * [EventLeaveGroup](#eventleavegroup) - * [EventProposalPruned](#eventProposalPruned) + * [EventProposalPruned](#eventproposalpruned) * [Client](#client) * [CLI](#cli) * [gRPC](#grpc) @@ -102,7 +101,7 @@ custom decision policies, as long as they adhere to the `DecisionPolicy` interface: ```go reference -https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/group/types.go#L27-L45 +https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/group/types.go#L27-L45 ``` #### Threshold decision policy @@ -213,8 +212,7 @@ Votes are pruned: * either after a successful tally, i.e. a tally whose result passes the decision policy's rules, which can be trigged by a `Msg/Exec` or a `Msg/{SubmitProposal,Vote}` with the `Exec` field set, -* or on `EndBlock` right after the proposal's voting period end. This applies to proposals with status `aborted` - or `withdrawn` too. +* or on `EndBlock` right after the proposal's voting period end. This applies to proposals with status `aborted` or `withdrawn` too. whichever happens first. @@ -230,8 +228,7 @@ whichever happens first. ## State The `group` module uses the `orm` package which provides table storage with support for -primary keys and secondary indexes. `orm` also defines `Sequence` which is a persistent unique key generator based on a -counter that can be used along with `Table`s. +primary keys and secondary indexes. `orm` also defines `Sequence` which is a persistent unique key generator based on a counter that can be used along with `Table`s. Here's the list of tables and associated sequences and indexes stored as part of the `group` module. @@ -241,8 +238,7 @@ The `groupTable` stores `GroupInfo`: `0x0 | BigEndian(GroupId) -> ProtocolBuffer #### groupSeq -The value of `groupSeq` is incremented when creating a new group and corresponds to the -new `GroupId`: `0x1 | 0x1 -> BigEndian`. +The value of `groupSeq` is incremented when creating a new group and corresponds to the new `GroupId`: `0x1 | 0x1 -> BigEndian`. The second `0x1` corresponds to the ORM `sequenceStorageKey`. @@ -253,8 +249,7 @@ The second `0x1` corresponds to the ORM `sequenceStorageKey`. ### Group Member Table -The `groupMemberTable` stores `GroupMember` -s: `0x10 | BigEndian(GroupId) | []byte(member.Address) -> ProtocolBuffer(GroupMember)`. +The `groupMemberTable` stores `GroupMember`s: `0x10 | BigEndian(GroupId) | []byte(member.Address) -> ProtocolBuffer(GroupMember)`. The `groupMemberTable` is a primary key table and its `PrimaryKey` is given by `BigEndian(GroupId) | []byte(member.Address)` which is used by the following indexes. @@ -271,16 +266,14 @@ The `groupMemberTable` is a primary key table and its `PrimaryKey` is given by ### Group Policy Table -The `groupPolicyTable` -stores `GroupPolicyInfo`: `0x20 | len([]byte(Address)) | []byte(Address) -> ProtocolBuffer(GroupPolicyInfo)`. +The `groupPolicyTable` stores `GroupPolicyInfo`: `0x20 | len([]byte(Address)) | []byte(Address) -> ProtocolBuffer(GroupPolicyInfo)`. The `groupPolicyTable` is a primary key table and its `PrimaryKey` is given by `len([]byte(Address)) | []byte(Address)` which is used by the following indexes. #### groupPolicySeq -The value of `groupPolicySeq` is incremented when creating a new group policy and is used to generate the new group -policy account `Address`: +The value of `groupPolicySeq` is incremented when creating a new group policy and is used to generate the new group policy account `Address`: `0x21 | 0x1 -> BigEndian`. The second `0x1` corresponds to the ORM `sequenceStorageKey`. @@ -301,8 +294,7 @@ The `proposalTable` stores `Proposal`s: `0x30 | BigEndian(ProposalId) -> Protoco #### proposalSeq -The value of `proposalSeq` is incremented when creating a new proposal and corresponds to the -new `ProposalId`: `0x31 | 0x1 -> BigEndian`. +The value of `proposalSeq` is incremented when creating a new proposal and corresponds to the new `ProposalId`: `0x31 | 0x1 -> BigEndian`. The second `0x1` corresponds to the ORM `sequenceStorageKey`. @@ -316,8 +308,7 @@ The second `0x1` corresponds to the ORM `sequenceStorageKey`. `proposalsByVotingPeriodEndIndex` allows to retrieve proposals sorted by chronological `voting_period_end`: `0x33 | sdk.FormatTimeBytes(proposal.VotingPeriodEnd) | BigEndian(ProposalId) -> []byte()`. -This index is used when tallying the proposal votes at the end of the voting period, and for pruning proposals -at `VotingPeriodEnd + MaxExecutionPeriod`. +This index is used when tallying the proposal votes at the end of the voting period, and for pruning proposals at `VotingPeriodEnd + MaxExecutionPeriod`. ### Vote Table @@ -340,14 +331,13 @@ The `voteTable` is a primary key table and its `PrimaryKey` is given by ### Msg/CreateGroup -A new group can be created with the `MsgCreateGroup`, which has an admin address, a list of members and some optional -metadata. +A new group can be created with the `MsgCreateGroup`, which has an admin address, a list of members and some optional metadata. The metadata has a maximum length that is chosen by the app developer, and passed into the group keeper as a config. ```go reference -https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L67-L80 +https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L67-L80 ``` It's expected to fail if @@ -360,7 +350,7 @@ It's expected to fail if Group members can be updated with the `UpdateGroupMembers`. ```go reference -https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L88-L102 +https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L88-L102 ``` In the list of `MemberUpdates`, an existing member can be removed by setting its weight to 0. @@ -368,15 +358,14 @@ In the list of `MemberUpdates`, an existing member can be removed by setting its It's expected to fail if: * the signer is not the admin of the group. -* for any one of the associated group policies, if its decision policy's `Validate()` method fails against the updated - group. +* for any one of the associated group policies, if its decision policy's `Validate()` method fails against the updated group. ### Msg/UpdateGroupAdmin The `UpdateGroupAdmin` can be used to update a group admin. ```go reference -https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L107-L120 +https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L107-L120 ``` It's expected to fail if the signer is not the admin of the group. @@ -386,7 +375,7 @@ It's expected to fail if the signer is not the admin of the group. The `UpdateGroupMetadata` can be used to update a group metadata. ```go reference -https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L125-L138 +https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L125-L138 ``` It's expected to fail if: @@ -396,11 +385,10 @@ It's expected to fail if: ### Msg/CreateGroupPolicy -A new group policy can be created with the `MsgCreateGroupPolicy`, which has an admin address, a group id, a decision -policy and some optional metadata. +A new group policy can be created with the `MsgCreateGroupPolicy`, which has an admin address, a group id, a decision policy and some optional metadata. ```go reference -https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L147-L165 +https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L147-L165 ``` It's expected to fail if: @@ -411,12 +399,10 @@ It's expected to fail if: ### Msg/CreateGroupWithPolicy -A new group with policy can be created with the `MsgCreateGroupWithPolicy`, which has an admin address, a list of -members, a decision policy, a `group_policy_as_admin` field to optionally set group and group policy admin with group -policy address and some optional metadata for group and group policy. +A new group with policy can be created with the `MsgCreateGroupWithPolicy`, which has an admin address, a list of members, a decision policy, a `group_policy_as_admin` field to optionally set group and group policy admin with group policy address and some optional metadata for group and group policy. ```go reference -https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L191-L215 +https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L191-L215 ``` It's expected to fail for the same reasons as `Msg/CreateGroup` and `Msg/CreateGroupPolicy`. @@ -426,7 +412,7 @@ It's expected to fail for the same reasons as `Msg/CreateGroup` and `Msg/CreateG The `UpdateGroupPolicyAdmin` can be used to update a group policy admin. ```go reference -https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L173-L186 +https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L173-L186 ``` It's expected to fail if the signer is not the admin of the group policy. @@ -436,7 +422,7 @@ It's expected to fail if the signer is not the admin of the group policy. The `UpdateGroupPolicyDecisionPolicy` can be used to update a decision policy. ```go reference -https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L226-L241 +https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L226-L241 ``` It's expected to fail if: @@ -449,7 +435,7 @@ It's expected to fail if: The `UpdateGroupPolicyMetadata` can be used to update a group policy metadata. ```go reference -https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L246-L259 +https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L246-L259 ``` It's expected to fail if: @@ -459,13 +445,11 @@ It's expected to fail if: ### Msg/SubmitProposal -A new proposal can be created with the `MsgSubmitProposal`, which has a group policy account address, a list of -proposers addresses, a list of messages to execute if the proposal is accepted and some optional metadata. -An optional `Exec` value can be provided to try to execute the proposal immediately after proposal creation. Proposers -signatures are considered as yes votes in this case. +A new proposal can be created with the `MsgSubmitProposal`, which has a group policy account address, a list of proposers addresses, a list of messages to execute if the proposal is accepted and some optional metadata. +An optional `Exec` value can be provided to try to execute the proposal immediately after proposal creation. Proposers signatures are considered as yes votes in this case. ```go reference -https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L281-L315 +https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L281-L315 ``` It's expected to fail if: @@ -475,11 +459,10 @@ It's expected to fail if: ### Msg/WithdrawProposal -A proposal can be withdrawn using `MsgWithdrawProposal` which has an `address` (can be either a proposer or the group -policy admin) and a `proposal_id` (which has to be withdrawn). +A proposal can be withdrawn using `MsgWithdrawProposal` which has an `address` (can be either a proposer or the group policy admin) and a `proposal_id` (which has to be withdrawn). ```go reference -https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L323-L333 +https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L323-L333 ``` It's expected to fail if: @@ -489,12 +472,11 @@ It's expected to fail if: ### Msg/Vote -A new vote can be created with the `MsgVote`, given a proposal id, a voter address, a choice (yes, no, veto or abstain) -and some optional metadata. +A new vote can be created with the `MsgVote`, given a proposal id, a voter address, a choice (yes, no, veto or abstain) and some optional metadata. An optional `Exec` value can be provided to try to execute the proposal immediately after voting. ```go reference -https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L338-L358 +https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L338-L358 ``` It's expected to fail if: @@ -507,7 +489,7 @@ It's expected to fail if: A proposal can be executed with the `MsgExec`. ```go reference -https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L363-L373 +https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L363-L373 ``` The messages that are part of this proposal won't be executed if: @@ -520,14 +502,13 @@ The messages that are part of this proposal won't be executed if: The `MsgLeaveGroup` allows group member to leave a group. ```go reference -https: //github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L381-L391 +https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L381-L391 ``` It's expected to fail if: * the group member is not part of the group. -* for any one of the associated group policies, if its decision policy's `Validate()` method fails against the updated - group. +* for any one of the associated group policies, if its decision policy's `Validate()` method fails against the updated group. ## Events @@ -536,56 +517,56 @@ The group module emits the following events: ### EventCreateGroup | Type | Attribute Key | Attribute Value | -|----------------------------------|---------------|----------------------------------| +| -------------------------------- | ------------- | -------------------------------- | | message | action | /cosmos.group.v1.Msg/CreateGroup | | cosmos.group.v1.EventCreateGroup | group_id | {groupId} | ### EventUpdateGroup | Type | Attribute Key | Attribute Value | -|----------------------------------|---------------|------------------------------------------------------------| +| -------------------------------- | ------------- | ---------------------------------------------------------- | | message | action | /cosmos.group.v1.Msg/UpdateGroup{Admin\|Metadata\|Members} | | cosmos.group.v1.EventUpdateGroup | group_id | {groupId} | ### EventCreateGroupPolicy | Type | Attribute Key | Attribute Value | -|----------------------------------------|---------------|----------------------------------------| +| -------------------------------------- | ------------- | -------------------------------------- | | message | action | /cosmos.group.v1.Msg/CreateGroupPolicy | | cosmos.group.v1.EventCreateGroupPolicy | address | {groupPolicyAddress} | ### EventUpdateGroupPolicy | Type | Attribute Key | Attribute Value | -|----------------------------------------|---------------|-------------------------------------------------------------------------| +| -------------------------------------- | ------------- | ----------------------------------------------------------------------- | | message | action | /cosmos.group.v1.Msg/UpdateGroupPolicy{Admin\|Metadata\|DecisionPolicy} | | cosmos.group.v1.EventUpdateGroupPolicy | address | {groupPolicyAddress} | ### EventCreateProposal | Type | Attribute Key | Attribute Value | -|-------------------------------------|---------------|-------------------------------------| +| ----------------------------------- | ------------- | ----------------------------------- | | message | action | /cosmos.group.v1.Msg/CreateProposal | | cosmos.group.v1.EventCreateProposal | proposal_id | {proposalId} | ### EventWithdrawProposal | Type | Attribute Key | Attribute Value | -|---------------------------------------|---------------|---------------------------------------| +| ------------------------------------- | ------------- | ------------------------------------- | | message | action | /cosmos.group.v1.Msg/WithdrawProposal | | cosmos.group.v1.EventWithdrawProposal | proposal_id | {proposalId} | ### EventVote | Type | Attribute Key | Attribute Value | -|---------------------------|---------------|---------------------------| +| ------------------------- | ------------- | ------------------------- | | message | action | /cosmos.group.v1.Msg/Vote | | cosmos.group.v1.EventVote | proposal_id | {proposalId} | ## EventExec | Type | Attribute Key | Attribute Value | -|---------------------------|---------------|---------------------------| +| ------------------------- | ------------- | ------------------------- | | message | action | /cosmos.group.v1.Msg/Exec | | cosmos.group.v1.EventExec | proposal_id | {proposalId} | | cosmos.group.v1.EventExec | logs | {logs_string} | @@ -593,7 +574,7 @@ The group module emits the following events: ### EventLeaveGroup | Type | Attribute Key | Attribute Value | -|---------------------------------|---------------|---------------------------------| +| ------------------------------- | ------------- | ------------------------------- | | message | action | /cosmos.group.v1.Msg/LeaveGroup | | cosmos.group.v1.EventLeaveGroup | proposal_id | {proposalId} | | cosmos.group.v1.EventLeaveGroup | address | {address} | @@ -607,6 +588,7 @@ The group module emits the following events: | cosmos.group.v1.EventProposalPruned | status | {ProposalStatus} | | cosmos.group.v1.EventProposalPruned | tally_result | {TallyResult} | + ## Client ### CLI @@ -788,8 +770,7 @@ pagination: ##### group-policies-by-admin -The `group-policies-by-admin` command allows users to query for group policies by admin account address with pagination -flags. +The `group-policies-by-admin` command allows users to query for group policies by admin account address with pagination flags. ```bash simd query group group-policies-by-admin [admin] [flags] @@ -882,8 +863,7 @@ proposal: ##### proposals-by-group-policy -The `proposals-by-group-policy` command allows users to query for proposals by account address of group policy with -pagination flags. +The `proposals-by-group-policy` command allows users to query for proposals by account address of group policy with pagination flags. ```bash simd query group proposals-by-group-policy [group-policy-account] [flags] @@ -1023,8 +1003,7 @@ simd tx group --help #### create-group -The `create-group` command allows users to create a group which is an aggregation of member accounts with associated -weights and +The `create-group` command allows users to create a group which is an aggregation of member accounts with associated weights and an administrator account. ```bash @@ -1081,8 +1060,7 @@ simd tx group update-group-metadata cosmos1.. 1 "AQ==" #### create-group-policy -The `create-group-policy` command allows users to create a group policy which is an account associated with a group and -a decision policy. +The `create-group-policy` command allows users to create a group policy which is an account associated with a group and a decision policy. ```bash simd tx group create-group-policy [admin] [group-id] [metadata] [decision-policy] [flags] @@ -1096,9 +1074,7 @@ simd tx group create-group-policy cosmos1.. 1 "AQ==" '{"@type":"/cosmos.group.v1 #### create-group-with-policy -The `create-group-with-policy` command allows users to create a group which is an aggregation of member accounts with -associated weights and an administrator account with decision policy. If the `--group-policy-as-admin` flag is set -to `true`, the group policy address becomes the group and group policy admin. +The `create-group-with-policy` command allows users to create a group which is an aggregation of member accounts with associated weights and an administrator account with decision policy. If the `--group-policy-as-admin` flag is set to `true`, the group policy address becomes the group and group policy admin. ```bash simd tx group create-group-with-policy [admin] [group-metadata] [group-policy-metadata] [members-json-file] [decision-policy] [flags] @@ -1409,8 +1385,7 @@ Example Output: #### GroupPoliciesByAdmin -The `GroupPoliciesByAdmin` endpoint allows users to query for group policies by admin account address with pagination -flags. +The `GroupPoliciesByAdmin` endpoint allows users to query for group policies by admin account address with pagination flags. ```bash cosmos.group.v1.Query/GroupPoliciesByAdmin @@ -1501,8 +1476,7 @@ Example Output: #### ProposalsByGroupPolicy -The `ProposalsByGroupPolicy` endpoint allows users to query for proposals by account address of group policy with -pagination flags. +The `ProposalsByGroupPolicy` endpoint allows users to query for proposals by account address of group policy with pagination flags. ```bash cosmos.group.v1.Query/ProposalsByGroupPolicy @@ -1859,8 +1833,7 @@ Example Output: #### GroupPoliciesByAdmin -The `GroupPoliciesByAdmin` endpoint allows users to query for group policies by admin account address with pagination -flags. +The `GroupPoliciesByAdmin` endpoint allows users to query for group policies by admin account address with pagination flags. ```bash /cosmos/group/v1/group_policies_by_admin/{admin} @@ -1976,8 +1949,7 @@ Example Output: #### ProposalsByGroupPolicy -The `ProposalsByGroupPolicy` endpoint allows users to query for proposals by account address of group policy with -pagination flags. +The `ProposalsByGroupPolicy` endpoint allows users to query for proposals by account address of group policy with pagination flags. ```bash /cosmos/group/v1/proposals_by_group_policy/{address} @@ -2137,13 +2109,7 @@ Example Output: ## Metadata -The group module has four locations for metadata where users can provide further context about the on-chain actions they -are taking. By default all metadata fields have a 255 character length field where metadata can be stored in json -format, either on-chain or off-chain depending on the amount of data required. Here we provide a recommendation for the -json structure and where the data should be stored. There are two important factors in making these recommendations. -First, that the group and gov modules are consistent with one another, note the number of proposals made by all groups -may be quite large. Second, that client applications such as block explorers and governance interfaces have confidence -in the consistency of metadata structure accross chains. +The group module has four locations for metadata where users can provide further context about the on-chain actions they are taking. By default all metadata fields have a 255 character length field where metadata can be stored in json format, either on-chain or off-chain depending on the amount of data required. Here we provide a recommendation for the json structure and where the data should be stored. There are two important factors in making these recommendations. First, that the group and gov modules are consistent with one another, note the number of proposals made by all groups may be quite large. Second, that client applications such as block explorers and governance interfaces have confidence in the consistency of metadata structure accross chains. ### Proposal @@ -2152,20 +2118,17 @@ Location: off-chain as json object stored on IPFS (mirrors [gov proposal](../gov ```json { "title": "", - "authors": [ - "" - ], + "authors": [""], "summary": "", "details": "", "proposal_forum_url": "", - "vote_option_context": "" + "vote_option_context": "", } ``` :::note The `authors` field is an array of strings, this is to allow for multiple authors to be listed in the metadata. -In v0.46, the `authors` field is a comma-separated string. Frontends are encouraged to support both formats for -backwards compatibility. +In v0.46, the `authors` field is a comma-separated string. Frontends are encouraged to support both formats for backwards compatibility. ::: ### Vote @@ -2174,7 +2137,7 @@ Location: on-chain as json within 255 character limit (mirrors [gov vote](../gov ```json { - "justification": "" + "justification": "", } ``` @@ -2187,7 +2150,7 @@ Location: off-chain as json object stored on IPFS "name": "", "description": "", "group_website_url": "", - "group_forum_url": "" + "group_forum_url": "", } ``` @@ -2198,6 +2161,6 @@ Location: on-chain as json within 255 character limit ```json { "name": "", - "description": "" + "description": "", } ``` From 29e602fcb8115fa03de8fac74eab17dad639a336 Mon Sep 17 00:00:00 2001 From: Jeancarlo Barrios Date: Wed, 24 May 2023 09:32:41 -0500 Subject: [PATCH 17/19] Update proto/cosmos/group/v1/events.proto Co-authored-by: Julien Robert --- proto/cosmos/group/v1/events.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/cosmos/group/v1/events.proto b/proto/cosmos/group/v1/events.proto index 6bc3e9574d4d..4d79ca07ef68 100644 --- a/proto/cosmos/group/v1/events.proto +++ b/proto/cosmos/group/v1/events.proto @@ -89,6 +89,6 @@ message EventProposalPruned { // status is the proposal status (UNSPECIFIED, SUBMITTED, ACCEPTED, REJECTED, ABORTED, WITHDRAWN). ProposalStatus status = 2; - // tally_result is the proposal tally result. + // tally_result is the proposal tally result (when applicable). TallyResult tally_result = 3; } From 088a054d9f2f229ab2a866dea37d3848c55da05b Mon Sep 17 00:00:00 2001 From: Jeancarlo Barrios Date: Wed, 24 May 2023 09:32:48 -0500 Subject: [PATCH 18/19] Update CHANGELOG.md Co-authored-by: Julien Robert --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce4d8177f9a3..6741b4092efe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,7 +69,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (types/simulation) [#16074](https://github.com/cosmos/cosmos-sdk/pull/16074) Add generic SimulationStoreDecoder for modules using collections. * (cli) [#16209](https://github.com/cosmos/cosmos-sdk/pull/16209) Make `StartCmd` more customizable. * (types) [#16257](https://github.com/cosmos/cosmos-sdk/pull/16257) Allow setting the base denom in the denom registry. -* (x/group) [#16191](https://github.com/cosmos/cosmos-sdk/pull/16191) Add EventProposalFinalized event to group module whenever a proposal is prune. +* (x/group) [#16191](https://github.com/cosmos/cosmos-sdk/pull/16191) Add EventProposalPruned event to group module whenever a proposal is pruned. ### Improvements From 097413e3e1edb6a1aadf4985dca47e0043cac615 Mon Sep 17 00:00:00 2001 From: Jeancarlo Barrios Date: Wed, 24 May 2023 09:32:55 -0500 Subject: [PATCH 19/19] Update proto/cosmos/group/v1/events.proto Co-authored-by: Julien Robert --- proto/cosmos/group/v1/events.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/cosmos/group/v1/events.proto b/proto/cosmos/group/v1/events.proto index 4d79ca07ef68..2b98ec9abc32 100644 --- a/proto/cosmos/group/v1/events.proto +++ b/proto/cosmos/group/v1/events.proto @@ -80,7 +80,7 @@ message EventLeaveGroup { string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } -// EventProposalTallyFinalized is an event emitted when a proposal tally is finalized. +// EventProposalPruned is an event emitted when a proposal is pruned. message EventProposalPruned { // proposal_id is the unique ID of the proposal.