feat: Add percentage decision policy to x/group (#11072)
## Description Closes: #10946 Add a percentage decision policy to group module. --- ### 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
89739a554a
commit
2c184d2056
|
@ -1639,6 +1639,505 @@ func (x *fastReflection_ThresholdDecisionPolicy) ProtoMethods() *protoiface.Meth
|
|||
}
|
||||
}
|
||||
|
||||
var (
|
||||
md_PercentageDecisionPolicy protoreflect.MessageDescriptor
|
||||
fd_PercentageDecisionPolicy_percentage protoreflect.FieldDescriptor
|
||||
fd_PercentageDecisionPolicy_timeout protoreflect.FieldDescriptor
|
||||
)
|
||||
|
||||
func init() {
|
||||
file_cosmos_group_v1beta1_types_proto_init()
|
||||
md_PercentageDecisionPolicy = File_cosmos_group_v1beta1_types_proto.Messages().ByName("PercentageDecisionPolicy")
|
||||
fd_PercentageDecisionPolicy_percentage = md_PercentageDecisionPolicy.Fields().ByName("percentage")
|
||||
fd_PercentageDecisionPolicy_timeout = md_PercentageDecisionPolicy.Fields().ByName("timeout")
|
||||
}
|
||||
|
||||
var _ protoreflect.Message = (*fastReflection_PercentageDecisionPolicy)(nil)
|
||||
|
||||
type fastReflection_PercentageDecisionPolicy PercentageDecisionPolicy
|
||||
|
||||
func (x *PercentageDecisionPolicy) ProtoReflect() protoreflect.Message {
|
||||
return (*fastReflection_PercentageDecisionPolicy)(x)
|
||||
}
|
||||
|
||||
func (x *PercentageDecisionPolicy) slowProtoReflect() protoreflect.Message {
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[3]
|
||||
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_PercentageDecisionPolicy_messageType fastReflection_PercentageDecisionPolicy_messageType
|
||||
var _ protoreflect.MessageType = fastReflection_PercentageDecisionPolicy_messageType{}
|
||||
|
||||
type fastReflection_PercentageDecisionPolicy_messageType struct{}
|
||||
|
||||
func (x fastReflection_PercentageDecisionPolicy_messageType) Zero() protoreflect.Message {
|
||||
return (*fastReflection_PercentageDecisionPolicy)(nil)
|
||||
}
|
||||
func (x fastReflection_PercentageDecisionPolicy_messageType) New() protoreflect.Message {
|
||||
return new(fastReflection_PercentageDecisionPolicy)
|
||||
}
|
||||
func (x fastReflection_PercentageDecisionPolicy_messageType) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_PercentageDecisionPolicy
|
||||
}
|
||||
|
||||
// Descriptor returns message descriptor, which contains only the protobuf
|
||||
// type information for the message.
|
||||
func (x *fastReflection_PercentageDecisionPolicy) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_PercentageDecisionPolicy
|
||||
}
|
||||
|
||||
// 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_PercentageDecisionPolicy) Type() protoreflect.MessageType {
|
||||
return _fastReflection_PercentageDecisionPolicy_messageType
|
||||
}
|
||||
|
||||
// New returns a newly allocated and mutable empty message.
|
||||
func (x *fastReflection_PercentageDecisionPolicy) New() protoreflect.Message {
|
||||
return new(fastReflection_PercentageDecisionPolicy)
|
||||
}
|
||||
|
||||
// Interface unwraps the message reflection interface and
|
||||
// returns the underlying ProtoMessage interface.
|
||||
func (x *fastReflection_PercentageDecisionPolicy) Interface() protoreflect.ProtoMessage {
|
||||
return (*PercentageDecisionPolicy)(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_PercentageDecisionPolicy) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||
if x.Percentage != "" {
|
||||
value := protoreflect.ValueOfString(x.Percentage)
|
||||
if !f(fd_PercentageDecisionPolicy_percentage, value) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if x.Timeout != nil {
|
||||
value := protoreflect.ValueOfMessage(x.Timeout.ProtoReflect())
|
||||
if !f(fd_PercentageDecisionPolicy_timeout, 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_PercentageDecisionPolicy) Has(fd protoreflect.FieldDescriptor) bool {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.group.v1beta1.PercentageDecisionPolicy.percentage":
|
||||
return x.Percentage != ""
|
||||
case "cosmos.group.v1beta1.PercentageDecisionPolicy.timeout":
|
||||
return x.Timeout != nil
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1beta1.PercentageDecisionPolicy"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.group.v1beta1.PercentageDecisionPolicy 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_PercentageDecisionPolicy) Clear(fd protoreflect.FieldDescriptor) {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.group.v1beta1.PercentageDecisionPolicy.percentage":
|
||||
x.Percentage = ""
|
||||
case "cosmos.group.v1beta1.PercentageDecisionPolicy.timeout":
|
||||
x.Timeout = nil
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1beta1.PercentageDecisionPolicy"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.group.v1beta1.PercentageDecisionPolicy 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_PercentageDecisionPolicy) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch descriptor.FullName() {
|
||||
case "cosmos.group.v1beta1.PercentageDecisionPolicy.percentage":
|
||||
value := x.Percentage
|
||||
return protoreflect.ValueOfString(value)
|
||||
case "cosmos.group.v1beta1.PercentageDecisionPolicy.timeout":
|
||||
value := x.Timeout
|
||||
return protoreflect.ValueOfMessage(value.ProtoReflect())
|
||||
default:
|
||||
if descriptor.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1beta1.PercentageDecisionPolicy"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.group.v1beta1.PercentageDecisionPolicy 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_PercentageDecisionPolicy) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.group.v1beta1.PercentageDecisionPolicy.percentage":
|
||||
x.Percentage = value.Interface().(string)
|
||||
case "cosmos.group.v1beta1.PercentageDecisionPolicy.timeout":
|
||||
x.Timeout = value.Message().Interface().(*durationpb.Duration)
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1beta1.PercentageDecisionPolicy"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.group.v1beta1.PercentageDecisionPolicy 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_PercentageDecisionPolicy) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.group.v1beta1.PercentageDecisionPolicy.timeout":
|
||||
if x.Timeout == nil {
|
||||
x.Timeout = new(durationpb.Duration)
|
||||
}
|
||||
return protoreflect.ValueOfMessage(x.Timeout.ProtoReflect())
|
||||
case "cosmos.group.v1beta1.PercentageDecisionPolicy.percentage":
|
||||
panic(fmt.Errorf("field percentage of message cosmos.group.v1beta1.PercentageDecisionPolicy is not mutable"))
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1beta1.PercentageDecisionPolicy"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.group.v1beta1.PercentageDecisionPolicy 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_PercentageDecisionPolicy) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.group.v1beta1.PercentageDecisionPolicy.percentage":
|
||||
return protoreflect.ValueOfString("")
|
||||
case "cosmos.group.v1beta1.PercentageDecisionPolicy.timeout":
|
||||
m := new(durationpb.Duration)
|
||||
return protoreflect.ValueOfMessage(m.ProtoReflect())
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.group.v1beta1.PercentageDecisionPolicy"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.group.v1beta1.PercentageDecisionPolicy 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_PercentageDecisionPolicy) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
|
||||
switch d.FullName() {
|
||||
default:
|
||||
panic(fmt.Errorf("%s is not a oneof field in cosmos.group.v1beta1.PercentageDecisionPolicy", 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_PercentageDecisionPolicy) 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_PercentageDecisionPolicy) 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_PercentageDecisionPolicy) 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_PercentageDecisionPolicy) ProtoMethods() *protoiface.Methods {
|
||||
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
|
||||
x := input.Message.Interface().(*PercentageDecisionPolicy)
|
||||
if x == nil {
|
||||
return protoiface.SizeOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Size: 0,
|
||||
}
|
||||
}
|
||||
options := runtime.SizeInputToOptions(input)
|
||||
_ = options
|
||||
var n int
|
||||
var l int
|
||||
_ = l
|
||||
l = len(x.Percentage)
|
||||
if l > 0 {
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
if x.Timeout != nil {
|
||||
l = options.Size(x.Timeout)
|
||||
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().(*PercentageDecisionPolicy)
|
||||
if x == nil {
|
||||
return protoiface.MarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Buf: input.Buf,
|
||||
}, nil
|
||||
}
|
||||
options := runtime.MarshalInputToOptions(input)
|
||||
_ = options
|
||||
size := options.Size(x)
|
||||
dAtA := make([]byte, size)
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if x.unknownFields != nil {
|
||||
i -= len(x.unknownFields)
|
||||
copy(dAtA[i:], x.unknownFields)
|
||||
}
|
||||
if x.Timeout != nil {
|
||||
encoded, err := options.Marshal(x.Timeout)
|
||||
if err != nil {
|
||||
return protoiface.MarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Buf: input.Buf,
|
||||
}, err
|
||||
}
|
||||
i -= len(encoded)
|
||||
copy(dAtA[i:], encoded)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(x.Percentage) > 0 {
|
||||
i -= len(x.Percentage)
|
||||
copy(dAtA[i:], x.Percentage)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Percentage)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
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().(*PercentageDecisionPolicy)
|
||||
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: PercentageDecisionPolicy: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: PercentageDecisionPolicy: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Percentage", 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.Percentage = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if postIndex > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
if x.Timeout == nil {
|
||||
x.Timeout = &durationpb.Duration{}
|
||||
}
|
||||
if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Timeout); err != nil {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := runtime.Skip(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
if !options.DiscardUnknown {
|
||||
x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil
|
||||
}
|
||||
return &protoiface.Methods{
|
||||
NoUnkeyedLiterals: struct{}{},
|
||||
Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,
|
||||
Size: size,
|
||||
Marshal: marshal,
|
||||
Unmarshal: unmarshal,
|
||||
Merge: nil,
|
||||
CheckInitialized: nil,
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
md_GroupInfo protoreflect.MessageDescriptor
|
||||
fd_GroupInfo_group_id protoreflect.FieldDescriptor
|
||||
|
@ -1669,7 +2168,7 @@ func (x *GroupInfo) ProtoReflect() protoreflect.Message {
|
|||
}
|
||||
|
||||
func (x *GroupInfo) slowProtoReflect() protoreflect.Message {
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[3]
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
@ -2386,7 +2885,7 @@ func (x *GroupMember) ProtoReflect() protoreflect.Message {
|
|||
}
|
||||
|
||||
func (x *GroupMember) slowProtoReflect() protoreflect.Message {
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[4]
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
@ -2879,7 +3378,7 @@ func (x *GroupPolicyInfo) ProtoReflect() protoreflect.Message {
|
|||
}
|
||||
|
||||
func (x *GroupPolicyInfo) slowProtoReflect() protoreflect.Message {
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[5]
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[6]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
@ -3792,7 +4291,7 @@ func (x *Proposal) ProtoReflect() protoreflect.Message {
|
|||
}
|
||||
|
||||
func (x *Proposal) slowProtoReflect() protoreflect.Message {
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[6]
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[7]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
@ -4950,7 +5449,7 @@ func (x *Tally) ProtoReflect() protoreflect.Message {
|
|||
}
|
||||
|
||||
func (x *Tally) slowProtoReflect() protoreflect.Message {
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[7]
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[8]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
@ -5564,7 +6063,7 @@ func (x *Vote) ProtoReflect() protoreflect.Message {
|
|||
}
|
||||
|
||||
func (x *Vote) slowProtoReflect() protoreflect.Message {
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[8]
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[9]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
@ -6330,7 +6829,7 @@ func (x Proposal_Status) Number() protoreflect.EnumNumber {
|
|||
|
||||
// Deprecated: Use Proposal_Status.Descriptor instead.
|
||||
func (Proposal_Status) EnumDescriptor() ([]byte, []int) {
|
||||
return file_cosmos_group_v1beta1_types_proto_rawDescGZIP(), []int{6, 0}
|
||||
return file_cosmos_group_v1beta1_types_proto_rawDescGZIP(), []int{7, 0}
|
||||
}
|
||||
|
||||
// Result defines types of proposal results.
|
||||
|
@ -6387,7 +6886,7 @@ func (x Proposal_Result) Number() protoreflect.EnumNumber {
|
|||
|
||||
// Deprecated: Use Proposal_Result.Descriptor instead.
|
||||
func (Proposal_Result) EnumDescriptor() ([]byte, []int) {
|
||||
return file_cosmos_group_v1beta1_types_proto_rawDescGZIP(), []int{6, 1}
|
||||
return file_cosmos_group_v1beta1_types_proto_rawDescGZIP(), []int{7, 1}
|
||||
}
|
||||
|
||||
// ExecutorResult defines types of proposal executor results.
|
||||
|
@ -6444,7 +6943,7 @@ func (x Proposal_ExecutorResult) Number() protoreflect.EnumNumber {
|
|||
|
||||
// Deprecated: Use Proposal_ExecutorResult.Descriptor instead.
|
||||
func (Proposal_ExecutorResult) EnumDescriptor() ([]byte, []int) {
|
||||
return file_cosmos_group_v1beta1_types_proto_rawDescGZIP(), []int{6, 2}
|
||||
return file_cosmos_group_v1beta1_types_proto_rawDescGZIP(), []int{7, 2}
|
||||
}
|
||||
|
||||
// Member represents a group member with an account address,
|
||||
|
@ -6596,6 +7095,53 @@ func (x *ThresholdDecisionPolicy) GetTimeout() *durationpb.Duration {
|
|||
return nil
|
||||
}
|
||||
|
||||
// PercentageDecisionPolicy implements the DecisionPolicy interface
|
||||
type PercentageDecisionPolicy struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// percentage is the minimum percentage the weighted sum of yes votes must met for a proposal to succeed.
|
||||
Percentage string `protobuf:"bytes,1,opt,name=percentage,proto3" json:"percentage,omitempty"`
|
||||
// timeout is the duration from submission of a proposal to the end of voting period
|
||||
// Within this times votes and exec messages can be submitted.
|
||||
Timeout *durationpb.Duration `protobuf:"bytes,2,opt,name=timeout,proto3" json:"timeout,omitempty"`
|
||||
}
|
||||
|
||||
func (x *PercentageDecisionPolicy) Reset() {
|
||||
*x = PercentageDecisionPolicy{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PercentageDecisionPolicy) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PercentageDecisionPolicy) ProtoMessage() {}
|
||||
|
||||
// Deprecated: Use PercentageDecisionPolicy.ProtoReflect.Descriptor instead.
|
||||
func (*PercentageDecisionPolicy) Descriptor() ([]byte, []int) {
|
||||
return file_cosmos_group_v1beta1_types_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *PercentageDecisionPolicy) GetPercentage() string {
|
||||
if x != nil {
|
||||
return x.Percentage
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PercentageDecisionPolicy) GetTimeout() *durationpb.Duration {
|
||||
if x != nil {
|
||||
return x.Timeout
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GroupInfo represents the high-level on-chain information for a group.
|
||||
type GroupInfo struct {
|
||||
state protoimpl.MessageState
|
||||
|
@ -6622,7 +7168,7 @@ type GroupInfo struct {
|
|||
func (x *GroupInfo) Reset() {
|
||||
*x = GroupInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[3]
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
@ -6636,7 +7182,7 @@ func (*GroupInfo) ProtoMessage() {}
|
|||
|
||||
// Deprecated: Use GroupInfo.ProtoReflect.Descriptor instead.
|
||||
func (*GroupInfo) Descriptor() ([]byte, []int) {
|
||||
return file_cosmos_group_v1beta1_types_proto_rawDescGZIP(), []int{3}
|
||||
return file_cosmos_group_v1beta1_types_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *GroupInfo) GetGroupId() uint64 {
|
||||
|
@ -6696,7 +7242,7 @@ type GroupMember struct {
|
|||
func (x *GroupMember) Reset() {
|
||||
*x = GroupMember{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[4]
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
@ -6710,7 +7256,7 @@ func (*GroupMember) ProtoMessage() {}
|
|||
|
||||
// Deprecated: Use GroupMember.ProtoReflect.Descriptor instead.
|
||||
func (*GroupMember) Descriptor() ([]byte, []int) {
|
||||
return file_cosmos_group_v1beta1_types_proto_rawDescGZIP(), []int{4}
|
||||
return file_cosmos_group_v1beta1_types_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *GroupMember) GetGroupId() uint64 {
|
||||
|
@ -6753,7 +7299,7 @@ type GroupPolicyInfo struct {
|
|||
func (x *GroupPolicyInfo) Reset() {
|
||||
*x = GroupPolicyInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[5]
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
@ -6767,7 +7313,7 @@ func (*GroupPolicyInfo) ProtoMessage() {}
|
|||
|
||||
// Deprecated: Use GroupPolicyInfo.ProtoReflect.Descriptor instead.
|
||||
func (*GroupPolicyInfo) Descriptor() ([]byte, []int) {
|
||||
return file_cosmos_group_v1beta1_types_proto_rawDescGZIP(), []int{5}
|
||||
return file_cosmos_group_v1beta1_types_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *GroupPolicyInfo) GetAddress() string {
|
||||
|
@ -6864,7 +7410,7 @@ type Proposal struct {
|
|||
func (x *Proposal) Reset() {
|
||||
*x = Proposal{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[6]
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
@ -6878,7 +7424,7 @@ func (*Proposal) ProtoMessage() {}
|
|||
|
||||
// Deprecated: Use Proposal.ProtoReflect.Descriptor instead.
|
||||
func (*Proposal) Descriptor() ([]byte, []int) {
|
||||
return file_cosmos_group_v1beta1_types_proto_rawDescGZIP(), []int{6}
|
||||
return file_cosmos_group_v1beta1_types_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *Proposal) GetProposalId() uint64 {
|
||||
|
@ -6991,7 +7537,7 @@ type Tally struct {
|
|||
func (x *Tally) Reset() {
|
||||
*x = Tally{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[7]
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
@ -7005,7 +7551,7 @@ func (*Tally) ProtoMessage() {}
|
|||
|
||||
// Deprecated: Use Tally.ProtoReflect.Descriptor instead.
|
||||
func (*Tally) Descriptor() ([]byte, []int) {
|
||||
return file_cosmos_group_v1beta1_types_proto_rawDescGZIP(), []int{7}
|
||||
return file_cosmos_group_v1beta1_types_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *Tally) GetYesCount() string {
|
||||
|
@ -7057,7 +7603,7 @@ type Vote struct {
|
|||
func (x *Vote) Reset() {
|
||||
*x = Vote{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[8]
|
||||
mi := &file_cosmos_group_v1beta1_types_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
@ -7071,7 +7617,7 @@ func (*Vote) ProtoMessage() {}
|
|||
|
||||
// Deprecated: Use Vote.ProtoReflect.Descriptor instead.
|
||||
func (*Vote) Descriptor() ([]byte, []int) {
|
||||
return file_cosmos_group_v1beta1_types_proto_rawDescGZIP(), []int{8}
|
||||
return file_cosmos_group_v1beta1_types_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
func (x *Vote) GetProposalId() uint64 {
|
||||
|
@ -7149,6 +7695,15 @@ var file_cosmos_group_v1beta1_types_proto_rawDesc = []byte{
|
|||
0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x98, 0xdf,
|
||||
0x1f, 0x01, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x3a, 0x12, 0xca, 0xb4, 0x2d,
|
||||
0x0e, 0x44, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22,
|
||||
0x8d, 0x01, 0x0a, 0x18, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x44, 0x65,
|
||||
0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x1e, 0x0a, 0x0a,
|
||||
0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x0a, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x12, 0x3d, 0x0a, 0x07,
|
||||
0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e,
|
||||
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
|
||||
0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x98, 0xdf,
|
||||
0x1f, 0x01, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x3a, 0x12, 0xca, 0xb4, 0x2d,
|
||||
0x0e, 0x44, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22,
|
||||
0xf4, 0x01, 0x0a, 0x09, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x6e, 0x66, 0x6f, 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, 0x2e, 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69,
|
||||
|
@ -7347,47 +7902,49 @@ func file_cosmos_group_v1beta1_types_proto_rawDescGZIP() []byte {
|
|||
}
|
||||
|
||||
var file_cosmos_group_v1beta1_types_proto_enumTypes = make([]protoimpl.EnumInfo, 4)
|
||||
var file_cosmos_group_v1beta1_types_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
|
||||
var file_cosmos_group_v1beta1_types_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
|
||||
var file_cosmos_group_v1beta1_types_proto_goTypes = []interface{}{
|
||||
(Choice)(0), // 0: cosmos.group.v1beta1.Choice
|
||||
(Proposal_Status)(0), // 1: cosmos.group.v1beta1.Proposal.Status
|
||||
(Proposal_Result)(0), // 2: cosmos.group.v1beta1.Proposal.Result
|
||||
(Proposal_ExecutorResult)(0), // 3: cosmos.group.v1beta1.Proposal.ExecutorResult
|
||||
(*Member)(nil), // 4: cosmos.group.v1beta1.Member
|
||||
(*Members)(nil), // 5: cosmos.group.v1beta1.Members
|
||||
(*ThresholdDecisionPolicy)(nil), // 6: cosmos.group.v1beta1.ThresholdDecisionPolicy
|
||||
(*GroupInfo)(nil), // 7: cosmos.group.v1beta1.GroupInfo
|
||||
(*GroupMember)(nil), // 8: cosmos.group.v1beta1.GroupMember
|
||||
(*GroupPolicyInfo)(nil), // 9: cosmos.group.v1beta1.GroupPolicyInfo
|
||||
(*Proposal)(nil), // 10: cosmos.group.v1beta1.Proposal
|
||||
(*Tally)(nil), // 11: cosmos.group.v1beta1.Tally
|
||||
(*Vote)(nil), // 12: cosmos.group.v1beta1.Vote
|
||||
(*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp
|
||||
(*durationpb.Duration)(nil), // 14: google.protobuf.Duration
|
||||
(*anypb.Any)(nil), // 15: google.protobuf.Any
|
||||
(Choice)(0), // 0: cosmos.group.v1beta1.Choice
|
||||
(Proposal_Status)(0), // 1: cosmos.group.v1beta1.Proposal.Status
|
||||
(Proposal_Result)(0), // 2: cosmos.group.v1beta1.Proposal.Result
|
||||
(Proposal_ExecutorResult)(0), // 3: cosmos.group.v1beta1.Proposal.ExecutorResult
|
||||
(*Member)(nil), // 4: cosmos.group.v1beta1.Member
|
||||
(*Members)(nil), // 5: cosmos.group.v1beta1.Members
|
||||
(*ThresholdDecisionPolicy)(nil), // 6: cosmos.group.v1beta1.ThresholdDecisionPolicy
|
||||
(*PercentageDecisionPolicy)(nil), // 7: cosmos.group.v1beta1.PercentageDecisionPolicy
|
||||
(*GroupInfo)(nil), // 8: cosmos.group.v1beta1.GroupInfo
|
||||
(*GroupMember)(nil), // 9: cosmos.group.v1beta1.GroupMember
|
||||
(*GroupPolicyInfo)(nil), // 10: cosmos.group.v1beta1.GroupPolicyInfo
|
||||
(*Proposal)(nil), // 11: cosmos.group.v1beta1.Proposal
|
||||
(*Tally)(nil), // 12: cosmos.group.v1beta1.Tally
|
||||
(*Vote)(nil), // 13: cosmos.group.v1beta1.Vote
|
||||
(*timestamppb.Timestamp)(nil), // 14: google.protobuf.Timestamp
|
||||
(*durationpb.Duration)(nil), // 15: google.protobuf.Duration
|
||||
(*anypb.Any)(nil), // 16: google.protobuf.Any
|
||||
}
|
||||
var file_cosmos_group_v1beta1_types_proto_depIdxs = []int32{
|
||||
13, // 0: cosmos.group.v1beta1.Member.added_at:type_name -> google.protobuf.Timestamp
|
||||
14, // 0: cosmos.group.v1beta1.Member.added_at:type_name -> google.protobuf.Timestamp
|
||||
4, // 1: cosmos.group.v1beta1.Members.members:type_name -> cosmos.group.v1beta1.Member
|
||||
14, // 2: cosmos.group.v1beta1.ThresholdDecisionPolicy.timeout:type_name -> google.protobuf.Duration
|
||||
13, // 3: cosmos.group.v1beta1.GroupInfo.created_at:type_name -> google.protobuf.Timestamp
|
||||
4, // 4: cosmos.group.v1beta1.GroupMember.member:type_name -> cosmos.group.v1beta1.Member
|
||||
15, // 5: cosmos.group.v1beta1.GroupPolicyInfo.decision_policy:type_name -> google.protobuf.Any
|
||||
13, // 6: cosmos.group.v1beta1.GroupPolicyInfo.created_at:type_name -> google.protobuf.Timestamp
|
||||
13, // 7: cosmos.group.v1beta1.Proposal.submitted_at:type_name -> google.protobuf.Timestamp
|
||||
1, // 8: cosmos.group.v1beta1.Proposal.status:type_name -> cosmos.group.v1beta1.Proposal.Status
|
||||
2, // 9: cosmos.group.v1beta1.Proposal.result:type_name -> cosmos.group.v1beta1.Proposal.Result
|
||||
11, // 10: cosmos.group.v1beta1.Proposal.vote_state:type_name -> cosmos.group.v1beta1.Tally
|
||||
13, // 11: cosmos.group.v1beta1.Proposal.timeout:type_name -> google.protobuf.Timestamp
|
||||
3, // 12: cosmos.group.v1beta1.Proposal.executor_result:type_name -> cosmos.group.v1beta1.Proposal.ExecutorResult
|
||||
15, // 13: cosmos.group.v1beta1.Proposal.msgs:type_name -> google.protobuf.Any
|
||||
0, // 14: cosmos.group.v1beta1.Vote.choice:type_name -> cosmos.group.v1beta1.Choice
|
||||
13, // 15: cosmos.group.v1beta1.Vote.submitted_at:type_name -> google.protobuf.Timestamp
|
||||
16, // [16:16] is the sub-list for method output_type
|
||||
16, // [16:16] is the sub-list for method input_type
|
||||
16, // [16:16] is the sub-list for extension type_name
|
||||
16, // [16:16] is the sub-list for extension extendee
|
||||
0, // [0:16] is the sub-list for field type_name
|
||||
15, // 2: cosmos.group.v1beta1.ThresholdDecisionPolicy.timeout:type_name -> google.protobuf.Duration
|
||||
15, // 3: cosmos.group.v1beta1.PercentageDecisionPolicy.timeout:type_name -> google.protobuf.Duration
|
||||
14, // 4: cosmos.group.v1beta1.GroupInfo.created_at:type_name -> google.protobuf.Timestamp
|
||||
4, // 5: cosmos.group.v1beta1.GroupMember.member:type_name -> cosmos.group.v1beta1.Member
|
||||
16, // 6: cosmos.group.v1beta1.GroupPolicyInfo.decision_policy:type_name -> google.protobuf.Any
|
||||
14, // 7: cosmos.group.v1beta1.GroupPolicyInfo.created_at:type_name -> google.protobuf.Timestamp
|
||||
14, // 8: cosmos.group.v1beta1.Proposal.submitted_at:type_name -> google.protobuf.Timestamp
|
||||
1, // 9: cosmos.group.v1beta1.Proposal.status:type_name -> cosmos.group.v1beta1.Proposal.Status
|
||||
2, // 10: cosmos.group.v1beta1.Proposal.result:type_name -> cosmos.group.v1beta1.Proposal.Result
|
||||
12, // 11: cosmos.group.v1beta1.Proposal.vote_state:type_name -> cosmos.group.v1beta1.Tally
|
||||
14, // 12: cosmos.group.v1beta1.Proposal.timeout:type_name -> google.protobuf.Timestamp
|
||||
3, // 13: cosmos.group.v1beta1.Proposal.executor_result:type_name -> cosmos.group.v1beta1.Proposal.ExecutorResult
|
||||
16, // 14: cosmos.group.v1beta1.Proposal.msgs:type_name -> google.protobuf.Any
|
||||
0, // 15: cosmos.group.v1beta1.Vote.choice:type_name -> cosmos.group.v1beta1.Choice
|
||||
14, // 16: cosmos.group.v1beta1.Vote.submitted_at:type_name -> google.protobuf.Timestamp
|
||||
17, // [17:17] is the sub-list for method output_type
|
||||
17, // [17:17] is the sub-list for method input_type
|
||||
17, // [17:17] is the sub-list for extension type_name
|
||||
17, // [17:17] is the sub-list for extension extendee
|
||||
0, // [0:17] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_cosmos_group_v1beta1_types_proto_init() }
|
||||
|
@ -7433,7 +7990,7 @@ func file_cosmos_group_v1beta1_types_proto_init() {
|
|||
}
|
||||
}
|
||||
file_cosmos_group_v1beta1_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GroupInfo); i {
|
||||
switch v := v.(*PercentageDecisionPolicy); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
@ -7445,7 +8002,7 @@ func file_cosmos_group_v1beta1_types_proto_init() {
|
|||
}
|
||||
}
|
||||
file_cosmos_group_v1beta1_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GroupMember); i {
|
||||
switch v := v.(*GroupInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
@ -7457,7 +8014,7 @@ func file_cosmos_group_v1beta1_types_proto_init() {
|
|||
}
|
||||
}
|
||||
file_cosmos_group_v1beta1_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GroupPolicyInfo); i {
|
||||
switch v := v.(*GroupMember); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
@ -7469,7 +8026,7 @@ func file_cosmos_group_v1beta1_types_proto_init() {
|
|||
}
|
||||
}
|
||||
file_cosmos_group_v1beta1_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Proposal); i {
|
||||
switch v := v.(*GroupPolicyInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
@ -7481,7 +8038,7 @@ func file_cosmos_group_v1beta1_types_proto_init() {
|
|||
}
|
||||
}
|
||||
file_cosmos_group_v1beta1_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Tally); i {
|
||||
switch v := v.(*Proposal); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
@ -7493,6 +8050,18 @@ func file_cosmos_group_v1beta1_types_proto_init() {
|
|||
}
|
||||
}
|
||||
file_cosmos_group_v1beta1_types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Tally); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_cosmos_group_v1beta1_types_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Vote); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
|
@ -7511,7 +8080,7 @@ func file_cosmos_group_v1beta1_types_proto_init() {
|
|||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_cosmos_group_v1beta1_types_proto_rawDesc,
|
||||
NumEnums: 4,
|
||||
NumMessages: 9,
|
||||
NumMessages: 10,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
|
|
@ -46,6 +46,18 @@ message ThresholdDecisionPolicy {
|
|||
google.protobuf.Duration timeout = 2 [(gogoproto.stdduration) = true, (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
// PercentageDecisionPolicy implements the DecisionPolicy interface
|
||||
message PercentageDecisionPolicy {
|
||||
option (cosmos_proto.implements_interface) = "DecisionPolicy";
|
||||
|
||||
// percentage is the minimum percentage the weighted sum of yes votes must meet for a proposal to succeed.
|
||||
string percentage = 1;
|
||||
|
||||
// timeout is the duration from submission of a proposal to the end of voting period
|
||||
// Within these times votes and exec messages can be submitted.
|
||||
google.protobuf.Duration timeout = 2 [(gogoproto.stdduration) = true, (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
// Choice defines available types of choices for voting.
|
||||
enum Choice {
|
||||
|
||||
|
|
|
@ -299,6 +299,9 @@ Note, the '--from' flag is ignored as it is implied from [admin].
|
|||
Example:
|
||||
$ %s tx group create-group-policy [admin] [group-id] [metadata] \
|
||||
'{"@type":"/cosmos.group.v1beta1.ThresholdDecisionPolicy", "threshold":"1", "timeout":"1s"}'
|
||||
|
||||
Here, we can use percentage decision policy when needed, where 0 < percentage <= 1.
|
||||
Ex: '{"@type":"/cosmos.group.v1beta1.PercentageDecisionPolicy", "percentage":"0.5", "timeout":"1s"}'
|
||||
`,
|
||||
version.AppName,
|
||||
),
|
||||
|
|
|
@ -372,6 +372,7 @@ func (s *IntegrationTestSuite) TestQueryGroupPoliciesByGroup() {
|
|||
s.groupPolicies[2],
|
||||
s.groupPolicies[3],
|
||||
s.groupPolicies[4],
|
||||
s.groupPolicies[5],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -443,6 +444,7 @@ func (s *IntegrationTestSuite) TestQueryGroupPoliciesByAdmin() {
|
|||
s.groupPolicies[2],
|
||||
s.groupPolicies[3],
|
||||
s.groupPolicies[4],
|
||||
s.groupPolicies[5],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -129,10 +129,29 @@ func (s *IntegrationTestSuite) SetupSuite() {
|
|||
out, err = cli.ExecTestCLICmd(val.ClientCtx, client.QueryGroupPoliciesByGroupCmd(), []string{"1", fmt.Sprintf("--%s=json", tmcli.OutputFlag)})
|
||||
s.Require().NoError(err, out.String())
|
||||
}
|
||||
percentage := 0.5
|
||||
// create group policy with percentage decision policy
|
||||
out, err = cli.ExecTestCLICmd(val.ClientCtx, client.MsgCreateGroupPolicyCmd(),
|
||||
append(
|
||||
[]string{
|
||||
val.Address.String(),
|
||||
"1",
|
||||
validMetadata,
|
||||
fmt.Sprintf("{\"@type\":\"/cosmos.group.v1beta1.PercentageDecisionPolicy\", \"percentage\":\"%f\", \"timeout\":\"30000s\"}", percentage),
|
||||
},
|
||||
commonFlags...,
|
||||
),
|
||||
)
|
||||
s.Require().NoError(err, out.String())
|
||||
s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String())
|
||||
s.Require().Equal(uint32(0), txResp.Code, out.String())
|
||||
|
||||
out, err = cli.ExecTestCLICmd(val.ClientCtx, client.QueryGroupPoliciesByGroupCmd(), []string{"1", fmt.Sprintf("--%s=json", tmcli.OutputFlag)})
|
||||
s.Require().NoError(err, out.String())
|
||||
|
||||
var res group.QueryGroupPoliciesByGroupResponse
|
||||
s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &res))
|
||||
s.Require().Equal(len(res.GroupPolicies), 5)
|
||||
s.Require().Equal(len(res.GroupPolicies), 6)
|
||||
s.groupPolicies = res.GroupPolicies
|
||||
|
||||
// create a proposal
|
||||
|
@ -711,6 +730,22 @@ func (s *IntegrationTestSuite) TestTxCreateGroupPolicy() {
|
|||
&sdk.TxResponse{},
|
||||
0,
|
||||
},
|
||||
{
|
||||
"correct data with percentage decision policy",
|
||||
append(
|
||||
[]string{
|
||||
val.Address.String(),
|
||||
fmt.Sprintf("%v", groupID),
|
||||
validMetadata,
|
||||
"{\"@type\":\"/cosmos.group.v1beta1.PercentageDecisionPolicy\", \"percentage\":\"0.5\", \"timeout\":\"1s\"}",
|
||||
},
|
||||
commonFlags...,
|
||||
),
|
||||
false,
|
||||
"",
|
||||
&sdk.TxResponse{},
|
||||
0,
|
||||
},
|
||||
{
|
||||
"with amino-json",
|
||||
append(
|
||||
|
@ -776,6 +811,38 @@ func (s *IntegrationTestSuite) TestTxCreateGroupPolicy() {
|
|||
&sdk.TxResponse{},
|
||||
0,
|
||||
},
|
||||
{
|
||||
"invalid percentage decision policy with negative value",
|
||||
append(
|
||||
[]string{
|
||||
val.Address.String(),
|
||||
fmt.Sprintf("%v", groupID),
|
||||
validMetadata,
|
||||
"{\"@type\":\"/cosmos.group.v1beta1.PercentageDecisionPolicy\", \"percentage\":\"-0.5\", \"timeout\":\"1s\"}",
|
||||
},
|
||||
commonFlags...,
|
||||
),
|
||||
true,
|
||||
"expected a positive decimal",
|
||||
&sdk.TxResponse{},
|
||||
0,
|
||||
},
|
||||
{
|
||||
"invalid percentage decision policy with value greater than 1",
|
||||
append(
|
||||
[]string{
|
||||
val.Address.String(),
|
||||
fmt.Sprintf("%v", groupID),
|
||||
validMetadata,
|
||||
"{\"@type\":\"/cosmos.group.v1beta1.PercentageDecisionPolicy\", \"percentage\":\"2\", \"timeout\":\"1s\"}",
|
||||
},
|
||||
commonFlags...,
|
||||
),
|
||||
true,
|
||||
"percentage must be > 0 and <= 1",
|
||||
&sdk.TxResponse{},
|
||||
0,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
@ -936,6 +1003,21 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyDecisionPolicy() {
|
|||
&sdk.TxResponse{},
|
||||
0,
|
||||
},
|
||||
{
|
||||
"correct data with percentage decision policy",
|
||||
append(
|
||||
[]string{
|
||||
groupPolicy.Admin,
|
||||
groupPolicy.Address,
|
||||
"{\"@type\":\"/cosmos.group.v1beta1.PercentageDecisionPolicy\", \"percentage\":\"0.5\", \"timeout\":\"40000s\"}",
|
||||
},
|
||||
commonFlags...,
|
||||
),
|
||||
false,
|
||||
"",
|
||||
&sdk.TxResponse{},
|
||||
0,
|
||||
},
|
||||
{
|
||||
"with amino-json",
|
||||
append(
|
||||
|
@ -982,6 +1064,36 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyDecisionPolicy() {
|
|||
&sdk.TxResponse{},
|
||||
0,
|
||||
},
|
||||
{
|
||||
"invalid percentage decision policy with negative value",
|
||||
append(
|
||||
[]string{
|
||||
groupPolicy.Admin,
|
||||
groupPolicy.Address,
|
||||
"{\"@type\":\"/cosmos.group.v1beta1.PercentageDecisionPolicy\", \"percentage\":\"-0.5\", \"timeout\":\"1s\"}",
|
||||
},
|
||||
commonFlags...,
|
||||
),
|
||||
true,
|
||||
"expected a positive decimal",
|
||||
&sdk.TxResponse{},
|
||||
0,
|
||||
},
|
||||
{
|
||||
"invalid percentage decision policy with value greater than 1",
|
||||
append(
|
||||
[]string{
|
||||
groupPolicy.Admin,
|
||||
groupPolicy.Address,
|
||||
"{\"@type\":\"/cosmos.group.v1beta1.PercentageDecisionPolicy\", \"percentage\":\"2\", \"timeout\":\"40000s\"}",
|
||||
},
|
||||
commonFlags...,
|
||||
),
|
||||
true,
|
||||
"percentage must be > 0 and <= 1",
|
||||
&sdk.TxResponse{},
|
||||
0,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
|
|
@ -13,6 +13,7 @@ import (
|
|||
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
|
||||
cdc.RegisterInterface((*DecisionPolicy)(nil), nil)
|
||||
cdc.RegisterConcrete(&ThresholdDecisionPolicy{}, "cosmos-sdk/ThresholdDecisionPolicy", nil)
|
||||
cdc.RegisterConcrete(&PercentageDecisionPolicy{}, "cosmos-sdk/PercentageDecisionPolicy", nil)
|
||||
cdc.RegisterConcrete(&MsgCreateGroup{}, "cosmos-sdk/MsgCreateGroup", nil)
|
||||
cdc.RegisterConcrete(&MsgUpdateGroupMembers{}, "cosmos-sdk/MsgUpdateGroupMembers", nil)
|
||||
cdc.RegisterConcrete(&MsgUpdateGroupAdmin{}, "cosmos-sdk/MsgUpdateGroupAdmin", nil)
|
||||
|
@ -49,6 +50,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
|
|||
"cosmos.group.v1beta1.DecisionPolicy",
|
||||
(*DecisionPolicy)(nil),
|
||||
&ThresholdDecisionPolicy{},
|
||||
&PercentageDecisionPolicy{},
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -101,6 +101,21 @@ func Add(x Dec, y Dec) (Dec, error) {
|
|||
return x.Add(y)
|
||||
}
|
||||
|
||||
var dec128Context = apd.Context{
|
||||
Precision: 34,
|
||||
MaxExponent: apd.MaxExponent,
|
||||
MinExponent: apd.MinExponent,
|
||||
Traps: apd.DefaultTraps,
|
||||
}
|
||||
|
||||
// Quo returns a new Dec with value `x/y` (formatted as decimal128, 34 digit precision) without mutating any
|
||||
// argument and error if there is an overflow.
|
||||
func (x Dec) Quo(y Dec) (Dec, error) {
|
||||
var z Dec
|
||||
_, err := dec128Context.Quo(&z.dec, &x.dec, &y.dec)
|
||||
return z, sdkerrors.Wrap(err, "decimal quotient error")
|
||||
}
|
||||
|
||||
func (x Dec) IsZero() bool {
|
||||
return x.dec.IsZero()
|
||||
}
|
||||
|
|
|
@ -75,6 +75,10 @@ func TestDec(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
require.True(t, res.IsEqual(minusFivePointZero))
|
||||
|
||||
res, err = four.Quo(two)
|
||||
require.NoError(t, err)
|
||||
require.True(t, res.IsEqual(two))
|
||||
|
||||
require.False(t, zero.IsNegative())
|
||||
require.False(t, one.IsNegative())
|
||||
require.True(t, minusOne.IsNegative())
|
||||
|
|
|
@ -719,9 +719,10 @@ func (s *TestSuite) TestCreateGroupPolicy() {
|
|||
myGroupID := groupRes.GroupId
|
||||
|
||||
specs := map[string]struct {
|
||||
req *group.MsgCreateGroupPolicy
|
||||
policy group.DecisionPolicy
|
||||
expErr bool
|
||||
req *group.MsgCreateGroupPolicy
|
||||
policy group.DecisionPolicy
|
||||
expErr bool
|
||||
expErrMsg string
|
||||
}{
|
||||
"all good": {
|
||||
req: &group.MsgCreateGroupPolicy{
|
||||
|
@ -734,6 +735,17 @@ func (s *TestSuite) TestCreateGroupPolicy() {
|
|||
time.Second,
|
||||
),
|
||||
},
|
||||
"all good with percentage decision policy": {
|
||||
req: &group.MsgCreateGroupPolicy{
|
||||
Admin: addr1.String(),
|
||||
Metadata: nil,
|
||||
GroupId: myGroupID,
|
||||
},
|
||||
policy: group.NewPercentageDecisionPolicy(
|
||||
"0.5",
|
||||
time.Second,
|
||||
),
|
||||
},
|
||||
"decision policy threshold > total group weight": {
|
||||
req: &group.MsgCreateGroupPolicy{
|
||||
Admin: addr1.String(),
|
||||
|
@ -755,7 +767,8 @@ func (s *TestSuite) TestCreateGroupPolicy() {
|
|||
"1",
|
||||
time.Second,
|
||||
),
|
||||
expErr: true,
|
||||
expErr: true,
|
||||
expErrMsg: "not found",
|
||||
},
|
||||
"admin not group admin": {
|
||||
req: &group.MsgCreateGroupPolicy{
|
||||
|
@ -767,7 +780,8 @@ func (s *TestSuite) TestCreateGroupPolicy() {
|
|||
"1",
|
||||
time.Second,
|
||||
),
|
||||
expErr: true,
|
||||
expErr: true,
|
||||
expErrMsg: "not group admin",
|
||||
},
|
||||
"metadata too long": {
|
||||
req: &group.MsgCreateGroupPolicy{
|
||||
|
@ -779,7 +793,34 @@ func (s *TestSuite) TestCreateGroupPolicy() {
|
|||
"1",
|
||||
time.Second,
|
||||
),
|
||||
expErr: true,
|
||||
expErr: true,
|
||||
expErrMsg: "limit exceeded",
|
||||
},
|
||||
"percentage decision policy with negative value": {
|
||||
req: &group.MsgCreateGroupPolicy{
|
||||
Admin: addr1.String(),
|
||||
Metadata: nil,
|
||||
GroupId: myGroupID,
|
||||
},
|
||||
policy: group.NewPercentageDecisionPolicy(
|
||||
"-0.5",
|
||||
time.Second,
|
||||
),
|
||||
expErr: true,
|
||||
expErrMsg: "expected a positive decimal",
|
||||
},
|
||||
"percentage decision policy with value greater than 1": {
|
||||
req: &group.MsgCreateGroupPolicy{
|
||||
Admin: addr1.String(),
|
||||
Metadata: nil,
|
||||
GroupId: myGroupID,
|
||||
},
|
||||
policy: group.NewPercentageDecisionPolicy(
|
||||
"2",
|
||||
time.Second,
|
||||
),
|
||||
expErr: true,
|
||||
expErrMsg: "percentage must be > 0 and <= 1",
|
||||
},
|
||||
}
|
||||
for msg, spec := range specs {
|
||||
|
@ -791,6 +832,7 @@ func (s *TestSuite) TestCreateGroupPolicy() {
|
|||
res, err := s.keeper.CreateGroupPolicy(s.ctx, spec.req)
|
||||
if spec.expErr {
|
||||
s.Require().Error(err)
|
||||
s.Require().Contains(err.Error(), spec.expErrMsg)
|
||||
return
|
||||
}
|
||||
s.Require().NoError(err)
|
||||
|
@ -806,7 +848,12 @@ func (s *TestSuite) TestCreateGroupPolicy() {
|
|||
s.Assert().Equal(spec.req.Admin, groupPolicy.Admin)
|
||||
s.Assert().Equal(spec.req.Metadata, groupPolicy.Metadata)
|
||||
s.Assert().Equal(uint64(1), groupPolicy.Version)
|
||||
s.Assert().Equal(spec.policy.(*group.ThresholdDecisionPolicy), groupPolicy.GetDecisionPolicy())
|
||||
percentageDecisionPolicy, ok := spec.policy.(*group.PercentageDecisionPolicy)
|
||||
if ok {
|
||||
s.Assert().Equal(percentageDecisionPolicy, groupPolicy.GetDecisionPolicy())
|
||||
} else {
|
||||
s.Assert().Equal(spec.policy.(*group.ThresholdDecisionPolicy), groupPolicy.GetDecisionPolicy())
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -1029,6 +1076,26 @@ func (s *TestSuite) TestUpdateGroupPolicyDecisionPolicy() {
|
|||
},
|
||||
expErr: false,
|
||||
},
|
||||
"correct data with percentage decision policy": {
|
||||
req: &group.MsgUpdateGroupPolicyDecisionPolicy{
|
||||
Admin: admin.String(),
|
||||
Address: groupPolicyAddr,
|
||||
},
|
||||
policy: group.NewPercentageDecisionPolicy(
|
||||
"0.5",
|
||||
time.Duration(2)*time.Second,
|
||||
),
|
||||
expGroupPolicy: &group.GroupPolicyInfo{
|
||||
Admin: admin.String(),
|
||||
Address: groupPolicyAddr,
|
||||
GroupId: myGroupID,
|
||||
Metadata: nil,
|
||||
Version: 3,
|
||||
DecisionPolicy: nil,
|
||||
CreatedAt: s.blockTime,
|
||||
},
|
||||
expErr: false,
|
||||
},
|
||||
}
|
||||
for msg, spec := range specs {
|
||||
spec := spec
|
||||
|
@ -1076,9 +1143,13 @@ func (s *TestSuite) TestGroupPoliciesByAdminOrGroup() {
|
|||
"10",
|
||||
time.Second,
|
||||
),
|
||||
group.NewPercentageDecisionPolicy(
|
||||
"0.5",
|
||||
time.Second,
|
||||
),
|
||||
}
|
||||
|
||||
count := 2
|
||||
count := 3
|
||||
expectAccs := make([]*group.GroupPolicyInfo, count)
|
||||
for i := range expectAccs {
|
||||
req := &group.MsgCreateGroupPolicy{
|
||||
|
|
|
@ -14,6 +14,9 @@ var (
|
|||
admin = sdk.AccAddress("admin")
|
||||
member1 = sdk.AccAddress("member1")
|
||||
member2 = sdk.AccAddress("member2")
|
||||
member3 = sdk.AccAddress("member3")
|
||||
member4 = sdk.AccAddress("member4")
|
||||
member5 = sdk.AccAddress("member5")
|
||||
)
|
||||
|
||||
func TestMsgCreateGroup(t *testing.T) {
|
||||
|
@ -403,6 +406,50 @@ func TestMsgCreateGroupPolicy(t *testing.T) {
|
|||
false,
|
||||
"",
|
||||
},
|
||||
{
|
||||
"invalid percentage decision policy with zero value",
|
||||
func() *group.MsgCreateGroupPolicy {
|
||||
percentagePolicy := group.NewPercentageDecisionPolicy("0", time.Second)
|
||||
req, err := group.NewMsgCreateGroupPolicy(admin, 1, []byte("metadata"), percentagePolicy)
|
||||
require.NoError(t, err)
|
||||
return req
|
||||
},
|
||||
true,
|
||||
"expected a positive decimal",
|
||||
},
|
||||
{
|
||||
"invalid percentage decision policy with negative value",
|
||||
func() *group.MsgCreateGroupPolicy {
|
||||
percentagePolicy := group.NewPercentageDecisionPolicy("-0.2", time.Second)
|
||||
req, err := group.NewMsgCreateGroupPolicy(admin, 1, []byte("metadata"), percentagePolicy)
|
||||
require.NoError(t, err)
|
||||
return req
|
||||
},
|
||||
true,
|
||||
"expected a positive decimal",
|
||||
},
|
||||
{
|
||||
"invalid percentage decision policy with value greater than 1",
|
||||
func() *group.MsgCreateGroupPolicy {
|
||||
percentagePolicy := group.NewPercentageDecisionPolicy("2", time.Second)
|
||||
req, err := group.NewMsgCreateGroupPolicy(admin, 1, []byte("metadata"), percentagePolicy)
|
||||
require.NoError(t, err)
|
||||
return req
|
||||
},
|
||||
true,
|
||||
"percentage must be > 0 and <= 1",
|
||||
},
|
||||
{
|
||||
"valid test case with percentage decision policy",
|
||||
func() *group.MsgCreateGroupPolicy {
|
||||
percentagePolicy := group.NewPercentageDecisionPolicy("0.5", time.Second)
|
||||
req, err := group.NewMsgCreateGroupPolicy(admin, 1, []byte("metadata"), percentagePolicy)
|
||||
require.NoError(t, err)
|
||||
return req
|
||||
},
|
||||
false,
|
||||
"",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
@ -429,6 +476,18 @@ func TestMsgUpdateGroupPolicyDecisionPolicy(t *testing.T) {
|
|||
msg2, err := group.NewMsgUpdateGroupPolicyDecisionPolicyRequest(admin, member2, invalidPolicy)
|
||||
require.NoError(t, err)
|
||||
|
||||
validPercentagePolicy := group.NewPercentageDecisionPolicy("0.7", time.Second)
|
||||
msg3, err := group.NewMsgUpdateGroupPolicyDecisionPolicyRequest(admin, member3, validPercentagePolicy)
|
||||
require.NoError(t, err)
|
||||
|
||||
invalidPercentagePolicy := group.NewPercentageDecisionPolicy("-0.1", time.Second)
|
||||
msg4, err := group.NewMsgUpdateGroupPolicyDecisionPolicyRequest(admin, member4, invalidPercentagePolicy)
|
||||
require.NoError(t, err)
|
||||
|
||||
invalidPercentagePolicy2 := group.NewPercentageDecisionPolicy("2", time.Second)
|
||||
msg5, err := group.NewMsgUpdateGroupPolicyDecisionPolicyRequest(admin, member5, invalidPercentagePolicy2)
|
||||
require.NoError(t, err)
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
msg *group.MsgUpdateGroupPolicyDecisionPolicy
|
||||
|
@ -468,11 +527,29 @@ func TestMsgUpdateGroupPolicyDecisionPolicy(t *testing.T) {
|
|||
"decision policy: threshold: expected a positive decimal",
|
||||
},
|
||||
{
|
||||
"invalid decision policy",
|
||||
"valid decision policy",
|
||||
msg1,
|
||||
false,
|
||||
"",
|
||||
},
|
||||
{
|
||||
"valid percentage decision policy",
|
||||
msg3,
|
||||
false,
|
||||
"",
|
||||
},
|
||||
{
|
||||
"invalid percentage decision policy with negative value",
|
||||
msg4,
|
||||
true,
|
||||
"decision policy: percentage threshold: expected a positive decimal",
|
||||
},
|
||||
{
|
||||
"invalid percentage decision policy with value greater than 1",
|
||||
msg5,
|
||||
true,
|
||||
"decision policy: percentage must be > 0 and <= 1",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"time"
|
||||
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
"github.com/gogo/protobuf/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
|
@ -54,11 +53,7 @@ func (p ThresholdDecisionPolicy) ValidateBasic() error {
|
|||
|
||||
// Allow allows a proposal to pass when the tally of yes votes equals or exceeds the threshold before the timeout.
|
||||
func (p ThresholdDecisionPolicy) Allow(tally Tally, totalPower string, votingDuration time.Duration) (DecisionPolicyResult, error) {
|
||||
pTimeout := types.DurationProto(p.Timeout)
|
||||
timeout, err := types.DurationFromProto(pTimeout)
|
||||
if err != nil {
|
||||
return DecisionPolicyResult{}, err
|
||||
}
|
||||
timeout := p.Timeout
|
||||
if timeout <= votingDuration {
|
||||
return DecisionPolicyResult{Allow: false, Final: true}, nil
|
||||
}
|
||||
|
@ -113,6 +108,85 @@ func (p *ThresholdDecisionPolicy) Validate(g GroupInfo) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Implements DecisionPolicy Interface
|
||||
var _ DecisionPolicy = &PercentageDecisionPolicy{}
|
||||
|
||||
// NewPercentageDecisionPolicy creates a new percentage DecisionPolicy
|
||||
func NewPercentageDecisionPolicy(percentage string, timeout time.Duration) DecisionPolicy {
|
||||
return &PercentageDecisionPolicy{percentage, timeout}
|
||||
}
|
||||
|
||||
func (p PercentageDecisionPolicy) ValidateBasic() error {
|
||||
percentage, err := math.NewPositiveDecFromString(p.Percentage)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "percentage threshold")
|
||||
}
|
||||
if percentage.Cmp(math.NewDecFromInt64(1)) == 1 {
|
||||
return sdkerrors.Wrap(errors.ErrInvalid, "percentage must be > 0 and <= 1")
|
||||
}
|
||||
|
||||
timeout := p.Timeout
|
||||
if timeout <= time.Nanosecond {
|
||||
return sdkerrors.Wrap(errors.ErrInvalid, "timeout")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *PercentageDecisionPolicy) Validate(g GroupInfo) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Allow allows a proposal to pass when the tally of yes votes equals or exceeds the percentage threshold before the timeout.
|
||||
func (p PercentageDecisionPolicy) Allow(tally Tally, totalPower string, votingDuration time.Duration) (DecisionPolicyResult, error) {
|
||||
timeout := p.Timeout
|
||||
if timeout <= votingDuration {
|
||||
return DecisionPolicyResult{Allow: false, Final: true}, nil
|
||||
}
|
||||
|
||||
percentage, err := math.NewPositiveDecFromString(p.Percentage)
|
||||
if err != nil {
|
||||
return DecisionPolicyResult{}, err
|
||||
}
|
||||
yesCount, err := math.NewNonNegativeDecFromString(tally.YesCount)
|
||||
if err != nil {
|
||||
return DecisionPolicyResult{}, err
|
||||
}
|
||||
totalPowerDec, err := math.NewNonNegativeDecFromString(totalPower)
|
||||
if err != nil {
|
||||
return DecisionPolicyResult{}, err
|
||||
}
|
||||
|
||||
yesPercentage, err := yesCount.Quo(totalPowerDec)
|
||||
if err != nil {
|
||||
return DecisionPolicyResult{}, err
|
||||
}
|
||||
|
||||
if yesPercentage.Cmp(percentage) >= 0 {
|
||||
return DecisionPolicyResult{Allow: true, Final: true}, nil
|
||||
}
|
||||
|
||||
totalCounts, err := tally.TotalCounts()
|
||||
if err != nil {
|
||||
return DecisionPolicyResult{}, err
|
||||
}
|
||||
undecided, err := math.SubNonNegative(totalPowerDec, totalCounts)
|
||||
if err != nil {
|
||||
return DecisionPolicyResult{}, err
|
||||
}
|
||||
sum, err := yesCount.Add(undecided)
|
||||
if err != nil {
|
||||
return DecisionPolicyResult{}, err
|
||||
}
|
||||
sumPercentage, err := sum.Quo(totalPowerDec)
|
||||
if err != nil {
|
||||
return DecisionPolicyResult{}, err
|
||||
}
|
||||
if sumPercentage.Cmp(percentage) < 0 {
|
||||
return DecisionPolicyResult{Allow: false, Final: true}, nil
|
||||
}
|
||||
return DecisionPolicyResult{Allow: false, Final: false}, nil
|
||||
}
|
||||
|
||||
var _ orm.Validateable = GroupPolicyInfo{}
|
||||
|
||||
// NewGroupPolicyInfo creates a new GroupPolicyInfo instance
|
||||
|
|
|
@ -109,7 +109,7 @@ func (x Proposal_Status) String() string {
|
|||
}
|
||||
|
||||
func (Proposal_Status) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e091dfce5c49c8b6, []int{6, 0}
|
||||
return fileDescriptor_e091dfce5c49c8b6, []int{7, 0}
|
||||
}
|
||||
|
||||
// Result defines types of proposal results.
|
||||
|
@ -145,7 +145,7 @@ func (x Proposal_Result) String() string {
|
|||
}
|
||||
|
||||
func (Proposal_Result) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e091dfce5c49c8b6, []int{6, 1}
|
||||
return fileDescriptor_e091dfce5c49c8b6, []int{7, 1}
|
||||
}
|
||||
|
||||
// ExecutorResult defines types of proposal executor results.
|
||||
|
@ -181,7 +181,7 @@ func (x Proposal_ExecutorResult) String() string {
|
|||
}
|
||||
|
||||
func (Proposal_ExecutorResult) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e091dfce5c49c8b6, []int{6, 2}
|
||||
return fileDescriptor_e091dfce5c49c8b6, []int{7, 2}
|
||||
}
|
||||
|
||||
// Member represents a group member with an account address,
|
||||
|
@ -360,6 +360,62 @@ func (m *ThresholdDecisionPolicy) GetTimeout() time.Duration {
|
|||
return 0
|
||||
}
|
||||
|
||||
// PercentageDecisionPolicy implements the DecisionPolicy interface
|
||||
type PercentageDecisionPolicy struct {
|
||||
// percentage is the minimum percentage the weighted sum of yes votes must meet for a proposal to succeed.
|
||||
Percentage string `protobuf:"bytes,1,opt,name=percentage,proto3" json:"percentage,omitempty"`
|
||||
// timeout is the duration from submission of a proposal to the end of voting period
|
||||
// Within these times votes and exec messages can be submitted.
|
||||
Timeout time.Duration `protobuf:"bytes,2,opt,name=timeout,proto3,stdduration" json:"timeout"`
|
||||
}
|
||||
|
||||
func (m *PercentageDecisionPolicy) Reset() { *m = PercentageDecisionPolicy{} }
|
||||
func (m *PercentageDecisionPolicy) String() string { return proto.CompactTextString(m) }
|
||||
func (*PercentageDecisionPolicy) ProtoMessage() {}
|
||||
func (*PercentageDecisionPolicy) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e091dfce5c49c8b6, []int{3}
|
||||
}
|
||||
func (m *PercentageDecisionPolicy) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *PercentageDecisionPolicy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_PercentageDecisionPolicy.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 *PercentageDecisionPolicy) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_PercentageDecisionPolicy.Merge(m, src)
|
||||
}
|
||||
func (m *PercentageDecisionPolicy) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *PercentageDecisionPolicy) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_PercentageDecisionPolicy.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_PercentageDecisionPolicy proto.InternalMessageInfo
|
||||
|
||||
func (m *PercentageDecisionPolicy) GetPercentage() string {
|
||||
if m != nil {
|
||||
return m.Percentage
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *PercentageDecisionPolicy) GetTimeout() time.Duration {
|
||||
if m != nil {
|
||||
return m.Timeout
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// GroupInfo represents the high-level on-chain information for a group.
|
||||
type GroupInfo struct {
|
||||
// group_id is the unique ID of the group.
|
||||
|
@ -383,7 +439,7 @@ func (m *GroupInfo) Reset() { *m = GroupInfo{} }
|
|||
func (m *GroupInfo) String() string { return proto.CompactTextString(m) }
|
||||
func (*GroupInfo) ProtoMessage() {}
|
||||
func (*GroupInfo) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e091dfce5c49c8b6, []int{3}
|
||||
return fileDescriptor_e091dfce5c49c8b6, []int{4}
|
||||
}
|
||||
func (m *GroupInfo) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -466,7 +522,7 @@ func (m *GroupMember) Reset() { *m = GroupMember{} }
|
|||
func (m *GroupMember) String() string { return proto.CompactTextString(m) }
|
||||
func (*GroupMember) ProtoMessage() {}
|
||||
func (*GroupMember) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e091dfce5c49c8b6, []int{4}
|
||||
return fileDescriptor_e091dfce5c49c8b6, []int{5}
|
||||
}
|
||||
func (m *GroupMember) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -532,7 +588,7 @@ func (m *GroupPolicyInfo) Reset() { *m = GroupPolicyInfo{} }
|
|||
func (m *GroupPolicyInfo) String() string { return proto.CompactTextString(m) }
|
||||
func (*GroupPolicyInfo) ProtoMessage() {}
|
||||
func (*GroupPolicyInfo) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e091dfce5c49c8b6, []int{5}
|
||||
return fileDescriptor_e091dfce5c49c8b6, []int{6}
|
||||
}
|
||||
func (m *GroupPolicyInfo) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -603,7 +659,7 @@ func (m *Proposal) Reset() { *m = Proposal{} }
|
|||
func (m *Proposal) String() string { return proto.CompactTextString(m) }
|
||||
func (*Proposal) ProtoMessage() {}
|
||||
func (*Proposal) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e091dfce5c49c8b6, []int{6}
|
||||
return fileDescriptor_e091dfce5c49c8b6, []int{7}
|
||||
}
|
||||
func (m *Proposal) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -648,7 +704,7 @@ func (m *Tally) Reset() { *m = Tally{} }
|
|||
func (m *Tally) String() string { return proto.CompactTextString(m) }
|
||||
func (*Tally) ProtoMessage() {}
|
||||
func (*Tally) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e091dfce5c49c8b6, []int{7}
|
||||
return fileDescriptor_e091dfce5c49c8b6, []int{8}
|
||||
}
|
||||
func (m *Tally) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -695,7 +751,7 @@ func (m *Vote) Reset() { *m = Vote{} }
|
|||
func (m *Vote) String() string { return proto.CompactTextString(m) }
|
||||
func (*Vote) ProtoMessage() {}
|
||||
func (*Vote) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e091dfce5c49c8b6, []int{8}
|
||||
return fileDescriptor_e091dfce5c49c8b6, []int{9}
|
||||
}
|
||||
func (m *Vote) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -767,6 +823,7 @@ func init() {
|
|||
proto.RegisterType((*Member)(nil), "cosmos.group.v1beta1.Member")
|
||||
proto.RegisterType((*Members)(nil), "cosmos.group.v1beta1.Members")
|
||||
proto.RegisterType((*ThresholdDecisionPolicy)(nil), "cosmos.group.v1beta1.ThresholdDecisionPolicy")
|
||||
proto.RegisterType((*PercentageDecisionPolicy)(nil), "cosmos.group.v1beta1.PercentageDecisionPolicy")
|
||||
proto.RegisterType((*GroupInfo)(nil), "cosmos.group.v1beta1.GroupInfo")
|
||||
proto.RegisterType((*GroupMember)(nil), "cosmos.group.v1beta1.GroupMember")
|
||||
proto.RegisterType((*GroupPolicyInfo)(nil), "cosmos.group.v1beta1.GroupPolicyInfo")
|
||||
|
@ -778,92 +835,93 @@ func init() {
|
|||
func init() { proto.RegisterFile("cosmos/group/v1beta1/types.proto", fileDescriptor_e091dfce5c49c8b6) }
|
||||
|
||||
var fileDescriptor_e091dfce5c49c8b6 = []byte{
|
||||
// 1345 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x4f, 0x6f, 0x13, 0xc7,
|
||||
0x1b, 0xce, 0x3a, 0x8e, 0xff, 0xbc, 0x4e, 0x1c, 0x6b, 0x94, 0x1f, 0x38, 0x0e, 0x38, 0x8b, 0xf9,
|
||||
0x55, 0x8a, 0x5a, 0xc5, 0x6e, 0xd2, 0x3f, 0x07, 0x54, 0x68, 0xd7, 0x9b, 0x0d, 0xb8, 0x0a, 0x76,
|
||||
0xba, 0xbb, 0x4e, 0x5a, 0x0e, 0xb5, 0xd6, 0xbb, 0x83, 0xb3, 0xad, 0xbd, 0x63, 0xed, 0x8e, 0x03,
|
||||
0xee, 0xb5, 0x17, 0xea, 0x13, 0xc7, 0xf6, 0x60, 0x09, 0xa9, 0x9f, 0xa0, 0x12, 0x1f, 0x02, 0xf5,
|
||||
0x84, 0x7a, 0xaa, 0x38, 0xb4, 0x15, 0x5c, 0x38, 0x57, 0xfd, 0x00, 0xd5, 0xce, 0xcc, 0x12, 0x0c,
|
||||
0xc6, 0x10, 0xd4, 0x53, 0x76, 0x66, 0x9e, 0xe7, 0x9d, 0xf7, 0x7d, 0x9e, 0x37, 0x33, 0x63, 0x90,
|
||||
0x6d, 0x12, 0xf4, 0x48, 0x50, 0xe9, 0xf8, 0x64, 0xd0, 0xaf, 0x1c, 0x6f, 0xb5, 0x31, 0xb5, 0xb6,
|
||||
0x2a, 0x74, 0xd8, 0xc7, 0x41, 0xb9, 0xef, 0x13, 0x4a, 0xd0, 0x0a, 0x47, 0x94, 0x19, 0xa2, 0x2c,
|
||||
0x10, 0x85, 0x95, 0x0e, 0xe9, 0x10, 0x06, 0xa8, 0x84, 0x5f, 0x1c, 0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 0x57, 0x9e, 0xa6, 0x79, 0x99, 0xe3,
|
||||
0xab, 0xf1, 0x30, 0x98, 0x1e, 0x51, 0x4a, 0x23, 0x09, 0xce, 0x9a, 0x47, 0x3e, 0x0e, 0x8e, 0x48,
|
||||
0xd7, 0xd9, 0xc1, 0xb6, 0x1b, 0xb8, 0xc4, 0xdb, 0x27, 0x5d, 0xd7, 0x1e, 0xa2, 0x73, 0x90, 0xa6,
|
||||
0xd1, 0x12, 0xd7, 0x43, 0x3f, 0x99, 0x40, 0x97, 0x21, 0x19, 0xea, 0x4f, 0x06, 0xbc, 0xf0, 0xcc,
|
||||
0xf6, 0xea, 0x4b, 0x25, 0xec, 0x08, 0xff, 0x78, 0x05, 0x3f, 0xb2, 0x0a, 0x04, 0xe7, 0x12, 0xfa,
|
||||
0xf5, 0xfe, 0x66, 0x76, 0x72, 0xc3, 0xd2, 0x3f, 0x12, 0xa4, 0xaf, 0x86, 0x49, 0xd7, 0xbc, 0x9b,
|
||||
0x04, 0xad, 0x42, 0x8a, 0x55, 0xd0, 0x72, 0xf9, 0xee, 0x71, 0x3d, 0xc9, 0xc6, 0x35, 0x07, 0x95,
|
||||
0x61, 0xc1, 0x72, 0x7a, 0xae, 0xc7, 0x25, 0x9f, 0xe1, 0x12, 0x87, 0xcd, 0xf4, 0x22, 0x0f, 0xc9,
|
||||
0x63, 0xec, 0x87, 0x59, 0x30, 0x2b, 0xe2, 0x7a, 0x34, 0x44, 0x17, 0x60, 0x91, 0x12, 0x6a, 0x75,
|
||||
0x5b, 0xc2, 0xdf, 0x05, 0x26, 0x41, 0x86, 0xcd, 0x1d, 0x72, 0x93, 0x55, 0x00, 0xdb, 0xc7, 0x16,
|
||||
0xe5, 0x56, 0x26, 0x4e, 0x61, 0x65, 0x5a, 0xf0, 0x14, 0x5a, 0xfa, 0x1a, 0x32, 0xac, 0x6a, 0xd1,
|
||||
0x84, 0x33, 0xea, 0xfe, 0x10, 0x12, 0xdc, 0x38, 0x21, 0xf9, 0x4c, 0xab, 0x75, 0x81, 0x2d, 0x3d,
|
||||
0x8d, 0xc1, 0x32, 0xdb, 0x80, 0xcb, 0xcc, 0xc4, 0x7d, 0x9b, 0x4e, 0x7f, 0x3e, 0xb1, 0xd8, 0x2b,
|
||||
0x0c, 0x99, 0x3f, 0xbd, 0x21, 0xf1, 0x57, 0x1b, 0xb2, 0x30, 0x69, 0xc8, 0x17, 0xb0, 0xec, 0x88,
|
||||
0x8e, 0x69, 0xf5, 0x59, 0x2d, 0x42, 0xf2, 0x95, 0x97, 0x24, 0x57, 0xbc, 0x61, 0x75, 0x4a, 0x8b,
|
||||
0xe9, 0x59, 0x67, 0xb2, 0xc7, 0x27, 0x0d, 0x4c, 0xbe, 0x95, 0x81, 0x97, 0x52, 0x77, 0xee, 0xad,
|
||||
0xcf, 0x3d, 0xbd, 0xb7, 0x2e, 0x95, 0x1e, 0x65, 0x20, 0xb5, 0xef, 0x93, 0x3e, 0x09, 0xac, 0x2e,
|
||||
0x5a, 0x87, 0x4c, 0x5f, 0x7c, 0x9f, 0x78, 0x09, 0xd1, 0x54, 0xcd, 0x79, 0xde, 0x84, 0xd8, 0x9b,
|
||||
0x9a, 0x30, 0xab, 0x95, 0x3f, 0x86, 0x34, 0x8f, 0x1e, 0x1e, 0x06, 0x71, 0x79, 0x7e, 0x66, 0xc4,
|
||||
0x13, 0x28, 0xba, 0x0a, 0x8b, 0xc1, 0xa0, 0xdd, 0x73, 0xa9, 0x90, 0x61, 0xe1, 0x14, 0x32, 0x64,
|
||||
0x9e, 0x31, 0x15, 0x8a, 0x2e, 0xc2, 0x12, 0xef, 0x90, 0xc8, 0xc0, 0x04, 0xab, 0x79, 0x91, 0x4d,
|
||||
0x1e, 0x08, 0x17, 0xdf, 0x87, 0x15, 0x0e, 0xe2, 0x16, 0x3e, 0xc3, 0x26, 0x19, 0x16, 0x75, 0x4e,
|
||||
0x3a, 0x35, 0x62, 0x5c, 0x86, 0x44, 0x40, 0x2d, 0x3a, 0x08, 0xf2, 0x29, 0x59, 0xda, 0xc8, 0x6e,
|
||||
0xbf, 0x33, 0xbd, 0xed, 0x23, 0xe1, 0xcb, 0x06, 0x03, 0xeb, 0x82, 0x14, 0xd2, 0x7d, 0x1c, 0x0c,
|
||||
0xba, 0x34, 0x9f, 0x7e, 0x23, 0xba, 0xce, 0xc0, 0xba, 0x20, 0xa1, 0xcf, 0x00, 0x8e, 0x09, 0xc5,
|
||||
0xad, 0x30, 0x1a, 0xce, 0x03, 0xd3, 0x66, 0x6d, 0x7a, 0x08, 0xd3, 0xea, 0x76, 0x87, 0xe2, 0x88,
|
||||
0x4d, 0x87, 0xa4, 0x30, 0x13, 0x8c, 0xae, 0x9c, 0x1c, 0x95, 0x99, 0xd3, 0x9c, 0xf6, 0x82, 0x84,
|
||||
0x0e, 0x60, 0x19, 0xdf, 0xc6, 0xf6, 0x80, 0x12, 0xbf, 0x25, 0x2a, 0x59, 0x64, 0x95, 0x6c, 0xbe,
|
||||
0xa6, 0x12, 0x4d, 0xb0, 0x44, 0x45, 0x59, 0x3c, 0x31, 0x46, 0x1b, 0x10, 0xef, 0x05, 0x9d, 0x20,
|
||||
0xbf, 0xc4, 0xee, 0x8d, 0xa9, 0xff, 0x44, 0x3a, 0x43, 0x94, 0xbe, 0x8f, 0x41, 0x82, 0xab, 0x8a,
|
||||
0xb6, 0x00, 0x19, 0xa6, 0x62, 0x36, 0x8d, 0x56, 0xb3, 0x6e, 0xec, 0x6b, 0x6a, 0x6d, 0xb7, 0xa6,
|
||||
0xed, 0xe4, 0xe6, 0x0a, 0xab, 0xa3, 0xb1, 0xfc, 0xbf, 0x68, 0x67, 0x8e, 0xad, 0x79, 0xc7, 0x56,
|
||||
0xd7, 0x75, 0xd0, 0x16, 0xe4, 0x04, 0xc5, 0x68, 0x56, 0xaf, 0xd7, 0x4c, 0x53, 0xdb, 0xc9, 0x49,
|
||||
0x85, 0xb5, 0xd1, 0x58, 0x3e, 0x3b, 0x49, 0x30, 0xa2, 0x5e, 0x42, 0xef, 0xc1, 0x92, 0xa0, 0xa8,
|
||||
0x7b, 0x0d, 0x43, 0xdb, 0xc9, 0xc5, 0x0a, 0xf9, 0xd1, 0x58, 0x5e, 0x99, 0xc4, 0xab, 0x5d, 0x12,
|
||||
0x60, 0x07, 0x6d, 0x42, 0x56, 0x80, 0x95, 0x6a, 0x43, 0x0f, 0xa3, 0xcf, 0x4f, 0x4b, 0x47, 0x69,
|
||||
0x13, 0x3f, 0x8c, 0x7d, 0x92, 0xce, 0x61, 0xcd, 0xbc, 0xb6, 0xa3, 0x2b, 0x87, 0xf5, 0x5c, 0x7c,
|
||||
0x5a, 0x3a, 0x87, 0x2e, 0x3d, 0x72, 0x7c, 0xeb, 0x96, 0x57, 0x88, 0xdf, 0xf9, 0xb9, 0x38, 0x57,
|
||||
0x7a, 0x24, 0x41, 0x42, 0x48, 0xb7, 0x05, 0x48, 0xd7, 0x8c, 0xe6, 0x9e, 0x39, 0x4b, 0x05, 0x8e,
|
||||
0x8d, 0x54, 0xf8, 0xe8, 0x39, 0xca, 0x6e, 0xad, 0xae, 0xec, 0xd5, 0x6e, 0x30, 0x1d, 0xce, 0x8f,
|
||||
0xc6, 0xf2, 0xea, 0x24, 0xa5, 0xe9, 0xdd, 0x74, 0x3d, 0xab, 0xeb, 0x7e, 0x87, 0x1d, 0x54, 0x81,
|
||||
0x65, 0x41, 0x53, 0x54, 0x55, 0xdb, 0x37, 0x99, 0x16, 0x85, 0xd1, 0x58, 0x3e, 0x33, 0xc9, 0x51,
|
||||
0x6c, 0x1b, 0xf7, 0xe9, 0x04, 0x41, 0xd7, 0x3e, 0xd7, 0x54, 0x2e, 0xc7, 0x14, 0x82, 0x8e, 0xbf,
|
||||
0xc1, 0x36, 0xc5, 0x8e, 0x28, 0xee, 0xa7, 0x18, 0x64, 0x27, 0xfb, 0x05, 0x55, 0x61, 0x4d, 0xfb,
|
||||
0x52, 0x53, 0x9b, 0x66, 0x43, 0x6f, 0x4d, 0xad, 0xf6, 0xc2, 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, 0xbe, 0xea, 0x8d, 0xa1, 0x32, 0x8c, 0x2e, 0xb0,
|
||||
0x33, 0x2f, 0xf4, 0xff, 0xea, 0x7a, 0x79, 0xd7, 0x81, 0x04, 0xdf, 0x16, 0x9d, 0x01, 0xa4, 0x5e,
|
||||
0x6b, 0xd4, 0x54, 0x6d, 0xb2, 0x21, 0xd1, 0x12, 0xa4, 0xc5, 0x7c, 0xbd, 0x91, 0x93, 0x50, 0x16,
|
||||
0x40, 0x0c, 0xbf, 0xd2, 0x8c, 0x5c, 0x0c, 0x21, 0xc8, 0x8a, 0xb1, 0x52, 0x35, 0x4c, 0xa5, 0x56,
|
||||
0xcf, 0xcd, 0xa3, 0x65, 0xc8, 0x88, 0xb9, 0x03, 0xcd, 0x6c, 0xe4, 0xe2, 0xd5, 0x2b, 0x0f, 0x1e,
|
||||
0x17, 0xa5, 0x87, 0x8f, 0x8b, 0xd2, 0x5f, 0x8f, 0x8b, 0xd2, 0xdd, 0x27, 0xc5, 0xb9, 0x87, 0x4f,
|
||||
0x8a, 0x73, 0xbf, 0x3f, 0x29, 0xce, 0xdd, 0xf8, 0x7f, 0xc7, 0xa5, 0x47, 0x83, 0x76, 0xd9, 0x26,
|
||||
0x3d, 0xf1, 0xeb, 0x42, 0xfc, 0xd9, 0x0c, 0x9c, 0x6f, 0x2b, 0xb7, 0xf9, 0xcf, 0xa0, 0x76, 0x82,
|
||||
0x15, 0xf4, 0xc1, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x6d, 0xca, 0xed, 0x16, 0x1d, 0x0d, 0x00,
|
||||
0x00,
|
||||
// 1373 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x4d, 0x6f, 0xdb, 0x46,
|
||||
0x13, 0x36, 0x65, 0x59, 0x1f, 0x23, 0x5b, 0x16, 0x16, 0x7e, 0x13, 0x59, 0x4e, 0x64, 0x46, 0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xf6, 0x92, 0x82, 0x4c, 0x9f, 0xbd,
|
||||
0x20, 0xf1, 0x97, 0x17, 0x64, 0x66, 0xb4, 0x20, 0x9f, 0xc1, 0xbc, 0x23, 0x3a, 0xa6, 0xd9, 0x63,
|
||||
0xb9, 0x08, 0xc9, 0x17, 0x5e, 0x90, 0x5c, 0xf1, 0x0e, 0xab, 0x63, 0x5a, 0x4c, 0xcf, 0x3a, 0xa3,
|
||||
0x5d, 0x3e, 0x5a, 0xc0, 0xe4, 0x1b, 0x15, 0xf0, 0x4a, 0xea, 0xde, 0x83, 0xe5, 0xa9, 0xe7, 0x0f,
|
||||
0x96, 0xa5, 0xd2, 0x93, 0x0c, 0xa4, 0x76, 0x7c, 0xd2, 0x23, 0x81, 0xd5, 0x41, 0xcb, 0x90, 0xe9,
|
||||
0x89, 0xef, 0xe3, 0x5a, 0x42, 0x34, 0x55, 0x73, 0x4e, 0x16, 0x21, 0xf6, 0xba, 0x45, 0x98, 0xd4,
|
||||
0xca, 0x1f, 0x42, 0x9a, 0x7b, 0x0f, 0x0f, 0xa7, 0xb8, 0x3c, 0x3d, 0xd1, 0xe3, 0x31, 0x14, 0x5d,
|
||||
0x87, 0xd9, 0xa0, 0xdf, 0xea, 0xba, 0x54, 0xc8, 0x30, 0x73, 0x06, 0x19, 0x32, 0x47, 0x4c, 0x85,
|
||||
0xa2, 0xcb, 0x30, 0xc7, 0x3b, 0x24, 0x2a, 0x60, 0x82, 0xe5, 0x3c, 0xcb, 0x26, 0x77, 0x45, 0x15,
|
||||
0xdf, 0x85, 0x05, 0x0e, 0xe2, 0x25, 0x3c, 0xc2, 0x26, 0x19, 0x16, 0xb5, 0x8f, 0x3b, 0x35, 0x62,
|
||||
0x5c, 0x85, 0x44, 0x40, 0x2d, 0xda, 0x0f, 0xf2, 0x29, 0x59, 0x5a, 0xc9, 0xae, 0xbf, 0x35, 0xbe,
|
||||
0xed, 0x23, 0xe1, 0xcb, 0x06, 0x03, 0xeb, 0x82, 0x14, 0xd2, 0x7d, 0x1c, 0xf4, 0x3b, 0x34, 0x9f,
|
||||
0x7e, 0x2d, 0xba, 0xce, 0xc0, 0xba, 0x20, 0xa1, 0x4f, 0x00, 0x0e, 0x08, 0xc5, 0xcd, 0xd0, 0x1b,
|
||||
0xce, 0x03, 0xd3, 0x66, 0x69, 0xbc, 0x0b, 0xd3, 0xea, 0x74, 0x0e, 0xc5, 0x91, 0x9f, 0x0e, 0x49,
|
||||
0x61, 0x24, 0x18, 0x5d, 0x3b, 0x3e, 0x2a, 0x33, 0x67, 0xb9, 0x7d, 0x04, 0x09, 0xed, 0xc2, 0x3c,
|
||||
0xbe, 0x8b, 0xed, 0x3e, 0x25, 0x7e, 0x53, 0x64, 0x32, 0xcb, 0x32, 0x59, 0x7d, 0x45, 0x26, 0x9a,
|
||||
0x60, 0x89, 0x8c, 0xb2, 0x78, 0x64, 0x8c, 0x56, 0x20, 0xde, 0x0d, 0xda, 0x41, 0x7e, 0x8e, 0xdd,
|
||||
0x63, 0x63, 0x37, 0x91, 0xce, 0x10, 0xa5, 0x6f, 0x63, 0x90, 0xe0, 0xaa, 0xa2, 0x35, 0x40, 0x86,
|
||||
0xa9, 0x98, 0x0d, 0xa3, 0xd9, 0xa8, 0x1b, 0x3b, 0x9a, 0x5a, 0xdb, 0xac, 0x69, 0x1b, 0xb9, 0xa9,
|
||||
0xc2, 0xe2, 0x60, 0x28, 0xff, 0x2f, 0x5a, 0x99, 0x63, 0x6b, 0xde, 0x81, 0xd5, 0x71, 0x1d, 0xb4,
|
||||
0x06, 0x39, 0x41, 0x31, 0x1a, 0xd5, 0x9b, 0x35, 0xd3, 0xd4, 0x36, 0x72, 0x52, 0x61, 0x69, 0x30,
|
||||
0x94, 0xcf, 0x8f, 0x12, 0x8c, 0xa8, 0x97, 0xd0, 0x3b, 0x30, 0x27, 0x28, 0xea, 0xd6, 0xb6, 0xa1,
|
||||
0x6d, 0xe4, 0x62, 0x85, 0xfc, 0x60, 0x28, 0x2f, 0x8c, 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db, 0x0e, 0x24, 0xf8, 0xb2, 0xe8, 0x1c, 0x20, 0xf5, 0xc6, 0x76, 0x4d, 0xd5,
|
||||
0x46, 0x1b, 0x12, 0xcd, 0x41, 0x5a, 0xcc, 0xd7, 0xb7, 0x73, 0x12, 0xca, 0x02, 0x88, 0xe1, 0x17,
|
||||
0x9a, 0x91, 0x8b, 0x21, 0x04, 0x59, 0x31, 0x56, 0xaa, 0x86, 0xa9, 0xd4, 0xea, 0xb9, 0x69, 0x34,
|
||||
0x0f, 0x19, 0x31, 0xb7, 0xab, 0x99, 0xdb, 0xb9, 0x78, 0xf5, 0xda, 0xa3, 0xa7, 0x45, 0xe9, 0xf1,
|
||||
0xd3, 0xa2, 0xf4, 0xe7, 0xd3, 0xa2, 0x74, 0xff, 0x59, 0x71, 0xea, 0xf1, 0xb3, 0xe2, 0xd4, 0x6f,
|
||||
0xcf, 0x8a, 0x53, 0xb7, 0xfe, 0xdf, 0x76, 0xe9, 0x7e, 0xbf, 0x55, 0xb6, 0x49, 0x57, 0xfc, 0xdb,
|
||||
0x11, 0x3f, 0xab, 0x81, 0xf3, 0x75, 0xe5, 0x2e, 0xff, 0x5b, 0xd6, 0x4a, 0xb0, 0x84, 0xde, 0xfb,
|
||||
0x27, 0x00, 0x00, 0xff, 0xff, 0xde, 0xf2, 0x0d, 0x3c, 0xad, 0x0d, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (this *GroupPolicyInfo) Equal(that interface{}) bool {
|
||||
|
@ -1035,6 +1093,44 @@ func (m *ThresholdDecisionPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error)
|
|||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *PercentageDecisionPolicy) 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 *PercentageDecisionPolicy) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *PercentageDecisionPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
n3, err3 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.Timeout, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.Timeout):])
|
||||
if err3 != nil {
|
||||
return 0, err3
|
||||
}
|
||||
i -= n3
|
||||
i = encodeVarintTypes(dAtA, i, uint64(n3))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
if len(m.Percentage) > 0 {
|
||||
i -= len(m.Percentage)
|
||||
copy(dAtA[i:], m.Percentage)
|
||||
i = encodeVarintTypes(dAtA, i, uint64(len(m.Percentage)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *GroupInfo) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
|
@ -1055,12 +1151,12 @@ func (m *GroupInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt):])
|
||||
if err3 != nil {
|
||||
return 0, err3
|
||||
n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt):])
|
||||
if err4 != nil {
|
||||
return 0, err4
|
||||
}
|
||||
i -= n3
|
||||
i = encodeVarintTypes(dAtA, i, uint64(n3))
|
||||
i -= n4
|
||||
i = encodeVarintTypes(dAtA, i, uint64(n4))
|
||||
i--
|
||||
dAtA[i] = 0x32
|
||||
if len(m.TotalWeight) > 0 {
|
||||
|
@ -1157,12 +1253,12 @@ func (m *GroupPolicyInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt):])
|
||||
if err5 != nil {
|
||||
return 0, err5
|
||||
n6, err6 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt):])
|
||||
if err6 != nil {
|
||||
return 0, err6
|
||||
}
|
||||
i -= n5
|
||||
i = encodeVarintTypes(dAtA, i, uint64(n5))
|
||||
i -= n6
|
||||
i = encodeVarintTypes(dAtA, i, uint64(n6))
|
||||
i--
|
||||
dAtA[i] = 0x3a
|
||||
if m.DecisionPolicy != nil {
|
||||
|
@ -1250,12 +1346,12 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||
i--
|
||||
dAtA[i] = 0x60
|
||||
}
|
||||
n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timeout, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timeout):])
|
||||
if err7 != nil {
|
||||
return 0, err7
|
||||
n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timeout, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timeout):])
|
||||
if err8 != nil {
|
||||
return 0, err8
|
||||
}
|
||||
i -= n7
|
||||
i = encodeVarintTypes(dAtA, i, uint64(n7))
|
||||
i -= n8
|
||||
i = encodeVarintTypes(dAtA, i, uint64(n8))
|
||||
i--
|
||||
dAtA[i] = 0x5a
|
||||
{
|
||||
|
@ -1288,12 +1384,12 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||
i--
|
||||
dAtA[i] = 0x30
|
||||
}
|
||||
n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.SubmittedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmittedAt):])
|
||||
if err9 != nil {
|
||||
return 0, err9
|
||||
n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.SubmittedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmittedAt):])
|
||||
if err10 != nil {
|
||||
return 0, err10
|
||||
}
|
||||
i -= n9
|
||||
i = encodeVarintTypes(dAtA, i, uint64(n9))
|
||||
i -= n10
|
||||
i = encodeVarintTypes(dAtA, i, uint64(n10))
|
||||
i--
|
||||
dAtA[i] = 0x2a
|
||||
if len(m.Proposers) > 0 {
|
||||
|
@ -1398,12 +1494,12 @@ func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.SubmittedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmittedAt):])
|
||||
if err10 != nil {
|
||||
return 0, err10
|
||||
n11, err11 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.SubmittedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmittedAt):])
|
||||
if err11 != nil {
|
||||
return 0, err11
|
||||
}
|
||||
i -= n10
|
||||
i = encodeVarintTypes(dAtA, i, uint64(n10))
|
||||
i -= n11
|
||||
i = encodeVarintTypes(dAtA, i, uint64(n11))
|
||||
i--
|
||||
dAtA[i] = 0x2a
|
||||
if len(m.Metadata) > 0 {
|
||||
|
@ -1497,6 +1593,21 @@ func (m *ThresholdDecisionPolicy) Size() (n int) {
|
|||
return n
|
||||
}
|
||||
|
||||
func (m *PercentageDecisionPolicy) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Percentage)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTypes(uint64(l))
|
||||
}
|
||||
l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.Timeout)
|
||||
n += 1 + l + sovTypes(uint64(l))
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *GroupInfo) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
|
@ -2064,6 +2175,121 @@ func (m *ThresholdDecisionPolicy) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
func (m *PercentageDecisionPolicy) 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 ErrIntOverflowTypes
|
||||
}
|
||||
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: PercentageDecisionPolicy: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: PercentageDecisionPolicy: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Percentage", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTypes
|
||||
}
|
||||
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 ErrInvalidLengthTypes
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Percentage = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTypes
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.Timeout, dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipTypes(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *GroupInfo) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
|
|
@ -0,0 +1,276 @@
|
|||
package group_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/x/group"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestPercentageDecisionPolicyAllow(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
policy *group.PercentageDecisionPolicy
|
||||
tally *group.Tally
|
||||
totalPower string
|
||||
votingDuration time.Duration
|
||||
result group.DecisionPolicyResult
|
||||
}{
|
||||
{
|
||||
"YesCount percentage > decision policy percentage",
|
||||
&group.PercentageDecisionPolicy{
|
||||
Percentage: "0.5",
|
||||
Timeout: time.Second * 100,
|
||||
},
|
||||
&group.Tally{
|
||||
YesCount: "2",
|
||||
NoCount: "0",
|
||||
AbstainCount: "0",
|
||||
VetoCount: "0",
|
||||
},
|
||||
"3",
|
||||
time.Duration(time.Second * 50),
|
||||
group.DecisionPolicyResult{
|
||||
Allow: true,
|
||||
Final: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
"YesCount percentage == decision policy percentage",
|
||||
&group.PercentageDecisionPolicy{
|
||||
Percentage: "0.5",
|
||||
Timeout: time.Second * 100,
|
||||
},
|
||||
&group.Tally{
|
||||
YesCount: "2",
|
||||
NoCount: "0",
|
||||
AbstainCount: "0",
|
||||
VetoCount: "0",
|
||||
},
|
||||
"4",
|
||||
time.Duration(time.Second * 50),
|
||||
group.DecisionPolicyResult{
|
||||
Allow: true,
|
||||
Final: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
"YesCount percentage < decision policy percentage",
|
||||
&group.PercentageDecisionPolicy{
|
||||
Percentage: "0.5",
|
||||
Timeout: time.Second * 100,
|
||||
},
|
||||
&group.Tally{
|
||||
YesCount: "1",
|
||||
NoCount: "0",
|
||||
AbstainCount: "0",
|
||||
VetoCount: "0",
|
||||
},
|
||||
"3",
|
||||
time.Duration(time.Second * 50),
|
||||
group.DecisionPolicyResult{
|
||||
Allow: false,
|
||||
Final: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
"sum percentage (YesCount + undecided votes percentage) < decision policy percentage",
|
||||
&group.PercentageDecisionPolicy{
|
||||
Percentage: "0.5",
|
||||
Timeout: time.Second * 100,
|
||||
},
|
||||
&group.Tally{
|
||||
YesCount: "1",
|
||||
NoCount: "2",
|
||||
AbstainCount: "0",
|
||||
VetoCount: "0",
|
||||
},
|
||||
"3",
|
||||
time.Duration(time.Second * 50),
|
||||
group.DecisionPolicyResult{
|
||||
Allow: false,
|
||||
Final: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
"sum percentage = decision policy percentage",
|
||||
&group.PercentageDecisionPolicy{
|
||||
Percentage: "0.5",
|
||||
Timeout: time.Second * 100,
|
||||
},
|
||||
&group.Tally{
|
||||
YesCount: "1",
|
||||
NoCount: "2",
|
||||
AbstainCount: "0",
|
||||
VetoCount: "0",
|
||||
},
|
||||
"4",
|
||||
time.Duration(time.Second * 50),
|
||||
group.DecisionPolicyResult{
|
||||
Allow: false,
|
||||
Final: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
"sum percentage > decision policy percentage",
|
||||
&group.PercentageDecisionPolicy{
|
||||
Percentage: "0.5",
|
||||
Timeout: time.Second * 100,
|
||||
},
|
||||
&group.Tally{
|
||||
YesCount: "1",
|
||||
NoCount: "0",
|
||||
AbstainCount: "0",
|
||||
VetoCount: "0",
|
||||
},
|
||||
"3",
|
||||
time.Duration(time.Second * 50),
|
||||
group.DecisionPolicyResult{
|
||||
Allow: false,
|
||||
Final: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
"decision policy timeout <= voting duration",
|
||||
&group.PercentageDecisionPolicy{
|
||||
Percentage: "0.5",
|
||||
Timeout: time.Second * 10,
|
||||
},
|
||||
&group.Tally{
|
||||
YesCount: "2",
|
||||
NoCount: "0",
|
||||
AbstainCount: "0",
|
||||
VetoCount: "0",
|
||||
},
|
||||
"3",
|
||||
time.Duration(time.Second * 50),
|
||||
group.DecisionPolicyResult{
|
||||
Allow: false,
|
||||
Final: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
policyResult, err := tc.policy.Allow(*tc.tally, tc.totalPower, tc.votingDuration)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, tc.result, policyResult)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestThresholdDecisionPolicyAllow(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
policy *group.ThresholdDecisionPolicy
|
||||
tally *group.Tally
|
||||
totalPower string
|
||||
votingDuration time.Duration
|
||||
result group.DecisionPolicyResult
|
||||
}{
|
||||
{
|
||||
"YesCount >= threshold decision policy",
|
||||
&group.ThresholdDecisionPolicy{
|
||||
Threshold: "3",
|
||||
Timeout: time.Second * 100,
|
||||
},
|
||||
&group.Tally{
|
||||
YesCount: "3",
|
||||
NoCount: "0",
|
||||
AbstainCount: "0",
|
||||
VetoCount: "0",
|
||||
},
|
||||
"3",
|
||||
time.Duration(time.Second * 50),
|
||||
group.DecisionPolicyResult{
|
||||
Allow: true,
|
||||
Final: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
"YesCount < threshold decision policy",
|
||||
&group.ThresholdDecisionPolicy{
|
||||
Threshold: "3",
|
||||
Timeout: time.Second * 100,
|
||||
},
|
||||
&group.Tally{
|
||||
YesCount: "1",
|
||||
NoCount: "0",
|
||||
AbstainCount: "0",
|
||||
VetoCount: "0",
|
||||
},
|
||||
"3",
|
||||
time.Duration(time.Second * 50),
|
||||
group.DecisionPolicyResult{
|
||||
Allow: false,
|
||||
Final: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
"sum votes < threshold decision policy",
|
||||
&group.ThresholdDecisionPolicy{
|
||||
Threshold: "3",
|
||||
Timeout: time.Second * 100,
|
||||
},
|
||||
&group.Tally{
|
||||
YesCount: "1",
|
||||
NoCount: "0",
|
||||
AbstainCount: "0",
|
||||
VetoCount: "0",
|
||||
},
|
||||
"2",
|
||||
time.Duration(time.Second * 50),
|
||||
group.DecisionPolicyResult{
|
||||
Allow: false,
|
||||
Final: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
"sum votes >= threshold decision policy",
|
||||
&group.ThresholdDecisionPolicy{
|
||||
Threshold: "3",
|
||||
Timeout: time.Second * 100,
|
||||
},
|
||||
&group.Tally{
|
||||
YesCount: "1",
|
||||
NoCount: "0",
|
||||
AbstainCount: "0",
|
||||
VetoCount: "0",
|
||||
},
|
||||
"3",
|
||||
time.Duration(time.Second * 50),
|
||||
group.DecisionPolicyResult{
|
||||
Allow: false,
|
||||
Final: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
"decision policy timeout <= voting duration",
|
||||
&group.ThresholdDecisionPolicy{
|
||||
Threshold: "3",
|
||||
Timeout: time.Second * 10,
|
||||
},
|
||||
&group.Tally{
|
||||
YesCount: "3",
|
||||
NoCount: "0",
|
||||
AbstainCount: "0",
|
||||
VetoCount: "0",
|
||||
},
|
||||
"3",
|
||||
time.Duration(time.Second * 50),
|
||||
group.DecisionPolicyResult{
|
||||
Allow: false,
|
||||
Final: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
policyResult, err := tc.policy.Allow(*tc.tally, tc.totalPower, tc.votingDuration)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, tc.result, policyResult)
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue