From 7954140e268c4809fd75dce96892d1469744e9c2 Mon Sep 17 00:00:00 2001 From: atheesh Date: Tue, 28 May 2024 17:28:25 +0530 Subject: [PATCH] review changes --- api/cosmos/authz/v1beta1/authz.pulsar.go | 984 ++++++++++++++++++++++- api/cosmos/authz/v1beta1/tx.pulsar.go | 274 +++---- proto/cosmos/authz/v1beta1/authz.proto | 8 + proto/cosmos/authz/v1beta1/tx.proto | 2 +- x/authz/authz.pb.go | 388 ++++++++- x/authz/client/cli/tx.go | 41 +- x/authz/keeper/msg_server.go | 38 +- x/authz/msgs.go | 2 +- x/authz/tx.pb.go | 115 ++- 9 files changed, 1509 insertions(+), 343 deletions(-) mode change 100644 => 100755 proto/cosmos/authz/v1beta1/tx.proto diff --git a/api/cosmos/authz/v1beta1/authz.pulsar.go b/api/cosmos/authz/v1beta1/authz.pulsar.go index 1b3f9f560bf5..a48e0f5cccdd 100644 --- a/api/cosmos/authz/v1beta1/authz.pulsar.go +++ b/api/cosmos/authz/v1beta1/authz.pulsar.go @@ -3250,6 +3250,858 @@ func (x *fastReflection_AllowedGrantRulesKeys) ProtoMethods() *protoiface.Method } } +var _ protoreflect.List = (*_AppAuthzRules_1_list)(nil) + +type _AppAuthzRules_1_list struct { + list *[]string +} + +func (x *_AppAuthzRules_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_AppAuthzRules_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfString((*x.list)[i]) +} + +func (x *_AppAuthzRules_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_AppAuthzRules_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_AppAuthzRules_1_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message AppAuthzRules at list field AllowedRecipients as it is not of Message kind")) +} + +func (x *_AppAuthzRules_1_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_AppAuthzRules_1_list) NewElement() protoreflect.Value { + v := "" + return protoreflect.ValueOfString(v) +} + +func (x *_AppAuthzRules_1_list) IsValid() bool { + return x.list != nil +} + +var _ protoreflect.List = (*_AppAuthzRules_2_list)(nil) + +type _AppAuthzRules_2_list struct { + list *[]string +} + +func (x *_AppAuthzRules_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_AppAuthzRules_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfString((*x.list)[i]) +} + +func (x *_AppAuthzRules_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_AppAuthzRules_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_AppAuthzRules_2_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message AppAuthzRules at list field MaxAmount as it is not of Message kind")) +} + +func (x *_AppAuthzRules_2_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_AppAuthzRules_2_list) NewElement() protoreflect.Value { + v := "" + return protoreflect.ValueOfString(v) +} + +func (x *_AppAuthzRules_2_list) IsValid() bool { + return x.list != nil +} + +var _ protoreflect.List = (*_AppAuthzRules_3_list)(nil) + +type _AppAuthzRules_3_list struct { + list *[]string +} + +func (x *_AppAuthzRules_3_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_AppAuthzRules_3_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfString((*x.list)[i]) +} + +func (x *_AppAuthzRules_3_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_AppAuthzRules_3_list) Append(value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_AppAuthzRules_3_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message AppAuthzRules at list field AllowedStakeValidators as it is not of Message kind")) +} + +func (x *_AppAuthzRules_3_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_AppAuthzRules_3_list) NewElement() protoreflect.Value { + v := "" + return protoreflect.ValueOfString(v) +} + +func (x *_AppAuthzRules_3_list) IsValid() bool { + return x.list != nil +} + +var _ protoreflect.List = (*_AppAuthzRules_4_list)(nil) + +type _AppAuthzRules_4_list struct { + list *[]string +} + +func (x *_AppAuthzRules_4_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_AppAuthzRules_4_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfString((*x.list)[i]) +} + +func (x *_AppAuthzRules_4_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_AppAuthzRules_4_list) Append(value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_AppAuthzRules_4_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message AppAuthzRules at list field AllowedMaxStakeAmount as it is not of Message kind")) +} + +func (x *_AppAuthzRules_4_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_AppAuthzRules_4_list) NewElement() protoreflect.Value { + v := "" + return protoreflect.ValueOfString(v) +} + +func (x *_AppAuthzRules_4_list) IsValid() bool { + return x.list != nil +} + +var ( + md_AppAuthzRules protoreflect.MessageDescriptor + fd_AppAuthzRules_allowed_recipients protoreflect.FieldDescriptor + fd_AppAuthzRules_max_amount protoreflect.FieldDescriptor + fd_AppAuthzRules_allowed_stake_validators protoreflect.FieldDescriptor + fd_AppAuthzRules_allowed_max_stake_amount protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_authz_v1beta1_authz_proto_init() + md_AppAuthzRules = File_cosmos_authz_v1beta1_authz_proto.Messages().ByName("AppAuthzRules") + fd_AppAuthzRules_allowed_recipients = md_AppAuthzRules.Fields().ByName("allowed_recipients") + fd_AppAuthzRules_max_amount = md_AppAuthzRules.Fields().ByName("max_amount") + fd_AppAuthzRules_allowed_stake_validators = md_AppAuthzRules.Fields().ByName("allowed_stake_validators") + fd_AppAuthzRules_allowed_max_stake_amount = md_AppAuthzRules.Fields().ByName("allowed_max_stake_amount") +} + +var _ protoreflect.Message = (*fastReflection_AppAuthzRules)(nil) + +type fastReflection_AppAuthzRules AppAuthzRules + +func (x *AppAuthzRules) ProtoReflect() protoreflect.Message { + return (*fastReflection_AppAuthzRules)(x) +} + +func (x *AppAuthzRules) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_authz_v1beta1_authz_proto_msgTypes[6] + 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_AppAuthzRules_messageType fastReflection_AppAuthzRules_messageType +var _ protoreflect.MessageType = fastReflection_AppAuthzRules_messageType{} + +type fastReflection_AppAuthzRules_messageType struct{} + +func (x fastReflection_AppAuthzRules_messageType) Zero() protoreflect.Message { + return (*fastReflection_AppAuthzRules)(nil) +} +func (x fastReflection_AppAuthzRules_messageType) New() protoreflect.Message { + return new(fastReflection_AppAuthzRules) +} +func (x fastReflection_AppAuthzRules_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_AppAuthzRules +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_AppAuthzRules) Descriptor() protoreflect.MessageDescriptor { + return md_AppAuthzRules +} + +// 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_AppAuthzRules) Type() protoreflect.MessageType { + return _fastReflection_AppAuthzRules_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_AppAuthzRules) New() protoreflect.Message { + return new(fastReflection_AppAuthzRules) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_AppAuthzRules) Interface() protoreflect.ProtoMessage { + return (*AppAuthzRules)(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_AppAuthzRules) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.AllowedRecipients) != 0 { + value := protoreflect.ValueOfList(&_AppAuthzRules_1_list{list: &x.AllowedRecipients}) + if !f(fd_AppAuthzRules_allowed_recipients, value) { + return + } + } + if len(x.MaxAmount) != 0 { + value := protoreflect.ValueOfList(&_AppAuthzRules_2_list{list: &x.MaxAmount}) + if !f(fd_AppAuthzRules_max_amount, value) { + return + } + } + if len(x.AllowedStakeValidators) != 0 { + value := protoreflect.ValueOfList(&_AppAuthzRules_3_list{list: &x.AllowedStakeValidators}) + if !f(fd_AppAuthzRules_allowed_stake_validators, value) { + return + } + } + if len(x.AllowedMaxStakeAmount) != 0 { + value := protoreflect.ValueOfList(&_AppAuthzRules_4_list{list: &x.AllowedMaxStakeAmount}) + if !f(fd_AppAuthzRules_allowed_max_stake_amount, 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_AppAuthzRules) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.authz.v1beta1.AppAuthzRules.allowed_recipients": + return len(x.AllowedRecipients) != 0 + case "cosmos.authz.v1beta1.AppAuthzRules.max_amount": + return len(x.MaxAmount) != 0 + case "cosmos.authz.v1beta1.AppAuthzRules.allowed_stake_validators": + return len(x.AllowedStakeValidators) != 0 + case "cosmos.authz.v1beta1.AppAuthzRules.allowed_max_stake_amount": + return len(x.AllowedMaxStakeAmount) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.AppAuthzRules")) + } + panic(fmt.Errorf("message cosmos.authz.v1beta1.AppAuthzRules 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_AppAuthzRules) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.authz.v1beta1.AppAuthzRules.allowed_recipients": + x.AllowedRecipients = nil + case "cosmos.authz.v1beta1.AppAuthzRules.max_amount": + x.MaxAmount = nil + case "cosmos.authz.v1beta1.AppAuthzRules.allowed_stake_validators": + x.AllowedStakeValidators = nil + case "cosmos.authz.v1beta1.AppAuthzRules.allowed_max_stake_amount": + x.AllowedMaxStakeAmount = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.AppAuthzRules")) + } + panic(fmt.Errorf("message cosmos.authz.v1beta1.AppAuthzRules 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_AppAuthzRules) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.authz.v1beta1.AppAuthzRules.allowed_recipients": + if len(x.AllowedRecipients) == 0 { + return protoreflect.ValueOfList(&_AppAuthzRules_1_list{}) + } + listValue := &_AppAuthzRules_1_list{list: &x.AllowedRecipients} + return protoreflect.ValueOfList(listValue) + case "cosmos.authz.v1beta1.AppAuthzRules.max_amount": + if len(x.MaxAmount) == 0 { + return protoreflect.ValueOfList(&_AppAuthzRules_2_list{}) + } + listValue := &_AppAuthzRules_2_list{list: &x.MaxAmount} + return protoreflect.ValueOfList(listValue) + case "cosmos.authz.v1beta1.AppAuthzRules.allowed_stake_validators": + if len(x.AllowedStakeValidators) == 0 { + return protoreflect.ValueOfList(&_AppAuthzRules_3_list{}) + } + listValue := &_AppAuthzRules_3_list{list: &x.AllowedStakeValidators} + return protoreflect.ValueOfList(listValue) + case "cosmos.authz.v1beta1.AppAuthzRules.allowed_max_stake_amount": + if len(x.AllowedMaxStakeAmount) == 0 { + return protoreflect.ValueOfList(&_AppAuthzRules_4_list{}) + } + listValue := &_AppAuthzRules_4_list{list: &x.AllowedMaxStakeAmount} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.AppAuthzRules")) + } + panic(fmt.Errorf("message cosmos.authz.v1beta1.AppAuthzRules 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_AppAuthzRules) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.authz.v1beta1.AppAuthzRules.allowed_recipients": + lv := value.List() + clv := lv.(*_AppAuthzRules_1_list) + x.AllowedRecipients = *clv.list + case "cosmos.authz.v1beta1.AppAuthzRules.max_amount": + lv := value.List() + clv := lv.(*_AppAuthzRules_2_list) + x.MaxAmount = *clv.list + case "cosmos.authz.v1beta1.AppAuthzRules.allowed_stake_validators": + lv := value.List() + clv := lv.(*_AppAuthzRules_3_list) + x.AllowedStakeValidators = *clv.list + case "cosmos.authz.v1beta1.AppAuthzRules.allowed_max_stake_amount": + lv := value.List() + clv := lv.(*_AppAuthzRules_4_list) + x.AllowedMaxStakeAmount = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.AppAuthzRules")) + } + panic(fmt.Errorf("message cosmos.authz.v1beta1.AppAuthzRules 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_AppAuthzRules) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.authz.v1beta1.AppAuthzRules.allowed_recipients": + if x.AllowedRecipients == nil { + x.AllowedRecipients = []string{} + } + value := &_AppAuthzRules_1_list{list: &x.AllowedRecipients} + return protoreflect.ValueOfList(value) + case "cosmos.authz.v1beta1.AppAuthzRules.max_amount": + if x.MaxAmount == nil { + x.MaxAmount = []string{} + } + value := &_AppAuthzRules_2_list{list: &x.MaxAmount} + return protoreflect.ValueOfList(value) + case "cosmos.authz.v1beta1.AppAuthzRules.allowed_stake_validators": + if x.AllowedStakeValidators == nil { + x.AllowedStakeValidators = []string{} + } + value := &_AppAuthzRules_3_list{list: &x.AllowedStakeValidators} + return protoreflect.ValueOfList(value) + case "cosmos.authz.v1beta1.AppAuthzRules.allowed_max_stake_amount": + if x.AllowedMaxStakeAmount == nil { + x.AllowedMaxStakeAmount = []string{} + } + value := &_AppAuthzRules_4_list{list: &x.AllowedMaxStakeAmount} + return protoreflect.ValueOfList(value) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.AppAuthzRules")) + } + panic(fmt.Errorf("message cosmos.authz.v1beta1.AppAuthzRules 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_AppAuthzRules) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.authz.v1beta1.AppAuthzRules.allowed_recipients": + list := []string{} + return protoreflect.ValueOfList(&_AppAuthzRules_1_list{list: &list}) + case "cosmos.authz.v1beta1.AppAuthzRules.max_amount": + list := []string{} + return protoreflect.ValueOfList(&_AppAuthzRules_2_list{list: &list}) + case "cosmos.authz.v1beta1.AppAuthzRules.allowed_stake_validators": + list := []string{} + return protoreflect.ValueOfList(&_AppAuthzRules_3_list{list: &list}) + case "cosmos.authz.v1beta1.AppAuthzRules.allowed_max_stake_amount": + list := []string{} + return protoreflect.ValueOfList(&_AppAuthzRules_4_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.AppAuthzRules")) + } + panic(fmt.Errorf("message cosmos.authz.v1beta1.AppAuthzRules 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_AppAuthzRules) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.authz.v1beta1.AppAuthzRules", 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_AppAuthzRules) 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_AppAuthzRules) 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_AppAuthzRules) 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_AppAuthzRules) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*AppAuthzRules) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.AllowedRecipients) > 0 { + for _, s := range x.AllowedRecipients { + l = len(s) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if len(x.MaxAmount) > 0 { + for _, s := range x.MaxAmount { + l = len(s) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if len(x.AllowedStakeValidators) > 0 { + for _, s := range x.AllowedStakeValidators { + l = len(s) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if len(x.AllowedMaxStakeAmount) > 0 { + for _, s := range x.AllowedMaxStakeAmount { + l = len(s) + 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().(*AppAuthzRules) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.AllowedMaxStakeAmount) > 0 { + for iNdEx := len(x.AllowedMaxStakeAmount) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.AllowedMaxStakeAmount[iNdEx]) + copy(dAtA[i:], x.AllowedMaxStakeAmount[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AllowedMaxStakeAmount[iNdEx]))) + i-- + dAtA[i] = 0x22 + } + } + if len(x.AllowedStakeValidators) > 0 { + for iNdEx := len(x.AllowedStakeValidators) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.AllowedStakeValidators[iNdEx]) + copy(dAtA[i:], x.AllowedStakeValidators[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AllowedStakeValidators[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(x.MaxAmount) > 0 { + for iNdEx := len(x.MaxAmount) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.MaxAmount[iNdEx]) + copy(dAtA[i:], x.MaxAmount[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MaxAmount[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(x.AllowedRecipients) > 0 { + for iNdEx := len(x.AllowedRecipients) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.AllowedRecipients[iNdEx]) + copy(dAtA[i:], x.AllowedRecipients[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AllowedRecipients[iNdEx]))) + 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().(*AppAuthzRules) + 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: AppAuthzRules: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: AppAuthzRules: 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 AllowedRecipients", 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.AllowedRecipients = append(x.AllowedRecipients, 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 MaxAmount", 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.MaxAmount = append(x.MaxAmount, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AllowedStakeValidators", 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.AllowedStakeValidators = append(x.AllowedStakeValidators, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AllowedMaxStakeAmount", 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.AllowedMaxStakeAmount = append(x.AllowedMaxStakeAmount, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Since: cosmos-sdk 0.43 // Code generated by protoc-gen-go. DO NOT EDIT. @@ -3538,6 +4390,66 @@ func (x *AllowedGrantRulesKeys) GetKeys() []*Rule { return nil } +// AppAuthzRules is rules passed to the authz app. +type AppAuthzRules struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AllowedRecipients []string `protobuf:"bytes,1,rep,name=allowed_recipients,json=allowedRecipients,proto3" json:"allowed_recipients,omitempty"` + MaxAmount []string `protobuf:"bytes,2,rep,name=max_amount,json=maxAmount,proto3" json:"max_amount,omitempty"` + AllowedStakeValidators []string `protobuf:"bytes,3,rep,name=allowed_stake_validators,json=allowedStakeValidators,proto3" json:"allowed_stake_validators,omitempty"` + AllowedMaxStakeAmount []string `protobuf:"bytes,4,rep,name=allowed_max_stake_amount,json=allowedMaxStakeAmount,proto3" json:"allowed_max_stake_amount,omitempty"` +} + +func (x *AppAuthzRules) Reset() { + *x = AppAuthzRules{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_authz_v1beta1_authz_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AppAuthzRules) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AppAuthzRules) ProtoMessage() {} + +// Deprecated: Use AppAuthzRules.ProtoReflect.Descriptor instead. +func (*AppAuthzRules) Descriptor() ([]byte, []int) { + return file_cosmos_authz_v1beta1_authz_proto_rawDescGZIP(), []int{6} +} + +func (x *AppAuthzRules) GetAllowedRecipients() []string { + if x != nil { + return x.AllowedRecipients + } + return nil +} + +func (x *AppAuthzRules) GetMaxAmount() []string { + if x != nil { + return x.MaxAmount + } + return nil +} + +func (x *AppAuthzRules) GetAllowedStakeValidators() []string { + if x != nil { + return x.AllowedStakeValidators + } + return nil +} + +func (x *AppAuthzRules) GetAllowedMaxStakeAmount() []string { + if x != nil { + return x.AllowedMaxStakeAmount + } + return nil +} + var File_cosmos_authz_v1beta1_authz_proto protoreflect.FileDescriptor var file_cosmos_authz_v1beta1_authz_proto_rawDesc = []byte{ @@ -3605,21 +4517,34 @@ var file_cosmos_authz_v1beta1_authz_proto_rawDesc = []byte{ 0x74, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x2e, 0x0a, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x52, 0x75, 0x6c, 0x65, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x42, 0xd0, 0x01, 0x0a, 0x18, 0x63, - 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0a, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, - 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, - 0x75, 0x74, 0x68, 0x7a, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x61, 0x75, 0x74, - 0x68, 0x7a, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x41, 0x58, 0xaa, - 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x56, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, - 0x41, 0x75, 0x74, 0x68, 0x7a, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x20, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x5c, 0x56, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x75, 0x74, 0x68, 0x7a, - 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xc8, 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x75, 0x6c, 0x65, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, 0xd0, 0x01, 0x0a, 0x0d, 0x41, + 0x70, 0x70, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x2d, 0x0a, 0x12, + 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x5f, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, + 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, + 0x64, 0x52, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, + 0x61, 0x78, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x09, 0x6d, 0x61, 0x78, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x38, 0x0a, 0x18, 0x61, 0x6c, + 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x5f, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x16, 0x61, 0x6c, + 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, + 0x74, 0x6f, 0x72, 0x73, 0x12, 0x37, 0x0a, 0x18, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x5f, + 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x15, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x4d, + 0x61, 0x78, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0xd0, 0x01, + 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, + 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0a, 0x41, 0x75, 0x74, 0x68, + 0x7a, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, + 0x61, 0x75, 0x74, 0x68, 0x7a, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, + 0x41, 0x58, 0xaa, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x68, + 0x7a, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x5c, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0xe2, 0x02, 0x20, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x5c, + 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x75, + 0x74, 0x68, 0x7a, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xc8, 0xe1, 0x1e, 0x00, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3634,7 +4559,7 @@ func file_cosmos_authz_v1beta1_authz_proto_rawDescGZIP() []byte { return file_cosmos_authz_v1beta1_authz_proto_rawDescData } -var file_cosmos_authz_v1beta1_authz_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_cosmos_authz_v1beta1_authz_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_cosmos_authz_v1beta1_authz_proto_goTypes = []interface{}{ (*GenericAuthorization)(nil), // 0: cosmos.authz.v1beta1.GenericAuthorization (*Grant)(nil), // 1: cosmos.authz.v1beta1.Grant @@ -3642,15 +4567,16 @@ var file_cosmos_authz_v1beta1_authz_proto_goTypes = []interface{}{ (*GrantAuthorization)(nil), // 3: cosmos.authz.v1beta1.GrantAuthorization (*GrantQueueItem)(nil), // 4: cosmos.authz.v1beta1.GrantQueueItem (*AllowedGrantRulesKeys)(nil), // 5: cosmos.authz.v1beta1.AllowedGrantRulesKeys - (*anypb.Any)(nil), // 6: google.protobuf.Any - (*timestamppb.Timestamp)(nil), // 7: google.protobuf.Timestamp + (*AppAuthzRules)(nil), // 6: cosmos.authz.v1beta1.AppAuthzRules + (*anypb.Any)(nil), // 7: google.protobuf.Any + (*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp } var file_cosmos_authz_v1beta1_authz_proto_depIdxs = []int32{ - 6, // 0: cosmos.authz.v1beta1.Grant.authorization:type_name -> google.protobuf.Any - 7, // 1: cosmos.authz.v1beta1.Grant.expiration:type_name -> google.protobuf.Timestamp + 7, // 0: cosmos.authz.v1beta1.Grant.authorization:type_name -> google.protobuf.Any + 8, // 1: cosmos.authz.v1beta1.Grant.expiration:type_name -> google.protobuf.Timestamp 2, // 2: cosmos.authz.v1beta1.Grant.rules:type_name -> cosmos.authz.v1beta1.Rule - 6, // 3: cosmos.authz.v1beta1.GrantAuthorization.authorization:type_name -> google.protobuf.Any - 7, // 4: cosmos.authz.v1beta1.GrantAuthorization.expiration:type_name -> google.protobuf.Timestamp + 7, // 3: cosmos.authz.v1beta1.GrantAuthorization.authorization:type_name -> google.protobuf.Any + 8, // 4: cosmos.authz.v1beta1.GrantAuthorization.expiration:type_name -> google.protobuf.Timestamp 2, // 5: cosmos.authz.v1beta1.AllowedGrantRulesKeys.keys:type_name -> cosmos.authz.v1beta1.Rule 6, // [6:6] is the sub-list for method output_type 6, // [6:6] is the sub-list for method input_type @@ -3737,6 +4663,18 @@ func file_cosmos_authz_v1beta1_authz_proto_init() { return nil } } + file_cosmos_authz_v1beta1_authz_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AppAuthzRules); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -3744,7 +4682,7 @@ func file_cosmos_authz_v1beta1_authz_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_authz_v1beta1_authz_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 7, NumExtensions: 0, NumServices: 0, }, diff --git a/api/cosmos/authz/v1beta1/tx.pulsar.go b/api/cosmos/authz/v1beta1/tx.pulsar.go index b3474119b1e5..4fc726a1e59b 100644 --- a/api/cosmos/authz/v1beta1/tx.pulsar.go +++ b/api/cosmos/authz/v1beta1/tx.pulsar.go @@ -17,57 +17,6 @@ import ( sync "sync" ) -var _ protoreflect.List = (*_MsgGrant_4_list)(nil) - -type _MsgGrant_4_list struct { - list *[]*Rule -} - -func (x *_MsgGrant_4_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_MsgGrant_4_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_MsgGrant_4_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Rule) - (*x.list)[i] = concreteValue -} - -func (x *_MsgGrant_4_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Rule) - *x.list = append(*x.list, concreteValue) -} - -func (x *_MsgGrant_4_list) AppendMutable() protoreflect.Value { - v := new(Rule) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgGrant_4_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_MsgGrant_4_list) NewElement() protoreflect.Value { - v := new(Rule) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgGrant_4_list) IsValid() bool { - return x.list != nil -} - var ( md_MsgGrant protoreflect.MessageDescriptor fd_MsgGrant_granter protoreflect.FieldDescriptor @@ -169,7 +118,7 @@ func (x *fastReflection_MsgGrant) Range(f func(protoreflect.FieldDescriptor, pro } } if len(x.Rules) != 0 { - value := protoreflect.ValueOfList(&_MsgGrant_4_list{list: &x.Rules}) + value := protoreflect.ValueOfBytes(x.Rules) if !f(fd_MsgGrant_rules, value) { return } @@ -247,11 +196,8 @@ func (x *fastReflection_MsgGrant) Get(descriptor protoreflect.FieldDescriptor) p value := x.Grant return protoreflect.ValueOfMessage(value.ProtoReflect()) case "cosmos.authz.v1beta1.MsgGrant.rules": - if len(x.Rules) == 0 { - return protoreflect.ValueOfList(&_MsgGrant_4_list{}) - } - listValue := &_MsgGrant_4_list{list: &x.Rules} - return protoreflect.ValueOfList(listValue) + value := x.Rules + return protoreflect.ValueOfBytes(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.MsgGrant")) @@ -279,9 +225,7 @@ func (x *fastReflection_MsgGrant) Set(fd protoreflect.FieldDescriptor, value pro case "cosmos.authz.v1beta1.MsgGrant.grant": x.Grant = value.Message().Interface().(*Grant) case "cosmos.authz.v1beta1.MsgGrant.rules": - lv := value.List() - clv := lv.(*_MsgGrant_4_list) - x.Rules = *clv.list + x.Rules = value.Bytes() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.MsgGrant")) @@ -307,16 +251,12 @@ func (x *fastReflection_MsgGrant) Mutable(fd protoreflect.FieldDescriptor) proto x.Grant = new(Grant) } return protoreflect.ValueOfMessage(x.Grant.ProtoReflect()) - case "cosmos.authz.v1beta1.MsgGrant.rules": - if x.Rules == nil { - x.Rules = []*Rule{} - } - value := &_MsgGrant_4_list{list: &x.Rules} - return protoreflect.ValueOfList(value) case "cosmos.authz.v1beta1.MsgGrant.granter": panic(fmt.Errorf("field granter of message cosmos.authz.v1beta1.MsgGrant is not mutable")) case "cosmos.authz.v1beta1.MsgGrant.grantee": panic(fmt.Errorf("field grantee of message cosmos.authz.v1beta1.MsgGrant is not mutable")) + case "cosmos.authz.v1beta1.MsgGrant.rules": + panic(fmt.Errorf("field rules of message cosmos.authz.v1beta1.MsgGrant is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.MsgGrant")) @@ -338,8 +278,7 @@ func (x *fastReflection_MsgGrant) NewField(fd protoreflect.FieldDescriptor) prot m := new(Grant) return protoreflect.ValueOfMessage(m.ProtoReflect()) case "cosmos.authz.v1beta1.MsgGrant.rules": - list := []*Rule{} - return protoreflect.ValueOfList(&_MsgGrant_4_list{list: &list}) + return protoreflect.ValueOfBytes(nil) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.MsgGrant")) @@ -421,11 +360,9 @@ func (x *fastReflection_MsgGrant) ProtoMethods() *protoiface.Methods { l = options.Size(x.Grant) n += 1 + l + runtime.Sov(uint64(l)) } - if len(x.Rules) > 0 { - for _, e := range x.Rules { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } + l = len(x.Rules) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { n += len(x.unknownFields) @@ -457,20 +394,11 @@ func (x *fastReflection_MsgGrant) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], x.unknownFields) } if len(x.Rules) > 0 { - for iNdEx := len(x.Rules) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Rules[iNdEx]) - 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] = 0x22 - } + i -= len(x.Rules) + copy(dAtA[i:], x.Rules) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Rules))) + i-- + dAtA[i] = 0x22 } if x.Grant != nil { encoded, err := options.Marshal(x.Grant) @@ -653,7 +581,7 @@ func (x *fastReflection_MsgGrant) ProtoMethods() *protoiface.Methods { if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Rules", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -663,24 +591,24 @@ func (x *fastReflection_MsgGrant) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen 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.Rules = append(x.Rules, &Rule{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Rules[len(x.Rules)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + x.Rules = append(x.Rules[:0], dAtA[iNdEx:postIndex]...) + if x.Rules == nil { + x.Rules = []byte{} } iNdEx = postIndex default: @@ -3042,7 +2970,7 @@ type MsgGrant struct { Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"` Grant *Grant `protobuf:"bytes,3,opt,name=grant,proto3" json:"grant,omitempty"` // rules are conditions to execute the grant. - Rules []*Rule `protobuf:"bytes,4,rep,name=rules,proto3" json:"rules,omitempty"` + Rules []byte `protobuf:"bytes,4,opt,name=rules,proto3" json:"rules,omitempty"` } func (x *MsgGrant) Reset() { @@ -3086,7 +3014,7 @@ func (x *MsgGrant) GetGrant() *Grant { return nil } -func (x *MsgGrant) GetRules() []*Rule { +func (x *MsgGrant) GetRules() []byte { if x != nil { return x.Rules } @@ -3301,7 +3229,7 @@ var file_cosmos_authz_v1beta1_tx_proto_rawDesc = []byte{ 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0x88, 0x02, 0x0a, 0x08, 0x4d, 0x73, 0x67, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x12, 0x32, 0x0a, 0x07, + 0xec, 0x01, 0x0a, 0x08, 0x4d, 0x73, 0x67, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x12, 0x32, 0x0a, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x72, @@ -3312,70 +3240,68 @@ var file_cosmos_authz_v1beta1_tx_proto_rawDesc = []byte{ 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x05, 0x67, 0x72, 0x61, - 0x6e, 0x74, 0x12, 0x30, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x05, 0x72, - 0x75, 0x6c, 0x65, 0x73, 0x3a, 0x24, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, - 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x13, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, - 0x6b, 0x2f, 0x4d, 0x73, 0x67, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x22, 0x12, 0x0a, 0x10, 0x4d, 0x73, - 0x67, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xa9, - 0x01, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x12, 0x32, 0x0a, 0x07, 0x67, 0x72, - 0x61, 0x6e, 0x74, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, - 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, - 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x65, 0x12, 0x45, - 0x0a, 0x04, 0x6d, 0x73, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, - 0x6e, 0x79, 0x42, 0x1b, 0xca, 0xb4, 0x2d, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, - 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, - 0x04, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x23, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x67, 0x72, 0x61, 0x6e, - 0x74, 0x65, 0x65, 0x8a, 0xe7, 0xb0, 0x2a, 0x12, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, - 0x64, 0x6b, 0x2f, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x22, 0x2b, 0x0a, 0x0f, 0x4d, 0x73, - 0x67, 0x45, 0x78, 0x65, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, - 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x07, - 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x22, 0xbc, 0x01, 0x0a, 0x09, 0x4d, 0x73, 0x67, 0x52, - 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x72, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x52, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x07, 0x67, 0x72, 0x61, - 0x6e, 0x74, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, + 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x3a, 0x24, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x67, + 0x72, 0x61, 0x6e, 0x74, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x13, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x4d, 0x73, 0x67, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x22, 0x12, + 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0xa9, 0x01, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x12, 0x32, + 0x0a, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, + 0x65, 0x65, 0x12, 0x45, 0x0a, 0x04, 0x6d, 0x73, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x42, 0x1b, 0xca, 0xb4, 0x2d, 0x17, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x4d, 0x73, 0x67, 0x52, 0x04, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x23, 0x82, 0xe7, 0xb0, 0x2a, 0x07, + 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x65, 0x8a, 0xe7, 0xb0, 0x2a, 0x12, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x22, 0x2b, + 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0c, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x22, 0xbc, 0x01, 0x0a, 0x09, + 0x4d, 0x73, 0x67, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x67, 0x72, 0x61, + 0x6e, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x65, 0x12, 0x20, 0x0a, - 0x0c, 0x6d, 0x73, 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x73, 0x67, 0x54, 0x79, 0x70, 0x65, 0x55, 0x72, 0x6c, 0x3a, - 0x25, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x72, 0x8a, 0xe7, 0xb0, - 0x2a, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x4d, 0x73, 0x67, - 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x22, 0x13, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x76, - 0x6f, 0x6b, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xff, 0x01, 0x0a, 0x03, - 0x4d, 0x73, 0x67, 0x12, 0x4f, 0x0a, 0x05, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x12, 0x1e, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x1a, 0x26, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x04, 0x45, 0x78, 0x65, 0x63, 0x12, 0x1d, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x1a, 0x25, 0x2e, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x52, 0x0a, 0x06, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x12, 0x1f, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x1a, 0x27, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xcd, 0x01, - 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, - 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, - 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, - 0x75, 0x74, 0x68, 0x7a, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x61, 0x75, 0x74, - 0x68, 0x7a, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x41, 0x58, 0xaa, - 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x56, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, - 0x41, 0x75, 0x74, 0x68, 0x7a, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x20, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x5c, 0x56, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x75, 0x74, 0x68, 0x7a, - 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xc8, 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x32, 0x0a, + 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, + 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, + 0x65, 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x73, 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x75, 0x72, + 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x73, 0x67, 0x54, 0x79, 0x70, 0x65, + 0x55, 0x72, 0x6c, 0x3a, 0x25, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, + 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, + 0x2f, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x22, 0x13, 0x0a, 0x11, 0x4d, 0x73, + 0x67, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, + 0xff, 0x01, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x4f, 0x0a, 0x05, 0x47, 0x72, 0x61, 0x6e, 0x74, + 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x47, 0x72, 0x61, 0x6e, 0x74, + 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x47, 0x72, 0x61, 0x6e, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x04, 0x45, 0x78, 0x65, 0x63, + 0x12, 0x1d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x1a, + 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x52, 0x0a, 0x06, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, + 0x12, 0x1f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x76, 0x6f, 0x6b, + 0x65, 0x1a, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x76, 0x6f, + 0x6b, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, + 0x01, 0x42, 0xcd, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, + 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x3b, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, + 0x43, 0x41, 0x58, 0xaa, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x75, 0x74, + 0x68, 0x7a, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x14, 0x43, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0xe2, 0x02, 0x20, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x75, 0x74, 0x68, 0x7a, + 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, + 0x75, 0x74, 0x68, 0x7a, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xc8, 0xe1, 0x1e, + 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3399,24 +3325,22 @@ var file_cosmos_authz_v1beta1_tx_proto_goTypes = []interface{}{ (*MsgRevoke)(nil), // 4: cosmos.authz.v1beta1.MsgRevoke (*MsgRevokeResponse)(nil), // 5: cosmos.authz.v1beta1.MsgRevokeResponse (*Grant)(nil), // 6: cosmos.authz.v1beta1.Grant - (*Rule)(nil), // 7: cosmos.authz.v1beta1.Rule - (*anypb.Any)(nil), // 8: google.protobuf.Any + (*anypb.Any)(nil), // 7: google.protobuf.Any } var file_cosmos_authz_v1beta1_tx_proto_depIdxs = []int32{ 6, // 0: cosmos.authz.v1beta1.MsgGrant.grant:type_name -> cosmos.authz.v1beta1.Grant - 7, // 1: cosmos.authz.v1beta1.MsgGrant.rules:type_name -> cosmos.authz.v1beta1.Rule - 8, // 2: cosmos.authz.v1beta1.MsgExec.msgs:type_name -> google.protobuf.Any - 0, // 3: cosmos.authz.v1beta1.Msg.Grant:input_type -> cosmos.authz.v1beta1.MsgGrant - 2, // 4: cosmos.authz.v1beta1.Msg.Exec:input_type -> cosmos.authz.v1beta1.MsgExec - 4, // 5: cosmos.authz.v1beta1.Msg.Revoke:input_type -> cosmos.authz.v1beta1.MsgRevoke - 1, // 6: cosmos.authz.v1beta1.Msg.Grant:output_type -> cosmos.authz.v1beta1.MsgGrantResponse - 3, // 7: cosmos.authz.v1beta1.Msg.Exec:output_type -> cosmos.authz.v1beta1.MsgExecResponse - 5, // 8: cosmos.authz.v1beta1.Msg.Revoke:output_type -> cosmos.authz.v1beta1.MsgRevokeResponse - 6, // [6:9] is the sub-list for method output_type - 3, // [3:6] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 7, // 1: cosmos.authz.v1beta1.MsgExec.msgs:type_name -> google.protobuf.Any + 0, // 2: cosmos.authz.v1beta1.Msg.Grant:input_type -> cosmos.authz.v1beta1.MsgGrant + 2, // 3: cosmos.authz.v1beta1.Msg.Exec:input_type -> cosmos.authz.v1beta1.MsgExec + 4, // 4: cosmos.authz.v1beta1.Msg.Revoke:input_type -> cosmos.authz.v1beta1.MsgRevoke + 1, // 5: cosmos.authz.v1beta1.Msg.Grant:output_type -> cosmos.authz.v1beta1.MsgGrantResponse + 3, // 6: cosmos.authz.v1beta1.Msg.Exec:output_type -> cosmos.authz.v1beta1.MsgExecResponse + 5, // 7: cosmos.authz.v1beta1.Msg.Revoke:output_type -> cosmos.authz.v1beta1.MsgRevokeResponse + 5, // [5:8] is the sub-list for method output_type + 2, // [2:5] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_cosmos_authz_v1beta1_tx_proto_init() } diff --git a/proto/cosmos/authz/v1beta1/authz.proto b/proto/cosmos/authz/v1beta1/authz.proto index e09853294d77..9198778f1b45 100644 --- a/proto/cosmos/authz/v1beta1/authz.proto +++ b/proto/cosmos/authz/v1beta1/authz.proto @@ -61,3 +61,11 @@ message GrantQueueItem { message AllowedGrantRulesKeys { repeated cosmos.authz.v1beta1.Rule keys = 1; } + +// AppAuthzRules is rules passed to the authz app. +message AppAuthzRules { + repeated string allowed_recipients = 1; + repeated string max_amount = 2; + repeated string allowed_stake_validators = 3; + repeated string allowed_max_stake_amount = 4; +} \ No newline at end of file diff --git a/proto/cosmos/authz/v1beta1/tx.proto b/proto/cosmos/authz/v1beta1/tx.proto old mode 100644 new mode 100755 index 1429f015b15e..858b582dcd05 --- a/proto/cosmos/authz/v1beta1/tx.proto +++ b/proto/cosmos/authz/v1beta1/tx.proto @@ -44,7 +44,7 @@ message MsgGrant { cosmos.authz.v1beta1.Grant grant = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // rules are conditions to execute the grant. - repeated cosmos.authz.v1beta1.Rule rules = 4; + bytes rules = 4; } // MsgGrantResponse defines the Msg/MsgGrant response type. diff --git a/x/authz/authz.pb.go b/x/authz/authz.pb.go index 4af0bdcde723..912440e06cd9 100644 --- a/x/authz/authz.pb.go +++ b/x/authz/authz.pb.go @@ -274,6 +274,47 @@ func (m *AllowedGrantRulesKeys) XXX_DiscardUnknown() { var xxx_messageInfo_AllowedGrantRulesKeys proto.InternalMessageInfo +// AppAuthzRules is rules passed to the authz app. +type AppAuthzRules struct { + AllowedRecipients []string `protobuf:"bytes,1,rep,name=allowed_recipients,json=allowedRecipients,proto3" json:"allowed_recipients,omitempty"` + MaxAmount []string `protobuf:"bytes,2,rep,name=max_amount,json=maxAmount,proto3" json:"max_amount,omitempty"` + AllowedStakeValidators []string `protobuf:"bytes,3,rep,name=allowed_stake_validators,json=allowedStakeValidators,proto3" json:"allowed_stake_validators,omitempty"` + AllowedMaxStakeAmount []string `protobuf:"bytes,4,rep,name=allowed_max_stake_amount,json=allowedMaxStakeAmount,proto3" json:"allowed_max_stake_amount,omitempty"` +} + +func (m *AppAuthzRules) Reset() { *m = AppAuthzRules{} } +func (m *AppAuthzRules) String() string { return proto.CompactTextString(m) } +func (*AppAuthzRules) ProtoMessage() {} +func (*AppAuthzRules) Descriptor() ([]byte, []int) { + return fileDescriptor_544dc2e84b61c637, []int{6} +} +func (m *AppAuthzRules) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AppAuthzRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AppAuthzRules.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 *AppAuthzRules) XXX_Merge(src proto.Message) { + xxx_messageInfo_AppAuthzRules.Merge(m, src) +} +func (m *AppAuthzRules) XXX_Size() int { + return m.Size() +} +func (m *AppAuthzRules) XXX_DiscardUnknown() { + xxx_messageInfo_AppAuthzRules.DiscardUnknown(m) +} + +var xxx_messageInfo_AppAuthzRules proto.InternalMessageInfo + func init() { proto.RegisterType((*GenericAuthorization)(nil), "cosmos.authz.v1beta1.GenericAuthorization") proto.RegisterType((*Grant)(nil), "cosmos.authz.v1beta1.Grant") @@ -281,46 +322,53 @@ func init() { proto.RegisterType((*GrantAuthorization)(nil), "cosmos.authz.v1beta1.GrantAuthorization") proto.RegisterType((*GrantQueueItem)(nil), "cosmos.authz.v1beta1.GrantQueueItem") proto.RegisterType((*AllowedGrantRulesKeys)(nil), "cosmos.authz.v1beta1.AllowedGrantRulesKeys") + proto.RegisterType((*AppAuthzRules)(nil), "cosmos.authz.v1beta1.AppAuthzRules") } func init() { proto.RegisterFile("cosmos/authz/v1beta1/authz.proto", fileDescriptor_544dc2e84b61c637) } var fileDescriptor_544dc2e84b61c637 = []byte{ - // 533 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcb, 0x6e, 0xd3, 0x40, - 0x14, 0x8d, 0x93, 0xb4, 0xd0, 0xa9, 0x8a, 0xc0, 0x0a, 0xc8, 0x64, 0xe1, 0x44, 0x16, 0x42, 0x15, - 0x52, 0xec, 0xb6, 0xb0, 0x62, 0x45, 0x2c, 0xa4, 0x08, 0x58, 0x61, 0xca, 0x86, 0x4d, 0x34, 0x4e, - 0x2e, 0x13, 0x2b, 0xb6, 0xc7, 0x9a, 0x47, 0xa9, 0xfb, 0x09, 0xac, 0xfa, 0x0d, 0x7c, 0x01, 0x8b, - 0x7e, 0x44, 0xc4, 0xaa, 0x62, 0xc5, 0x8a, 0x47, 0xb2, 0xe0, 0x37, 0x90, 0x67, 0x6c, 0x48, 0xda, - 0x08, 0xba, 0x60, 0x13, 0xcd, 0x9d, 0x7b, 0xce, 0x7d, 0x9c, 0x93, 0x31, 0xea, 0x8e, 0x28, 0x4f, - 0x28, 0xf7, 0xb0, 0x14, 0x93, 0x13, 0xef, 0x68, 0x3f, 0x04, 0x81, 0xf7, 0x75, 0xe4, 0x66, 0x8c, - 0x0a, 0x6a, 0xb6, 0x34, 0xc2, 0xd5, 0x77, 0x25, 0xa2, 0x7d, 0x0b, 0x27, 0x51, 0x4a, 0x3d, 0xf5, - 0xab, 0x81, 0xed, 0xbb, 0x1a, 0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 0x91, 0xa1, 0x3b, 0xa2, 0x49, 0xf9, 0xb4, 0xbd, 0xa5, 0xc7, 0x70, 0xac, - 0xbf, 0x18, 0xe1, 0xa6, 0x5a, 0xf4, 0xe1, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x44, 0xd3, 0x32, - 0x34, 0x56, 0x04, 0x00, 0x00, + // 634 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0x8d, 0x9b, 0xb4, 0xdf, 0x97, 0xa9, 0x8a, 0xe8, 0x28, 0xad, 0x42, 0x25, 0x9c, 0xc8, 0x42, + 0xa8, 0x42, 0x8a, 0xdd, 0x16, 0x24, 0x10, 0x2b, 0x12, 0x21, 0x55, 0x80, 0x58, 0xe0, 0x16, 0x16, + 0x6c, 0xa2, 0x71, 0x72, 0x71, 0xad, 0x78, 0x3c, 0xd6, 0xcc, 0xb8, 0xc4, 0x7d, 0x04, 0x56, 0x7d, + 0x06, 0x9e, 0x80, 0x45, 0x1f, 0xa2, 0x62, 0x55, 0xb1, 0x62, 0xc5, 0x4f, 0xb3, 0xe0, 0x35, 0x90, + 0x67, 0xc6, 0x6d, 0xd3, 0x46, 0xd0, 0x05, 0x9b, 0xc8, 0x77, 0xce, 0x39, 0xf7, 0xef, 0x4c, 0x06, + 0xb5, 0x07, 0x4c, 0x50, 0x26, 0x3c, 0x92, 0xc9, 0xbd, 0x03, 0x6f, 0x7f, 0x33, 0x00, 0x49, 0x36, + 0x75, 0xe4, 0xa6, 0x9c, 0x49, 0x86, 0x1b, 0x9a, 0xe1, 0xea, 0x33, 0xc3, 0x58, 0x5b, 0x26, 0x34, + 0x4a, 0x98, 0xa7, 0x7e, 0x35, 0x71, 0xed, 0x96, 0x26, 0xf6, 0x55, 0xe4, 0x19, 0x95, 0x86, 0x5a, + 0x21, 0x63, 0x61, 0x0c, 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 0x2c, 0x91, 0xe6, 0x02, 0xd4, 0x29, 0x19, 0x77, 0xd5, 0x01, 0x7e, 0x84, 0x9a, 0x65, 0x36, + 0x21, 0xc9, 0x08, 0xfa, 0xfb, 0x24, 0x8e, 0x86, 0x44, 0x32, 0xae, 0xaf, 0x5e, 0xdd, 0x5f, 0x35, + 0xf8, 0x4e, 0x01, 0xbf, 0x39, 0x43, 0xf1, 0xc3, 0x73, 0x65, 0x51, 0x40, 0xab, 0x4d, 0x99, 0x9a, + 0x52, 0xae, 0x18, 0xfc, 0x25, 0x19, 0x2b, 0xb1, 0x2e, 0xd9, 0xeb, 0x1d, 0xff, 0xb4, 0x2b, 0xc7, + 0xa7, 0xb6, 0x75, 0x72, 0x6a, 0x5b, 0x3f, 0x4e, 0x6d, 0xeb, 0x70, 0x62, 0x57, 0x4e, 0x26, 0x76, + 0xe5, 0xeb, 0xc4, 0xae, 0xbc, 0xbd, 0x13, 0x46, 0x72, 0x2f, 0x0b, 0xdc, 0x01, 0xa3, 0xe6, 0xb5, + 0xf2, 0x2e, 0xfc, 0xbf, 0xc7, 0xfa, 0x11, 0x0c, 0x16, 0x94, 0x77, 0xf7, 0x7f, 0x07, 0x00, 0x00, + 0xff, 0xff, 0x4a, 0x33, 0x08, 0xe0, 0x29, 0x05, 0x00, 0x00, } func (m *GenericAuthorization) Marshal() (dAtA []byte, err error) { @@ -579,6 +627,65 @@ func (m *AllowedGrantRulesKeys) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *AppAuthzRules) 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 *AppAuthzRules) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AppAuthzRules) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AllowedMaxStakeAmount) > 0 { + for iNdEx := len(m.AllowedMaxStakeAmount) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.AllowedMaxStakeAmount[iNdEx]) + copy(dAtA[i:], m.AllowedMaxStakeAmount[iNdEx]) + i = encodeVarintAuthz(dAtA, i, uint64(len(m.AllowedMaxStakeAmount[iNdEx]))) + i-- + dAtA[i] = 0x22 + } + } + if len(m.AllowedStakeValidators) > 0 { + for iNdEx := len(m.AllowedStakeValidators) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.AllowedStakeValidators[iNdEx]) + copy(dAtA[i:], m.AllowedStakeValidators[iNdEx]) + i = encodeVarintAuthz(dAtA, i, uint64(len(m.AllowedStakeValidators[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.MaxAmount) > 0 { + for iNdEx := len(m.MaxAmount) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.MaxAmount[iNdEx]) + copy(dAtA[i:], m.MaxAmount[iNdEx]) + i = encodeVarintAuthz(dAtA, i, uint64(len(m.MaxAmount[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.AllowedRecipients) > 0 { + for iNdEx := len(m.AllowedRecipients) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.AllowedRecipients[iNdEx]) + copy(dAtA[i:], m.AllowedRecipients[iNdEx]) + i = encodeVarintAuthz(dAtA, i, uint64(len(m.AllowedRecipients[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintAuthz(dAtA []byte, offset int, v uint64) int { offset -= sovAuthz(v) base := offset @@ -700,6 +807,39 @@ func (m *AllowedGrantRulesKeys) Size() (n int) { return n } +func (m *AppAuthzRules) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.AllowedRecipients) > 0 { + for _, s := range m.AllowedRecipients { + l = len(s) + n += 1 + l + sovAuthz(uint64(l)) + } + } + if len(m.MaxAmount) > 0 { + for _, s := range m.MaxAmount { + l = len(s) + n += 1 + l + sovAuthz(uint64(l)) + } + } + if len(m.AllowedStakeValidators) > 0 { + for _, s := range m.AllowedStakeValidators { + l = len(s) + n += 1 + l + sovAuthz(uint64(l)) + } + } + if len(m.AllowedMaxStakeAmount) > 0 { + for _, s := range m.AllowedMaxStakeAmount { + l = len(s) + n += 1 + l + sovAuthz(uint64(l)) + } + } + return n +} + func sovAuthz(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1410,6 +1550,184 @@ func (m *AllowedGrantRulesKeys) Unmarshal(dAtA []byte) error { } return nil } +func (m *AppAuthzRules) 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 ErrIntOverflowAuthz + } + 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: AppAuthzRules: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AppAuthzRules: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowedRecipients", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuthz + } + 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 ErrInvalidLengthAuthz + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuthz + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AllowedRecipients = append(m.AllowedRecipients, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuthz + } + 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 ErrInvalidLengthAuthz + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuthz + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MaxAmount = append(m.MaxAmount, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowedStakeValidators", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuthz + } + 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 ErrInvalidLengthAuthz + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuthz + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AllowedStakeValidators = append(m.AllowedStakeValidators, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowedMaxStakeAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuthz + } + 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 ErrInvalidLengthAuthz + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuthz + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AllowedMaxStakeAmount = append(m.AllowedMaxStakeAmount, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAuthz(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAuthz + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipAuthz(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/authz/client/cli/tx.go b/x/authz/client/cli/tx.go index 27b8df71e97c..80da44d113a0 100644 --- a/x/authz/client/cli/tx.go +++ b/x/authz/client/cli/tx.go @@ -1,7 +1,6 @@ package cli import ( - "encoding/json" "errors" "fmt" "os" @@ -10,7 +9,6 @@ import ( "github.com/spf13/cobra" - bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" "cosmossdk.io/core/address" "github.com/cosmos/cosmos-sdk/client" @@ -218,12 +216,7 @@ Examples: return err } - rules, err := buildRules(args[1], contents) - if err != nil { - return err - } - - msg.SetAuthzRules(rules) + msg.SetAuthzRules(contents) } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) @@ -240,38 +233,6 @@ Examples: return cmd } -func buildRules(msg string, rulesBytes []byte) ([]*authz.Rule, error) { - type internalRules struct { - AllowedRecipients []string `json:"allowed_recepients"` - MaxAmount []string `json:"max_amount"` - AllowedStakeValidators []string `json:"allowed_stake_validators"` - AllowedMaxStakeAmount []string `json:"allowed_max_stake_amount"` - } - - var rulesJson internalRules - err := json.Unmarshal(rulesBytes, &rulesJson) - if err != nil { - return nil, err - } - - switch msg { - case sdk.MsgTypeURL(&bankv1beta1.MsgSend{}): - return []*authz.Rule{ - {Key: authz.AllowedRecipients, Values: rulesJson.AllowedRecipients}, - {Key: authz.MaxAmount, Values: rulesJson.MaxAmount}, - }, nil - - case sdk.MsgTypeURL(&staking.MsgDelegate{}): - return []*authz.Rule{ - {Key: authz.AllowedStakeValidators, Values: rulesJson.AllowedStakeValidators}, - {Key: authz.AllowedMaxStakeAmount, Values: rulesJson.AllowedMaxStakeAmount}, - }, nil - - default: - return []*authz.Rule{}, nil - } -} - func getExpireTime(cmd *cobra.Command) (*time.Time, error) { exp, err := cmd.Flags().GetInt64(FlagExpiration) if err != nil { diff --git a/x/authz/keeper/msg_server.go b/x/authz/keeper/msg_server.go index 030acb8e64e0..fdd919257b95 100644 --- a/x/authz/keeper/msg_server.go +++ b/x/authz/keeper/msg_server.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "encoding/json" "errors" "fmt" "reflect" @@ -9,9 +10,11 @@ import ( errorsmod "cosmossdk.io/errors" + bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/authz" + staking "github.com/cosmos/cosmos-sdk/x/staking/types" ) var _ authz.MsgServer = Keeper{} @@ -54,14 +57,16 @@ func (k Keeper) Grant(goCtx context.Context, msg *authz.MsgGrant) (*authz.MsgGra return nil, sdkerrors.ErrInvalidType.Wrapf("%s doesn't exist.", t) } + var rules []*authz.Rule if msg.Rules != nil { - err := k.VerifyTheRules(goCtx, msg.Grant.Authorization.GetTypeUrl(), msg.Rules) + var err error + err, rules = k.VerifyAndBuildRules(goCtx, msg.Grant.Authorization.GetTypeUrl(), msg.Rules) if err != nil { return nil, err } } - err = k.SaveGrant(ctx, grantee, granter, authorization, msg.Grant.Expiration, msg.Rules) + err = k.SaveGrant(ctx, grantee, granter, authorization, msg.Grant.Expiration, rules) if err != nil { return nil, err } @@ -70,10 +75,31 @@ func (k Keeper) Grant(goCtx context.Context, msg *authz.MsgGrant) (*authz.MsgGra } // VerifyTheRules checks the keys of rules provided are allowed -func (k Keeper) VerifyTheRules(goCtx context.Context, msg string, rules []*authz.Rule) error { +func (k Keeper) VerifyAndBuildRules(goCtx context.Context, msg string, rulesBytes []byte) (error, []*authz.Rule) { + var rulesJson authz.AppAuthzRules + err := json.Unmarshal(rulesBytes, &rulesJson) + if err != nil { + return err, nil + } + + var rules []*authz.Rule + switch msg { + case sdk.MsgTypeURL(&bankv1beta1.MsgSend{}): + rules = []*authz.Rule{ + {Key: authz.AllowedRecipients, Values: rulesJson.AllowedRecipients}, + {Key: authz.MaxAmount, Values: rulesJson.MaxAmount}, + } + + case sdk.MsgTypeURL(&staking.MsgDelegate{}): + rules = []*authz.Rule{ + {Key: authz.AllowedStakeValidators, Values: rulesJson.AllowedStakeValidators}, + {Key: authz.AllowedMaxStakeAmount, Values: rulesJson.AllowedMaxStakeAmount}, + } + } + registeredRules, err := k.GetAuthzRulesKeys(goCtx) if err != nil { - return err + return err, nil } var values []string @@ -85,10 +111,10 @@ func (k Keeper) VerifyTheRules(goCtx context.Context, msg string, rules []*authz } if err := checkStructKeys(rules, values); err != nil { - return err + return err, nil } - return nil + return nil, rules } func checkStructKeys(s interface{}, allowedKeys []string) error { diff --git a/x/authz/msgs.go b/x/authz/msgs.go index 9de397bb3855..bfdef2a7b6ea 100644 --- a/x/authz/msgs.go +++ b/x/authz/msgs.go @@ -33,7 +33,7 @@ func NewMsgGrant(granter, grantee sdk.AccAddress, a Authorization, expiration *t return m, nil } -func (msg *MsgGrant) SetAuthzRules(rules []*Rule) { +func (msg *MsgGrant) SetAuthzRules(rules []byte) { msg.Rules = rules } diff --git a/x/authz/tx.pb.go b/x/authz/tx.pb.go index 57e48244884a..ead6fd14538f 100644 --- a/x/authz/tx.pb.go +++ b/x/authz/tx.pb.go @@ -39,7 +39,7 @@ type MsgGrant struct { Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"` Grant Grant `protobuf:"bytes,3,opt,name=grant,proto3" json:"grant"` // rules are conditions to execute the grant. - Rules []*Rule `protobuf:"bytes,4,rep,name=rules,proto3" json:"rules,omitempty"` + Rules []byte `protobuf:"bytes,4,opt,name=rules,proto3" json:"rules,omitempty"` } func (m *MsgGrant) Reset() { *m = MsgGrant{} } @@ -284,43 +284,43 @@ func init() { func init() { proto.RegisterFile("cosmos/authz/v1beta1/tx.proto", fileDescriptor_3ceddab7d8589ad1) } var fileDescriptor_3ceddab7d8589ad1 = []byte{ - // 572 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0x3f, 0x6f, 0xd3, 0x40, - 0x14, 0xcf, 0x35, 0x49, 0x43, 0xae, 0x95, 0xa0, 0x6e, 0x24, 0x5c, 0x57, 0x75, 0x2d, 0xd3, 0x42, - 0x14, 0x14, 0x9b, 0x84, 0x2d, 0x62, 0x69, 0xa4, 0x8a, 0x85, 0x08, 0xc9, 0xc0, 0xc2, 0x12, 0xd9, - 0xc9, 0x71, 0x8d, 0x6a, 0xfb, 0x22, 0x9f, 0x1d, 0x25, 0x4c, 0x88, 0x09, 0x31, 0xf1, 0x31, 0x60, - 0xcb, 0xd0, 0x91, 0x0f, 0x10, 0x31, 0x55, 0x4c, 0x4c, 0x08, 0x92, 0x21, 0x1f, 0x03, 0xe4, 0xfb, - 0x13, 0x52, 0x94, 0x96, 0x4e, 0x2c, 0xf6, 0x7b, 0xef, 0xf7, 0x7b, 0xe7, 0xf7, 0x7b, 0xef, 0xf9, - 0xe0, 0x5e, 0x87, 0xd0, 0x80, 0x50, 0xdb, 0x4d, 0xe2, 0x93, 0xd7, 0xf6, 0xa0, 0xe6, 0xa1, 0xd8, - 0xad, 0xd9, 0xf1, 0xd0, 0xea, 0x47, 0x24, 0x26, 0x4a, 0x89, 0xc3, 0x16, 0x83, 0x2d, 0x01, 0x6b, - 0x3b, 0x3c, 0xda, 0x66, 0x1c, 0x5b, 0x50, 0x98, 0xa3, 0x95, 0x30, 0xc1, 0x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2, 0x6f, 0xd2, 0x3f, 0xa4, 0xd9, 0x9c, 0xfc, - 0xd4, 0x33, 0x93, 0xa9, 0x0e, 0xce, 0xa7, 0x3a, 0xf8, 0x31, 0xd5, 0xc1, 0x87, 0x99, 0x9e, 0x39, - 0x9f, 0xe9, 0x99, 0x6f, 0x33, 0x3d, 0xf3, 0xf2, 0x00, 0xf7, 0xe2, 0x93, 0xc4, 0xb3, 0x3a, 0x24, - 0x10, 0x77, 0x90, 0xbd, 0xd4, 0xdc, 0x21, 0xbf, 0x43, 0xbc, 0x75, 0xb6, 0x9c, 0x0f, 0x7f, 0x07, - 0x00, 0x00, 0xff, 0xff, 0xe7, 0x98, 0xd2, 0x96, 0xe9, 0x04, 0x00, 0x00, + // 569 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0x41, 0x6f, 0x12, 0x5f, + 0x10, 0xe7, 0x15, 0x28, 0x7f, 0x5e, 0x49, 0xfe, 0x76, 0x4b, 0xe2, 0x76, 0x9b, 0x6e, 0x37, 0x6b, + 0xab, 0x04, 0xc3, 0x6e, 0xc0, 0x1b, 0xf1, 0x52, 0x92, 0xc6, 0x8b, 0xc4, 0x64, 0xd5, 0x8b, 0x17, + 0xb2, 0xc0, 0xf3, 0x95, 0x94, 0xdd, 0x47, 0x76, 0x76, 0x09, 0x78, 0x32, 0x1e, 0x3d, 0xf9, 0x31, + 0xf4, 0xc6, 0xa1, 0x47, 0x3f, 0x00, 0xf1, 0xd4, 0x78, 0xf2, 0x64, 0x14, 0x0e, 0x5c, 0xfc, 0x0e, + 0x9a, 0x7d, 0x6f, 0x1f, 0x52, 0x43, 0x6b, 0x4f, 0x5e, 0x60, 0x66, 0x7e, 0xbf, 0x19, 0xe6, 0x37, + 0x33, 0x3c, 0xbc, 0xdf, 0x61, 0xe0, 0x31, 0xb0, 0xdd, 0x28, 0x3c, 0x7d, 0x65, 0x0f, 0x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xaf, 0xe4, 0xc7, 0xb0, 0x76, + 0x74, 0x2d, 0xbc, 0xac, 0xe6, 0xe0, 0xcd, 0x64, 0xec, 0x07, 0x57, 0x26, 0x08, 0x82, 0x76, 0xef, + 0x2f, 0x04, 0x59, 0x53, 0xcb, 0xbe, 0x8e, 0xff, 0x05, 0x8d, 0xc6, 0xf4, 0xbb, 0x9e, 0x9a, 0xce, + 0x74, 0x74, 0x31, 0xd3, 0xd1, 0xb7, 0x99, 0x8e, 0xde, 0xcd, 0xf5, 0xd4, 0xc5, 0x5c, 0x4f, 0x7d, + 0x99, 0xeb, 0xa9, 0x17, 0x87, 0xb4, 0x17, 0x9e, 0x46, 0x6d, 0xab, 0xc3, 0xbc, 0xe4, 0x9d, 0xb1, + 0x57, 0x86, 0x3b, 0x12, 0xef, 0x44, 0x7b, 0x93, 0x1f, 0xe7, 0x83, 0x5f, 0x01, 0x00, 0x00, 0xff, + 0xff, 0x05, 0x07, 0xc6, 0x37, 0xcd, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -514,18 +514,11 @@ func (m *MsgGrant) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if len(m.Rules) > 0 { - for iNdEx := len(m.Rules) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Rules[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } + i -= len(m.Rules) + copy(dAtA[i:], m.Rules) + i = encodeVarintTx(dAtA, i, uint64(len(m.Rules))) + i-- + dAtA[i] = 0x22 } { size, err := m.Grant.MarshalToSizedBuffer(dAtA[:i]) @@ -747,11 +740,9 @@ func (m *MsgGrant) Size() (n int) { } l = m.Grant.Size() n += 1 + l + sovTx(uint64(l)) - if len(m.Rules) > 0 { - for _, e := range m.Rules { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } + l = len(m.Rules) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) } return n } @@ -965,7 +956,7 @@ func (m *MsgGrant) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Rules", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -975,24 +966,24 @@ func (m *MsgGrant) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Rules = append(m.Rules, &Rule{}) - if err := m.Rules[len(m.Rules)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.Rules = append(m.Rules[:0], dAtA[iNdEx:postIndex]...) + if m.Rules == nil { + m.Rules = []byte{} } iNdEx = postIndex default: