feat: Add MsgLeaveGroup to group module (#10887)
## Description Closes: #9657 --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
This commit is contained in:
parent
7c0c347840
commit
9ef249cd9e
@ -3277,6 +3277,474 @@ func (x *fastReflection_EventExec) ProtoMethods() *protoiface.Methods {
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
md_EventLeaveGroup protoreflect.MessageDescriptor
|
||||
fd_EventLeaveGroup_group_id protoreflect.FieldDescriptor
|
||||
fd_EventLeaveGroup_address protoreflect.FieldDescriptor
|
||||
)
|
||||
|
||||
func init() {
|
||||
file_cosmos_group_v1beta1_events_proto_init()
|
||||
md_EventLeaveGroup = File_cosmos_group_v1beta1_events_proto.Messages().ByName("EventLeaveGroup")
|
||||
fd_EventLeaveGroup_group_id = md_EventLeaveGroup.Fields().ByName("group_id")
|
||||
fd_EventLeaveGroup_address = md_EventLeaveGroup.Fields().ByName("address")
|
||||
}
|
||||
|
||||
var _ protoreflect.Message = (*fastReflection_EventLeaveGroup)(nil)
|
||||
|
||||
type fastReflection_EventLeaveGroup EventLeaveGroup
|
||||
|
||||
func (x *EventLeaveGroup) ProtoReflect() protoreflect.Message {
|
||||
return (*fastReflection_EventLeaveGroup)(x)
|
||||
}
|
||||
|
||||
func (x *EventLeaveGroup) slowProtoReflect() protoreflect.Message {
|
||||
mi := &file_cosmos_group_v1beta1_events_proto_msgTypes[8]
|
||||
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_EventLeaveGroup_messageType fastReflection_EventLeaveGroup_messageType
|
||||
var _ protoreflect.MessageType = fastReflection_EventLeaveGroup_messageType{}
|
||||
|
||||
type fastReflection_EventLeaveGroup_messageType struct{}
|
||||
|
||||
func (x fastReflection_EventLeaveGroup_messageType) Zero() protoreflect.Message {
|
||||
return (*fastReflection_EventLeaveGroup)(nil)
|
||||
}
|
||||
func (x fastReflection_EventLeaveGroup_messageType) New() protoreflect.Message {
|
||||
return new(fastReflection_EventLeaveGroup)
|
||||
}
|
||||
func (x fastReflection_EventLeaveGroup_messageType) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_EventLeaveGroup
|
||||
}
|
||||
|
||||
// Descriptor returns message descriptor, which contains only the protobuf
|
||||
// type information for the message.
|
||||
func (x *fastReflection_EventLeaveGroup) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_EventLeaveGroup
|
||||
}
|
||||
|
||||
// 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_EventLeaveGroup) Type() protoreflect.MessageType {
|
||||
return _fastReflection_EventLeaveGroup_messageType
|
||||
}
|
||||
|
||||
// New returns a newly allocated and mutable empty message.
|
||||
func (x *fastReflection_EventLeaveGroup) New() protoreflect.Message {
|
||||
return new(fastReflection_EventLeaveGroup)
|
||||
}
|
||||
|
||||
// Interface unwraps the message reflection interface and
|
||||
// returns the underlying ProtoMessage interface.
|
||||
func (x *fastReflection_EventLeaveGroup) Interface() protoreflect.ProtoMessage {
|
||||
return (*EventLeaveGroup)(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_EventLeaveGroup) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||
if x.GroupId != uint64(0) {
|
||||
value := protoreflect.ValueOfUint64(x.GroupId)
|
||||
if !f(fd_EventLeaveGroup_group_id, value) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if x.Address != "" {
|
||||
value := protoreflect.ValueOfString(x.Address)
|
||||
if !f(fd_EventLeaveGroup_address, 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_EventLeaveGroup) Has(fd protoreflect.FieldDescriptor) bool {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.group.v1beta1.EventLeaveGroup.group_id":
|
||||
return x.GroupId != uint64(0)
|
||||
case "cosmos.group.v1beta1.EventLeaveGroup.address":
|
||||
return x.Address != ""
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1beta1.EventLeaveGroup"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.group.v1beta1.EventLeaveGroup 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_EventLeaveGroup) Clear(fd protoreflect.FieldDescriptor) {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.group.v1beta1.EventLeaveGroup.group_id":
|
||||
x.GroupId = uint64(0)
|
||||
case "cosmos.group.v1beta1.EventLeaveGroup.address":
|
||||
x.Address = ""
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1beta1.EventLeaveGroup"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.group.v1beta1.EventLeaveGroup 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_EventLeaveGroup) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch descriptor.FullName() {
|
||||
case "cosmos.group.v1beta1.EventLeaveGroup.group_id":
|
||||
value := x.GroupId
|
||||
return protoreflect.ValueOfUint64(value)
|
||||
case "cosmos.group.v1beta1.EventLeaveGroup.address":
|
||||
value := x.Address
|
||||
return protoreflect.ValueOfString(value)
|
||||
default:
|
||||
if descriptor.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1beta1.EventLeaveGroup"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.group.v1beta1.EventLeaveGroup 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_EventLeaveGroup) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.group.v1beta1.EventLeaveGroup.group_id":
|
||||
x.GroupId = value.Uint()
|
||||
case "cosmos.group.v1beta1.EventLeaveGroup.address":
|
||||
x.Address = value.Interface().(string)
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1beta1.EventLeaveGroup"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.group.v1beta1.EventLeaveGroup 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_EventLeaveGroup) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.group.v1beta1.EventLeaveGroup.group_id":
|
||||
panic(fmt.Errorf("field group_id of message cosmos.group.v1beta1.EventLeaveGroup is not mutable"))
|
||||
case "cosmos.group.v1beta1.EventLeaveGroup.address":
|
||||
panic(fmt.Errorf("field address of message cosmos.group.v1beta1.EventLeaveGroup is not mutable"))
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1beta1.EventLeaveGroup"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.group.v1beta1.EventLeaveGroup 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_EventLeaveGroup) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.group.v1beta1.EventLeaveGroup.group_id":
|
||||
return protoreflect.ValueOfUint64(uint64(0))
|
||||
case "cosmos.group.v1beta1.EventLeaveGroup.address":
|
||||
return protoreflect.ValueOfString("")
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1beta1.EventLeaveGroup"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.group.v1beta1.EventLeaveGroup 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_EventLeaveGroup) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
|
||||
switch d.FullName() {
|
||||
default:
|
||||
panic(fmt.Errorf("%s is not a oneof field in cosmos.group.v1beta1.EventLeaveGroup", 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_EventLeaveGroup) 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_EventLeaveGroup) 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_EventLeaveGroup) 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_EventLeaveGroup) ProtoMethods() *protoiface.Methods {
|
||||
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
|
||||
x := input.Message.Interface().(*EventLeaveGroup)
|
||||
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.GroupId != 0 {
|
||||
n += 1 + runtime.Sov(uint64(x.GroupId))
|
||||
}
|
||||
l = len(x.Address)
|
||||
if l > 0 {
|
||||
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().(*EventLeaveGroup)
|
||||
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 len(x.Address) > 0 {
|
||||
i -= len(x.Address)
|
||||
copy(dAtA[i:], x.Address)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if x.GroupId != 0 {
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(x.GroupId))
|
||||
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().(*EventLeaveGroup)
|
||||
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: EventLeaveGroup: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventLeaveGroup: 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 GroupId", wireType)
|
||||
}
|
||||
x.GroupId = 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.GroupId |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if postIndex > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
x.Address = string(dAtA[iNdEx:postIndex])
|
||||
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,
|
||||
}
|
||||
}
|
||||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.0
|
||||
@ -3586,6 +4054,52 @@ func (x *EventExec) GetProposalId() uint64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
// EventLeaveGroup is an event emitted when group member leaves the group.
|
||||
type EventLeaveGroup struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// group_id is the unique ID of the group.
|
||||
GroupId uint64 `protobuf:"varint,1,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"`
|
||||
// address is the account address of the group member.
|
||||
Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
|
||||
}
|
||||
|
||||
func (x *EventLeaveGroup) Reset() {
|
||||
*x = EventLeaveGroup{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_cosmos_group_v1beta1_events_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *EventLeaveGroup) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*EventLeaveGroup) ProtoMessage() {}
|
||||
|
||||
// Deprecated: Use EventLeaveGroup.ProtoReflect.Descriptor instead.
|
||||
func (*EventLeaveGroup) Descriptor() ([]byte, []int) {
|
||||
return file_cosmos_group_v1beta1_events_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *EventLeaveGroup) GetGroupId() uint64 {
|
||||
if x != nil {
|
||||
return x.GroupId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *EventLeaveGroup) GetAddress() string {
|
||||
if x != nil {
|
||||
return x.Address
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_cosmos_group_v1beta1_events_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_cosmos_group_v1beta1_events_proto_rawDesc = []byte{
|
||||
@ -3622,22 +4136,28 @@ var file_cosmos_group_v1beta1_events_proto_rawDesc = []byte{
|
||||
0x28, 0x04, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x22, 0x2c,
|
||||
0x0a, 0x09, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x45, 0x78, 0x65, 0x63, 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, 0x42, 0xdd, 0x01, 0x0a,
|
||||
0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x72, 0x6f, 0x75,
|
||||
0x70, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74,
|
||||
0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
|
||||
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d,
|
||||
0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f,
|
||||
0x73, 0x2f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b,
|
||||
0x67, 0x72, 0x6f, 0x75, 0x70, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43,
|
||||
0x47, 0x58, 0xaa, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x47, 0x72, 0x6f, 0x75,
|
||||
0x70, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d,
|
||||
0x6f, 0x73, 0x5c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31,
|
||||
0xe2, 0x02, 0x20, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x5c,
|
||||
0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64,
|
||||
0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x47, 0x72,
|
||||
0x6f, 0x75, 0x70, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x22, 0x60, 0x0a, 0x0f,
|
||||
0x45, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12,
|
||||
0x19, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x04, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 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, 0xdd,
|
||||
0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x72,
|
||||
0x6f, 0x75, 0x70, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0b, 0x45, 0x76, 0x65,
|
||||
0x6e, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68,
|
||||
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f,
|
||||
0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73,
|
||||
0x6d, 0x6f, 0x73, 0x2f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61,
|
||||
0x31, 0x3b, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02,
|
||||
0x03, 0x43, 0x47, 0x58, 0xaa, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x47, 0x72,
|
||||
0x6f, 0x75, 0x70, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x14, 0x43, 0x6f,
|
||||
0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74,
|
||||
0x61, 0x31, 0xe2, 0x02, 0x20, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x72, 0x6f, 0x75,
|
||||
0x70, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74,
|
||||
0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a,
|
||||
0x47, 0x72, 0x6f, 0x75, 0x70, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -3652,7 +4172,7 @@ func file_cosmos_group_v1beta1_events_proto_rawDescGZIP() []byte {
|
||||
return file_cosmos_group_v1beta1_events_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_cosmos_group_v1beta1_events_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||
var file_cosmos_group_v1beta1_events_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
|
||||
var file_cosmos_group_v1beta1_events_proto_goTypes = []interface{}{
|
||||
(*EventCreateGroup)(nil), // 0: cosmos.group.v1beta1.EventCreateGroup
|
||||
(*EventUpdateGroup)(nil), // 1: cosmos.group.v1beta1.EventUpdateGroup
|
||||
@ -3662,6 +4182,7 @@ var file_cosmos_group_v1beta1_events_proto_goTypes = []interface{}{
|
||||
(*EventWithdrawProposal)(nil), // 5: cosmos.group.v1beta1.EventWithdrawProposal
|
||||
(*EventVote)(nil), // 6: cosmos.group.v1beta1.EventVote
|
||||
(*EventExec)(nil), // 7: cosmos.group.v1beta1.EventExec
|
||||
(*EventLeaveGroup)(nil), // 8: cosmos.group.v1beta1.EventLeaveGroup
|
||||
}
|
||||
var file_cosmos_group_v1beta1_events_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
@ -3773,6 +4294,18 @@ func file_cosmos_group_v1beta1_events_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_cosmos_group_v1beta1_events_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*EventLeaveGroup); 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{
|
||||
@ -3780,7 +4313,7 @@ func file_cosmos_group_v1beta1_events_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_cosmos_group_v1beta1_events_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 8,
|
||||
NumMessages: 9,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -48,6 +48,8 @@ type MsgClient interface {
|
||||
Vote(ctx context.Context, in *MsgVote, opts ...grpc.CallOption) (*MsgVoteResponse, error)
|
||||
// Exec executes a proposal.
|
||||
Exec(ctx context.Context, in *MsgExec, opts ...grpc.CallOption) (*MsgExecResponse, error)
|
||||
// LeaveGroup allows a group member to leave the group.
|
||||
LeaveGroup(ctx context.Context, in *MsgLeaveGroup, opts ...grpc.CallOption) (*MsgLeaveGroupResponse, error)
|
||||
}
|
||||
|
||||
type msgClient struct {
|
||||
@ -175,6 +177,15 @@ func (c *msgClient) Exec(ctx context.Context, in *MsgExec, opts ...grpc.CallOpti
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) LeaveGroup(ctx context.Context, in *MsgLeaveGroup, opts ...grpc.CallOption) (*MsgLeaveGroupResponse, error) {
|
||||
out := new(MsgLeaveGroupResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.group.v1beta1.Msg/LeaveGroup", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MsgServer is the server API for Msg service.
|
||||
// All implementations must embed UnimplementedMsgServer
|
||||
// for forward compatibility
|
||||
@ -205,6 +216,8 @@ type MsgServer interface {
|
||||
Vote(context.Context, *MsgVote) (*MsgVoteResponse, error)
|
||||
// Exec executes a proposal.
|
||||
Exec(context.Context, *MsgExec) (*MsgExecResponse, error)
|
||||
// LeaveGroup allows a group member to leave the group.
|
||||
LeaveGroup(context.Context, *MsgLeaveGroup) (*MsgLeaveGroupResponse, error)
|
||||
mustEmbedUnimplementedMsgServer()
|
||||
}
|
||||
|
||||
@ -251,6 +264,9 @@ func (UnimplementedMsgServer) Vote(context.Context, *MsgVote) (*MsgVoteResponse,
|
||||
func (UnimplementedMsgServer) Exec(context.Context, *MsgExec) (*MsgExecResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Exec not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) LeaveGroup(context.Context, *MsgLeaveGroup) (*MsgLeaveGroupResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method LeaveGroup not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
|
||||
|
||||
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
|
||||
@ -498,6 +514,24 @@ func _Msg_Exec_Handler(srv interface{}, ctx context.Context, dec func(interface{
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_LeaveGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgLeaveGroup)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).LeaveGroup(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/cosmos.group.v1beta1.Msg/LeaveGroup",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).LeaveGroup(ctx, req.(*MsgLeaveGroup))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@ -557,6 +591,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "Exec",
|
||||
Handler: _Msg_Exec_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "LeaveGroup",
|
||||
Handler: _Msg_LeaveGroup_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "cosmos/group/v1beta1/tx.proto",
|
||||
|
||||
@ -61,3 +61,13 @@ message EventExec {
|
||||
// proposal_id is the unique ID of the proposal.
|
||||
uint64 proposal_id = 1;
|
||||
}
|
||||
|
||||
// EventLeaveGroup is an event emitted when group member leaves the group.
|
||||
message EventLeaveGroup {
|
||||
|
||||
// group_id is the unique ID of the group.
|
||||
uint64 group_id = 1;
|
||||
|
||||
// address is the account address of the group member.
|
||||
string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
}
|
||||
|
||||
@ -53,6 +53,9 @@ service Msg {
|
||||
|
||||
// Exec executes a proposal.
|
||||
rpc Exec(MsgExec) returns (MsgExecResponse);
|
||||
|
||||
// LeaveGroup allows a group member to leave the group.
|
||||
rpc LeaveGroup(MsgLeaveGroup) returns (MsgLeaveGroupResponse);
|
||||
}
|
||||
|
||||
//
|
||||
@ -345,3 +348,17 @@ message MsgExec {
|
||||
|
||||
// MsgExecResponse is the Msg/Exec request type.
|
||||
message MsgExecResponse {}
|
||||
|
||||
// MsgLeaveGroup is the Msg/LeaveGroup request type.
|
||||
message MsgLeaveGroup {
|
||||
option (cosmos.msg.v1.signer) = "address";
|
||||
|
||||
// address is the account address of the group member.
|
||||
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// group_id is the unique ID of the group.
|
||||
uint64 group_id = 2;
|
||||
}
|
||||
|
||||
// MsgLeaveGroupResponse is the Msg/LeaveGroup response type.
|
||||
message MsgLeaveGroupResponse {}
|
||||
|
||||
@ -44,6 +44,7 @@ func TxCmd(name string) *cobra.Command {
|
||||
MsgSubmitProposalCmd(),
|
||||
MsgVoteCmd(),
|
||||
MsgExecCmd(),
|
||||
MsgLeaveGroupCmd(),
|
||||
)
|
||||
|
||||
return txCmd
|
||||
@ -780,3 +781,46 @@ func MsgExecCmd() *cobra.Command {
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
// MsgLeaveGroupCmd creates a CLI command for Msg/LeaveGroup.
|
||||
func MsgLeaveGroupCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "leave-group [member-address] [group-id]",
|
||||
Short: "remove member from the group",
|
||||
Long: ` remove member from the group
|
||||
|
||||
Parameters:
|
||||
group-id: unique id of the group
|
||||
member-address: account address of the group member
|
||||
Note, the '--from' flag is
|
||||
ignored as it is implied from [member-address]
|
||||
`,
|
||||
Args: cobra.ExactArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
cmd.Flags().Set(flags.FlagFrom, args[0])
|
||||
clientCtx, err := client.GetClientTxContext(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
groupID, err := strconv.ParseUint(args[1], 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
msg := &group.MsgLeaveGroup{
|
||||
Address: clientCtx.GetFromAddress().String(),
|
||||
GroupId: groupID,
|
||||
}
|
||||
if err = msg.ValidateBasic(); err != nil {
|
||||
return fmt.Errorf("message validation failed: %w", err)
|
||||
}
|
||||
|
||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
|
||||
},
|
||||
}
|
||||
|
||||
flags.AddTxFlagsToCmd(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@ -2108,6 +2108,193 @@ func (s *IntegrationTestSuite) TestTxExec() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestTxLeaveGroup() {
|
||||
val := s.network.Validators[0]
|
||||
clientCtx := val.ClientCtx
|
||||
require := s.Require()
|
||||
|
||||
commonFlags := []string{
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
|
||||
}
|
||||
|
||||
// create 3 accounts with some tokens
|
||||
members := make([]string, 3)
|
||||
for i := 1; i <= 3; i++ {
|
||||
info, _, err := clientCtx.Keyring.NewMnemonic(fmt.Sprintf("member%d", i), keyring.English, sdk.FullFundraiserPath,
|
||||
keyring.DefaultBIP39Passphrase, hd.Secp256k1)
|
||||
require.NoError(err)
|
||||
|
||||
pk, err := info.GetPubKey()
|
||||
require.NoError(err)
|
||||
|
||||
account := sdk.AccAddress(pk.Address())
|
||||
members[i-1] = account.String()
|
||||
|
||||
_, err = banktestutil.MsgSendExec(clientCtx, val.Address, account,
|
||||
sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(100))),
|
||||
commonFlags...,
|
||||
)
|
||||
require.NoError(err)
|
||||
}
|
||||
|
||||
// create a group with three members
|
||||
validMembers := fmt.Sprintf(`{"members": [{
|
||||
"address": "%s",
|
||||
"weight": "1",
|
||||
"metadata": "AQ=="
|
||||
},{
|
||||
"address": "%s",
|
||||
"weight": "2",
|
||||
"metadata": "AQ=="
|
||||
},{
|
||||
"address": "%s",
|
||||
"weight": "2",
|
||||
"metadata": "AQ=="
|
||||
}]}`, members[0], members[1], members[2])
|
||||
validMembersFile := testutil.WriteToNewTempFile(s.T(), validMembers)
|
||||
out, err := cli.ExecTestCLICmd(clientCtx, client.MsgCreateGroupCmd(),
|
||||
append(
|
||||
[]string{
|
||||
val.Address.String(),
|
||||
validMetadata,
|
||||
validMembersFile.Name(),
|
||||
},
|
||||
commonFlags...,
|
||||
),
|
||||
)
|
||||
require.NoError(err, out.String())
|
||||
var txResp sdk.TxResponse
|
||||
s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String())
|
||||
groupID := s.getGroupIdFromTxResponse(txResp)
|
||||
|
||||
// create group policy
|
||||
out, err = cli.ExecTestCLICmd(clientCtx, client.MsgCreateGroupPolicyCmd(),
|
||||
append(
|
||||
[]string{
|
||||
val.Address.String(),
|
||||
groupID,
|
||||
"AQ==",
|
||||
"{\"@type\":\"/cosmos.group.v1beta1.ThresholdDecisionPolicy\", \"threshold\":\"3\", \"windows\":{\"voting_period\":\"1s\"}}",
|
||||
},
|
||||
commonFlags...,
|
||||
),
|
||||
)
|
||||
require.NoError(err, out.String())
|
||||
|
||||
out, err = cli.ExecTestCLICmd(clientCtx, client.QueryGroupPoliciesByGroupCmd(), []string{groupID, fmt.Sprintf("--%s=json", tmcli.OutputFlag)})
|
||||
require.NoError(err, out.String())
|
||||
require.NotNil(out)
|
||||
var resp group.QueryGroupPoliciesByGroupResponse
|
||||
require.NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp))
|
||||
require.Len(resp.GroupPolicies, 1)
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
expectErr bool
|
||||
errMsg string
|
||||
}{
|
||||
{
|
||||
"invalid member address",
|
||||
append(
|
||||
[]string{
|
||||
"address",
|
||||
groupID,
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()),
|
||||
},
|
||||
commonFlags...,
|
||||
),
|
||||
true,
|
||||
"key not found",
|
||||
},
|
||||
{
|
||||
"group not found",
|
||||
append(
|
||||
[]string{
|
||||
members[0],
|
||||
"40",
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, members[0]),
|
||||
},
|
||||
commonFlags...,
|
||||
),
|
||||
true,
|
||||
"group: not found",
|
||||
},
|
||||
{
|
||||
"valid case",
|
||||
append(
|
||||
[]string{
|
||||
members[2],
|
||||
groupID,
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, members[2]),
|
||||
},
|
||||
commonFlags...,
|
||||
),
|
||||
false,
|
||||
"",
|
||||
},
|
||||
{
|
||||
"not part of group",
|
||||
append(
|
||||
[]string{
|
||||
members[2],
|
||||
groupID,
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, members[2]),
|
||||
},
|
||||
commonFlags...,
|
||||
),
|
||||
true,
|
||||
"is not part of group",
|
||||
},
|
||||
{
|
||||
"can leave group policy threshold is more than group weight",
|
||||
append(
|
||||
[]string{
|
||||
members[1],
|
||||
groupID,
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, members[1]),
|
||||
},
|
||||
commonFlags...,
|
||||
),
|
||||
false,
|
||||
"",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
cmd := client.MsgLeaveGroupCmd()
|
||||
out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.expectErr {
|
||||
require.Contains(out.String(), tc.errMsg)
|
||||
} else {
|
||||
require.NoError(err, out.String())
|
||||
var resp sdk.TxResponse
|
||||
require.NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String())
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) getGroupIdFromTxResponse(txResp sdk.TxResponse) string {
|
||||
s.Require().Greater(len(txResp.Logs), 0)
|
||||
s.Require().NotNil(txResp.Logs[0].Events)
|
||||
events := txResp.Logs[0].Events
|
||||
createProposalEvent, _ := sdk.TypedEventToEvent(&group.EventCreateGroup{})
|
||||
|
||||
for _, e := range events {
|
||||
if e.Type == createProposalEvent.Type {
|
||||
return strings.ReplaceAll(e.Attributes[0].Value, "\"", "")
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// createCLIProposal writes a CLI proposal with a MsgSend to a file. Returns
|
||||
// the path to the JSON file.
|
||||
func (s *IntegrationTestSuite) createCLIProposal(groupPolicyAddress, proposer, sendFrom, sendTo, metadata string) string {
|
||||
|
||||
@ -28,6 +28,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
|
||||
cdc.RegisterConcrete(&MsgWithdrawProposal{}, "cosmos-sdk/group/MsgWithdrawProposal", nil)
|
||||
cdc.RegisterConcrete(&MsgVote{}, "cosmos-sdk/group/MsgVote", nil)
|
||||
cdc.RegisterConcrete(&MsgExec{}, "cosmos-sdk/group/MsgExec", nil)
|
||||
cdc.RegisterConcrete(&MsgLeaveGroup{}, "cosmos-sdk/group/MsgLeaveGroup", nil)
|
||||
}
|
||||
|
||||
func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
|
||||
@ -45,6 +46,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
|
||||
&MsgWithdrawProposal{},
|
||||
&MsgVote{},
|
||||
&MsgExec{},
|
||||
&MsgLeaveGroup{},
|
||||
)
|
||||
|
||||
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
|
||||
|
||||
@ -391,6 +391,61 @@ func (m *EventExec) GetProposalId() uint64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
// EventLeaveGroup is an event emitted when group member leaves the group.
|
||||
type EventLeaveGroup struct {
|
||||
// group_id is the unique ID of the group.
|
||||
GroupId uint64 `protobuf:"varint,1,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"`
|
||||
// address is the account address of the group member.
|
||||
Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
|
||||
}
|
||||
|
||||
func (m *EventLeaveGroup) Reset() { *m = EventLeaveGroup{} }
|
||||
func (m *EventLeaveGroup) String() string { return proto.CompactTextString(m) }
|
||||
func (*EventLeaveGroup) ProtoMessage() {}
|
||||
func (*EventLeaveGroup) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_7879e051fb126fc0, []int{8}
|
||||
}
|
||||
func (m *EventLeaveGroup) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *EventLeaveGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_EventLeaveGroup.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 *EventLeaveGroup) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_EventLeaveGroup.Merge(m, src)
|
||||
}
|
||||
func (m *EventLeaveGroup) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *EventLeaveGroup) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_EventLeaveGroup.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_EventLeaveGroup proto.InternalMessageInfo
|
||||
|
||||
func (m *EventLeaveGroup) GetGroupId() uint64 {
|
||||
if m != nil {
|
||||
return m.GroupId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *EventLeaveGroup) GetAddress() string {
|
||||
if m != nil {
|
||||
return m.Address
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*EventCreateGroup)(nil), "cosmos.group.v1beta1.EventCreateGroup")
|
||||
proto.RegisterType((*EventUpdateGroup)(nil), "cosmos.group.v1beta1.EventUpdateGroup")
|
||||
@ -400,12 +455,13 @@ func init() {
|
||||
proto.RegisterType((*EventWithdrawProposal)(nil), "cosmos.group.v1beta1.EventWithdrawProposal")
|
||||
proto.RegisterType((*EventVote)(nil), "cosmos.group.v1beta1.EventVote")
|
||||
proto.RegisterType((*EventExec)(nil), "cosmos.group.v1beta1.EventExec")
|
||||
proto.RegisterType((*EventLeaveGroup)(nil), "cosmos.group.v1beta1.EventLeaveGroup")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("cosmos/group/v1beta1/events.proto", fileDescriptor_7879e051fb126fc0) }
|
||||
|
||||
var fileDescriptor_7879e051fb126fc0 = []byte{
|
||||
// 301 bytes of a gzipped FileDescriptorProto
|
||||
// 319 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4c, 0xce, 0x2f, 0xce,
|
||||
0xcd, 0x2f, 0xd6, 0x4f, 0x2f, 0xca, 0x2f, 0x2d, 0xd0, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34,
|
||||
0xd4, 0x4f, 0x2d, 0x4b, 0xcd, 0x2b, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x81,
|
||||
@ -420,11 +476,12 @@ var fileDescriptor_7879e051fb126fc0 = []byte{
|
||||
0xfc, 0x82, 0xfc, 0xe2, 0xc4, 0x1c, 0x21, 0x79, 0x2e, 0xee, 0x02, 0x28, 0x1b, 0xe1, 0x21, 0x2e,
|
||||
0x98, 0x90, 0x67, 0x8a, 0x92, 0x05, 0x97, 0x28, 0x58, 0x5f, 0x78, 0x66, 0x49, 0x46, 0x4a, 0x51,
|
||||
0x62, 0x39, 0xf1, 0x3a, 0x75, 0xb8, 0x38, 0xc1, 0x3a, 0xc3, 0xf2, 0x4b, 0x52, 0x89, 0x57, 0xed,
|
||||
0x5a, 0x91, 0x9a, 0x4c, 0x50, 0xb5, 0x93, 0xdd, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31,
|
||||
0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb,
|
||||
0x31, 0x44, 0xa9, 0xa4, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0x42, 0xa3, 0x1e,
|
||||
0x4a, 0xe9, 0x16, 0xa7, 0x64, 0xeb, 0x57, 0x40, 0x52, 0x53, 0x12, 0x1b, 0x38, 0x39, 0x18, 0x03,
|
||||
0x02, 0x00, 0x00, 0xff, 0xff, 0x54, 0x9c, 0xae, 0x89, 0x64, 0x02, 0x00, 0x00,
|
||||
0x5a, 0x91, 0x9a, 0x4c, 0x58, 0x75, 0x02, 0x17, 0x3f, 0x58, 0xb5, 0x4f, 0x6a, 0x62, 0x19, 0xc1,
|
||||
0x78, 0x41, 0x0e, 0x2f, 0x26, 0x22, 0xc3, 0xcb, 0xc9, 0xee, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f,
|
||||
0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b,
|
||||
0x8f, 0xe5, 0x18, 0xa2, 0x54, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xa1,
|
||||
0x89, 0x0b, 0x4a, 0xe9, 0x16, 0xa7, 0x64, 0xeb, 0x57, 0x40, 0xd2, 0x6b, 0x12, 0x1b, 0x38, 0xc1,
|
||||
0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xf6, 0xfb, 0x10, 0x68, 0xc6, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *EventCreateGroup) Marshal() (dAtA []byte, err error) {
|
||||
@ -655,6 +712,41 @@ func (m *EventExec) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *EventLeaveGroup) 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 *EventLeaveGroup) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *EventLeaveGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Address) > 0 {
|
||||
i -= len(m.Address)
|
||||
copy(dAtA[i:], m.Address)
|
||||
i = encodeVarintEvents(dAtA, i, uint64(len(m.Address)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if m.GroupId != 0 {
|
||||
i = encodeVarintEvents(dAtA, i, uint64(m.GroupId))
|
||||
i--
|
||||
dAtA[i] = 0x8
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintEvents(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovEvents(v)
|
||||
base := offset
|
||||
@ -764,6 +856,22 @@ func (m *EventExec) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *EventLeaveGroup) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.GroupId != 0 {
|
||||
n += 1 + sovEvents(uint64(m.GroupId))
|
||||
}
|
||||
l = len(m.Address)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovEvents(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovEvents(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
@ -1348,6 +1456,107 @@ func (m *EventExec) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *EventLeaveGroup) 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: EventLeaveGroup: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: EventLeaveGroup: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field GroupId", wireType)
|
||||
}
|
||||
m.GroupId = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowEvents
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.GroupId |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowEvents
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthEvents
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthEvents
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Address = string(dAtA[iNdEx:postIndex])
|
||||
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
|
||||
|
||||
@ -18,6 +18,7 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/testutil"
|
||||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/group"
|
||||
"github.com/cosmos/cosmos-sdk/x/group/internal/math"
|
||||
"github.com/cosmos/cosmos-sdk/x/group/keeper"
|
||||
)
|
||||
|
||||
@ -1018,7 +1019,12 @@ func (s *TestSuite) TestUpdateGroupPolicyAdmin() {
|
||||
addr5 := addrs[4]
|
||||
|
||||
admin, newAdmin := addr1, addr2
|
||||
groupPolicyAddr, myGroupID, policy := createGroupAndGroupPolicy(admin, s)
|
||||
policy := group.NewThresholdDecisionPolicy(
|
||||
"1",
|
||||
time.Second,
|
||||
0,
|
||||
)
|
||||
groupPolicyAddr, myGroupID := s.createGroupAndGroupPolicy(admin, nil, policy)
|
||||
|
||||
specs := map[string]struct {
|
||||
req *group.MsgUpdateGroupPolicyAdmin
|
||||
@ -1101,7 +1107,12 @@ func (s *TestSuite) TestUpdateGroupPolicyMetadata() {
|
||||
addr5 := addrs[4]
|
||||
|
||||
admin := addr1
|
||||
groupPolicyAddr, myGroupID, policy := createGroupAndGroupPolicy(admin, s)
|
||||
policy := group.NewThresholdDecisionPolicy(
|
||||
"1",
|
||||
time.Second,
|
||||
0,
|
||||
)
|
||||
groupPolicyAddr, myGroupID := s.createGroupAndGroupPolicy(admin, nil, policy)
|
||||
|
||||
specs := map[string]struct {
|
||||
req *group.MsgUpdateGroupPolicyMetadata
|
||||
@ -1175,10 +1186,15 @@ func (s *TestSuite) TestUpdateGroupPolicyDecisionPolicy() {
|
||||
addr5 := addrs[4]
|
||||
|
||||
admin := addr1
|
||||
groupPolicyAddr, myGroupID, policy := createGroupAndGroupPolicy(admin, s)
|
||||
policy := group.NewThresholdDecisionPolicy(
|
||||
"1",
|
||||
time.Second,
|
||||
0,
|
||||
)
|
||||
groupPolicyAddr, myGroupID := s.createGroupAndGroupPolicy(admin, nil, policy)
|
||||
|
||||
specs := map[string]struct {
|
||||
preRun func(admin sdk.AccAddress, s *TestSuite) (policyAddr string, groupId uint64, policy group.DecisionPolicy)
|
||||
preRun func(admin sdk.AccAddress) (policyAddr string, groupId uint64)
|
||||
req *group.MsgUpdateGroupPolicyDecisionPolicy
|
||||
policy group.DecisionPolicy
|
||||
expGroupPolicy *group.GroupPolicyInfo
|
||||
@ -1223,8 +1239,8 @@ func (s *TestSuite) TestUpdateGroupPolicyDecisionPolicy() {
|
||||
expErr: false,
|
||||
},
|
||||
"correct data with percentage decision policy": {
|
||||
preRun: func(admin sdk.AccAddress, s *TestSuite) (policyAddr string, groupId uint64, policy group.DecisionPolicy) {
|
||||
return createGroupAndGroupPolicy(admin, s)
|
||||
preRun: func(admin sdk.AccAddress) (string, uint64) {
|
||||
return s.createGroupAndGroupPolicy(admin, nil, policy)
|
||||
},
|
||||
req: &group.MsgUpdateGroupPolicyDecisionPolicy{
|
||||
Admin: admin.String(),
|
||||
@ -1250,7 +1266,7 @@ func (s *TestSuite) TestUpdateGroupPolicyDecisionPolicy() {
|
||||
err := spec.expGroupPolicy.SetDecisionPolicy(spec.policy)
|
||||
s.Require().NoError(err)
|
||||
if spec.preRun != nil {
|
||||
policyAddr1, groupId, _ := spec.preRun(admin, s)
|
||||
policyAddr1, groupId := spec.preRun(admin)
|
||||
policyAddr = policyAddr1
|
||||
|
||||
// update the expected info with new group policy details
|
||||
@ -2141,6 +2157,68 @@ func (s *TestSuite) TestVote() {
|
||||
spec.postRun(sdkCtx)
|
||||
})
|
||||
}
|
||||
|
||||
s.T().Log("test tally result should not take into account the member who left the group")
|
||||
require := s.Require()
|
||||
members = []group.Member{
|
||||
{Address: addr2.String(), Weight: "3", AddedAt: s.blockTime},
|
||||
{Address: addr3.String(), Weight: "2", AddedAt: s.blockTime},
|
||||
{Address: addr4.String(), Weight: "1", AddedAt: s.blockTime},
|
||||
}
|
||||
reqCreate := &group.MsgCreateGroupWithPolicy{
|
||||
Admin: addr1.String(),
|
||||
Members: members,
|
||||
GroupMetadata: "metadata",
|
||||
}
|
||||
|
||||
policy = group.NewThresholdDecisionPolicy(
|
||||
"4",
|
||||
time.Duration(10),
|
||||
0,
|
||||
)
|
||||
require.NoError(reqCreate.SetDecisionPolicy(policy))
|
||||
result, err := s.keeper.CreateGroupWithPolicy(s.ctx, reqCreate)
|
||||
require.NoError(err)
|
||||
require.NotNil(result)
|
||||
|
||||
policyAddr := result.GroupPolicyAddress
|
||||
groupID := result.GroupId
|
||||
reqProposal := &group.MsgSubmitProposal{
|
||||
Address: policyAddr,
|
||||
Proposers: []string{addr4.String()},
|
||||
}
|
||||
require.NoError(reqProposal.SetMsgs([]sdk.Msg{&banktypes.MsgSend{
|
||||
FromAddress: policyAddr,
|
||||
ToAddress: addr5.String(),
|
||||
Amount: sdk.Coins{sdk.NewInt64Coin("test", 100)},
|
||||
}}))
|
||||
|
||||
resSubmitProposal, err := s.keeper.SubmitProposal(s.ctx, reqProposal)
|
||||
require.NoError(err)
|
||||
require.NotNil(resSubmitProposal)
|
||||
proposalID := resSubmitProposal.ProposalId
|
||||
|
||||
for _, voter := range []string{addr4.String(), addr3.String(), addr2.String()} {
|
||||
_, err := s.keeper.Vote(s.ctx,
|
||||
&group.MsgVote{ProposalId: proposalID, Voter: voter, Option: group.VOTE_OPTION_YES},
|
||||
)
|
||||
require.NoError(err)
|
||||
}
|
||||
|
||||
qProposals, err := s.keeper.Proposal(s.ctx, &group.QueryProposalRequest{
|
||||
ProposalId: proposalID,
|
||||
})
|
||||
require.NoError(err)
|
||||
|
||||
tallyResult, err := s.keeper.Tally(s.sdkCtx, *qProposals.Proposal, groupID)
|
||||
require.NoError(err)
|
||||
|
||||
_, err = s.keeper.LeaveGroup(s.ctx, &group.MsgLeaveGroup{Address: addr4.String(), GroupId: groupID})
|
||||
require.NoError(err)
|
||||
|
||||
tallyResult1, err := s.keeper.Tally(s.sdkCtx, *qProposals.Proposal, groupID)
|
||||
require.NoError(err)
|
||||
require.NotEqual(tallyResult.String(), tallyResult1.String())
|
||||
}
|
||||
|
||||
func (s *TestSuite) TestExecProposal() {
|
||||
@ -2355,6 +2433,186 @@ func (s *TestSuite) TestExecProposal() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TestSuite) TestLeaveGroup() {
|
||||
addrs := simapp.AddTestAddrsIncremental(s.app, s.sdkCtx, 7, sdk.NewInt(3000000))
|
||||
admin1 := addrs[0]
|
||||
member1 := addrs[1]
|
||||
member2 := addrs[2]
|
||||
member3 := addrs[3]
|
||||
member4 := addrs[4]
|
||||
admin2 := addrs[5]
|
||||
admin3 := addrs[6]
|
||||
require := s.Require()
|
||||
|
||||
members := []group.Member{
|
||||
{
|
||||
Address: member1.String(),
|
||||
Weight: "1",
|
||||
Metadata: "metadata",
|
||||
AddedAt: s.sdkCtx.BlockTime(),
|
||||
},
|
||||
{
|
||||
Address: member2.String(),
|
||||
Weight: "2",
|
||||
Metadata: "metadata",
|
||||
AddedAt: s.sdkCtx.BlockTime(),
|
||||
},
|
||||
{
|
||||
Address: member3.String(),
|
||||
Weight: "3",
|
||||
Metadata: "metadata",
|
||||
AddedAt: s.sdkCtx.BlockTime(),
|
||||
},
|
||||
}
|
||||
policy := group.NewThresholdDecisionPolicy(
|
||||
"3",
|
||||
time.Hour,
|
||||
time.Hour,
|
||||
)
|
||||
_, groupID1 := s.createGroupAndGroupPolicy(admin1, members, policy)
|
||||
|
||||
members = []group.Member{
|
||||
{
|
||||
Address: member1.String(),
|
||||
Weight: "1",
|
||||
Metadata: "metadata",
|
||||
AddedAt: s.sdkCtx.BlockTime(),
|
||||
},
|
||||
}
|
||||
_, groupID2 := s.createGroupAndGroupPolicy(admin2, members, nil)
|
||||
|
||||
members = []group.Member{
|
||||
{
|
||||
Address: member1.String(),
|
||||
Weight: "1",
|
||||
Metadata: "metadata",
|
||||
AddedAt: s.sdkCtx.BlockTime(),
|
||||
},
|
||||
{
|
||||
Address: member2.String(),
|
||||
Weight: "2",
|
||||
Metadata: "metadata",
|
||||
AddedAt: s.sdkCtx.BlockTime(),
|
||||
},
|
||||
}
|
||||
policy = &group.PercentageDecisionPolicy{
|
||||
Percentage: "0.5",
|
||||
Windows: &group.DecisionPolicyWindows{VotingPeriod: time.Hour},
|
||||
}
|
||||
|
||||
_, groupID3 := s.createGroupAndGroupPolicy(admin3, members, policy)
|
||||
testCases := []struct {
|
||||
name string
|
||||
req *group.MsgLeaveGroup
|
||||
expErr bool
|
||||
errMsg string
|
||||
expMembersSize int
|
||||
memberWeight math.Dec
|
||||
}{
|
||||
{
|
||||
"expect error: group not found",
|
||||
&group.MsgLeaveGroup{
|
||||
GroupId: 100000,
|
||||
Address: member1.String(),
|
||||
},
|
||||
true,
|
||||
"group: not found",
|
||||
0,
|
||||
math.NewDecFromInt64(0),
|
||||
},
|
||||
{
|
||||
"expect error: member not part of group",
|
||||
&group.MsgLeaveGroup{
|
||||
GroupId: groupID1,
|
||||
Address: member4.String(),
|
||||
},
|
||||
true,
|
||||
"not part of group",
|
||||
0,
|
||||
math.NewDecFromInt64(0),
|
||||
},
|
||||
{
|
||||
"valid testcase: decision policy is not present",
|
||||
&group.MsgLeaveGroup{
|
||||
GroupId: groupID2,
|
||||
Address: member1.String(),
|
||||
},
|
||||
false,
|
||||
"",
|
||||
0,
|
||||
math.NewDecFromInt64(1),
|
||||
},
|
||||
{
|
||||
"valid testcase: threshold decision policy",
|
||||
&group.MsgLeaveGroup{
|
||||
GroupId: groupID1,
|
||||
Address: member3.String(),
|
||||
},
|
||||
false,
|
||||
"",
|
||||
2,
|
||||
math.NewDecFromInt64(3),
|
||||
},
|
||||
{
|
||||
"valid request: can leave group policy threshold more than group weight",
|
||||
&group.MsgLeaveGroup{
|
||||
GroupId: groupID1,
|
||||
Address: member2.String(),
|
||||
},
|
||||
false,
|
||||
"",
|
||||
1,
|
||||
math.NewDecFromInt64(2),
|
||||
},
|
||||
{
|
||||
"valid request: can leave group (percentage decision policy)",
|
||||
&group.MsgLeaveGroup{
|
||||
GroupId: groupID3,
|
||||
Address: member2.String(),
|
||||
},
|
||||
false,
|
||||
"",
|
||||
1,
|
||||
math.NewDecFromInt64(2),
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
var groupWeight1 math.Dec
|
||||
if !tc.expErr {
|
||||
groupRes, err := s.keeper.GroupInfo(s.ctx, &group.QueryGroupInfoRequest{GroupId: tc.req.GroupId})
|
||||
require.NoError(err)
|
||||
groupWeight1, err = math.NewNonNegativeDecFromString(groupRes.Info.TotalWeight)
|
||||
require.NoError(err)
|
||||
}
|
||||
|
||||
res, err := s.keeper.LeaveGroup(s.ctx, tc.req)
|
||||
if tc.expErr {
|
||||
require.Error(err)
|
||||
require.Contains(err.Error(), tc.errMsg)
|
||||
} else {
|
||||
require.NoError(err)
|
||||
require.NotNil(res)
|
||||
res, err := s.keeper.GroupMembers(s.ctx, &group.QueryGroupMembersRequest{
|
||||
GroupId: tc.req.GroupId,
|
||||
})
|
||||
require.NoError(err)
|
||||
require.Len(res.Members, tc.expMembersSize)
|
||||
|
||||
groupRes, err := s.keeper.GroupInfo(s.ctx, &group.QueryGroupInfoRequest{GroupId: tc.req.GroupId})
|
||||
require.NoError(err)
|
||||
groupWeight2, err := math.NewNonNegativeDecFromString(groupRes.Info.TotalWeight)
|
||||
require.NoError(err)
|
||||
|
||||
rWeight, err := groupWeight1.Sub(tc.memberWeight)
|
||||
require.NoError(err)
|
||||
require.Equal(rWeight.Cmp(groupWeight2), 0)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func submitProposal(
|
||||
ctx context.Context, s *TestSuite, msgs []sdk.Msg,
|
||||
proposers []string) uint64 {
|
||||
@ -2385,32 +2643,31 @@ func submitProposalAndVote(
|
||||
return myProposalID
|
||||
}
|
||||
|
||||
func createGroupAndGroupPolicy(
|
||||
func (s *TestSuite) createGroupAndGroupPolicy(
|
||||
admin sdk.AccAddress,
|
||||
s *TestSuite,
|
||||
) (string, uint64, group.DecisionPolicy) {
|
||||
members []group.Member,
|
||||
policy group.DecisionPolicy,
|
||||
) (policyAddr string, groupID uint64) {
|
||||
groupRes, err := s.keeper.CreateGroup(s.ctx, &group.MsgCreateGroup{
|
||||
Admin: admin.String(),
|
||||
Members: nil,
|
||||
Members: members,
|
||||
})
|
||||
s.Require().NoError(err)
|
||||
|
||||
myGroupID := groupRes.GroupId
|
||||
groupID = groupRes.GroupId
|
||||
groupPolicy := &group.MsgCreateGroupPolicy{
|
||||
Admin: admin.String(),
|
||||
GroupId: myGroupID,
|
||||
GroupId: groupID,
|
||||
}
|
||||
|
||||
policy := group.NewThresholdDecisionPolicy(
|
||||
"1",
|
||||
time.Second,
|
||||
0,
|
||||
)
|
||||
err = groupPolicy.SetDecisionPolicy(policy)
|
||||
s.Require().NoError(err)
|
||||
if policy != nil {
|
||||
err = groupPolicy.SetDecisionPolicy(policy)
|
||||
s.Require().NoError(err)
|
||||
|
||||
groupPolicyRes, err := s.keeper.CreateGroupPolicy(s.ctx, groupPolicy)
|
||||
s.Require().NoError(err)
|
||||
groupPolicyRes, err := s.keeper.CreateGroupPolicy(s.ctx, groupPolicy)
|
||||
s.Require().NoError(err)
|
||||
policyAddr = groupPolicyRes.Address
|
||||
}
|
||||
|
||||
return groupPolicyRes.Address, myGroupID, policy
|
||||
return policyAddr, groupID
|
||||
}
|
||||
|
||||
@ -793,6 +793,76 @@ func (k Keeper) Exec(goCtx context.Context, req *group.MsgExec) (*group.MsgExecR
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// LeaveGroup implements the MsgServer/LeaveGroup method.
|
||||
func (k Keeper) LeaveGroup(goCtx context.Context, req *group.MsgLeaveGroup) (*group.MsgLeaveGroupResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
_, err := sdk.AccAddressFromBech32(req.Address)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
groupInfo, err := k.getGroupInfo(ctx, req.GroupId)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "group")
|
||||
}
|
||||
|
||||
groupWeight, err := math.NewNonNegativeDecFromString(groupInfo.TotalWeight)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
gm, err := k.getGroupMember(ctx, &group.GroupMember{
|
||||
GroupId: req.GroupId,
|
||||
Member: &group.Member{Address: req.Address},
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
memberWeight, err := math.NewNonNegativeDecFromString(gm.Member.Weight)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
updatedWeight, err := math.SubNonNegative(groupWeight, memberWeight)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// delete group member in the groupMemberTable.
|
||||
if err := k.groupMemberTable.Delete(ctx.KVStore(k.key), gm); err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "group member")
|
||||
}
|
||||
|
||||
// update group weight
|
||||
groupInfo.TotalWeight = updatedWeight.String()
|
||||
if err := k.groupTable.Update(ctx.KVStore(k.key), groupInfo.Id, &groupInfo); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ctx.EventManager().EmitTypedEvent(&group.EventLeaveGroup{
|
||||
GroupId: req.GroupId,
|
||||
Address: req.Address,
|
||||
})
|
||||
|
||||
return &group.MsgLeaveGroupResponse{}, nil
|
||||
}
|
||||
|
||||
func (k Keeper) getGroupMember(ctx sdk.Context, member *group.GroupMember) (*group.GroupMember, error) {
|
||||
var groupMember group.GroupMember
|
||||
switch err := k.groupMemberTable.GetOne(ctx.KVStore(k.key),
|
||||
orm.PrimaryKey(member), &groupMember); {
|
||||
case err == nil:
|
||||
break
|
||||
case sdkerrors.ErrNotFound.Is(err):
|
||||
return nil, sdkerrors.ErrNotFound.Wrapf("%s is not part of group %d", member.Member.Address, member.GroupId)
|
||||
default:
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &groupMember, nil
|
||||
}
|
||||
|
||||
type authNGroupReq interface {
|
||||
GetGroupID() uint64
|
||||
GetAdmin() string
|
||||
|
||||
@ -797,6 +797,43 @@ func (m MsgExec) ValidateBasic() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var _ sdk.Msg = &MsgLeaveGroup{}
|
||||
|
||||
// Route Implements Msg
|
||||
func (m MsgLeaveGroup) Route() string {
|
||||
return sdk.MsgTypeURL(&m)
|
||||
}
|
||||
|
||||
// Type Implements Msg
|
||||
func (m MsgLeaveGroup) Type() string { return sdk.MsgTypeURL(&m) }
|
||||
|
||||
// GetSignBytes Implements Msg
|
||||
func (m MsgLeaveGroup) GetSignBytes() []byte {
|
||||
return sdk.MustSortJSON(legacy.Cdc.MustMarshalJSON(&m))
|
||||
}
|
||||
|
||||
// GetSigners returns the expected signers for a MsgLeaveGroup
|
||||
func (m MsgLeaveGroup) GetSigners() []sdk.AccAddress {
|
||||
signer, err := sdk.AccAddressFromBech32(m.Address)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return []sdk.AccAddress{signer}
|
||||
}
|
||||
|
||||
// ValidateBasic does a sanity check on the provided data
|
||||
func (m MsgLeaveGroup) ValidateBasic() error {
|
||||
_, err := sdk.AccAddressFromBech32(m.Address)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "group member")
|
||||
}
|
||||
|
||||
if m.GroupId == 0 {
|
||||
return sdkerrors.Wrap(errors.ErrEmpty, "group-id")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateMembers(members []Member) error {
|
||||
index := make(map[string]struct{}, len(members))
|
||||
for i := range members {
|
||||
|
||||
@ -1117,3 +1117,51 @@ func TestMsgExec(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestMsgLeaveGroup(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
msg *group.MsgLeaveGroup
|
||||
expErr bool
|
||||
errMsg string
|
||||
}{
|
||||
{
|
||||
"invalid group member address",
|
||||
&group.MsgLeaveGroup{
|
||||
Address: "member",
|
||||
},
|
||||
true,
|
||||
"group member: decoding bech32 failed",
|
||||
},
|
||||
{
|
||||
"group id is required",
|
||||
&group.MsgLeaveGroup{
|
||||
Address: admin.String(),
|
||||
},
|
||||
true,
|
||||
"group-id: value is empty",
|
||||
},
|
||||
{
|
||||
"valid testcase",
|
||||
&group.MsgLeaveGroup{
|
||||
Address: admin.String(),
|
||||
GroupId: 1,
|
||||
},
|
||||
false,
|
||||
"",
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
msg := tc.msg
|
||||
err := msg.ValidateBasic()
|
||||
if tc.expErr {
|
||||
require.Error(t, err)
|
||||
require.Contains(t, err.Error(), tc.errMsg)
|
||||
} else {
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, msg.Type(), sdk.MsgTypeURL(&group.MsgLeaveGroup{}))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,6 +38,7 @@ var (
|
||||
TypeMsgWithdrawProposal = sdk.MsgTypeURL(&group.MsgWithdrawProposal{})
|
||||
TypeMsgVote = sdk.MsgTypeURL(&group.MsgVote{})
|
||||
TypeMsgExec = sdk.MsgTypeURL(&group.MsgExec{})
|
||||
TypeMsgLeaveGroup = sdk.MsgTypeURL(&group.MsgLeaveGroup{})
|
||||
)
|
||||
|
||||
// Simulation operation weights constants
|
||||
@ -54,7 +55,8 @@ const (
|
||||
OpMsgSubmitProposal = "op_weight_msg_submit_proposal"
|
||||
OpMsgWithdrawProposal = "op_weight_msg_withdraw_proposal"
|
||||
OpMsgVote = "op_weight_msg_vote"
|
||||
OpMsgExec = "op_weight_msg_exec"
|
||||
OpMsgExec = "ops_weight_msg_exec"
|
||||
OpMsgLeaveGroup = "ops_weight_msg_leave_group"
|
||||
)
|
||||
|
||||
// If update group or group policy txn's executed, `SimulateMsgVote` & `SimulateMsgExec` txn's returns `noOp`.
|
||||
@ -65,6 +67,7 @@ const (
|
||||
WeightMsgSubmitProposal = 90
|
||||
WeightMsgVote = 90
|
||||
WeightMsgExec = 90
|
||||
WeightMsgLeaveGroup = 20
|
||||
WeightMsgUpdateGroupMetadata = 5
|
||||
WeightMsgUpdateGroupAdmin = 5
|
||||
WeightMsgUpdateGroupMembers = 5
|
||||
@ -91,6 +94,7 @@ func WeightedOperations(
|
||||
weightMsgSubmitProposal int
|
||||
weightMsgVote int
|
||||
weightMsgExec int
|
||||
weightMsgLeaveGroup int
|
||||
weightMsgWithdrawProposal int
|
||||
weightMsgCreateGroupWithPolicy int
|
||||
)
|
||||
@ -105,6 +109,11 @@ func WeightedOperations(
|
||||
weightMsgCreateGroupPolicy = WeightMsgCreateGroupPolicy
|
||||
},
|
||||
)
|
||||
appParams.GetOrGenerate(cdc, OpMsgLeaveGroup, &weightMsgLeaveGroup, nil,
|
||||
func(_ *rand.Rand) {
|
||||
weightMsgLeaveGroup = WeightMsgLeaveGroup
|
||||
},
|
||||
)
|
||||
appParams.GetOrGenerate(cdc, OpMsgCreateGroupWithPolicy, &weightMsgCreateGroupWithPolicy, nil,
|
||||
func(_ *rand.Rand) {
|
||||
weightMsgCreateGroupWithPolicy = WeightMsgCreateGroupWithPolicy
|
||||
@ -179,6 +188,10 @@ func WeightedOperations(
|
||||
weightMsgCreateGroupPolicy,
|
||||
SimulateMsgCreateGroupPolicy(ak, bk, k),
|
||||
),
|
||||
simulation.NewWeightedOperation(
|
||||
weightMsgLeaveGroup,
|
||||
SimulateMsgLeaveGroup(k, ak, bk),
|
||||
),
|
||||
simulation.NewWeightedOperation(
|
||||
weightMsgCreateGroupWithPolicy,
|
||||
SimulateMsgCreateGroupWithPolicy(ak, bk),
|
||||
@ -583,7 +596,6 @@ func SimulateMsgUpdateGroupMembers(ak group.AccountKeeper,
|
||||
}
|
||||
|
||||
members := genGroupMembers(r, accounts)
|
||||
|
||||
ctx := sdk.UnwrapSDKContext(sdkCtx)
|
||||
res, err := k.GroupMembers(ctx, &group.QueryGroupMembersRequest{GroupId: groupID})
|
||||
if err != nil {
|
||||
@ -1106,6 +1118,65 @@ func SimulateMsgExec(ak group.AccountKeeper,
|
||||
}
|
||||
}
|
||||
|
||||
// SimulateMsgLeaveGroup generates a MsgLeaveGroup with random values
|
||||
func SimulateMsgLeaveGroup(k keeper.Keeper, ak group.AccountKeeper, bk group.BankKeeper) simtypes.Operation {
|
||||
return func(
|
||||
r *rand.Rand, app *baseapp.BaseApp, sdkCtx sdk.Context, accounts []simtypes.Account, chainID string) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
|
||||
|
||||
ctx := sdk.WrapSDKContext(sdkCtx)
|
||||
groupInfo, policyInfo, _, _, err := randomGroupPolicy(r, k, ak, sdkCtx, accounts)
|
||||
if err != nil {
|
||||
return simtypes.NoOpMsg(group.ModuleName, TypeMsgLeaveGroup, ""), nil, err
|
||||
}
|
||||
|
||||
if policyInfo == nil {
|
||||
return simtypes.NoOpMsg(group.ModuleName, TypeMsgLeaveGroup, "no policy found"), nil, nil
|
||||
}
|
||||
|
||||
// Pick a random member from the group
|
||||
acc, account, err := randomMember(r, k, ak, ctx, accounts, groupInfo.Id)
|
||||
if err != nil {
|
||||
return simtypes.NoOpMsg(group.ModuleName, TypeMsgLeaveGroup, ""), nil, err
|
||||
}
|
||||
if account == nil {
|
||||
return simtypes.NoOpMsg(group.ModuleName, TypeMsgLeaveGroup, "no group member found"), nil, nil
|
||||
}
|
||||
|
||||
spendableCoins := bk.SpendableCoins(sdkCtx, acc.Address)
|
||||
fees, err := simtypes.RandomFees(r, sdkCtx, spendableCoins)
|
||||
if err != nil {
|
||||
return simtypes.NoOpMsg(group.ModuleName, TypeMsgLeaveGroup, "fee error"), nil, err
|
||||
}
|
||||
|
||||
msg := &group.MsgLeaveGroup{
|
||||
Address: acc.Address.String(),
|
||||
GroupId: groupInfo.Id,
|
||||
}
|
||||
|
||||
txGen := simappparams.MakeTestEncodingConfig().TxConfig
|
||||
tx, err := helpers.GenTx(
|
||||
txGen,
|
||||
[]sdk.Msg{msg},
|
||||
fees,
|
||||
helpers.DefaultGenTxGas,
|
||||
chainID,
|
||||
[]uint64{account.GetAccountNumber()},
|
||||
[]uint64{account.GetSequence()},
|
||||
acc.PrivKey,
|
||||
)
|
||||
if err != nil {
|
||||
return simtypes.NoOpMsg(group.ModuleName, TypeMsgLeaveGroup, "unable to generate mock tx"), nil, err
|
||||
}
|
||||
|
||||
_, _, err = app.SimDeliver(txGen.TxEncoder(), tx)
|
||||
if err != nil {
|
||||
return simtypes.NoOpMsg(group.ModuleName, msg.Type(), err.Error()), nil, err
|
||||
}
|
||||
|
||||
return simtypes.NewOperationMsg(msg, true, "", nil), nil, err
|
||||
}
|
||||
}
|
||||
|
||||
func randomGroup(r *rand.Rand, k keeper.Keeper, ak group.AccountKeeper,
|
||||
ctx sdk.Context, accounts []simtypes.Account) (groupInfo *group.GroupInfo, acc simtypes.Account, account authtypes.AccountI, err error) {
|
||||
groupID := k.GetGroupSequence(ctx)
|
||||
@ -1222,7 +1293,7 @@ func genGroupMembers(r *rand.Rand, accounts []simtypes.Account) []group.Member {
|
||||
return []group.Member{
|
||||
{
|
||||
Address: accounts[0].Address.String(),
|
||||
Weight: fmt.Sprintf("%d", simtypes.RandIntBetween(r, 1, 5)),
|
||||
Weight: fmt.Sprintf("%d", simtypes.RandIntBetween(r, 1, 10)),
|
||||
Metadata: simtypes.RandStringOfLength(r, 10),
|
||||
},
|
||||
}
|
||||
@ -1239,7 +1310,7 @@ func genGroupMembers(r *rand.Rand, accounts []simtypes.Account) []group.Member {
|
||||
for i := 0; i < membersLen; i++ {
|
||||
members[i] = group.Member{
|
||||
Address: accounts[i].Address.String(),
|
||||
Weight: fmt.Sprintf("%d", simtypes.RandIntBetween(r, 1, 5)),
|
||||
Weight: fmt.Sprintf("%d", simtypes.RandIntBetween(r, 1, 10)),
|
||||
Metadata: simtypes.RandStringOfLength(r, 10),
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,6 +53,7 @@ func (suite *SimTestSuite) TestWeightedOperations() {
|
||||
}{
|
||||
{simulation.WeightMsgCreateGroup, group.MsgCreateGroup{}.Route(), simulation.TypeMsgCreateGroup},
|
||||
{simulation.WeightMsgCreateGroupPolicy, group.MsgCreateGroupPolicy{}.Route(), simulation.TypeMsgCreateGroupPolicy},
|
||||
{simulation.WeightMsgLeaveGroup, group.MsgLeaveGroup{}.Route(), simulation.TypeMsgLeaveGroup},
|
||||
{simulation.WeightMsgCreateGroupWithPolicy, group.MsgCreateGroupWithPolicy{}.Route(), simulation.TypeMsgCreateGroupWithPolicy},
|
||||
{simulation.WeightMsgSubmitProposal, group.MsgSubmitProposal{}.Route(), simulation.TypeMsgSubmitProposal},
|
||||
{simulation.WeightMsgSubmitProposal, group.MsgSubmitProposal{}.Route(), simulation.TypeMsgSubmitProposal},
|
||||
@ -196,7 +197,7 @@ func (suite *SimTestSuite) TestSimulateCreateGroupPolicy() {
|
||||
|
||||
func (suite *SimTestSuite) TestSimulateSubmitProposal() {
|
||||
// setup 1 account
|
||||
s := rand.NewSource(1)
|
||||
s := rand.NewSource(2)
|
||||
r := rand.New(s)
|
||||
accounts := suite.getTestingAccounts(r, 1)
|
||||
acc := accounts[0]
|
||||
@ -740,6 +741,72 @@ func (suite *SimTestSuite) TestSimulateUpdateGroupPolicyMetadata() {
|
||||
suite.Require().Len(futureOperations, 0)
|
||||
}
|
||||
|
||||
func (suite *SimTestSuite) TestSimulateLeaveGroup() {
|
||||
s := rand.NewSource(1)
|
||||
r := rand.New(s)
|
||||
require := suite.Require()
|
||||
|
||||
// setup 4 account
|
||||
accounts := suite.getTestingAccounts(r, 4)
|
||||
admin := accounts[0]
|
||||
member1 := accounts[1]
|
||||
member2 := accounts[2]
|
||||
member3 := accounts[3]
|
||||
|
||||
// setup a group
|
||||
ctx := sdk.WrapSDKContext(suite.ctx)
|
||||
groupRes, err := suite.app.GroupKeeper.CreateGroup(ctx,
|
||||
&group.MsgCreateGroup{
|
||||
Admin: admin.Address.String(),
|
||||
Members: []group.Member{
|
||||
{
|
||||
Address: member1.Address.String(),
|
||||
Weight: "1",
|
||||
},
|
||||
{
|
||||
Address: member2.Address.String(),
|
||||
Weight: "2",
|
||||
},
|
||||
{
|
||||
Address: member3.Address.String(),
|
||||
Weight: "1",
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
require.NoError(err)
|
||||
|
||||
// setup a group account
|
||||
accountReq := &group.MsgCreateGroupPolicy{
|
||||
Admin: admin.Address.String(),
|
||||
GroupId: groupRes.GroupId,
|
||||
Metadata: "",
|
||||
}
|
||||
require.NoError(accountReq.SetDecisionPolicy(group.NewThresholdDecisionPolicy("3", time.Hour, time.Hour)))
|
||||
_, err = suite.app.GroupKeeper.CreateGroupPolicy(ctx, accountReq)
|
||||
require.NoError(err)
|
||||
|
||||
// begin a new block
|
||||
suite.app.BeginBlock(abci.RequestBeginBlock{
|
||||
Header: tmproto.Header{
|
||||
Height: suite.app.LastBlockHeight() + 1,
|
||||
AppHash: suite.app.LastCommitID().Hash,
|
||||
},
|
||||
})
|
||||
|
||||
// execute operation
|
||||
op := simulation.SimulateMsgLeaveGroup(suite.app.GroupKeeper, suite.app.AccountKeeper, suite.app.BankKeeper)
|
||||
operationMsg, futureOperations, err := op(r, suite.app.BaseApp, suite.ctx, accounts, "")
|
||||
suite.Require().NoError(err)
|
||||
|
||||
var msg group.MsgLeaveGroup
|
||||
err = legacy.Cdc.UnmarshalJSON(operationMsg.Msg, &msg)
|
||||
suite.Require().NoError(err)
|
||||
suite.Require().True(operationMsg.OK)
|
||||
suite.Require().Equal(groupRes.GroupId, msg.GroupId)
|
||||
suite.Require().Len(futureOperations, 0)
|
||||
}
|
||||
|
||||
func TestSimTestSuite(t *testing.T) {
|
||||
suite.Run(t, new(SimTestSuite))
|
||||
}
|
||||
|
||||
@ -129,3 +129,13 @@ The messages that are part of this proposal won't be executed if:
|
||||
* the proposal has not been accepted.
|
||||
* the proposal status is not closed.
|
||||
* the proposal has already been successfully executed.
|
||||
|
||||
## Msg/LeaveGroup
|
||||
|
||||
The `MsgLeaveGroup` allows group member to leave a group.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/a635fd78663d04c5de23f4d032e5a3abea1b005a/proto/cosmos/group/v1beta1/tx.proto#L352-L361
|
||||
|
||||
It's expecting to fail if:
|
||||
|
||||
* the group member is not part of the group.
|
||||
|
||||
@ -580,6 +580,21 @@ Example:
|
||||
simd tx group exec 1
|
||||
```
|
||||
|
||||
#### leave-group
|
||||
|
||||
The `leave-group` command allows group member to leave the group.
|
||||
|
||||
```bash
|
||||
simd tx group leave-group [member-address] [group-id]
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
simd tx group leave-group cosmos1... 1
|
||||
```
|
||||
|
||||
|
||||
## gRPC
|
||||
|
||||
A user can query the `group` module using gRPC endpoints.
|
||||
|
||||
521
x/group/tx.pb.go
521
x/group/tx.pb.go
@ -1358,6 +1358,98 @@ func (m *MsgExecResponse) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_MsgExecResponse proto.InternalMessageInfo
|
||||
|
||||
// MsgLeaveGroup is the Msg/LeaveGroup request type.
|
||||
type MsgLeaveGroup struct {
|
||||
// address is the account address of the group member.
|
||||
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
|
||||
// group_id is the unique ID of the group.
|
||||
GroupId uint64 `protobuf:"varint,2,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgLeaveGroup) Reset() { *m = MsgLeaveGroup{} }
|
||||
func (m *MsgLeaveGroup) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgLeaveGroup) ProtoMessage() {}
|
||||
func (*MsgLeaveGroup) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_da0de9d603d844fb, []int{26}
|
||||
}
|
||||
func (m *MsgLeaveGroup) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgLeaveGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgLeaveGroup.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 *MsgLeaveGroup) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgLeaveGroup.Merge(m, src)
|
||||
}
|
||||
func (m *MsgLeaveGroup) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgLeaveGroup) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgLeaveGroup.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgLeaveGroup proto.InternalMessageInfo
|
||||
|
||||
func (m *MsgLeaveGroup) GetAddress() string {
|
||||
if m != nil {
|
||||
return m.Address
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgLeaveGroup) GetGroupId() uint64 {
|
||||
if m != nil {
|
||||
return m.GroupId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// MsgLeaveGroupResponse is the Msg/LeaveGroup response type.
|
||||
type MsgLeaveGroupResponse struct {
|
||||
}
|
||||
|
||||
func (m *MsgLeaveGroupResponse) Reset() { *m = MsgLeaveGroupResponse{} }
|
||||
func (m *MsgLeaveGroupResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgLeaveGroupResponse) ProtoMessage() {}
|
||||
func (*MsgLeaveGroupResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_da0de9d603d844fb, []int{27}
|
||||
}
|
||||
func (m *MsgLeaveGroupResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgLeaveGroupResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgLeaveGroupResponse.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 *MsgLeaveGroupResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgLeaveGroupResponse.Merge(m, src)
|
||||
}
|
||||
func (m *MsgLeaveGroupResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgLeaveGroupResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgLeaveGroupResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgLeaveGroupResponse proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterEnum("cosmos.group.v1beta1.Exec", Exec_name, Exec_value)
|
||||
proto.RegisterType((*MsgCreateGroup)(nil), "cosmos.group.v1beta1.MsgCreateGroup")
|
||||
@ -1386,87 +1478,92 @@ func init() {
|
||||
proto.RegisterType((*MsgVoteResponse)(nil), "cosmos.group.v1beta1.MsgVoteResponse")
|
||||
proto.RegisterType((*MsgExec)(nil), "cosmos.group.v1beta1.MsgExec")
|
||||
proto.RegisterType((*MsgExecResponse)(nil), "cosmos.group.v1beta1.MsgExecResponse")
|
||||
proto.RegisterType((*MsgLeaveGroup)(nil), "cosmos.group.v1beta1.MsgLeaveGroup")
|
||||
proto.RegisterType((*MsgLeaveGroupResponse)(nil), "cosmos.group.v1beta1.MsgLeaveGroupResponse")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("cosmos/group/v1beta1/tx.proto", fileDescriptor_da0de9d603d844fb) }
|
||||
|
||||
var fileDescriptor_da0de9d603d844fb = []byte{
|
||||
// 1198 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcf, 0x6f, 0xe3, 0xc4,
|
||||
0x17, 0xcf, 0x34, 0xde, 0xfe, 0x78, 0xf9, 0x6e, 0xb6, 0x75, 0xd3, 0xfd, 0xa6, 0xa6, 0x4d, 0x83,
|
||||
0xe9, 0x42, 0x29, 0xad, 0xbd, 0x4d, 0xf9, 0xb1, 0xaa, 0x56, 0x88, 0xb6, 0x1b, 0x50, 0x10, 0x81,
|
||||
0xe2, 0xb2, 0xfc, 0xba, 0x44, 0x4e, 0x6c, 0xbc, 0x5e, 0x9a, 0xd8, 0xca, 0x38, 0x6d, 0x73, 0x42,
|
||||
0xda, 0x13, 0x68, 0x2f, 0xfc, 0x03, 0x48, 0x48, 0x48, 0x1c, 0x38, 0x71, 0xd8, 0x0b, 0x57, 0x4e,
|
||||
0x2b, 0x4e, 0x2b, 0x4e, 0x9c, 0xd0, 0xaa, 0x3d, 0x70, 0x00, 0x09, 0x6e, 0x5c, 0x91, 0x67, 0xec,
|
||||
0x49, 0x9c, 0xd8, 0x89, 0x93, 0xad, 0xf6, 0x94, 0xd8, 0xf3, 0x79, 0xef, 0x7d, 0x3e, 0xef, 0xbd,
|
||||
0x79, 0x33, 0x09, 0x2c, 0xd7, 0x2c, 0x5c, 0xb7, 0xb0, 0x6c, 0x34, 0xad, 0x96, 0x2d, 0x1f, 0x6f,
|
||||
0x55, 0x75, 0x47, 0xdd, 0x92, 0x9d, 0x53, 0xc9, 0x6e, 0x5a, 0x8e, 0xc5, 0x67, 0xe8, 0xb2, 0x44,
|
||||
0x96, 0x25, 0x6f, 0x59, 0xc8, 0x18, 0x96, 0x61, 0x11, 0x80, 0xec, 0x7e, 0xa3, 0x58, 0x61, 0x91,
|
||||
0x62, 0x2b, 0x74, 0xc1, 0x33, 0xf4, 0x96, 0x0c, 0xcb, 0x32, 0x8e, 0x74, 0x99, 0x3c, 0x55, 0x5b,
|
||||
0x9f, 0xc9, 0x6a, 0xa3, 0xed, 0x2d, 0xe5, 0xc3, 0x09, 0xb4, 0x6d, 0xdd, 0x37, 0xfe, 0xbf, 0x87,
|
||||
0xa8, 0x63, 0x43, 0x3e, 0xde, 0x72, 0x3f, 0xe8, 0x82, 0xf8, 0x3d, 0x82, 0x74, 0x19, 0x1b, 0xfb,
|
||||
0x4d, 0x5d, 0x75, 0xf4, 0xb7, 0x5c, 0x7b, 0x5e, 0x82, 0x4b, 0xaa, 0x56, 0x37, 0x1b, 0x59, 0x94,
|
||||
0x47, 0x6b, 0x33, 0x7b, 0xd9, 0x5f, 0x1f, 0x6c, 0xfa, 0x12, 0x76, 0x35, 0xad, 0xa9, 0x63, 0x7c,
|
||||
0xe8, 0x34, 0xcd, 0x86, 0xa1, 0x50, 0x18, 0x7f, 0x13, 0xa6, 0xea, 0x7a, 0xbd, 0xaa, 0x37, 0x71,
|
||||
0x76, 0x22, 0x9f, 0x5c, 0x4b, 0x15, 0x96, 0xa4, 0x30, 0xc5, 0x52, 0x99, 0x80, 0xf6, 0xb8, 0x87,
|
||||
0xbf, 0xaf, 0x24, 0x14, 0xdf, 0x84, 0x17, 0x60, 0xba, 0xae, 0x3b, 0xaa, 0xa6, 0x3a, 0x6a, 0x36,
|
||||
0xe9, 0x06, 0x54, 0xd8, 0xf3, 0x0e, 0xdc, 0xfb, 0xe3, 0xc7, 0x75, 0x1a, 0x45, 0xdc, 0x86, 0xab,
|
||||
0x41, 0x9e, 0x8a, 0x8e, 0x6d, 0xab, 0x81, 0x75, 0x7e, 0x11, 0xa6, 0x49, 0xa0, 0x8a, 0xa9, 0x11,
|
||||
0xca, 0x9c, 0x32, 0x45, 0x9e, 0x4b, 0x9a, 0xf8, 0x13, 0x82, 0x85, 0x32, 0x36, 0x6e, 0xdb, 0x9a,
|
||||
0x6f, 0x55, 0xf6, 0xc2, 0x8e, 0x2a, 0xb2, 0x3b, 0xc8, 0x44, 0x20, 0x08, 0x5f, 0x82, 0x34, 0x15,
|
||||
0x53, 0x69, 0x91, 0x38, 0x38, 0x9b, 0x8c, 0x9d, 0x86, 0xcb, 0xd4, 0x92, 0x12, 0xc4, 0x01, 0xc1,
|
||||
0x2b, 0xb0, 0x1c, 0x4a, 0xdd, 0xd7, 0x2d, 0x7e, 0x87, 0x60, 0x3e, 0x88, 0xd8, 0x25, 0x54, 0x2f,
|
||||
0x50, 0xda, 0x2b, 0x30, 0xd3, 0xd0, 0x4f, 0x2a, 0xd4, 0x5d, 0x72, 0x88, 0xbb, 0xe9, 0x86, 0x7e,
|
||||
0x42, 0x18, 0x04, 0x64, 0x2c, 0xc3, 0x33, 0x21, 0x24, 0x99, 0x88, 0xfb, 0x88, 0xd4, 0x35, 0x20,
|
||||
0x93, 0x56, 0xff, 0x22, 0x75, 0xc4, 0x6d, 0xb2, 0x3c, 0xe4, 0xc2, 0xc9, 0x30, 0xbe, 0x8f, 0x11,
|
||||
0x64, 0x82, 0x7d, 0x78, 0x60, 0x1d, 0x99, 0xb5, 0xf6, 0x53, 0x62, 0xcb, 0xbf, 0x0f, 0x57, 0x34,
|
||||
0xbd, 0x66, 0x62, 0xd3, 0x6a, 0x54, 0x6c, 0x12, 0x39, 0xcb, 0xe5, 0xd1, 0x5a, 0xaa, 0x90, 0x91,
|
||||
0xe8, 0x7c, 0x90, 0xfc, 0xf9, 0x20, 0xed, 0x36, 0xda, 0x7b, 0xfc, 0x2f, 0x0f, 0x36, 0xd3, 0xb7,
|
||||
0x3c, 0x03, 0xca, 0x54, 0x49, 0x6b, 0x81, 0xe7, 0x9d, 0xf4, 0x97, 0xdf, 0xae, 0x24, 0xba, 0x92,
|
||||
0xa0, 0xc0, 0x52, 0x98, 0x42, 0xb6, 0xdf, 0x0a, 0x30, 0xa5, 0x52, 0x45, 0x43, 0xb5, 0xfa, 0x40,
|
||||
0xf1, 0x67, 0x04, 0x8b, 0xc1, 0xcc, 0x52, 0xa7, 0xe3, 0x75, 0x6c, 0x17, 0x83, 0x89, 0x98, 0x0c,
|
||||
0x2e, 0xa2, 0x95, 0xff, 0x9e, 0x80, 0x6c, 0x30, 0x33, 0x1f, 0x99, 0xce, 0x9d, 0x31, 0xeb, 0xff,
|
||||
0x64, 0x53, 0xf3, 0x1a, 0xa4, 0x69, 0xf7, 0xf4, 0x34, 0xca, 0x65, 0x23, 0xb0, 0x85, 0x0a, 0xb0,
|
||||
0x40, 0x61, 0xb4, 0x55, 0x3a, 0x68, 0x8e, 0xa0, 0xe7, 0x8d, 0x4e, 0x25, 0x98, 0xcd, 0x56, 0x8f,
|
||||
0x8d, 0x8a, 0xbd, 0xa4, 0x5d, 0xca, 0xa3, 0xb5, 0x69, 0x85, 0xef, 0xb2, 0xd9, 0xc5, 0xb4, 0x7e,
|
||||
0x21, 0x4d, 0x39, 0xf9, 0x84, 0x4d, 0xc9, 0xb9, 0x4d, 0x29, 0x7e, 0x85, 0x20, 0x1f, 0x95, 0xf1,
|
||||
0x18, 0xf3, 0x9f, 0x7f, 0x1b, 0x32, 0x41, 0x2d, 0x31, 0xbb, 0x26, 0x20, 0xd2, 0x6b, 0xe1, 0xe7,
|
||||
0xe0, 0xd9, 0xc8, 0x0e, 0x66, 0xe3, 0xe1, 0x4f, 0x04, 0x62, 0x18, 0x2a, 0xa8, 0xf6, 0xa9, 0x34,
|
||||
0x7c, 0x48, 0x51, 0x92, 0x17, 0x3c, 0x29, 0x36, 0x60, 0x7d, 0xb8, 0x58, 0x96, 0x9b, 0x1f, 0x10,
|
||||
0x19, 0x2c, 0x7d, 0xf0, 0xb1, 0x07, 0xfe, 0x38, 0x59, 0x89, 0x7b, 0x12, 0x3c, 0x0f, 0xab, 0x83,
|
||||
0xb8, 0x32, 0x51, 0xff, 0x22, 0x98, 0x2b, 0x63, 0xe3, 0xb0, 0x55, 0xad, 0x9b, 0xce, 0x41, 0xd3,
|
||||
0xb2, 0x2d, 0xac, 0x1e, 0x8d, 0x33, 0x22, 0xf9, 0x25, 0x98, 0xb1, 0x89, 0xbd, 0x3f, 0x12, 0x66,
|
||||
0x94, 0xce, 0x8b, 0x81, 0x67, 0xc2, 0x75, 0x77, 0x0d, 0x63, 0xd5, 0xd0, 0x71, 0x96, 0x23, 0xb3,
|
||||
0x24, 0xb4, 0xc4, 0x0a, 0x43, 0xf1, 0x12, 0x70, 0xfa, 0xa9, 0x5e, 0x23, 0x5b, 0x3a, 0x5d, 0x10,
|
||||
0xc2, 0x27, 0x4f, 0xf1, 0x54, 0xaf, 0x29, 0x04, 0xb7, 0xc3, 0xfb, 0x85, 0xef, 0x30, 0x12, 0x6f,
|
||||
0x92, 0x89, 0x1e, 0x14, 0xce, 0xf6, 0xe4, 0x0a, 0xa4, 0x6c, 0xef, 0x5d, 0x67, 0x5b, 0x82, 0xff,
|
||||
0xaa, 0xa4, 0x89, 0x77, 0xc9, 0xdd, 0xc5, 0xdd, 0xcd, 0x5a, 0x53, 0x3d, 0x61, 0x89, 0x1b, 0x66,
|
||||
0x37, 0x4e, 0xcd, 0xbd, 0x2b, 0x48, 0x6f, 0x2c, 0x56, 0xc2, 0xbf, 0x10, 0x4c, 0x95, 0xb1, 0xf1,
|
||||
0xa1, 0xe5, 0x0c, 0xe7, 0xed, 0xf6, 0xe8, 0xb1, 0xe5, 0xe8, 0xcd, 0xa1, 0xd1, 0x29, 0x8c, 0xbf,
|
||||
0x01, 0x93, 0x96, 0xed, 0x98, 0x16, 0x3d, 0x73, 0xd2, 0x85, 0x7c, 0x78, 0xae, 0xdd, 0xe0, 0xef,
|
||||
0x11, 0x9c, 0xe2, 0xe1, 0x03, 0x15, 0xe7, 0x7a, 0x2a, 0x3e, 0x6a, 0xfd, 0x68, 0x67, 0x13, 0x46,
|
||||
0xe2, 0x1c, 0x5c, 0xf1, 0xd4, 0xb2, 0x0c, 0x98, 0x24, 0x01, 0x2e, 0x7e, 0x78, 0x02, 0xae, 0xc3,
|
||||
0x24, 0x36, 0x8d, 0x46, 0x8c, 0x0c, 0x78, 0xb8, 0x9d, 0x94, 0x1b, 0xdc, 0x7b, 0xf0, 0xa2, 0x13,
|
||||
0x6a, 0x5e, 0xf4, 0xf5, 0x75, 0xe0, 0x48, 0xe8, 0x0c, 0xcc, 0x16, 0x3f, 0x2e, 0xee, 0x57, 0x6e,
|
||||
0xbf, 0x7b, 0x78, 0x50, 0xdc, 0x2f, 0xbd, 0x59, 0x2a, 0xde, 0x9a, 0x4d, 0xf0, 0xff, 0x83, 0x69,
|
||||
0xf2, 0xf6, 0x03, 0xe5, 0x93, 0x59, 0x54, 0xf8, 0x27, 0x05, 0xc9, 0x32, 0x36, 0x78, 0x15, 0x52,
|
||||
0xdd, 0x3f, 0x59, 0x56, 0x23, 0xce, 0xce, 0xc0, 0xd1, 0x21, 0x6c, 0xc4, 0x41, 0xb1, 0x16, 0x3e,
|
||||
0x06, 0x3e, 0xe4, 0x77, 0xc3, 0x4b, 0x91, 0x3e, 0xfa, 0xc1, 0xc2, 0xf6, 0x08, 0x60, 0x16, 0xd7,
|
||||
0x86, 0xd9, 0xbe, 0x2b, 0xfd, 0x8b, 0x71, 0x1c, 0x11, 0xa8, 0xb0, 0x15, 0x1b, 0xca, 0x22, 0xb6,
|
||||
0x61, 0x3e, 0xec, 0xfe, 0xbd, 0x11, 0x8f, 0x3d, 0x45, 0x0b, 0x2f, 0x8f, 0x82, 0x66, 0xa1, 0x31,
|
||||
0xcc, 0xf5, 0x5f, 0xa5, 0xd7, 0xe3, 0xd4, 0x89, 0x62, 0x85, 0x42, 0x7c, 0x2c, 0x0b, 0xfa, 0x05,
|
||||
0x2c, 0x44, 0xdc, 0xe1, 0xe2, 0x38, 0xeb, 0xe0, 0x85, 0x57, 0x47, 0xc3, 0x33, 0x02, 0xf7, 0x10,
|
||||
0x5c, 0x8d, 0xb8, 0x0a, 0xcb, 0x71, 0xd2, 0xd8, 0x65, 0x20, 0xbc, 0x36, 0xa2, 0x01, 0x23, 0xf1,
|
||||
0x0d, 0x82, 0x95, 0x61, 0xf7, 0x94, 0x1b, 0xf1, 0x9d, 0x07, 0x2d, 0x85, 0x37, 0xc6, 0xb5, 0x64,
|
||||
0xfc, 0xee, 0x23, 0x58, 0x8c, 0xbe, 0x2b, 0x14, 0xe2, 0xfb, 0x67, 0x2d, 0xba, 0x33, 0xba, 0x0d,
|
||||
0x63, 0x73, 0x17, 0xd2, 0x3d, 0x67, 0xfc, 0x0b, 0x91, 0xde, 0x82, 0x40, 0x41, 0x8e, 0x09, 0xec,
|
||||
0x9e, 0x00, 0x7d, 0x07, 0x63, 0xf4, 0x04, 0xe8, 0x85, 0x0e, 0x98, 0x00, 0x51, 0x47, 0x20, 0xff,
|
||||
0x0e, 0x70, 0xe4, 0xf8, 0x5b, 0x8e, 0x34, 0x75, 0x97, 0x85, 0x6b, 0x03, 0x97, 0xbb, 0xbd, 0x91,
|
||||
0x81, 0x1e, 0xed, 0xcd, 0x5d, 0x1e, 0xe0, 0xad, 0xfb, 0x78, 0xd8, 0x7b, 0xfd, 0xe1, 0x59, 0x0e,
|
||||
0x3d, 0x3a, 0xcb, 0xa1, 0xc7, 0x67, 0x39, 0xf4, 0xf5, 0x79, 0x2e, 0xf1, 0xe8, 0x3c, 0x97, 0xf8,
|
||||
0xed, 0x3c, 0x97, 0xf8, 0x74, 0xd5, 0x30, 0x9d, 0x3b, 0xad, 0xaa, 0x54, 0xb3, 0xea, 0xde, 0x5f,
|
||||
0x65, 0xde, 0xc7, 0x26, 0xd6, 0x3e, 0x97, 0x4f, 0xe9, 0xdf, 0x61, 0xd5, 0x49, 0x72, 0x07, 0xda,
|
||||
0xfe, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x75, 0x15, 0x0d, 0x97, 0xa6, 0x13, 0x00, 0x00,
|
||||
// 1244 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcd, 0x6f, 0x1b, 0x45,
|
||||
0x14, 0xf7, 0xc4, 0x6e, 0x3e, 0x5e, 0x12, 0x37, 0xd9, 0x38, 0xad, 0xb3, 0x24, 0x8e, 0x71, 0x53,
|
||||
0x08, 0x69, 0xb2, 0xdb, 0x38, 0x7c, 0x54, 0x56, 0x85, 0x48, 0xd2, 0x80, 0x82, 0x6a, 0x08, 0x1b,
|
||||
0xca, 0xd7, 0x01, 0x6b, 0xed, 0x1d, 0xb6, 0x5b, 0x62, 0xef, 0xca, 0xb3, 0xf9, 0x3a, 0x21, 0xf5,
|
||||
0x04, 0xea, 0x85, 0x7f, 0x00, 0x09, 0x09, 0x89, 0x03, 0x27, 0x0e, 0xbd, 0x70, 0xe5, 0x54, 0x71,
|
||||
0x8a, 0x38, 0x71, 0x42, 0x55, 0x72, 0xe0, 0x00, 0x12, 0x47, 0xae, 0x68, 0x67, 0x76, 0xc7, 0xbb,
|
||||
0xce, 0xae, 0xbd, 0x76, 0xa3, 0x9e, 0x92, 0xd9, 0xf7, 0x7b, 0xef, 0xfd, 0xde, 0xc7, 0xbc, 0x99,
|
||||
0x31, 0xcc, 0xd5, 0x4c, 0x52, 0x37, 0x89, 0xac, 0x37, 0xcd, 0x7d, 0x4b, 0x3e, 0x58, 0xad, 0x62,
|
||||
0x5b, 0x5d, 0x95, 0xed, 0x23, 0xc9, 0x6a, 0x9a, 0xb6, 0x29, 0x64, 0x98, 0x58, 0xa2, 0x62, 0xc9,
|
||||
0x15, 0x8b, 0x19, 0xdd, 0xd4, 0x4d, 0x0a, 0x90, 0x9d, 0xff, 0x18, 0x56, 0x9c, 0x61, 0xd8, 0x0a,
|
||||
0x13, 0xb8, 0x8a, 0xae, 0x48, 0x37, 0x4d, 0x7d, 0x0f, 0xcb, 0x74, 0x55, 0xdd, 0xff, 0x42, 0x56,
|
||||
0x1b, 0xc7, 0xae, 0x28, 0x1f, 0x4e, 0xe0, 0xd8, 0xc2, 0x9e, 0xf2, 0x55, 0x17, 0x51, 0x27, 0xba,
|
||||
0x7c, 0xb0, 0xea, 0xfc, 0x61, 0x82, 0xc2, 0x8f, 0x08, 0xd2, 0x65, 0xa2, 0x6f, 0x36, 0xb1, 0x6a,
|
||||
0xe3, 0x77, 0x1c, 0x7d, 0x41, 0x82, 0x4b, 0xaa, 0x56, 0x37, 0x1a, 0x59, 0x94, 0x47, 0x8b, 0x23,
|
||||
0x1b, 0xd9, 0xdf, 0x1f, 0xaf, 0x78, 0x21, 0xac, 0x6b, 0x5a, 0x13, 0x13, 0xb2, 0x6b, 0x37, 0x8d,
|
||||
0x86, 0xae, 0x30, 0x98, 0x70, 0x1b, 0x86, 0xea, 0xb8, 0x5e, 0xc5, 0x4d, 0x92, 0x1d, 0xc8, 0x27,
|
||||
0x17, 0x47, 0x8b, 0xb3, 0x52, 0x58, 0xc4, 0x52, 0x99, 0x82, 0x36, 0x52, 0x4f, 0xfe, 0x9c, 0x4f,
|
||||
0x28, 0x9e, 0x8a, 0x20, 0xc2, 0x70, 0x1d, 0xdb, 0xaa, 0xa6, 0xda, 0x6a, 0x36, 0xe9, 0x38, 0x54,
|
||||
0xf8, 0xba, 0x04, 0x0f, 0xff, 0xfa, 0x79, 0x89, 0x79, 0x29, 0xac, 0xc1, 0x95, 0x20, 0x4f, 0x05,
|
||||
0x13, 0xcb, 0x6c, 0x10, 0x2c, 0xcc, 0xc0, 0x30, 0x75, 0x54, 0x31, 0x34, 0x4a, 0x39, 0xa5, 0x0c,
|
||||
0xd1, 0xf5, 0xb6, 0x56, 0xf8, 0x05, 0xc1, 0x74, 0x99, 0xe8, 0xf7, 0x2c, 0xcd, 0xd3, 0x2a, 0xbb,
|
||||
0x6e, 0x7b, 0x0d, 0xd2, 0xef, 0x64, 0x20, 0xe0, 0x44, 0xd8, 0x86, 0x34, 0x0b, 0xa6, 0xb2, 0x4f,
|
||||
0xfd, 0x90, 0x6c, 0x32, 0x76, 0x1a, 0xc6, 0x99, 0x26, 0x23, 0x48, 0x02, 0x01, 0xcf, 0xc3, 0x5c,
|
||||
0x28, 0x75, 0x2f, 0xee, 0xc2, 0x0f, 0x08, 0xa6, 0x82, 0x88, 0x75, 0x4a, 0xf5, 0x02, 0x43, 0x7b,
|
||||
0x0d, 0x46, 0x1a, 0xf8, 0xb0, 0xc2, 0xcc, 0x25, 0xbb, 0x98, 0x1b, 0x6e, 0xe0, 0x43, 0xca, 0x20,
|
||||
0x10, 0xc6, 0x1c, 0xbc, 0x10, 0x42, 0x92, 0x07, 0xf1, 0x08, 0xd1, 0xba, 0x06, 0xc2, 0x64, 0xd5,
|
||||
0xbf, 0xc8, 0x38, 0xe2, 0x36, 0x59, 0x1e, 0x72, 0xe1, 0x64, 0x38, 0xdf, 0xa7, 0x08, 0x32, 0xc1,
|
||||
0x3e, 0xdc, 0x31, 0xf7, 0x8c, 0xda, 0xf1, 0x73, 0x62, 0x2b, 0x7c, 0x00, 0x97, 0x35, 0x5c, 0x33,
|
||||
0x88, 0x61, 0x36, 0x2a, 0x16, 0xf5, 0x9c, 0x4d, 0xe5, 0xd1, 0xe2, 0x68, 0x31, 0x23, 0xb1, 0xf9,
|
||||
0x20, 0x79, 0xf3, 0x41, 0x5a, 0x6f, 0x1c, 0x6f, 0x08, 0xbf, 0x3d, 0x5e, 0x49, 0xdf, 0x71, 0x15,
|
||||
0x18, 0x53, 0x25, 0xad, 0x05, 0xd6, 0xa5, 0xf4, 0xd7, 0xdf, 0xcf, 0x27, 0x7c, 0x49, 0x50, 0x60,
|
||||
0x36, 0x2c, 0x42, 0xbe, 0xdf, 0x8a, 0x30, 0xa4, 0xb2, 0x88, 0xba, 0xc6, 0xea, 0x01, 0x0b, 0xbf,
|
||||
0x22, 0x98, 0x09, 0x66, 0x96, 0x19, 0xed, 0xaf, 0x63, 0x7d, 0x0c, 0x06, 0x62, 0x32, 0xb8, 0x88,
|
||||
0x56, 0xfe, 0x77, 0x00, 0xb2, 0xc1, 0xcc, 0x7c, 0x6c, 0xd8, 0xf7, 0xfb, 0xac, 0xff, 0xb3, 0x4d,
|
||||
0xcd, 0xeb, 0x90, 0x66, 0xdd, 0xd3, 0xd6, 0x28, 0xe3, 0x7a, 0x60, 0x0b, 0x15, 0x61, 0x9a, 0xc1,
|
||||
0x58, 0xab, 0xb4, 0xd0, 0x29, 0x8a, 0x9e, 0xd2, 0x5b, 0x95, 0xe0, 0x3a, 0xab, 0x6d, 0x3a, 0x2a,
|
||||
0x71, 0x93, 0x76, 0x29, 0x8f, 0x16, 0x87, 0x15, 0xc1, 0xa7, 0xb3, 0x4e, 0x58, 0xfd, 0x42, 0x9a,
|
||||
0x72, 0xf0, 0x19, 0x9b, 0x32, 0xe5, 0x34, 0x65, 0xe1, 0x1b, 0x04, 0xf9, 0xa8, 0x8c, 0xc7, 0x98,
|
||||
0xff, 0xc2, 0xbb, 0x90, 0x09, 0xc6, 0x12, 0xb3, 0x6b, 0x02, 0x41, 0xba, 0x2d, 0x7c, 0x0d, 0x5e,
|
||||
0x8c, 0xec, 0x60, 0x3e, 0x1e, 0xfe, 0x46, 0x50, 0x08, 0x43, 0x05, 0xa3, 0x7d, 0x2e, 0x0d, 0x1f,
|
||||
0x52, 0x94, 0xe4, 0x05, 0x4f, 0x8a, 0x65, 0x58, 0xea, 0x1e, 0x2c, 0xcf, 0xcd, 0x4f, 0x88, 0x0e,
|
||||
0x96, 0x73, 0xf0, 0xbe, 0x07, 0x7e, 0x3f, 0x59, 0x89, 0x7b, 0x12, 0xbc, 0x04, 0x0b, 0x9d, 0xb8,
|
||||
0xf2, 0xa0, 0xfe, 0x43, 0x30, 0x59, 0x26, 0xfa, 0xee, 0x7e, 0xb5, 0x6e, 0xd8, 0x3b, 0x4d, 0xd3,
|
||||
0x32, 0x89, 0xba, 0xd7, 0xcf, 0x88, 0x14, 0x66, 0x61, 0xc4, 0xa2, 0xfa, 0xde, 0x48, 0x18, 0x51,
|
||||
0x5a, 0x1f, 0x3a, 0x9e, 0x09, 0x37, 0x1d, 0x19, 0x21, 0xaa, 0x8e, 0x49, 0x36, 0x45, 0x67, 0x49,
|
||||
0x68, 0x89, 0x15, 0x8e, 0x12, 0x24, 0x48, 0xe1, 0x23, 0x5c, 0xa3, 0x5b, 0x3a, 0x5d, 0x14, 0xc3,
|
||||
0x27, 0xcf, 0xd6, 0x11, 0xae, 0x29, 0x14, 0x57, 0x12, 0xbc, 0xc2, 0xb7, 0x18, 0x15, 0x6e, 0xd3,
|
||||
0x89, 0x1e, 0x0c, 0x9c, 0xef, 0xc9, 0x79, 0x18, 0xb5, 0xdc, 0x6f, 0xad, 0x6d, 0x09, 0xde, 0xa7,
|
||||
0x6d, 0xad, 0xf0, 0x80, 0xde, 0x5d, 0x9c, 0xdd, 0xac, 0x35, 0xd5, 0x43, 0x9e, 0xb8, 0x6e, 0x7a,
|
||||
0xfd, 0xd4, 0xdc, 0xbd, 0x82, 0xb4, 0xfb, 0xe2, 0x25, 0xfc, 0x07, 0xc1, 0x50, 0x99, 0xe8, 0x1f,
|
||||
0x99, 0x76, 0x77, 0xde, 0x4e, 0x8f, 0x1e, 0x98, 0x36, 0x6e, 0x76, 0xf5, 0xce, 0x60, 0xc2, 0x2d,
|
||||
0x18, 0x34, 0x2d, 0xdb, 0x30, 0xd9, 0x99, 0x93, 0x2e, 0xe6, 0xc3, 0x73, 0xed, 0x38, 0x7f, 0x9f,
|
||||
0xe2, 0x14, 0x17, 0x1f, 0xa8, 0x78, 0xaa, 0xad, 0xe2, 0xbd, 0xd6, 0x8f, 0x75, 0x36, 0x65, 0x54,
|
||||
0x98, 0x84, 0xcb, 0x6e, 0xb4, 0x3c, 0x03, 0x06, 0x4d, 0x80, 0x83, 0xef, 0x9e, 0x80, 0x9b, 0x30,
|
||||
0x48, 0x0c, 0xbd, 0x11, 0x23, 0x03, 0x2e, 0xae, 0x34, 0xea, 0x38, 0x77, 0x17, 0xae, 0x77, 0x4a,
|
||||
0xcd, 0xf3, 0xbe, 0x07, 0xe3, 0x65, 0xa2, 0xdf, 0xc5, 0xea, 0x81, 0xfb, 0x00, 0xe9, 0x67, 0xf7,
|
||||
0x44, 0x5f, 0xa7, 0x4a, 0x63, 0x8e, 0x7f, 0xde, 0x0c, 0x57, 0xe9, 0x8b, 0xa0, 0xe5, 0xcd, 0xa3,
|
||||
0xb1, 0xb4, 0x04, 0x29, 0x9a, 0x81, 0x0c, 0x4c, 0x6c, 0x7d, 0xb2, 0xb5, 0x59, 0xb9, 0xf7, 0xde,
|
||||
0xee, 0xce, 0xd6, 0xe6, 0xf6, 0xdb, 0xdb, 0x5b, 0x77, 0x26, 0x12, 0xc2, 0x18, 0x0c, 0xd3, 0xaf,
|
||||
0x1f, 0x2a, 0x9f, 0x4e, 0xa0, 0xe2, 0xc9, 0x18, 0x24, 0xcb, 0x44, 0x17, 0x54, 0x18, 0xf5, 0xbf,
|
||||
0x9c, 0x16, 0x22, 0x8e, 0xf0, 0xc0, 0x09, 0x26, 0x2e, 0xc7, 0x41, 0xf1, 0x9d, 0x74, 0x00, 0x42,
|
||||
0xc8, 0xf3, 0xe5, 0x46, 0xa4, 0x8d, 0xf3, 0x60, 0x71, 0xad, 0x07, 0x30, 0xf7, 0x6b, 0xc1, 0xc4,
|
||||
0xb9, 0x97, 0xc5, 0x2b, 0x71, 0x0c, 0x51, 0xa8, 0xb8, 0x1a, 0x1b, 0xca, 0x3d, 0x1e, 0xc3, 0x54,
|
||||
0xd8, 0x33, 0x60, 0x39, 0x1e, 0x7b, 0x86, 0x16, 0x5f, 0xed, 0x05, 0xcd, 0x5d, 0x13, 0x98, 0x3c,
|
||||
0x7f, 0xa3, 0x5f, 0x8a, 0x53, 0x27, 0x86, 0x15, 0x8b, 0xf1, 0xb1, 0xdc, 0xe9, 0x57, 0x30, 0x1d,
|
||||
0x71, 0x95, 0x8c, 0x63, 0xac, 0x85, 0x17, 0x5f, 0xef, 0x0d, 0xcf, 0x09, 0x3c, 0x44, 0x70, 0x25,
|
||||
0xe2, 0x46, 0x2e, 0xc7, 0x49, 0xa3, 0x4f, 0x41, 0x7c, 0xa3, 0x47, 0x05, 0x4e, 0xe2, 0x3b, 0x04,
|
||||
0xf3, 0xdd, 0xae, 0x4b, 0xb7, 0xe2, 0x1b, 0x0f, 0x6a, 0x8a, 0x6f, 0xf5, 0xab, 0xc9, 0xf9, 0x3d,
|
||||
0x42, 0x30, 0x13, 0x7d, 0x65, 0x29, 0xc6, 0xb7, 0xcf, 0x5b, 0xb4, 0xd4, 0xbb, 0x0e, 0x67, 0xf3,
|
||||
0x00, 0xd2, 0x6d, 0x57, 0x8d, 0x97, 0x23, 0xad, 0x05, 0x81, 0xa2, 0x1c, 0x13, 0xe8, 0x9f, 0x00,
|
||||
0xe7, 0xce, 0xe7, 0xe8, 0x09, 0xd0, 0x0e, 0xed, 0x30, 0x01, 0xa2, 0x4e, 0x62, 0xe1, 0x2e, 0xa4,
|
||||
0xe8, 0x29, 0x3c, 0x17, 0xa9, 0xea, 0x88, 0xc5, 0xeb, 0x1d, 0xc5, 0x7e, 0x6b, 0x74, 0xa0, 0x47,
|
||||
0x5b, 0x73, 0xc4, 0x1d, 0xac, 0xf9, 0x4f, 0x29, 0xe1, 0x73, 0x00, 0xdf, 0x11, 0x75, 0x2d, 0x52,
|
||||
0xa9, 0x05, 0x12, 0x6f, 0xc4, 0x00, 0x79, 0xf6, 0x37, 0xde, 0x7c, 0x72, 0x9a, 0x43, 0x27, 0xa7,
|
||||
0x39, 0xf4, 0xf4, 0x34, 0x87, 0xbe, 0x3d, 0xcb, 0x25, 0x4e, 0xce, 0x72, 0x89, 0x3f, 0xce, 0x72,
|
||||
0x89, 0xcf, 0x16, 0x74, 0xc3, 0xbe, 0xbf, 0x5f, 0x95, 0x6a, 0x66, 0xdd, 0xfd, 0x45, 0xd0, 0xfd,
|
||||
0xb3, 0x42, 0xb4, 0x2f, 0xe5, 0x23, 0xf6, 0xab, 0x5f, 0x75, 0x90, 0x5e, 0xf5, 0xd6, 0xfe, 0x0f,
|
||||
0x00, 0x00, 0xff, 0xff, 0x07, 0xa9, 0xb6, 0xce, 0x8d, 0x14, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -1507,6 +1604,8 @@ type MsgClient interface {
|
||||
Vote(ctx context.Context, in *MsgVote, opts ...grpc.CallOption) (*MsgVoteResponse, error)
|
||||
// Exec executes a proposal.
|
||||
Exec(ctx context.Context, in *MsgExec, opts ...grpc.CallOption) (*MsgExecResponse, error)
|
||||
// LeaveGroup allows a group member to leave the group.
|
||||
LeaveGroup(ctx context.Context, in *MsgLeaveGroup, opts ...grpc.CallOption) (*MsgLeaveGroupResponse, error)
|
||||
}
|
||||
|
||||
type msgClient struct {
|
||||
@ -1634,6 +1733,15 @@ func (c *msgClient) Exec(ctx context.Context, in *MsgExec, opts ...grpc.CallOpti
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) LeaveGroup(ctx context.Context, in *MsgLeaveGroup, opts ...grpc.CallOption) (*MsgLeaveGroupResponse, error) {
|
||||
out := new(MsgLeaveGroupResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.group.v1beta1.Msg/LeaveGroup", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MsgServer is the server API for Msg service.
|
||||
type MsgServer interface {
|
||||
// CreateGroup creates a new group with an admin account address, a list of members and some optional metadata.
|
||||
@ -1662,6 +1770,8 @@ type MsgServer interface {
|
||||
Vote(context.Context, *MsgVote) (*MsgVoteResponse, error)
|
||||
// Exec executes a proposal.
|
||||
Exec(context.Context, *MsgExec) (*MsgExecResponse, error)
|
||||
// LeaveGroup allows a group member to leave the group.
|
||||
LeaveGroup(context.Context, *MsgLeaveGroup) (*MsgLeaveGroupResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
|
||||
@ -1707,6 +1817,9 @@ func (*UnimplementedMsgServer) Vote(ctx context.Context, req *MsgVote) (*MsgVote
|
||||
func (*UnimplementedMsgServer) Exec(ctx context.Context, req *MsgExec) (*MsgExecResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Exec not implemented")
|
||||
}
|
||||
func (*UnimplementedMsgServer) LeaveGroup(ctx context.Context, req *MsgLeaveGroup) (*MsgLeaveGroupResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method LeaveGroup not implemented")
|
||||
}
|
||||
|
||||
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
|
||||
s.RegisterService(&_Msg_serviceDesc, srv)
|
||||
@ -1946,6 +2059,24 @@ func _Msg_Exec_Handler(srv interface{}, ctx context.Context, dec func(interface{
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_LeaveGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgLeaveGroup)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).LeaveGroup(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/cosmos.group.v1beta1.Msg/LeaveGroup",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).LeaveGroup(ctx, req.(*MsgLeaveGroup))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Msg_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "cosmos.group.v1beta1.Msg",
|
||||
HandlerType: (*MsgServer)(nil),
|
||||
@ -2002,6 +2133,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "Exec",
|
||||
Handler: _Msg_Exec_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "LeaveGroup",
|
||||
Handler: _Msg_LeaveGroup_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "cosmos/group/v1beta1/tx.proto",
|
||||
@ -2977,6 +3112,64 @@ func (m *MsgExecResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MsgLeaveGroup) 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 *MsgLeaveGroup) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgLeaveGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.GroupId != 0 {
|
||||
i = encodeVarintTx(dAtA, i, uint64(m.GroupId))
|
||||
i--
|
||||
dAtA[i] = 0x10
|
||||
}
|
||||
if len(m.Address) > 0 {
|
||||
i -= len(m.Address)
|
||||
copy(dAtA[i:], m.Address)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Address)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MsgLeaveGroupResponse) 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 *MsgLeaveGroupResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgLeaveGroupResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovTx(v)
|
||||
base := offset
|
||||
@ -3418,6 +3611,31 @@ func (m *MsgExecResponse) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MsgLeaveGroup) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Address)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
if m.GroupId != 0 {
|
||||
n += 1 + sovTx(uint64(m.GroupId))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MsgLeaveGroupResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
return n
|
||||
}
|
||||
|
||||
func sovTx(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
@ -6163,6 +6381,157 @@ func (m *MsgExecResponse) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MsgLeaveGroup) 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 ErrIntOverflowTx
|
||||
}
|
||||
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: MsgLeaveGroup: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgLeaveGroup: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Address = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field GroupId", wireType)
|
||||
}
|
||||
m.GroupId = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.GroupId |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipTx(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MsgLeaveGroupResponse) 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 ErrIntOverflowTx
|
||||
}
|
||||
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: MsgLeaveGroupResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgLeaveGroupResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipTx(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipTx(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user