diff --git a/api/cosmos/authz/v1beta1/authz.pulsar.go b/api/cosmos/authz/v1beta1/authz.pulsar.go index 42424dd25f4f..865fe2408dc3 100644 --- a/api/cosmos/authz/v1beta1/authz.pulsar.go +++ b/api/cosmos/authz/v1beta1/authz.pulsar.go @@ -438,6 +438,57 @@ func (x *fastReflection_GenericAuthorization) ProtoMethods() *protoiface.Methods } } +var _ protoreflect.List = (*_Grant_3_list)(nil) + +type _Grant_3_list struct { + list *[]*Rule +} + +func (x *_Grant_3_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_Grant_3_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_Grant_3_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Rule) + (*x.list)[i] = concreteValue +} + +func (x *_Grant_3_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Rule) + *x.list = append(*x.list, concreteValue) +} + +func (x *_Grant_3_list) AppendMutable() protoreflect.Value { + v := new(Rule) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_Grant_3_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_Grant_3_list) NewElement() protoreflect.Value { + v := new(Rule) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_Grant_3_list) IsValid() bool { + return x.list != nil +} + var ( md_Grant protoreflect.MessageDescriptor fd_Grant_authorization protoreflect.FieldDescriptor @@ -531,7 +582,7 @@ func (x *fastReflection_Grant) Range(f func(protoreflect.FieldDescriptor, protor } } if len(x.Rules) != 0 { - value := protoreflect.ValueOfBytes(x.Rules) + value := protoreflect.ValueOfList(&_Grant_3_list{list: &x.Rules}) if !f(fd_Grant_rules, value) { return } @@ -602,8 +653,11 @@ func (x *fastReflection_Grant) Get(descriptor protoreflect.FieldDescriptor) prot value := x.Expiration return protoreflect.ValueOfMessage(value.ProtoReflect()) case "cosmos.authz.v1beta1.Grant.rules": - value := x.Rules - return protoreflect.ValueOfBytes(value) + if len(x.Rules) == 0 { + return protoreflect.ValueOfList(&_Grant_3_list{}) + } + listValue := &_Grant_3_list{list: &x.Rules} + return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.Grant")) @@ -629,7 +683,9 @@ func (x *fastReflection_Grant) Set(fd protoreflect.FieldDescriptor, value protor case "cosmos.authz.v1beta1.Grant.expiration": x.Expiration = value.Message().Interface().(*timestamppb.Timestamp) case "cosmos.authz.v1beta1.Grant.rules": - x.Rules = value.Bytes() + lv := value.List() + clv := lv.(*_Grant_3_list) + x.Rules = *clv.list default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.Grant")) @@ -661,7 +717,11 @@ func (x *fastReflection_Grant) Mutable(fd protoreflect.FieldDescriptor) protoref } return protoreflect.ValueOfMessage(x.Expiration.ProtoReflect()) case "cosmos.authz.v1beta1.Grant.rules": - panic(fmt.Errorf("field rules of message cosmos.authz.v1beta1.Grant is not mutable")) + if x.Rules == nil { + x.Rules = []*Rule{} + } + value := &_Grant_3_list{list: &x.Rules} + return protoreflect.ValueOfList(value) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.Grant")) @@ -682,7 +742,8 @@ func (x *fastReflection_Grant) NewField(fd protoreflect.FieldDescriptor) protore m := new(timestamppb.Timestamp) return protoreflect.ValueOfMessage(m.ProtoReflect()) case "cosmos.authz.v1beta1.Grant.rules": - return protoreflect.ValueOfBytes(nil) + list := []*Rule{} + return protoreflect.ValueOfList(&_Grant_3_list{list: &list}) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.Grant")) @@ -760,9 +821,11 @@ func (x *fastReflection_Grant) ProtoMethods() *protoiface.Methods { l = options.Size(x.Expiration) n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.Rules) - if l > 0 { - 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)) + } } if x.unknownFields != nil { n += len(x.unknownFields) @@ -794,11 +857,20 @@ func (x *fastReflection_Grant) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], x.unknownFields) } if len(x.Rules) > 0 { - i -= len(x.Rules) - copy(dAtA[i:], x.Rules) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Rules))) - i-- - dAtA[i] = 0x1a + 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] = 0x1a + } } if x.Expiration != nil { encoded, err := options.Marshal(x.Expiration) @@ -953,7 +1025,7 @@ func (x *fastReflection_Grant) 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 byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -963,24 +1035,24 @@ func (x *fastReflection_Grant) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + byteLen + 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 } - x.Rules = append(x.Rules[:0], dAtA[iNdEx:postIndex]...) - if x.Rules == nil { - x.Rules = []byte{} + 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 } iNdEx = postIndex default: @@ -1018,32 +1090,74 @@ func (x *fastReflection_Grant) ProtoMethods() *protoiface.Methods { } } +var _ protoreflect.List = (*_Rule_2_list)(nil) + +type _Rule_2_list struct { + list *[]string +} + +func (x *_Rule_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_Rule_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfString((*x.list)[i]) +} + +func (x *_Rule_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_Rule_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_Rule_2_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message Rule at list field Values as it is not of Message kind")) +} + +func (x *_Rule_2_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_Rule_2_list) NewElement() protoreflect.Value { + v := "" + return protoreflect.ValueOfString(v) +} + +func (x *_Rule_2_list) IsValid() bool { + return x.list != nil +} + var ( - md_GrantAuthorization protoreflect.MessageDescriptor - fd_GrantAuthorization_granter protoreflect.FieldDescriptor - fd_GrantAuthorization_grantee protoreflect.FieldDescriptor - fd_GrantAuthorization_authorization protoreflect.FieldDescriptor - fd_GrantAuthorization_expiration protoreflect.FieldDescriptor + md_Rule protoreflect.MessageDescriptor + fd_Rule_key protoreflect.FieldDescriptor + fd_Rule_values protoreflect.FieldDescriptor ) func init() { file_cosmos_authz_v1beta1_authz_proto_init() - md_GrantAuthorization = File_cosmos_authz_v1beta1_authz_proto.Messages().ByName("GrantAuthorization") - fd_GrantAuthorization_granter = md_GrantAuthorization.Fields().ByName("granter") - fd_GrantAuthorization_grantee = md_GrantAuthorization.Fields().ByName("grantee") - fd_GrantAuthorization_authorization = md_GrantAuthorization.Fields().ByName("authorization") - fd_GrantAuthorization_expiration = md_GrantAuthorization.Fields().ByName("expiration") + md_Rule = File_cosmos_authz_v1beta1_authz_proto.Messages().ByName("Rule") + fd_Rule_key = md_Rule.Fields().ByName("key") + fd_Rule_values = md_Rule.Fields().ByName("values") } -var _ protoreflect.Message = (*fastReflection_GrantAuthorization)(nil) +var _ protoreflect.Message = (*fastReflection_Rule)(nil) -type fastReflection_GrantAuthorization GrantAuthorization +type fastReflection_Rule Rule -func (x *GrantAuthorization) ProtoReflect() protoreflect.Message { - return (*fastReflection_GrantAuthorization)(x) +func (x *Rule) ProtoReflect() protoreflect.Message { + return (*fastReflection_Rule)(x) } -func (x *GrantAuthorization) slowProtoReflect() protoreflect.Message { +func (x *Rule) slowProtoReflect() protoreflect.Message { mi := &file_cosmos_authz_v1beta1_authz_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1055,43 +1169,43 @@ func (x *GrantAuthorization) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_GrantAuthorization_messageType fastReflection_GrantAuthorization_messageType -var _ protoreflect.MessageType = fastReflection_GrantAuthorization_messageType{} +var _fastReflection_Rule_messageType fastReflection_Rule_messageType +var _ protoreflect.MessageType = fastReflection_Rule_messageType{} -type fastReflection_GrantAuthorization_messageType struct{} +type fastReflection_Rule_messageType struct{} -func (x fastReflection_GrantAuthorization_messageType) Zero() protoreflect.Message { - return (*fastReflection_GrantAuthorization)(nil) +func (x fastReflection_Rule_messageType) Zero() protoreflect.Message { + return (*fastReflection_Rule)(nil) } -func (x fastReflection_GrantAuthorization_messageType) New() protoreflect.Message { - return new(fastReflection_GrantAuthorization) +func (x fastReflection_Rule_messageType) New() protoreflect.Message { + return new(fastReflection_Rule) } -func (x fastReflection_GrantAuthorization_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GrantAuthorization +func (x fastReflection_Rule_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Rule } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_GrantAuthorization) Descriptor() protoreflect.MessageDescriptor { - return md_GrantAuthorization +func (x *fastReflection_Rule) Descriptor() protoreflect.MessageDescriptor { + return md_Rule } // 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_GrantAuthorization) Type() protoreflect.MessageType { - return _fastReflection_GrantAuthorization_messageType +func (x *fastReflection_Rule) Type() protoreflect.MessageType { + return _fastReflection_Rule_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_GrantAuthorization) New() protoreflect.Message { - return new(fastReflection_GrantAuthorization) +func (x *fastReflection_Rule) New() protoreflect.Message { + return new(fastReflection_Rule) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_GrantAuthorization) Interface() protoreflect.ProtoMessage { - return (*GrantAuthorization)(x) +func (x *fastReflection_Rule) Interface() protoreflect.ProtoMessage { + return (*Rule)(x) } // Range iterates over every populated field in an undefined order, @@ -1099,28 +1213,16 @@ func (x *fastReflection_GrantAuthorization) Interface() protoreflect.ProtoMessag // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_GrantAuthorization) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Granter != "" { - value := protoreflect.ValueOfString(x.Granter) - if !f(fd_GrantAuthorization_granter, value) { - return - } - } - if x.Grantee != "" { - value := protoreflect.ValueOfString(x.Grantee) - if !f(fd_GrantAuthorization_grantee, value) { - return - } - } - if x.Authorization != nil { - value := protoreflect.ValueOfMessage(x.Authorization.ProtoReflect()) - if !f(fd_GrantAuthorization_authorization, value) { +func (x *fastReflection_Rule) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Key != "" { + value := protoreflect.ValueOfString(x.Key) + if !f(fd_Rule_key, value) { return } } - if x.Expiration != nil { - value := protoreflect.ValueOfMessage(x.Expiration.ProtoReflect()) - if !f(fd_GrantAuthorization_expiration, value) { + if len(x.Values) != 0 { + value := protoreflect.ValueOfList(&_Rule_2_list{list: &x.Values}) + if !f(fd_Rule_values, value) { return } } @@ -1137,21 +1239,17 @@ func (x *fastReflection_GrantAuthorization) Range(f func(protoreflect.FieldDescr // 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_GrantAuthorization) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_Rule) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "cosmos.authz.v1beta1.GrantAuthorization.granter": - return x.Granter != "" - case "cosmos.authz.v1beta1.GrantAuthorization.grantee": - return x.Grantee != "" - case "cosmos.authz.v1beta1.GrantAuthorization.authorization": - return x.Authorization != nil - case "cosmos.authz.v1beta1.GrantAuthorization.expiration": - return x.Expiration != nil + case "cosmos.authz.v1beta1.Rule.key": + return x.Key != "" + case "cosmos.authz.v1beta1.Rule.values": + return len(x.Values) != 0 default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantAuthorization")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.Rule")) } - panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantAuthorization does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.authz.v1beta1.Rule does not contain field %s", fd.FullName())) } } @@ -1161,21 +1259,17 @@ func (x *fastReflection_GrantAuthorization) Has(fd protoreflect.FieldDescriptor) // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GrantAuthorization) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_Rule) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "cosmos.authz.v1beta1.GrantAuthorization.granter": - x.Granter = "" - case "cosmos.authz.v1beta1.GrantAuthorization.grantee": - x.Grantee = "" - case "cosmos.authz.v1beta1.GrantAuthorization.authorization": - x.Authorization = nil - case "cosmos.authz.v1beta1.GrantAuthorization.expiration": - x.Expiration = nil + case "cosmos.authz.v1beta1.Rule.key": + x.Key = "" + case "cosmos.authz.v1beta1.Rule.values": + x.Values = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantAuthorization")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.Rule")) } - panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantAuthorization does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.authz.v1beta1.Rule does not contain field %s", fd.FullName())) } } @@ -1185,25 +1279,22 @@ func (x *fastReflection_GrantAuthorization) Clear(fd protoreflect.FieldDescripto // 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_GrantAuthorization) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_Rule) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "cosmos.authz.v1beta1.GrantAuthorization.granter": - value := x.Granter - return protoreflect.ValueOfString(value) - case "cosmos.authz.v1beta1.GrantAuthorization.grantee": - value := x.Grantee + case "cosmos.authz.v1beta1.Rule.key": + value := x.Key return protoreflect.ValueOfString(value) - case "cosmos.authz.v1beta1.GrantAuthorization.authorization": - value := x.Authorization - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "cosmos.authz.v1beta1.GrantAuthorization.expiration": - value := x.Expiration - return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "cosmos.authz.v1beta1.Rule.values": + if len(x.Values) == 0 { + return protoreflect.ValueOfList(&_Rule_2_list{}) + } + listValue := &_Rule_2_list{list: &x.Values} + return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantAuthorization")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.Rule")) } - panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantAuthorization does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message cosmos.authz.v1beta1.Rule does not contain field %s", descriptor.FullName())) } } @@ -1217,21 +1308,19 @@ func (x *fastReflection_GrantAuthorization) Get(descriptor protoreflect.FieldDes // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GrantAuthorization) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_Rule) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "cosmos.authz.v1beta1.GrantAuthorization.granter": - x.Granter = value.Interface().(string) - case "cosmos.authz.v1beta1.GrantAuthorization.grantee": - x.Grantee = value.Interface().(string) - case "cosmos.authz.v1beta1.GrantAuthorization.authorization": - x.Authorization = value.Message().Interface().(*anypb.Any) - case "cosmos.authz.v1beta1.GrantAuthorization.expiration": - x.Expiration = value.Message().Interface().(*timestamppb.Timestamp) + case "cosmos.authz.v1beta1.Rule.key": + x.Key = value.Interface().(string) + case "cosmos.authz.v1beta1.Rule.values": + lv := value.List() + clv := lv.(*_Rule_2_list) + x.Values = *clv.list default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantAuthorization")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.Rule")) } - panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantAuthorization does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.authz.v1beta1.Rule does not contain field %s", fd.FullName())) } } @@ -1245,60 +1334,49 @@ func (x *fastReflection_GrantAuthorization) Set(fd protoreflect.FieldDescriptor, // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GrantAuthorization) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_Rule) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "cosmos.authz.v1beta1.GrantAuthorization.authorization": - if x.Authorization == nil { - x.Authorization = new(anypb.Any) - } - return protoreflect.ValueOfMessage(x.Authorization.ProtoReflect()) - case "cosmos.authz.v1beta1.GrantAuthorization.expiration": - if x.Expiration == nil { - x.Expiration = new(timestamppb.Timestamp) + case "cosmos.authz.v1beta1.Rule.values": + if x.Values == nil { + x.Values = []string{} } - return protoreflect.ValueOfMessage(x.Expiration.ProtoReflect()) - case "cosmos.authz.v1beta1.GrantAuthorization.granter": - panic(fmt.Errorf("field granter of message cosmos.authz.v1beta1.GrantAuthorization is not mutable")) - case "cosmos.authz.v1beta1.GrantAuthorization.grantee": - panic(fmt.Errorf("field grantee of message cosmos.authz.v1beta1.GrantAuthorization is not mutable")) + value := &_Rule_2_list{list: &x.Values} + return protoreflect.ValueOfList(value) + case "cosmos.authz.v1beta1.Rule.key": + panic(fmt.Errorf("field key of message cosmos.authz.v1beta1.Rule is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantAuthorization")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.Rule")) } - panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantAuthorization does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.authz.v1beta1.Rule 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_GrantAuthorization) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_Rule) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "cosmos.authz.v1beta1.GrantAuthorization.granter": - return protoreflect.ValueOfString("") - case "cosmos.authz.v1beta1.GrantAuthorization.grantee": + case "cosmos.authz.v1beta1.Rule.key": return protoreflect.ValueOfString("") - case "cosmos.authz.v1beta1.GrantAuthorization.authorization": - m := new(anypb.Any) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "cosmos.authz.v1beta1.GrantAuthorization.expiration": - m := new(timestamppb.Timestamp) - return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "cosmos.authz.v1beta1.Rule.values": + list := []string{} + return protoreflect.ValueOfList(&_Rule_2_list{list: &list}) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantAuthorization")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.Rule")) } - panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantAuthorization does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.authz.v1beta1.Rule 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_GrantAuthorization) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_Rule) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in cosmos.authz.v1beta1.GrantAuthorization", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in cosmos.authz.v1beta1.Rule", d.FullName())) } panic("unreachable") } @@ -1306,7 +1384,7 @@ func (x *fastReflection_GrantAuthorization) WhichOneof(d protoreflect.OneofDescr // 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_GrantAuthorization) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_Rule) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -1317,7 +1395,7 @@ func (x *fastReflection_GrantAuthorization) GetUnknown() protoreflect.RawFields // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GrantAuthorization) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_Rule) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -1329,7 +1407,7 @@ func (x *fastReflection_GrantAuthorization) SetUnknown(fields protoreflect.RawFi // 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_GrantAuthorization) IsValid() bool { +func (x *fastReflection_Rule) IsValid() bool { return x != nil } @@ -1339,9 +1417,9 @@ func (x *fastReflection_GrantAuthorization) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_GrantAuthorization) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_Rule) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GrantAuthorization) + x := input.Message.Interface().(*Rule) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1353,21 +1431,15 @@ func (x *fastReflection_GrantAuthorization) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - l = len(x.Granter) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.Grantee) + l = len(x.Key) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - if x.Authorization != nil { - l = options.Size(x.Authorization) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.Expiration != nil { - l = options.Size(x.Expiration) - n += 1 + l + runtime.Sov(uint64(l)) + if len(x.Values) > 0 { + for _, s := range x.Values { + l = len(s) + n += 1 + l + runtime.Sov(uint64(l)) + } } if x.unknownFields != nil { n += len(x.unknownFields) @@ -1379,7 +1451,7 @@ func (x *fastReflection_GrantAuthorization) ProtoMethods() *protoiface.Methods { } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*GrantAuthorization) + x := input.Message.Interface().(*Rule) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1398,47 +1470,21 @@ func (x *fastReflection_GrantAuthorization) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.Expiration != nil { - encoded, err := options.Marshal(x.Expiration) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err + if len(x.Values) > 0 { + for iNdEx := len(x.Values) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.Values[iNdEx]) + copy(dAtA[i:], x.Values[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Values[iNdEx]))) + i-- + dAtA[i] = 0x12 } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + } + if len(x.Key) > 0 { + i -= len(x.Key) + copy(dAtA[i:], x.Key) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Key))) i-- - dAtA[i] = 0x22 - } - if x.Authorization != nil { - encoded, err := options.Marshal(x.Authorization) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x1a - } - if len(x.Grantee) > 0 { - i -= len(x.Grantee) - copy(dAtA[i:], x.Grantee) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Grantee))) - i-- - dAtA[i] = 0x12 - } - if len(x.Granter) > 0 { - i -= len(x.Granter) - copy(dAtA[i:], x.Granter) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Granter))) - i-- - dAtA[i] = 0xa + dAtA[i] = 0xa } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -1451,7 +1497,7 @@ func (x *fastReflection_GrantAuthorization) ProtoMethods() *protoiface.Methods { }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GrantAuthorization) + x := input.Message.Interface().(*Rule) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1483,15 +1529,15 @@ func (x *fastReflection_GrantAuthorization) ProtoMethods() *protoiface.Methods { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GrantAuthorization: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Rule: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GrantAuthorization: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Rule: 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 Granter", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1519,11 +1565,11 @@ func (x *fastReflection_GrantAuthorization) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Granter = string(dAtA[iNdEx:postIndex]) + x.Key = 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 Grantee", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1551,79 +1597,7 @@ func (x *fastReflection_GrantAuthorization) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Grantee = 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 Authorization", 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.Authorization == nil { - x.Authorization = &anypb.Any{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Authorization); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Expiration", 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.Expiration == nil { - x.Expiration = ×tamppb.Timestamp{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Expiration); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } + x.Values = append(x.Values, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -1660,72 +1634,32 @@ func (x *fastReflection_GrantAuthorization) ProtoMethods() *protoiface.Methods { } } -var _ protoreflect.List = (*_GrantQueueItem_1_list)(nil) - -type _GrantQueueItem_1_list struct { - list *[]string -} - -func (x *_GrantQueueItem_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_GrantQueueItem_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfString((*x.list)[i]) -} - -func (x *_GrantQueueItem_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - (*x.list)[i] = concreteValue -} - -func (x *_GrantQueueItem_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - *x.list = append(*x.list, concreteValue) -} - -func (x *_GrantQueueItem_1_list) AppendMutable() protoreflect.Value { - panic(fmt.Errorf("AppendMutable can not be called on message GrantQueueItem at list field MsgTypeUrls as it is not of Message kind")) -} - -func (x *_GrantQueueItem_1_list) Truncate(n int) { - *x.list = (*x.list)[:n] -} - -func (x *_GrantQueueItem_1_list) NewElement() protoreflect.Value { - v := "" - return protoreflect.ValueOfString(v) -} - -func (x *_GrantQueueItem_1_list) IsValid() bool { - return x.list != nil -} - var ( - md_GrantQueueItem protoreflect.MessageDescriptor - fd_GrantQueueItem_msg_type_urls protoreflect.FieldDescriptor + md_GrantAuthorization protoreflect.MessageDescriptor + fd_GrantAuthorization_granter protoreflect.FieldDescriptor + fd_GrantAuthorization_grantee protoreflect.FieldDescriptor + fd_GrantAuthorization_authorization protoreflect.FieldDescriptor + fd_GrantAuthorization_expiration protoreflect.FieldDescriptor ) func init() { file_cosmos_authz_v1beta1_authz_proto_init() - md_GrantQueueItem = File_cosmos_authz_v1beta1_authz_proto.Messages().ByName("GrantQueueItem") - fd_GrantQueueItem_msg_type_urls = md_GrantQueueItem.Fields().ByName("msg_type_urls") + md_GrantAuthorization = File_cosmos_authz_v1beta1_authz_proto.Messages().ByName("GrantAuthorization") + fd_GrantAuthorization_granter = md_GrantAuthorization.Fields().ByName("granter") + fd_GrantAuthorization_grantee = md_GrantAuthorization.Fields().ByName("grantee") + fd_GrantAuthorization_authorization = md_GrantAuthorization.Fields().ByName("authorization") + fd_GrantAuthorization_expiration = md_GrantAuthorization.Fields().ByName("expiration") } -var _ protoreflect.Message = (*fastReflection_GrantQueueItem)(nil) +var _ protoreflect.Message = (*fastReflection_GrantAuthorization)(nil) -type fastReflection_GrantQueueItem GrantQueueItem +type fastReflection_GrantAuthorization GrantAuthorization -func (x *GrantQueueItem) ProtoReflect() protoreflect.Message { - return (*fastReflection_GrantQueueItem)(x) +func (x *GrantAuthorization) ProtoReflect() protoreflect.Message { + return (*fastReflection_GrantAuthorization)(x) } -func (x *GrantQueueItem) slowProtoReflect() protoreflect.Message { +func (x *GrantAuthorization) slowProtoReflect() protoreflect.Message { mi := &file_cosmos_authz_v1beta1_authz_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1737,43 +1671,43 @@ func (x *GrantQueueItem) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_GrantQueueItem_messageType fastReflection_GrantQueueItem_messageType -var _ protoreflect.MessageType = fastReflection_GrantQueueItem_messageType{} +var _fastReflection_GrantAuthorization_messageType fastReflection_GrantAuthorization_messageType +var _ protoreflect.MessageType = fastReflection_GrantAuthorization_messageType{} -type fastReflection_GrantQueueItem_messageType struct{} +type fastReflection_GrantAuthorization_messageType struct{} -func (x fastReflection_GrantQueueItem_messageType) Zero() protoreflect.Message { - return (*fastReflection_GrantQueueItem)(nil) +func (x fastReflection_GrantAuthorization_messageType) Zero() protoreflect.Message { + return (*fastReflection_GrantAuthorization)(nil) } -func (x fastReflection_GrantQueueItem_messageType) New() protoreflect.Message { - return new(fastReflection_GrantQueueItem) +func (x fastReflection_GrantAuthorization_messageType) New() protoreflect.Message { + return new(fastReflection_GrantAuthorization) } -func (x fastReflection_GrantQueueItem_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GrantQueueItem +func (x fastReflection_GrantAuthorization_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_GrantAuthorization } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_GrantQueueItem) Descriptor() protoreflect.MessageDescriptor { - return md_GrantQueueItem +func (x *fastReflection_GrantAuthorization) Descriptor() protoreflect.MessageDescriptor { + return md_GrantAuthorization } // 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_GrantQueueItem) Type() protoreflect.MessageType { - return _fastReflection_GrantQueueItem_messageType +func (x *fastReflection_GrantAuthorization) Type() protoreflect.MessageType { + return _fastReflection_GrantAuthorization_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_GrantQueueItem) New() protoreflect.Message { - return new(fastReflection_GrantQueueItem) +func (x *fastReflection_GrantAuthorization) New() protoreflect.Message { + return new(fastReflection_GrantAuthorization) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_GrantQueueItem) Interface() protoreflect.ProtoMessage { - return (*GrantQueueItem)(x) +func (x *fastReflection_GrantAuthorization) Interface() protoreflect.ProtoMessage { + return (*GrantAuthorization)(x) } // Range iterates over every populated field in an undefined order, @@ -1781,10 +1715,28 @@ func (x *fastReflection_GrantQueueItem) Interface() protoreflect.ProtoMessage { // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_GrantQueueItem) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.MsgTypeUrls) != 0 { - value := protoreflect.ValueOfList(&_GrantQueueItem_1_list{list: &x.MsgTypeUrls}) - if !f(fd_GrantQueueItem_msg_type_urls, value) { +func (x *fastReflection_GrantAuthorization) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Granter != "" { + value := protoreflect.ValueOfString(x.Granter) + if !f(fd_GrantAuthorization_granter, value) { + return + } + } + if x.Grantee != "" { + value := protoreflect.ValueOfString(x.Grantee) + if !f(fd_GrantAuthorization_grantee, value) { + return + } + } + if x.Authorization != nil { + value := protoreflect.ValueOfMessage(x.Authorization.ProtoReflect()) + if !f(fd_GrantAuthorization_authorization, value) { + return + } + } + if x.Expiration != nil { + value := protoreflect.ValueOfMessage(x.Expiration.ProtoReflect()) + if !f(fd_GrantAuthorization_expiration, value) { return } } @@ -1801,15 +1753,21 @@ func (x *fastReflection_GrantQueueItem) Range(f func(protoreflect.FieldDescripto // 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_GrantQueueItem) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_GrantAuthorization) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "cosmos.authz.v1beta1.GrantQueueItem.msg_type_urls": - return len(x.MsgTypeUrls) != 0 + case "cosmos.authz.v1beta1.GrantAuthorization.granter": + return x.Granter != "" + case "cosmos.authz.v1beta1.GrantAuthorization.grantee": + return x.Grantee != "" + case "cosmos.authz.v1beta1.GrantAuthorization.authorization": + return x.Authorization != nil + case "cosmos.authz.v1beta1.GrantAuthorization.expiration": + return x.Expiration != nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantQueueItem")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantAuthorization")) } - panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantQueueItem does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantAuthorization does not contain field %s", fd.FullName())) } } @@ -1819,15 +1777,21 @@ func (x *fastReflection_GrantQueueItem) Has(fd protoreflect.FieldDescriptor) boo // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GrantQueueItem) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_GrantAuthorization) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "cosmos.authz.v1beta1.GrantQueueItem.msg_type_urls": - x.MsgTypeUrls = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantQueueItem")) - } - panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantQueueItem does not contain field %s", fd.FullName())) + case "cosmos.authz.v1beta1.GrantAuthorization.granter": + x.Granter = "" + case "cosmos.authz.v1beta1.GrantAuthorization.grantee": + x.Grantee = "" + case "cosmos.authz.v1beta1.GrantAuthorization.authorization": + x.Authorization = nil + case "cosmos.authz.v1beta1.GrantAuthorization.expiration": + x.Expiration = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantAuthorization")) + } + panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantAuthorization does not contain field %s", fd.FullName())) } } @@ -1837,19 +1801,25 @@ func (x *fastReflection_GrantQueueItem) Clear(fd protoreflect.FieldDescriptor) { // 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_GrantQueueItem) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_GrantAuthorization) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "cosmos.authz.v1beta1.GrantQueueItem.msg_type_urls": - if len(x.MsgTypeUrls) == 0 { - return protoreflect.ValueOfList(&_GrantQueueItem_1_list{}) - } - listValue := &_GrantQueueItem_1_list{list: &x.MsgTypeUrls} - return protoreflect.ValueOfList(listValue) + case "cosmos.authz.v1beta1.GrantAuthorization.granter": + value := x.Granter + return protoreflect.ValueOfString(value) + case "cosmos.authz.v1beta1.GrantAuthorization.grantee": + value := x.Grantee + return protoreflect.ValueOfString(value) + case "cosmos.authz.v1beta1.GrantAuthorization.authorization": + value := x.Authorization + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "cosmos.authz.v1beta1.GrantAuthorization.expiration": + value := x.Expiration + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantQueueItem")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantAuthorization")) } - panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantQueueItem does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantAuthorization does not contain field %s", descriptor.FullName())) } } @@ -1863,17 +1833,21 @@ func (x *fastReflection_GrantQueueItem) Get(descriptor protoreflect.FieldDescrip // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GrantQueueItem) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_GrantAuthorization) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "cosmos.authz.v1beta1.GrantQueueItem.msg_type_urls": - lv := value.List() - clv := lv.(*_GrantQueueItem_1_list) - x.MsgTypeUrls = *clv.list + case "cosmos.authz.v1beta1.GrantAuthorization.granter": + x.Granter = value.Interface().(string) + case "cosmos.authz.v1beta1.GrantAuthorization.grantee": + x.Grantee = value.Interface().(string) + case "cosmos.authz.v1beta1.GrantAuthorization.authorization": + x.Authorization = value.Message().Interface().(*anypb.Any) + case "cosmos.authz.v1beta1.GrantAuthorization.expiration": + x.Expiration = value.Message().Interface().(*timestamppb.Timestamp) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantQueueItem")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantAuthorization")) } - panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantQueueItem does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantAuthorization does not contain field %s", fd.FullName())) } } @@ -1887,45 +1861,60 @@ func (x *fastReflection_GrantQueueItem) Set(fd protoreflect.FieldDescriptor, val // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GrantQueueItem) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_GrantAuthorization) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "cosmos.authz.v1beta1.GrantQueueItem.msg_type_urls": - if x.MsgTypeUrls == nil { - x.MsgTypeUrls = []string{} + case "cosmos.authz.v1beta1.GrantAuthorization.authorization": + if x.Authorization == nil { + x.Authorization = new(anypb.Any) } - value := &_GrantQueueItem_1_list{list: &x.MsgTypeUrls} - return protoreflect.ValueOfList(value) + return protoreflect.ValueOfMessage(x.Authorization.ProtoReflect()) + case "cosmos.authz.v1beta1.GrantAuthorization.expiration": + if x.Expiration == nil { + x.Expiration = new(timestamppb.Timestamp) + } + return protoreflect.ValueOfMessage(x.Expiration.ProtoReflect()) + case "cosmos.authz.v1beta1.GrantAuthorization.granter": + panic(fmt.Errorf("field granter of message cosmos.authz.v1beta1.GrantAuthorization is not mutable")) + case "cosmos.authz.v1beta1.GrantAuthorization.grantee": + panic(fmt.Errorf("field grantee of message cosmos.authz.v1beta1.GrantAuthorization is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantQueueItem")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantAuthorization")) } - panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantQueueItem does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantAuthorization 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_GrantQueueItem) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_GrantAuthorization) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "cosmos.authz.v1beta1.GrantQueueItem.msg_type_urls": - list := []string{} - return protoreflect.ValueOfList(&_GrantQueueItem_1_list{list: &list}) + case "cosmos.authz.v1beta1.GrantAuthorization.granter": + return protoreflect.ValueOfString("") + case "cosmos.authz.v1beta1.GrantAuthorization.grantee": + return protoreflect.ValueOfString("") + case "cosmos.authz.v1beta1.GrantAuthorization.authorization": + m := new(anypb.Any) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "cosmos.authz.v1beta1.GrantAuthorization.expiration": + m := new(timestamppb.Timestamp) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantQueueItem")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantAuthorization")) } - panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantQueueItem does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantAuthorization 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_GrantQueueItem) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_GrantAuthorization) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in cosmos.authz.v1beta1.GrantQueueItem", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in cosmos.authz.v1beta1.GrantAuthorization", d.FullName())) } panic("unreachable") } @@ -1933,7 +1922,7 @@ func (x *fastReflection_GrantQueueItem) WhichOneof(d protoreflect.OneofDescripto // 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_GrantQueueItem) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_GrantAuthorization) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -1944,7 +1933,7 @@ func (x *fastReflection_GrantQueueItem) GetUnknown() protoreflect.RawFields { // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GrantQueueItem) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_GrantAuthorization) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -1956,7 +1945,7 @@ func (x *fastReflection_GrantQueueItem) SetUnknown(fields protoreflect.RawFields // 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_GrantQueueItem) IsValid() bool { +func (x *fastReflection_GrantAuthorization) IsValid() bool { return x != nil } @@ -1966,9 +1955,9 @@ func (x *fastReflection_GrantQueueItem) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_GrantQueueItem) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_GrantAuthorization) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GrantQueueItem) + x := input.Message.Interface().(*GrantAuthorization) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1980,11 +1969,21 @@ func (x *fastReflection_GrantQueueItem) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - if len(x.MsgTypeUrls) > 0 { - for _, s := range x.MsgTypeUrls { - l = len(s) - n += 1 + l + runtime.Sov(uint64(l)) - } + l = len(x.Granter) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Grantee) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Authorization != nil { + l = options.Size(x.Authorization) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Expiration != nil { + l = options.Size(x.Expiration) + n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { n += len(x.unknownFields) @@ -1996,7 +1995,7 @@ func (x *fastReflection_GrantQueueItem) ProtoMethods() *protoiface.Methods { } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*GrantQueueItem) + x := input.Message.Interface().(*GrantAuthorization) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2015,14 +2014,47 @@ func (x *fastReflection_GrantQueueItem) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.MsgTypeUrls) > 0 { - for iNdEx := len(x.MsgTypeUrls) - 1; iNdEx >= 0; iNdEx-- { - i -= len(x.MsgTypeUrls[iNdEx]) - copy(dAtA[i:], x.MsgTypeUrls[iNdEx]) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MsgTypeUrls[iNdEx]))) - i-- - dAtA[i] = 0xa + if x.Expiration != nil { + encoded, err := options.Marshal(x.Expiration) + 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 + } + if x.Authorization != nil { + encoded, err := options.Marshal(x.Authorization) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + if len(x.Grantee) > 0 { + i -= len(x.Grantee) + copy(dAtA[i:], x.Grantee) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Grantee))) + i-- + dAtA[i] = 0x12 + } + if len(x.Granter) > 0 { + i -= len(x.Granter) + copy(dAtA[i:], x.Granter) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Granter))) + i-- + dAtA[i] = 0xa } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -2035,7 +2067,7 @@ func (x *fastReflection_GrantQueueItem) ProtoMethods() *protoiface.Methods { }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GrantQueueItem) + x := input.Message.Interface().(*GrantAuthorization) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2063,21 +2095,121 @@ func (x *fastReflection_GrantQueueItem) ProtoMethods() *protoiface.Methods { 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: GrantQueueItem: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GrantQueueItem: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GrantAuthorization: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GrantAuthorization: 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 Granter", 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.Granter = 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 Grantee", 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.Grantee = 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 Authorization", 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.Authorization == nil { + x.Authorization = &anypb.Any{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Authorization); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 4: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrls", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Expiration", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -2087,23 +2219,27 @@ func (x *fastReflection_GrantQueueItem) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + intStringLen + 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 } - x.MsgTypeUrls = append(x.MsgTypeUrls, string(dAtA[iNdEx:postIndex])) + if x.Expiration == nil { + x.Expiration = ×tamppb.Timestamp{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Expiration); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } iNdEx = postIndex default: iNdEx = preIndex @@ -2140,26 +2276,72 @@ func (x *fastReflection_GrantQueueItem) ProtoMethods() *protoiface.Methods { } } +var _ protoreflect.List = (*_GrantQueueItem_1_list)(nil) + +type _GrantQueueItem_1_list struct { + list *[]string +} + +func (x *_GrantQueueItem_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_GrantQueueItem_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfString((*x.list)[i]) +} + +func (x *_GrantQueueItem_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_GrantQueueItem_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_GrantQueueItem_1_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message GrantQueueItem at list field MsgTypeUrls as it is not of Message kind")) +} + +func (x *_GrantQueueItem_1_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_GrantQueueItem_1_list) NewElement() protoreflect.Value { + v := "" + return protoreflect.ValueOfString(v) +} + +func (x *_GrantQueueItem_1_list) IsValid() bool { + return x.list != nil +} + var ( - md_AuthzRuleKeys protoreflect.MessageDescriptor - fd_AuthzRuleKeys_raw_json protoreflect.FieldDescriptor + md_GrantQueueItem protoreflect.MessageDescriptor + fd_GrantQueueItem_msg_type_urls protoreflect.FieldDescriptor ) func init() { file_cosmos_authz_v1beta1_authz_proto_init() - md_AuthzRuleKeys = File_cosmos_authz_v1beta1_authz_proto.Messages().ByName("AuthzRuleKeys") - fd_AuthzRuleKeys_raw_json = md_AuthzRuleKeys.Fields().ByName("raw_json") + md_GrantQueueItem = File_cosmos_authz_v1beta1_authz_proto.Messages().ByName("GrantQueueItem") + fd_GrantQueueItem_msg_type_urls = md_GrantQueueItem.Fields().ByName("msg_type_urls") } -var _ protoreflect.Message = (*fastReflection_AuthzRuleKeys)(nil) +var _ protoreflect.Message = (*fastReflection_GrantQueueItem)(nil) -type fastReflection_AuthzRuleKeys AuthzRuleKeys +type fastReflection_GrantQueueItem GrantQueueItem -func (x *AuthzRuleKeys) ProtoReflect() protoreflect.Message { - return (*fastReflection_AuthzRuleKeys)(x) +func (x *GrantQueueItem) ProtoReflect() protoreflect.Message { + return (*fastReflection_GrantQueueItem)(x) } -func (x *AuthzRuleKeys) slowProtoReflect() protoreflect.Message { +func (x *GrantQueueItem) slowProtoReflect() protoreflect.Message { mi := &file_cosmos_authz_v1beta1_authz_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2171,43 +2353,43 @@ func (x *AuthzRuleKeys) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_AuthzRuleKeys_messageType fastReflection_AuthzRuleKeys_messageType -var _ protoreflect.MessageType = fastReflection_AuthzRuleKeys_messageType{} +var _fastReflection_GrantQueueItem_messageType fastReflection_GrantQueueItem_messageType +var _ protoreflect.MessageType = fastReflection_GrantQueueItem_messageType{} -type fastReflection_AuthzRuleKeys_messageType struct{} +type fastReflection_GrantQueueItem_messageType struct{} -func (x fastReflection_AuthzRuleKeys_messageType) Zero() protoreflect.Message { - return (*fastReflection_AuthzRuleKeys)(nil) +func (x fastReflection_GrantQueueItem_messageType) Zero() protoreflect.Message { + return (*fastReflection_GrantQueueItem)(nil) } -func (x fastReflection_AuthzRuleKeys_messageType) New() protoreflect.Message { - return new(fastReflection_AuthzRuleKeys) +func (x fastReflection_GrantQueueItem_messageType) New() protoreflect.Message { + return new(fastReflection_GrantQueueItem) } -func (x fastReflection_AuthzRuleKeys_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_AuthzRuleKeys +func (x fastReflection_GrantQueueItem_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_GrantQueueItem } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_AuthzRuleKeys) Descriptor() protoreflect.MessageDescriptor { - return md_AuthzRuleKeys +func (x *fastReflection_GrantQueueItem) Descriptor() protoreflect.MessageDescriptor { + return md_GrantQueueItem } // 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_AuthzRuleKeys) Type() protoreflect.MessageType { - return _fastReflection_AuthzRuleKeys_messageType +func (x *fastReflection_GrantQueueItem) Type() protoreflect.MessageType { + return _fastReflection_GrantQueueItem_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_AuthzRuleKeys) New() protoreflect.Message { - return new(fastReflection_AuthzRuleKeys) +func (x *fastReflection_GrantQueueItem) New() protoreflect.Message { + return new(fastReflection_GrantQueueItem) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_AuthzRuleKeys) Interface() protoreflect.ProtoMessage { - return (*AuthzRuleKeys)(x) +func (x *fastReflection_GrantQueueItem) Interface() protoreflect.ProtoMessage { + return (*GrantQueueItem)(x) } // Range iterates over every populated field in an undefined order, @@ -2215,10 +2397,10 @@ func (x *fastReflection_AuthzRuleKeys) Interface() protoreflect.ProtoMessage { // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_AuthzRuleKeys) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.RawJson) != 0 { - value := protoreflect.ValueOfBytes(x.RawJson) - if !f(fd_AuthzRuleKeys_raw_json, value) { +func (x *fastReflection_GrantQueueItem) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.MsgTypeUrls) != 0 { + value := protoreflect.ValueOfList(&_GrantQueueItem_1_list{list: &x.MsgTypeUrls}) + if !f(fd_GrantQueueItem_msg_type_urls, value) { return } } @@ -2235,15 +2417,15 @@ func (x *fastReflection_AuthzRuleKeys) Range(f func(protoreflect.FieldDescriptor // 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_AuthzRuleKeys) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_GrantQueueItem) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "cosmos.authz.v1beta1.AuthzRuleKeys.raw_json": - return len(x.RawJson) != 0 + case "cosmos.authz.v1beta1.GrantQueueItem.msg_type_urls": + return len(x.MsgTypeUrls) != 0 default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.AuthzRuleKeys")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantQueueItem")) } - panic(fmt.Errorf("message cosmos.authz.v1beta1.AuthzRuleKeys does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantQueueItem does not contain field %s", fd.FullName())) } } @@ -2253,15 +2435,15 @@ func (x *fastReflection_AuthzRuleKeys) Has(fd protoreflect.FieldDescriptor) bool // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AuthzRuleKeys) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_GrantQueueItem) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "cosmos.authz.v1beta1.AuthzRuleKeys.raw_json": - x.RawJson = nil + case "cosmos.authz.v1beta1.GrantQueueItem.msg_type_urls": + x.MsgTypeUrls = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.AuthzRuleKeys")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantQueueItem")) } - panic(fmt.Errorf("message cosmos.authz.v1beta1.AuthzRuleKeys does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantQueueItem does not contain field %s", fd.FullName())) } } @@ -2271,16 +2453,19 @@ func (x *fastReflection_AuthzRuleKeys) Clear(fd protoreflect.FieldDescriptor) { // 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_AuthzRuleKeys) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_GrantQueueItem) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "cosmos.authz.v1beta1.AuthzRuleKeys.raw_json": - value := x.RawJson - return protoreflect.ValueOfBytes(value) + case "cosmos.authz.v1beta1.GrantQueueItem.msg_type_urls": + if len(x.MsgTypeUrls) == 0 { + return protoreflect.ValueOfList(&_GrantQueueItem_1_list{}) + } + listValue := &_GrantQueueItem_1_list{list: &x.MsgTypeUrls} + return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.AuthzRuleKeys")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantQueueItem")) } - panic(fmt.Errorf("message cosmos.authz.v1beta1.AuthzRuleKeys does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantQueueItem does not contain field %s", descriptor.FullName())) } } @@ -2294,15 +2479,17 @@ func (x *fastReflection_AuthzRuleKeys) Get(descriptor protoreflect.FieldDescript // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AuthzRuleKeys) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_GrantQueueItem) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "cosmos.authz.v1beta1.AuthzRuleKeys.raw_json": - x.RawJson = value.Bytes() + case "cosmos.authz.v1beta1.GrantQueueItem.msg_type_urls": + lv := value.List() + clv := lv.(*_GrantQueueItem_1_list) + x.MsgTypeUrls = *clv.list default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.AuthzRuleKeys")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantQueueItem")) } - panic(fmt.Errorf("message cosmos.authz.v1beta1.AuthzRuleKeys does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantQueueItem does not contain field %s", fd.FullName())) } } @@ -2316,40 +2503,45 @@ func (x *fastReflection_AuthzRuleKeys) Set(fd protoreflect.FieldDescriptor, valu // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AuthzRuleKeys) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_GrantQueueItem) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "cosmos.authz.v1beta1.AuthzRuleKeys.raw_json": - panic(fmt.Errorf("field raw_json of message cosmos.authz.v1beta1.AuthzRuleKeys is not mutable")) + case "cosmos.authz.v1beta1.GrantQueueItem.msg_type_urls": + if x.MsgTypeUrls == nil { + x.MsgTypeUrls = []string{} + } + value := &_GrantQueueItem_1_list{list: &x.MsgTypeUrls} + return protoreflect.ValueOfList(value) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.AuthzRuleKeys")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantQueueItem")) } - panic(fmt.Errorf("message cosmos.authz.v1beta1.AuthzRuleKeys does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantQueueItem 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_AuthzRuleKeys) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_GrantQueueItem) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "cosmos.authz.v1beta1.AuthzRuleKeys.raw_json": - return protoreflect.ValueOfBytes(nil) + case "cosmos.authz.v1beta1.GrantQueueItem.msg_type_urls": + list := []string{} + return protoreflect.ValueOfList(&_GrantQueueItem_1_list{list: &list}) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.AuthzRuleKeys")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.GrantQueueItem")) } - panic(fmt.Errorf("message cosmos.authz.v1beta1.AuthzRuleKeys does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.authz.v1beta1.GrantQueueItem 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_AuthzRuleKeys) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_GrantQueueItem) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in cosmos.authz.v1beta1.AuthzRuleKeys", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in cosmos.authz.v1beta1.GrantQueueItem", d.FullName())) } panic("unreachable") } @@ -2357,7 +2549,7 @@ func (x *fastReflection_AuthzRuleKeys) WhichOneof(d protoreflect.OneofDescriptor // 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_AuthzRuleKeys) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_GrantQueueItem) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -2368,7 +2560,7 @@ func (x *fastReflection_AuthzRuleKeys) GetUnknown() protoreflect.RawFields { // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AuthzRuleKeys) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_GrantQueueItem) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -2380,7 +2572,7 @@ func (x *fastReflection_AuthzRuleKeys) SetUnknown(fields protoreflect.RawFields) // 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_AuthzRuleKeys) IsValid() bool { +func (x *fastReflection_GrantQueueItem) IsValid() bool { return x != nil } @@ -2390,9 +2582,9 @@ func (x *fastReflection_AuthzRuleKeys) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_AuthzRuleKeys) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_GrantQueueItem) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*AuthzRuleKeys) + x := input.Message.Interface().(*GrantQueueItem) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2404,9 +2596,11 @@ func (x *fastReflection_AuthzRuleKeys) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - l = len(x.RawJson) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) + if len(x.MsgTypeUrls) > 0 { + for _, s := range x.MsgTypeUrls { + l = len(s) + n += 1 + l + runtime.Sov(uint64(l)) + } } if x.unknownFields != nil { n += len(x.unknownFields) @@ -2418,7 +2612,7 @@ func (x *fastReflection_AuthzRuleKeys) ProtoMethods() *protoiface.Methods { } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*AuthzRuleKeys) + x := input.Message.Interface().(*GrantQueueItem) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2437,12 +2631,14 @@ func (x *fastReflection_AuthzRuleKeys) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.RawJson) > 0 { - i -= len(x.RawJson) - copy(dAtA[i:], x.RawJson) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.RawJson))) - i-- - dAtA[i] = 0xa + if len(x.MsgTypeUrls) > 0 { + for iNdEx := len(x.MsgTypeUrls) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.MsgTypeUrls[iNdEx]) + copy(dAtA[i:], x.MsgTypeUrls[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MsgTypeUrls[iNdEx]))) + i-- + dAtA[i] = 0xa + } } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -2455,7 +2651,7 @@ func (x *fastReflection_AuthzRuleKeys) ProtoMethods() *protoiface.Methods { }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*AuthzRuleKeys) + x := input.Message.Interface().(*GrantQueueItem) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2487,17 +2683,17 @@ func (x *fastReflection_AuthzRuleKeys) ProtoMethods() *protoiface.Methods { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: AuthzRuleKeys: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GrantQueueItem: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: AuthzRuleKeys: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GrantQueueItem: 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 RawJson", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrls", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -2507,25 +2703,23 @@ func (x *fastReflection_AuthzRuleKeys) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + byteLen + 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.RawJson = append(x.RawJson[:0], dAtA[iNdEx:postIndex]...) - if x.RawJson == nil { - x.RawJson = []byte{} - } + x.MsgTypeUrls = append(x.MsgTypeUrls, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -2628,7 +2822,7 @@ type Grant struct { // may apply to invalidate the grant) Expiration *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=expiration,proto3" json:"expiration,omitempty"` // rules are conditions to execute the grant. - Rules []byte `protobuf:"bytes,3,opt,name=rules,proto3" json:"rules,omitempty"` + Rules []*Rule `protobuf:"bytes,3,rep,name=rules,proto3" json:"rules,omitempty"` } func (x *Grant) Reset() { @@ -2665,13 +2859,57 @@ func (x *Grant) GetExpiration() *timestamppb.Timestamp { return nil } -func (x *Grant) GetRules() []byte { +func (x *Grant) GetRules() []*Rule { if x != nil { return x.Rules } return nil } +// rules are conditions to execute the grant. +type Rule struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Values []string `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` +} + +func (x *Rule) Reset() { + *x = Rule{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_authz_v1beta1_authz_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Rule) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Rule) ProtoMessage() {} + +// Deprecated: Use Rule.ProtoReflect.Descriptor instead. +func (*Rule) Descriptor() ([]byte, []int) { + return file_cosmos_authz_v1beta1_authz_proto_rawDescGZIP(), []int{2} +} + +func (x *Rule) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *Rule) GetValues() []string { + if x != nil { + return x.Values + } + return nil +} + // GrantAuthorization extends a grant with both the addresses of the grantee and granter. // It is used in genesis.proto and query.proto type GrantAuthorization struct { @@ -2688,7 +2926,7 @@ type GrantAuthorization struct { func (x *GrantAuthorization) Reset() { *x = GrantAuthorization{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_authz_v1beta1_authz_proto_msgTypes[2] + mi := &file_cosmos_authz_v1beta1_authz_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2702,7 +2940,7 @@ func (*GrantAuthorization) ProtoMessage() {} // Deprecated: Use GrantAuthorization.ProtoReflect.Descriptor instead. func (*GrantAuthorization) Descriptor() ([]byte, []int) { - return file_cosmos_authz_v1beta1_authz_proto_rawDescGZIP(), []int{2} + return file_cosmos_authz_v1beta1_authz_proto_rawDescGZIP(), []int{3} } func (x *GrantAuthorization) GetGranter() string { @@ -2746,7 +2984,7 @@ type GrantQueueItem struct { func (x *GrantQueueItem) Reset() { *x = GrantQueueItem{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_authz_v1beta1_authz_proto_msgTypes[3] + mi := &file_cosmos_authz_v1beta1_authz_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2760,7 +2998,7 @@ func (*GrantQueueItem) ProtoMessage() {} // Deprecated: Use GrantQueueItem.ProtoReflect.Descriptor instead. func (*GrantQueueItem) Descriptor() ([]byte, []int) { - return file_cosmos_authz_v1beta1_authz_proto_rawDescGZIP(), []int{3} + return file_cosmos_authz_v1beta1_authz_proto_rawDescGZIP(), []int{4} } func (x *GrantQueueItem) GetMsgTypeUrls() []string { @@ -2770,42 +3008,6 @@ func (x *GrantQueueItem) GetMsgTypeUrls() []string { return nil } -// AuthzRuleKeys is app specific options to the keys -type AuthzRuleKeys struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RawJson []byte `protobuf:"bytes,1,opt,name=raw_json,json=rawJson,proto3" json:"raw_json,omitempty"` -} - -func (x *AuthzRuleKeys) Reset() { - *x = AuthzRuleKeys{} - if protoimpl.UnsafeEnabled { - mi := &file_cosmos_authz_v1beta1_authz_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthzRuleKeys) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthzRuleKeys) ProtoMessage() {} - -// Deprecated: Use AuthzRuleKeys.ProtoReflect.Descriptor instead. -func (*AuthzRuleKeys) Descriptor() ([]byte, []int) { - return file_cosmos_authz_v1beta1_authz_proto_rawDescGZIP(), []int{4} -} - -func (x *AuthzRuleKeys) GetRawJson() []byte { - if x != nil { - return x.RawJson - } - return nil -} - var File_cosmos_authz_v1beta1_authz_proto protoreflect.FileDescriptor var file_cosmos_authz_v1beta1_authz_proto_rawDesc = []byte{ @@ -2829,7 +3031,7 @@ var file_cosmos_authz_v1beta1_authz_proto_rawDesc = []byte{ 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x8a, 0xe7, 0xb0, 0x2a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, - 0x63, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xc7, + 0x63, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xe3, 0x01, 0x0a, 0x05, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x12, 0x62, 0x0a, 0x0d, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, @@ -2841,46 +3043,48 @@ var file_cosmos_authz_v1beta1_authz_proto_rawDesc = []byte{ 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x01, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x22, 0xa2, 0x02, 0x0a, 0x12, 0x47, 0x72, 0x61, - 0x6e, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 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, 0x62, 0x0a, 0x0d, 0x61, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 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, 0x26, 0xca, 0xb4, 0x2d, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x41, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x61, 0x75, - 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x40, 0x0a, 0x0a, 0x65, - 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x04, 0x90, 0xdf, 0x1f, - 0x01, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x34, 0x0a, - 0x0e, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x51, 0x75, 0x65, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x12, - 0x22, 0x0a, 0x0d, 0x6d, 0x73, 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x6d, 0x73, 0x67, 0x54, 0x79, 0x70, 0x65, 0x55, - 0x72, 0x6c, 0x73, 0x22, 0x2a, 0x0a, 0x0d, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x52, 0x75, 0x6c, 0x65, - 0x4b, 0x65, 0x79, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x61, 0x77, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x72, 0x61, 0x77, 0x4a, 0x73, 0x6f, 0x6e, 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, + 0x6f, 0x6e, 0x12, 0x30, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x03, 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, 0x22, 0x30, 0x0a, 0x04, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x16, + 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0xa2, 0x02, 0x0a, 0x12, 0x47, 0x72, 0x61, 0x6e, 0x74, + 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 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, 0x62, 0x0a, 0x0d, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 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, 0x26, 0xca, 0xb4, 0x2d, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x41, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x40, 0x0a, 0x0a, 0x65, 0x78, 0x70, + 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x04, 0x90, 0xdf, 0x1f, 0x01, 0x52, + 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x34, 0x0a, 0x0e, 0x47, + 0x72, 0x61, 0x6e, 0x74, 0x51, 0x75, 0x65, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x22, 0x0a, + 0x0d, 0x6d, 0x73, 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x6d, 0x73, 0x67, 0x54, 0x79, 0x70, 0x65, 0x55, 0x72, 0x6c, + 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, } var ( @@ -2899,22 +3103,23 @@ var file_cosmos_authz_v1beta1_authz_proto_msgTypes = make([]protoimpl.MessageInf var file_cosmos_authz_v1beta1_authz_proto_goTypes = []interface{}{ (*GenericAuthorization)(nil), // 0: cosmos.authz.v1beta1.GenericAuthorization (*Grant)(nil), // 1: cosmos.authz.v1beta1.Grant - (*GrantAuthorization)(nil), // 2: cosmos.authz.v1beta1.GrantAuthorization - (*GrantQueueItem)(nil), // 3: cosmos.authz.v1beta1.GrantQueueItem - (*AuthzRuleKeys)(nil), // 4: cosmos.authz.v1beta1.AuthzRuleKeys + (*Rule)(nil), // 2: cosmos.authz.v1beta1.Rule + (*GrantAuthorization)(nil), // 3: cosmos.authz.v1beta1.GrantAuthorization + (*GrantQueueItem)(nil), // 4: cosmos.authz.v1beta1.GrantQueueItem (*anypb.Any)(nil), // 5: google.protobuf.Any (*timestamppb.Timestamp)(nil), // 6: google.protobuf.Timestamp } var file_cosmos_authz_v1beta1_authz_proto_depIdxs = []int32{ 5, // 0: cosmos.authz.v1beta1.Grant.authorization:type_name -> google.protobuf.Any 6, // 1: cosmos.authz.v1beta1.Grant.expiration:type_name -> google.protobuf.Timestamp - 5, // 2: cosmos.authz.v1beta1.GrantAuthorization.authorization:type_name -> google.protobuf.Any - 6, // 3: cosmos.authz.v1beta1.GrantAuthorization.expiration:type_name -> google.protobuf.Timestamp - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 2, // 2: cosmos.authz.v1beta1.Grant.rules:type_name -> cosmos.authz.v1beta1.Rule + 5, // 3: cosmos.authz.v1beta1.GrantAuthorization.authorization:type_name -> google.protobuf.Any + 6, // 4: cosmos.authz.v1beta1.GrantAuthorization.expiration:type_name -> google.protobuf.Timestamp + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_cosmos_authz_v1beta1_authz_proto_init() } @@ -2948,7 +3153,7 @@ func file_cosmos_authz_v1beta1_authz_proto_init() { } } file_cosmos_authz_v1beta1_authz_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GrantAuthorization); i { + switch v := v.(*Rule); i { case 0: return &v.state case 1: @@ -2960,7 +3165,7 @@ func file_cosmos_authz_v1beta1_authz_proto_init() { } } file_cosmos_authz_v1beta1_authz_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GrantQueueItem); i { + switch v := v.(*GrantAuthorization); i { case 0: return &v.state case 1: @@ -2972,7 +3177,7 @@ func file_cosmos_authz_v1beta1_authz_proto_init() { } } file_cosmos_authz_v1beta1_authz_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthzRuleKeys); i { + switch v := v.(*GrantQueueItem); i { case 0: return &v.state case 1: diff --git a/api/cosmos/authz/v1beta1/tx.pulsar.go b/api/cosmos/authz/v1beta1/tx.pulsar.go index 4fc726a1e59b..b3474119b1e5 100644 --- a/api/cosmos/authz/v1beta1/tx.pulsar.go +++ b/api/cosmos/authz/v1beta1/tx.pulsar.go @@ -17,6 +17,57 @@ 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 @@ -118,7 +169,7 @@ func (x *fastReflection_MsgGrant) Range(f func(protoreflect.FieldDescriptor, pro } } if len(x.Rules) != 0 { - value := protoreflect.ValueOfBytes(x.Rules) + value := protoreflect.ValueOfList(&_MsgGrant_4_list{list: &x.Rules}) if !f(fd_MsgGrant_rules, value) { return } @@ -196,8 +247,11 @@ func (x *fastReflection_MsgGrant) Get(descriptor protoreflect.FieldDescriptor) p value := x.Grant return protoreflect.ValueOfMessage(value.ProtoReflect()) case "cosmos.authz.v1beta1.MsgGrant.rules": - value := x.Rules - return protoreflect.ValueOfBytes(value) + if len(x.Rules) == 0 { + return protoreflect.ValueOfList(&_MsgGrant_4_list{}) + } + listValue := &_MsgGrant_4_list{list: &x.Rules} + return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.MsgGrant")) @@ -225,7 +279,9 @@ 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": - x.Rules = value.Bytes() + lv := value.List() + clv := lv.(*_MsgGrant_4_list) + x.Rules = *clv.list default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.MsgGrant")) @@ -251,12 +307,16 @@ 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")) @@ -278,7 +338,8 @@ func (x *fastReflection_MsgGrant) NewField(fd protoreflect.FieldDescriptor) prot m := new(Grant) return protoreflect.ValueOfMessage(m.ProtoReflect()) case "cosmos.authz.v1beta1.MsgGrant.rules": - return protoreflect.ValueOfBytes(nil) + list := []*Rule{} + return protoreflect.ValueOfList(&_MsgGrant_4_list{list: &list}) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.MsgGrant")) @@ -360,9 +421,11 @@ func (x *fastReflection_MsgGrant) ProtoMethods() *protoiface.Methods { l = options.Size(x.Grant) n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.Rules) - if l > 0 { - 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)) + } } if x.unknownFields != nil { n += len(x.unknownFields) @@ -394,11 +457,20 @@ func (x *fastReflection_MsgGrant) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], x.unknownFields) } if len(x.Rules) > 0 { - i -= len(x.Rules) - copy(dAtA[i:], x.Rules) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Rules))) - i-- - dAtA[i] = 0x22 + 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 + } } if x.Grant != nil { encoded, err := options.Marshal(x.Grant) @@ -581,7 +653,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 byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -591,24 +663,24 @@ func (x *fastReflection_MsgGrant) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + byteLen + 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 } - x.Rules = append(x.Rules[:0], dAtA[iNdEx:postIndex]...) - if x.Rules == nil { - x.Rules = []byte{} + 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 } iNdEx = postIndex default: @@ -2970,7 +3042,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 []byte `protobuf:"bytes,4,opt,name=rules,proto3" json:"rules,omitempty"` + Rules []*Rule `protobuf:"bytes,4,rep,name=rules,proto3" json:"rules,omitempty"` } func (x *MsgGrant) Reset() { @@ -3014,7 +3086,7 @@ func (x *MsgGrant) GetGrant() *Grant { return nil } -func (x *MsgGrant) GetRules() []byte { +func (x *MsgGrant) GetRules() []*Rule { if x != nil { return x.Rules } @@ -3229,7 +3301,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, - 0xec, 0x01, 0x0a, 0x08, 0x4d, 0x73, 0x67, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x12, 0x32, 0x0a, 0x07, + 0x88, 0x02, 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, @@ -3240,68 +3312,70 @@ 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, 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, + 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, 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, 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, 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 ( @@ -3325,22 +3399,24 @@ 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 - (*anypb.Any)(nil), // 7: google.protobuf.Any + (*Rule)(nil), // 7: cosmos.authz.v1beta1.Rule + (*anypb.Any)(nil), // 8: 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.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 + 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 } 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 0e80a8082d7b..85188ba62051 100644 --- a/proto/cosmos/authz/v1beta1/authz.proto +++ b/proto/cosmos/authz/v1beta1/authz.proto @@ -32,7 +32,13 @@ message Grant { google.protobuf.Timestamp expiration = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; // rules are conditions to execute the grant. - bytes rules = 3; + repeated Rule rules = 3; +} + +// rules are conditions to execute the grant. +message Rule { + string key = 1; + repeated string values = 2; } // GrantAuthorization extends a grant with both the addresses of the grantee and granter. @@ -50,41 +56,3 @@ message GrantQueueItem { // msg_type_urls contains the list of TypeURL of a sdk.Msg. repeated string msg_type_urls = 1; } - -// // AuthzRules defines the rules for authz messages. -// message AuthzRules { -// // Send authz rules -// SendAuthzRules send = 1 [(gogoproto.nullable) = false]; - -// // Stake authz rules -// StakeAuthzRules stake = 2 [(gogoproto.nullable) = false]; - -// // Generic authz rules -// GenericAuthzRules generic = 3 [(gogoproto.nullable) = false]; -// } - -// // Send authz rules -// message SendAuthzRules { -// repeated cosmos.base.v1beta1.Coin spend_limit = 1 [ -// (gogoproto.nullable) = false, -// (amino.dont_omitempty) = true, -// (amino.encoding) = "legacy_coins", -// (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" -// ]; -// repeated string blocked_recipients = 2; -// } - -// // Stake authz rules -// message StakeAuthzRules { -// repeated string blocked_validators = 1; -// } - -// // Generic authz rules -// message GenericAuthzRules { -// repeated string blocked_messages = 1; -// } - -// AuthzRuleKeys is app specific options to the keys -message AuthzRuleKeys { - bytes raw_json = 1; -} \ No newline at end of file diff --git a/proto/cosmos/authz/v1beta1/tx.proto b/proto/cosmos/authz/v1beta1/tx.proto index 858b582dcd05..1429f015b15e 100644 --- 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. - bytes rules = 4; + repeated cosmos.authz.v1beta1.Rule rules = 4; } // MsgGrantResponse defines the Msg/MsgGrant response type. diff --git a/x/auth/ante/authz_rules_ante.go b/x/auth/ante/authz_rules_ante.go index 8a15c49a2641..93ebba1f9f99 100644 --- a/x/auth/ante/authz_rules_ante.go +++ b/x/auth/ante/authz_rules_ante.go @@ -3,6 +3,7 @@ package ante import ( "strings" + stakingv1beta1 "cosmossdk.io/api/cosmos/staking/v1beta1" errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -11,11 +12,6 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" ) -const ( - AllowedRecipients = "allowed_recipients" - MaxAmount = "max_amount" -) - type AuthzDecorator struct { azk AuthzKeeper ak AccountKeeper @@ -59,7 +55,13 @@ func (azd AuthzDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, if isRulesBroken { return ctx, err } + case *stakingv1beta1.MsgDelegate: + isRulesBroken, err := azd.handleStakeAuthzRules(ctx, innerMsgConverted, grantee) + if isRulesBroken { + return ctx, err + } } + } } } @@ -77,12 +79,10 @@ func (azd AuthzDecorator) handleSendAuthzRules(ctx sdk.Context, msg *banktypes.M } _, rules := azd.azk.GetAuthzWithRules(ctx, grantee, granter, sdk.MsgTypeURL(&banktypes.MsgSend{})) - if rules != nil { - if allowedAddrs, ok := rules[AllowedRecipients]; ok { - allowedAddrsValue := allowedAddrs.(string) - allowedAddrs := strings.Split(allowedAddrsValue, ",") + for _, rule := range rules { + if rule.Key == authztypes.AllowedRecipients { isAllowed := false - for _, allowedRecipient := range allowedAddrs { + for _, allowedRecipient := range rule.Values { if msg.ToAddress == allowedRecipient { isAllowed = true break @@ -94,9 +94,8 @@ func (azd AuthzDecorator) handleSendAuthzRules(ctx sdk.Context, msg *banktypes.M } } - if spendLimitInterface, ok := rules[MaxAmount]; ok { - spendLimit := spendLimitInterface.(string) - limit, err := sdk.ParseCoinsNormalized(spendLimit) + if rule.Key == authztypes.MaxAmount { + limit, err := sdk.ParseCoinsNormalized(strings.Join(rule.Values, ",")) if err != nil { return true, err } @@ -104,20 +103,50 @@ func (azd AuthzDecorator) handleSendAuthzRules(ctx sdk.Context, msg *banktypes.M return true, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Amount exceeds the max_amount limit set by the granter") } } + } return false, nil } -// func checkGenericAuthzRules(_ *authztypes.MsgGrant, authz *authztypes.GenericAuthorization, genericRules map[string]string) bool { -// if msgsStr, ok := genericRules["blockedMessages"]; ok { -// msgs := strings.Split(msgsStr, ",") -// for _, v := range msgs { -// if v == authz.Msg { -// return true -// } -// } -// } - -// return false -// } +func (azd AuthzDecorator) handleStakeAuthzRules(ctx sdk.Context, msg *stakingv1beta1.MsgDelegate, grantee []byte) (bool, error) { + granter, err := azd.ak.AddressCodec().StringToBytes(msg.DelegatorAddress) + if err != nil { + return true, err + } + + _, rules := azd.azk.GetAuthzWithRules(ctx, grantee, granter, sdk.MsgTypeURL(&banktypes.MsgSend{})) + + for _, rule := range rules { + if rule.Key == authztypes.AllowedStakeValidators { + isAllowed := false + for _, allowedValidator := range rule.Values { + if msg.ValidatorAddress == allowedValidator { + isAllowed = true + break + } + } + + if !isAllowed { + return true, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Validator is not in the allowed validators of the grant") + } + } + + if rule.Key == authztypes.AllowedMaxStakeAmount { + limit, err := sdk.ParseCoinsNormalized(strings.Join(rule.Values, ",")) + if err != nil { + return true, err + } + amount, err := sdk.ParseCoinNormalized(msg.Amount.String()) + if err != nil { + return true, err + } + + if !limit.IsAllGTE(sdk.NewCoins(amount)) { + return true, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Amount exceeds the max_amount limit set by the granter") + } + } + } + + return false, nil +} diff --git a/x/auth/ante/expected_keepers.go b/x/auth/ante/expected_keepers.go index 1478fc45a2a8..5c80b9ffc1d1 100644 --- a/x/auth/ante/expected_keepers.go +++ b/x/auth/ante/expected_keepers.go @@ -26,7 +26,5 @@ type FeegrantKeeper interface { } type AuthzKeeper interface { - GetAuthzOptions() map[string]map[string]string - GetAuthzRulesKeys(ctx context.Context) (map[string]interface{}, error) - GetAuthzWithRules(ctx context.Context, grantee, granter sdk.AccAddress, msgType string) (authz.Authorization, map[string]interface{}) + GetAuthzWithRules(ctx context.Context, grantee, granter sdk.AccAddress, msgType string) (authz.Authorization, []*authz.Rule) } diff --git a/x/authz/authorization_grant.go b/x/authz/authorization_grant.go index 2b3efd6cbaaa..9390410dc661 100644 --- a/x/authz/authorization_grant.go +++ b/x/authz/authorization_grant.go @@ -14,26 +14,7 @@ import ( // NewGrant returns new Grant. Expiration is optional and noop if null. // It returns an error if the expiration is before the current block time, // which is passed into the `blockTime` arg. -func NewGrant(blockTime time.Time, a Authorization, expiration *time.Time) (Grant, error) { - if expiration != nil && !expiration.After(blockTime) { - return Grant{}, errorsmod.Wrapf(ErrInvalidExpirationTime, "expiration must be after the current block time (%v), got %v", blockTime.Format(time.RFC3339), expiration.Format(time.RFC3339)) - } - msg, ok := a.(proto.Message) - if !ok { - return Grant{}, sdkerrors.ErrPackAny.Wrapf("cannot proto marshal %T", a) - } - any, err := cdctypes.NewAnyWithValue(msg) - if err != nil { - return Grant{}, err - } - return Grant{ - Expiration: expiration, - Authorization: any, - }, nil -} - -// NewGrantWithRules does the same as NewGrant but takes rules as extra arg. -func NewGrantWithRules(blockTime time.Time, a Authorization, expiration *time.Time, rules []byte) (Grant, error) { +func NewGrant(blockTime time.Time, a Authorization, expiration *time.Time, rules []*Rule) (Grant, error) { if expiration != nil && !expiration.After(blockTime) { return Grant{}, errorsmod.Wrapf(ErrInvalidExpirationTime, "expiration must be after the current block time (%v), got %v", blockTime.Format(time.RFC3339), expiration.Format(time.RFC3339)) } diff --git a/x/authz/authorizations.go b/x/authz/authorizations.go index 70cb6f8d60c4..75b2e0659097 100644 --- a/x/authz/authorizations.go +++ b/x/authz/authorizations.go @@ -2,7 +2,6 @@ package authz import ( context "context" - "encoding/json" "github.com/cosmos/gogoproto/proto" @@ -25,9 +24,6 @@ type Authorization interface { // ValidateBasic does a simple validation check that // doesn't require access to any other information. ValidateBasic() error - - // GetOptions are, rules defined if any. - GetOptions() json.RawMessage } // AcceptResponse instruments the controller of an authz message if the request is accepted diff --git a/x/authz/authz.pb.go b/x/authz/authz.pb.go index b84eefa30b7c..6b4a528ffd56 100644 --- a/x/authz/authz.pb.go +++ b/x/authz/authz.pb.go @@ -80,7 +80,7 @@ type Grant struct { // may apply to invalidate the grant) Expiration *time.Time `protobuf:"bytes,2,opt,name=expiration,proto3,stdtime" json:"expiration,omitempty"` // rules are conditions to execute the grant. - Rules []byte `protobuf:"bytes,3,opt,name=rules,proto3" json:"rules,omitempty"` + Rules []*Rule `protobuf:"bytes,3,rep,name=rules,proto3" json:"rules,omitempty"` } func (m *Grant) Reset() { *m = Grant{} } @@ -116,6 +116,45 @@ func (m *Grant) XXX_DiscardUnknown() { var xxx_messageInfo_Grant proto.InternalMessageInfo +// rules are conditions to execute the grant. +type Rule struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Values []string `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` +} + +func (m *Rule) Reset() { *m = Rule{} } +func (m *Rule) String() string { return proto.CompactTextString(m) } +func (*Rule) ProtoMessage() {} +func (*Rule) Descriptor() ([]byte, []int) { + return fileDescriptor_544dc2e84b61c637, []int{2} +} +func (m *Rule) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Rule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Rule.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 *Rule) XXX_Merge(src proto.Message) { + xxx_messageInfo_Rule.Merge(m, src) +} +func (m *Rule) XXX_Size() int { + return m.Size() +} +func (m *Rule) XXX_DiscardUnknown() { + xxx_messageInfo_Rule.DiscardUnknown(m) +} + +var xxx_messageInfo_Rule proto.InternalMessageInfo + // GrantAuthorization extends a grant with both the addresses of the grantee and granter. // It is used in genesis.proto and query.proto type GrantAuthorization struct { @@ -129,7 +168,7 @@ func (m *GrantAuthorization) Reset() { *m = GrantAuthorization{} } func (m *GrantAuthorization) String() string { return proto.CompactTextString(m) } func (*GrantAuthorization) ProtoMessage() {} func (*GrantAuthorization) Descriptor() ([]byte, []int) { - return fileDescriptor_544dc2e84b61c637, []int{2} + return fileDescriptor_544dc2e84b61c637, []int{3} } func (m *GrantAuthorization) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -168,7 +207,7 @@ func (m *GrantQueueItem) Reset() { *m = GrantQueueItem{} } func (m *GrantQueueItem) String() string { return proto.CompactTextString(m) } func (*GrantQueueItem) ProtoMessage() {} func (*GrantQueueItem) Descriptor() ([]byte, []int) { - return fileDescriptor_544dc2e84b61c637, []int{3} + return fileDescriptor_544dc2e84b61c637, []int{4} } func (m *GrantQueueItem) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -197,88 +236,50 @@ func (m *GrantQueueItem) XXX_DiscardUnknown() { var xxx_messageInfo_GrantQueueItem proto.InternalMessageInfo -// AuthzRuleKeys is app specific options to the keys -type AuthzRuleKeys struct { - RawJson []byte `protobuf:"bytes,1,opt,name=raw_json,json=rawJson,proto3" json:"raw_json,omitempty"` -} - -func (m *AuthzRuleKeys) Reset() { *m = AuthzRuleKeys{} } -func (m *AuthzRuleKeys) String() string { return proto.CompactTextString(m) } -func (*AuthzRuleKeys) ProtoMessage() {} -func (*AuthzRuleKeys) Descriptor() ([]byte, []int) { - return fileDescriptor_544dc2e84b61c637, []int{4} -} -func (m *AuthzRuleKeys) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthzRuleKeys) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthzRuleKeys.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 *AuthzRuleKeys) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthzRuleKeys.Merge(m, src) -} -func (m *AuthzRuleKeys) XXX_Size() int { - return m.Size() -} -func (m *AuthzRuleKeys) XXX_DiscardUnknown() { - xxx_messageInfo_AuthzRuleKeys.DiscardUnknown(m) -} - -var xxx_messageInfo_AuthzRuleKeys proto.InternalMessageInfo - func init() { proto.RegisterType((*GenericAuthorization)(nil), "cosmos.authz.v1beta1.GenericAuthorization") proto.RegisterType((*Grant)(nil), "cosmos.authz.v1beta1.Grant") + proto.RegisterType((*Rule)(nil), "cosmos.authz.v1beta1.Rule") proto.RegisterType((*GrantAuthorization)(nil), "cosmos.authz.v1beta1.GrantAuthorization") proto.RegisterType((*GrantQueueItem)(nil), "cosmos.authz.v1beta1.GrantQueueItem") - proto.RegisterType((*AuthzRuleKeys)(nil), "cosmos.authz.v1beta1.AuthzRuleKeys") } func init() { proto.RegisterFile("cosmos/authz/v1beta1/authz.proto", fileDescriptor_544dc2e84b61c637) } var fileDescriptor_544dc2e84b61c637 = []byte{ // 505 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xce, 0x36, 0x2d, 0x6d, 0xb7, 0x2d, 0x02, 0xcb, 0x87, 0x34, 0x07, 0x27, 0xb2, 0x10, 0x8a, - 0x2a, 0xc5, 0x56, 0x0b, 0x27, 0x4e, 0xc4, 0x42, 0xaa, 0x28, 0x27, 0x4c, 0xb9, 0x70, 0x89, 0xd6, - 0xc9, 0xb0, 0x31, 0xd8, 0x5e, 0x6b, 0x7f, 0x68, 0x9d, 0x47, 0xe0, 0xd4, 0x67, 0xe0, 0x09, 0x38, - 0xf4, 0x1d, 0x88, 0x38, 0x55, 0x9c, 0x38, 0xf1, 0x93, 0x1c, 0x78, 0x0d, 0x94, 0x5d, 0x1b, 0x92, - 0xb6, 0x12, 0x3d, 0x70, 0x59, 0xed, 0xec, 0x7c, 0xdf, 0xcc, 0x7c, 0x9f, 0x66, 0x71, 0x7b, 0xc0, - 0x44, 0xca, 0x84, 0x4f, 0x94, 0x1c, 0x8d, 0xfd, 0x77, 0xfb, 0x11, 0x48, 0xb2, 0x6f, 0x22, 0x2f, - 0xe7, 0x4c, 0x32, 0xcb, 0x36, 0x08, 0xcf, 0xbc, 0x95, 0x88, 0xe6, 0x5d, 0x92, 0xc6, 0x19, 0xf3, - 0xf5, 0x69, 0x80, 0xcd, 0x5d, 0x03, 0xec, 0xeb, 0xc8, 0x2f, 0x59, 0x26, 0xd5, 0xa2, 0x8c, 0xd1, - 0x04, 0x7c, 0x1d, 0x45, 0xea, 0xb5, 0x2f, 0xe3, 0x14, 0x84, 0x24, 0x69, 0x5e, 0x02, 0x6c, 0xca, - 0x28, 0x33, 0xc4, 0xf9, 0xad, 0xaa, 0x78, 0x99, 0x46, 0xb2, 0xa2, 0x4c, 0x39, 0xe5, 0xdc, 0x11, - 0x11, 0xf0, 0x67, 0xec, 0x01, 0x8b, 0x33, 0x93, 0x77, 0x25, 0xb6, 0x0f, 0x21, 0x03, 0x1e, 0x0f, - 0x7a, 0x4a, 0x8e, 0x18, 0x8f, 0xc7, 0x44, 0xc6, 0x2c, 0xb3, 0xee, 0xe0, 0x7a, 0x2a, 0x68, 0x03, - 0xb5, 0x51, 0x67, 0x33, 0x9c, 0x5f, 0x1f, 0x1d, 0x7d, 0x3e, 0xef, 0xba, 0xd7, 0x69, 0xf4, 0x96, - 0x98, 0xef, 0x7f, 0x7d, 0xdc, 0x6b, 0x19, 0x58, 0x57, 0x0c, 0xdf, 0xfa, 0xd7, 0x55, 0x77, 0x3f, - 0x21, 0xbc, 0x76, 0xc8, 0x49, 0x26, 0xad, 0x08, 0xef, 0x90, 0xc5, 0x94, 0xee, 0xb8, 0x75, 0x60, - 0x7b, 0x46, 0x92, 0x57, 0x49, 0xf2, 0x7a, 0x59, 0x11, 0xdc, 0xbf, 0xd9, 0x08, 0xe1, 0x72, 0x49, - 0xeb, 0x09, 0xc6, 0x70, 0x9a, 0xc7, 0xdc, 0x34, 0x58, 0xd1, 0x0d, 0x9a, 0x57, 0x1a, 0x1c, 0x57, - 0x56, 0x07, 0x1b, 0x93, 0x6f, 0x2d, 0x74, 0xf6, 0xbd, 0x85, 0xc2, 0x05, 0x9e, 0x65, 0xe3, 0x35, - 0xae, 0x12, 0x10, 0x8d, 0x7a, 0x1b, 0x75, 0xb6, 0x43, 0x13, 0xb8, 0x1f, 0x56, 0xb0, 0xa5, 0x95, - 0x2c, 0xdb, 0x77, 0x80, 0xd7, 0xe9, 0xfc, 0x15, 0xb8, 0xb1, 0x30, 0x68, 0x7c, 0x39, 0xef, 0x56, - 0x1b, 0xd2, 0x1b, 0x0e, 0x39, 0x08, 0xf1, 0x42, 0xf2, 0x38, 0xa3, 0x61, 0x05, 0xfc, 0xcb, 0x01, - 0x3d, 0xe3, 0x0d, 0x38, 0x70, 0xd5, 0xbe, 0xfa, 0xff, 0xb7, 0xef, 0xf1, 0x92, 0x7d, 0xab, 0xff, - 0xb4, 0x6f, 0xf5, 0xb2, 0x75, 0xee, 0x43, 0x7c, 0x5b, 0x7b, 0xf4, 0x5c, 0x81, 0x82, 0xa7, 0x12, - 0x52, 0xcb, 0xc5, 0x3b, 0xa9, 0xa0, 0x7d, 0x59, 0xe4, 0xd0, 0x57, 0x3c, 0x11, 0x0d, 0xd4, 0xae, - 0x77, 0x36, 0xc3, 0xad, 0x54, 0xd0, 0xe3, 0x22, 0x87, 0x97, 0x3c, 0x11, 0xee, 0x1e, 0xde, 0x99, - 0xcf, 0x35, 0x0e, 0x55, 0x02, 0xcf, 0xa0, 0x10, 0xd6, 0x2e, 0xde, 0xe0, 0xe4, 0xa4, 0xff, 0x46, - 0x94, 0x6b, 0xb2, 0x1d, 0xae, 0x73, 0x72, 0x72, 0x24, 0x58, 0x16, 0x04, 0x93, 0x9f, 0x4e, 0x6d, - 0x32, 0x75, 0xd0, 0xc5, 0xd4, 0x41, 0x3f, 0xa6, 0x0e, 0x3a, 0x9b, 0x39, 0xb5, 0x8b, 0x99, 0x53, - 0xfb, 0x3a, 0x73, 0x6a, 0xaf, 0xee, 0xd1, 0x58, 0x8e, 0x54, 0xe4, 0x0d, 0x58, 0x5a, 0xfe, 0x37, - 0x7f, 0x61, 0x43, 0x4f, 0xcd, 0x37, 0x8e, 0x6e, 0x69, 0x2d, 0x0f, 0x7e, 0x07, 0x00, 0x00, 0xff, - 0xff, 0x5e, 0x66, 0xb7, 0xda, 0xeb, 0x03, 0x00, 0x00, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0xcb, 0x6e, 0xd3, 0x40, + 0x14, 0x8d, 0xe3, 0xb4, 0xd0, 0xa9, 0x8a, 0xc0, 0x8a, 0x90, 0xc9, 0xc2, 0x89, 0x2c, 0x84, 0x2a, + 0xa4, 0xd8, 0x6d, 0x61, 0xc5, 0x8a, 0x58, 0x48, 0x15, 0xec, 0x30, 0x65, 0xc3, 0x26, 0x1a, 0x27, + 0x97, 0x89, 0x15, 0xdb, 0x63, 0xcd, 0xa3, 0xaa, 0xfb, 0x09, 0xac, 0xfa, 0x0d, 0x7c, 0x01, 0x8b, + 0x7e, 0x44, 0xc4, 0xaa, 0x62, 0xc5, 0x8a, 0x47, 0xb2, 0xe0, 0x37, 0x90, 0x67, 0x6c, 0x48, 0xda, + 0x48, 0x64, 0xc1, 0xc6, 0xf2, 0x9d, 0x7b, 0xce, 0x7d, 0x9c, 0x33, 0x83, 0x7a, 0x23, 0xca, 0x53, + 0xca, 0x7d, 0x2c, 0xc5, 0xe4, 0xdc, 0x3f, 0x3d, 0x8c, 0x40, 0xe0, 0x43, 0x1d, 0x79, 0x39, 0xa3, + 0x82, 0x5a, 0x6d, 0x8d, 0xf0, 0xf4, 0x59, 0x85, 0xe8, 0xdc, 0xc3, 0x69, 0x9c, 0x51, 0x5f, 0x7d, + 0x35, 0xb0, 0xf3, 0x40, 0x03, 0x87, 0x2a, 0xf2, 0x2b, 0x96, 0x4e, 0x75, 0x09, 0xa5, 0x24, 0x01, + 0x5f, 0x45, 0x91, 0x7c, 0xef, 0x8b, 0x38, 0x05, 0x2e, 0x70, 0x9a, 0x57, 0x80, 0x36, 0xa1, 0x84, + 0x6a, 0x62, 0xf9, 0x57, 0x57, 0xbc, 0x4e, 0xc3, 0x59, 0x51, 0xa5, 0x9c, 0x6a, 0xee, 0x08, 0x73, + 0xf8, 0x33, 0xf6, 0x88, 0xc6, 0x99, 0xce, 0xbb, 0x02, 0xb5, 0x8f, 0x21, 0x03, 0x16, 0x8f, 0x06, + 0x52, 0x4c, 0x28, 0x8b, 0xcf, 0xb1, 0x88, 0x69, 0x66, 0xdd, 0x45, 0x66, 0xca, 0x89, 0x6d, 0xf4, + 0x8c, 0xfd, 0x9d, 0xb0, 0xfc, 0x7d, 0xf6, 0xea, 0xf3, 0x65, 0xdf, 0x5d, 0xb7, 0xa3, 0xb7, 0xc2, + 0xfc, 0xf0, 0xeb, 0xd3, 0xe3, 0xae, 0x86, 0xf5, 0xf9, 0x78, 0xea, 0xaf, 0xab, 0xee, 0x2e, 0x0c, + 0xb4, 0x75, 0xcc, 0x70, 0x26, 0xac, 0x08, 0xed, 0xe1, 0xe5, 0x94, 0xea, 0xb8, 0x7b, 0xd4, 0xf6, + 0xf4, 0x4a, 0x5e, 0xbd, 0x92, 0x37, 0xc8, 0x8a, 0xe0, 0xd1, 0x66, 0x23, 0x84, 0xab, 0x25, 0xad, + 0x17, 0x08, 0xc1, 0x59, 0x1e, 0x33, 0xdd, 0xa0, 0xa9, 0x1a, 0x74, 0x6e, 0x34, 0x38, 0xa9, 0xa5, + 0x0e, 0x6e, 0xcf, 0xbe, 0x75, 0x8d, 0x8b, 0xef, 0x5d, 0x23, 0x5c, 0xe2, 0x59, 0x07, 0x68, 0x8b, + 0xc9, 0x04, 0xb8, 0x6d, 0xf6, 0x4c, 0x55, 0x60, 0xed, 0x20, 0xa1, 0x4c, 0x20, 0xd4, 0x40, 0xf7, + 0x00, 0xb5, 0xca, 0xb0, 0xd4, 0x72, 0x0a, 0x45, 0xad, 0xe5, 0x14, 0x0a, 0xeb, 0x3e, 0xda, 0x3e, + 0xc5, 0x89, 0x04, 0x6e, 0x37, 0x7b, 0xe6, 0xfe, 0x4e, 0x58, 0x45, 0xee, 0xc7, 0x26, 0xb2, 0x94, + 0x2e, 0xab, 0x66, 0x1c, 0xa1, 0x5b, 0xa4, 0x3c, 0x05, 0xa6, 0x8b, 0x04, 0xf6, 0x97, 0xcb, 0x7e, + 0x7d, 0xdf, 0x06, 0xe3, 0x31, 0x03, 0xce, 0xdf, 0x08, 0x16, 0x67, 0x24, 0xac, 0x81, 0x7f, 0x39, + 0xa0, 0x36, 0xde, 0x80, 0x03, 0x37, 0xcd, 0x30, 0xff, 0xbf, 0x19, 0xcf, 0x57, 0xcc, 0x68, 0xfd, + 0xd3, 0x8c, 0xd6, 0x75, 0x23, 0xdc, 0xa7, 0xe8, 0x8e, 0xd2, 0xe8, 0xb5, 0x04, 0x09, 0x2f, 0x05, + 0xa4, 0x96, 0x8b, 0xf6, 0x52, 0x4e, 0x86, 0xa2, 0xc8, 0x61, 0x28, 0x59, 0xc2, 0x6d, 0x43, 0xa9, + 0xba, 0x9b, 0x72, 0x72, 0x52, 0xe4, 0xf0, 0x96, 0x25, 0x3c, 0x08, 0x66, 0x3f, 0x9d, 0xc6, 0x6c, + 0xee, 0x18, 0x57, 0x73, 0xc7, 0xf8, 0x31, 0x77, 0x8c, 0x8b, 0x85, 0xd3, 0xb8, 0x5a, 0x38, 0x8d, + 0xaf, 0x0b, 0xa7, 0xf1, 0xee, 0x21, 0x89, 0xc5, 0x44, 0x46, 0xde, 0x88, 0xa6, 0xd5, 0x8b, 0xf4, + 0x97, 0xee, 0xf0, 0x99, 0x7e, 0xe8, 0xd1, 0xb6, 0x9a, 0xef, 0xc9, 0xef, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x7b, 0x22, 0x81, 0x7c, 0x0d, 0x04, 0x00, 0x00, } func (m *GenericAuthorization) Marshal() (dAtA []byte, err error) { @@ -332,11 +333,18 @@ func (m *Grant) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if len(m.Rules) > 0 { - i -= len(m.Rules) - copy(dAtA[i:], m.Rules) - i = encodeVarintAuthz(dAtA, i, uint64(len(m.Rules))) - i-- - dAtA[i] = 0x1a + 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 = encodeVarintAuthz(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } } if m.Expiration != nil { n1, err1 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.Expiration, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.Expiration):]) @@ -363,6 +371,45 @@ func (m *Grant) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Rule) 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 *Rule) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Rule) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Values) > 0 { + for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Values[iNdEx]) + copy(dAtA[i:], m.Values[iNdEx]) + i = encodeVarintAuthz(dAtA, i, uint64(len(m.Values[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintAuthz(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *GrantAuthorization) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -454,36 +501,6 @@ func (m *GrantQueueItem) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *AuthzRuleKeys) 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 *AuthzRuleKeys) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthzRuleKeys) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.RawJson) > 0 { - i -= len(m.RawJson) - copy(dAtA[i:], m.RawJson) - i = encodeVarintAuthz(dAtA, i, uint64(len(m.RawJson))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func encodeVarintAuthz(dAtA []byte, offset int, v uint64) int { offset -= sovAuthz(v) base := offset @@ -522,10 +539,31 @@ func (m *Grant) Size() (n int) { l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.Expiration) n += 1 + l + sovAuthz(uint64(l)) } - l = len(m.Rules) + if len(m.Rules) > 0 { + for _, e := range m.Rules { + l = e.Size() + n += 1 + l + sovAuthz(uint64(l)) + } + } + return n +} + +func (m *Rule) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) if l > 0 { n += 1 + l + sovAuthz(uint64(l)) } + if len(m.Values) > 0 { + for _, s := range m.Values { + l = len(s) + n += 1 + l + sovAuthz(uint64(l)) + } + } return n } @@ -569,19 +607,6 @@ func (m *GrantQueueItem) Size() (n int) { return n } -func (m *AuthzRuleKeys) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RawJson) - if l > 0 { - n += 1 + l + sovAuthz(uint64(l)) - } - return n -} - func sovAuthz(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -775,7 +800,7 @@ func (m *Grant) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Rules", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowAuthz @@ -785,24 +810,24 @@ func (m *Grant) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthAuthz } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthAuthz } if postIndex > l { return io.ErrUnexpectedEOF } - m.Rules = append(m.Rules[:0], dAtA[iNdEx:postIndex]...) - if m.Rules == nil { - m.Rules = []byte{} + m.Rules = append(m.Rules, &Rule{}) + if err := m.Rules[len(m.Rules)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: @@ -826,6 +851,120 @@ func (m *Grant) Unmarshal(dAtA []byte) error { } return nil } +func (m *Rule) 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: Rule: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Rule: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", 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.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Values", 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.Values = append(m.Values, 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 (m *GrantAuthorization) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1094,90 +1233,6 @@ func (m *GrantQueueItem) Unmarshal(dAtA []byte) error { } return nil } -func (m *AuthzRuleKeys) 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: AuthzRuleKeys: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthzRuleKeys: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RawJson", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuthz - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAuthz - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAuthz - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RawJson = append(m.RawJson[:0], dAtA[iNdEx:postIndex]...) - if m.RawJson == nil { - m.RawJson = []byte{} - } - 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 80da44d113a0..27b8df71e97c 100644 --- a/x/authz/client/cli/tx.go +++ b/x/authz/client/cli/tx.go @@ -1,6 +1,7 @@ package cli import ( + "encoding/json" "errors" "fmt" "os" @@ -9,6 +10,7 @@ import ( "github.com/spf13/cobra" + bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" "cosmossdk.io/core/address" "github.com/cosmos/cosmos-sdk/client" @@ -216,7 +218,12 @@ Examples: return err } - msg.SetAuthzRules(contents) + rules, err := buildRules(args[1], contents) + if err != nil { + return err + } + + msg.SetAuthzRules(rules) } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) @@ -233,6 +240,38 @@ 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/consts.go b/x/authz/consts.go new file mode 100644 index 000000000000..06b58f3bc015 --- /dev/null +++ b/x/authz/consts.go @@ -0,0 +1,8 @@ +package authz + +const ( + AllowedRecipients = "allowed_recipients" + MaxAmount = "max_amount" + AllowedStakeValidators = "allowed_stake_validators" + AllowedMaxStakeAmount = "allowed_Max_stake_amount" +) diff --git a/x/authz/generic_authorization.go b/x/authz/generic_authorization.go index 535ff2a93383..a7c790e02bf1 100644 --- a/x/authz/generic_authorization.go +++ b/x/authz/generic_authorization.go @@ -2,7 +2,6 @@ package authz import ( "context" - "encoding/json" "errors" sdk "github.com/cosmos/cosmos-sdk/types" @@ -34,7 +33,3 @@ func (a GenericAuthorization) ValidateBasic() error { } return nil } - -func (a GenericAuthorization) GetOptions() json.RawMessage { - return nil -} diff --git a/x/authz/keeper/keeper.go b/x/authz/keeper/keeper.go index 68990079cdb4..7220ff5c252f 100644 --- a/x/authz/keeper/keeper.go +++ b/x/authz/keeper/keeper.go @@ -3,7 +3,6 @@ package keeper import ( "bytes" "context" - "encoding/json" "fmt" "strconv" "time" @@ -69,65 +68,6 @@ func (k Keeper) getGrant(ctx context.Context, skey []byte) (grant authz.Grant, f return grant, true } -func (k Keeper) SetAuthzRulesKeys(ctx context.Context, options json.RawMessage) error { - store := k.storeService.OpenKVStore(ctx) - - optionsBytes, err := json.Marshal(options) - if err != nil { - return err - } - - authzRuleKeys := authz.AuthzRuleKeys{ - RawJson: optionsBytes, - } - - bz, err := k.cdc.Marshal(&authzRuleKeys) - if err != nil { - return err - } - - err = store.Set(AuthzOptionsKeys, bz) - return err -} - -func (k Keeper) GetAuthzRulesKeys(ctx context.Context) (map[string]interface{}, error) { - store := k.storeService.OpenKVStore(ctx) - bz, err := store.Get(AuthzOptionsKeys) - - if err != nil { - return nil, err - } - - var keys json.RawMessage - var authzRuleKeys authz.AuthzRuleKeys - err = k.cdc.Unmarshal(bz, &authzRuleKeys) - if err != nil { - return nil, err - } - - err = json.Unmarshal(authzRuleKeys.RawJson, &keys) - if err != nil { - return nil, err - } - - // rules := map[string]interface{}{ - // "Send": []string{"AllowRecipients", "SpendLImit"}, - // "Stake": []string{"DelegateLimit"}, - // } - rules := map[string]interface{}{ - // "Send": []string{"AllowRecipients", "SpendLImit"}, - // "Stake": []string{"DelegateLimit"}, - } - - return rules, nil - - // return keys, nil -} - -func (k Keeper) GetAuthzOptions() map[string]map[string]string { - return nil -} - func (k Keeper) update(ctx context.Context, grantee, granter sdk.AccAddress, updated authz.Authorization) error { skey := grantStoreKey(grantee, granter, updated.MsgTypeURL()) grant, found := k.getGrant(ctx, skey) @@ -247,54 +187,7 @@ func (k Keeper) SaveGrant(ctx context.Context, grantee, granter sdk.AccAddress, store := k.storeService.OpenKVStore(ctx) skey := grantStoreKey(grantee, granter, msgType) - grant, err := authz.NewGrant(sdkCtx.BlockTime(), authorization, expiration) - if err != nil { - return err - } - - var oldExp *time.Time - if oldGrant, found := k.getGrant(ctx, skey); found { - oldExp = oldGrant.Expiration - } - - if oldExp != nil && (expiration == nil || !oldExp.Equal(*expiration)) { - if err = k.removeFromGrantQueue(ctx, skey, granter, grantee, *oldExp); err != nil { - return err - } - } - - // If the expiration didn't change, then we don't remove it and we should not insert again - if expiration != nil && (oldExp == nil || !oldExp.Equal(*expiration)) { - if err = k.insertIntoGrantQueue(ctx, granter, grantee, msgType, *expiration); err != nil { - return err - } - } - - bz, err := k.cdc.Marshal(&grant) - if err != nil { - return err - } - - err = store.Set(skey, bz) - if err != nil { - return err - } - - return sdkCtx.EventManager().EmitTypedEvent(&authz.EventGrant{ - MsgTypeUrl: authorization.MsgTypeURL(), - Granter: granter.String(), - Grantee: grantee.String(), - }) -} - -// SaveGrantWithRules method does the same as SaveGrant method but stores rules. -func (k Keeper) SaveGrantWithRules(ctx context.Context, grantee, granter sdk.AccAddress, authorization authz.Authorization, expiration *time.Time, rules []byte) error { - sdkCtx := sdk.UnwrapSDKContext(ctx) - msgType := authorization.MsgTypeURL() - store := k.storeService.OpenKVStore(ctx) - skey := grantStoreKey(grantee, granter, msgType) - - grant, err := authz.NewGrantWithRules(sdkCtx.BlockTime(), authorization, expiration, rules) + grant, err := authz.NewGrant(sdkCtx.BlockTime(), authorization, expiration, nil) if err != nil { return err } @@ -409,25 +302,19 @@ func (k Keeper) GetAuthorization(ctx context.Context, grantee, granter sdk.AccAd return auth, grant.Expiration } -func (k Keeper) GetAuthzWithRules(ctx context.Context, grantee, granter sdk.AccAddress, msgType string) (authz.Authorization, map[string]interface{}) { +func (k Keeper) GetAuthzWithRules(ctx context.Context, grantee, granter sdk.AccAddress, msgType string) (authz.Authorization, []*authz.Rule) { sdkCtx := sdk.UnwrapSDKContext(ctx) grant, found := k.getGrant(ctx, grantStoreKey(grantee, granter, msgType)) if !found || (grant.Expiration != nil && grant.Expiration.Before(sdkCtx.BlockHeader().Time)) { return nil, nil } - auth, err := grant.GetAuthorization() - if err != nil { - return nil, nil - } - - var rules map[string]interface{} - err = json.Unmarshal(grant.Rules, &rules) + authz, err := grant.GetAuthorization() if err != nil { return nil, nil } - return auth, rules + return authz, grant.Rules } // IterateGrants iterates over all authorization grants diff --git a/x/authz/keeper/msg_server_test.go b/x/authz/keeper/msg_server_test.go index d314c4d2ce08..900689835479 100644 --- a/x/authz/keeper/msg_server_test.go +++ b/x/authz/keeper/msg_server_test.go @@ -45,7 +45,7 @@ func (suite *TestSuite) TestGrant() { { name: "identical grantee and granter", malleate: func() *authz.MsgGrant { - grant, err := authz.NewGrant(curBlockTime, banktypes.NewSendAuthorization(coins, nil), &oneYear) + grant, err := authz.NewGrant(curBlockTime, banktypes.NewSendAuthorization(coins, nil), &oneYear, nil) suite.Require().NoError(err) return &authz.MsgGrant{ Granter: grantee.String(), @@ -59,7 +59,7 @@ func (suite *TestSuite) TestGrant() { { name: "invalid granter", malleate: func() *authz.MsgGrant { - grant, err := authz.NewGrant(curBlockTime, banktypes.NewSendAuthorization(coins, nil), &oneYear) + grant, err := authz.NewGrant(curBlockTime, banktypes.NewSendAuthorization(coins, nil), &oneYear, nil) suite.Require().NoError(err) return &authz.MsgGrant{ Granter: "invalid", @@ -73,7 +73,7 @@ func (suite *TestSuite) TestGrant() { { name: "invalid grantee", malleate: func() *authz.MsgGrant { - grant, err := authz.NewGrant(curBlockTime, banktypes.NewSendAuthorization(coins, nil), &oneYear) + grant, err := authz.NewGrant(curBlockTime, banktypes.NewSendAuthorization(coins, nil), &oneYear, nil) suite.Require().NoError(err) return &authz.MsgGrant{ Granter: granter.String(), @@ -102,7 +102,7 @@ func (suite *TestSuite) TestGrant() { name: "invalid grant, past time", malleate: func() *authz.MsgGrant { pastTime := curBlockTime.Add(-time.Hour) - grant, err := authz.NewGrant(curBlockTime, banktypes.NewSendAuthorization(coins, nil), &oneHour) // we only need the authorization + grant, err := authz.NewGrant(curBlockTime, banktypes.NewSendAuthorization(coins, nil), &oneHour, nil) // we only need the authorization suite.Require().NoError(err) return &authz.MsgGrant{ Granter: granter.String(), @@ -125,7 +125,7 @@ func (suite *TestSuite) TestGrant() { suite.accountKeeper.EXPECT().NewAccountWithAddress(gomock.Any(), newAcc).Return(acc).AnyTimes() suite.accountKeeper.EXPECT().SetAccount(gomock.Any(), acc).Return() - grant, err := authz.NewGrant(curBlockTime, banktypes.NewSendAuthorization(coins, nil), &oneYear) + grant, err := authz.NewGrant(curBlockTime, banktypes.NewSendAuthorization(coins, nil), &oneYear, nil) suite.Require().NoError(err) return &authz.MsgGrant{ Granter: granter.String(), @@ -137,7 +137,7 @@ func (suite *TestSuite) TestGrant() { { name: "valid grant", malleate: func() *authz.MsgGrant { - grant, err := authz.NewGrant(curBlockTime, banktypes.NewSendAuthorization(coins, nil), &oneYear) + grant, err := authz.NewGrant(curBlockTime, banktypes.NewSendAuthorization(coins, nil), &oneYear, nil) suite.Require().NoError(err) return &authz.MsgGrant{ Granter: granter.String(), @@ -149,7 +149,7 @@ func (suite *TestSuite) TestGrant() { { name: "valid grant, same grantee, granter pair but different msgType", malleate: func() *authz.MsgGrant { - g, err := authz.NewGrant(curBlockTime, banktypes.NewSendAuthorization(coins, nil), &oneHour) + g, err := authz.NewGrant(curBlockTime, banktypes.NewSendAuthorization(coins, nil), &oneHour, nil) suite.Require().NoError(err) _, err = suite.msgSrvr.Grant(suite.ctx, &authz.MsgGrant{ Granter: granter.String(), @@ -158,7 +158,7 @@ func (suite *TestSuite) TestGrant() { }) suite.Require().NoError(err) - grant, err := authz.NewGrant(curBlockTime, authz.NewGenericAuthorization("/cosmos.bank.v1beta1.MsgUpdateParams"), &oneHour) + grant, err := authz.NewGrant(curBlockTime, authz.NewGenericAuthorization("/cosmos.bank.v1beta1.MsgUpdateParams"), &oneHour, nil) suite.Require().NoError(err) return &authz.MsgGrant{ Granter: granter.String(), @@ -170,7 +170,7 @@ func (suite *TestSuite) TestGrant() { { name: "valid grant with allow list", malleate: func() *authz.MsgGrant { - grant, err := authz.NewGrant(curBlockTime, banktypes.NewSendAuthorization(coins, []sdk.AccAddress{granter}), &oneYear) + grant, err := authz.NewGrant(curBlockTime, banktypes.NewSendAuthorization(coins, []sdk.AccAddress{granter}), &oneYear, nil) suite.Require().NoError(err) return &authz.MsgGrant{ Granter: granter.String(), @@ -182,7 +182,7 @@ func (suite *TestSuite) TestGrant() { { name: "valid grant with nil expiration time", malleate: func() *authz.MsgGrant { - grant, err := authz.NewGrant(curBlockTime, banktypes.NewSendAuthorization(coins, nil), nil) + grant, err := authz.NewGrant(curBlockTime, banktypes.NewSendAuthorization(coins, nil), nil, nil) suite.Require().NoError(err) return &authz.MsgGrant{ Granter: granter.String(), diff --git a/x/authz/msgs.go b/x/authz/msgs.go index bfdef2a7b6ea..9de397bb3855 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 []byte) { +func (msg *MsgGrant) SetAuthzRules(rules []*Rule) { msg.Rules = rules } diff --git a/x/authz/msgs_test.go b/x/authz/msgs_test.go index ea634fd39526..736213f63d71 100644 --- a/x/authz/msgs_test.go +++ b/x/authz/msgs_test.go @@ -64,16 +64,16 @@ func TestAminoJSON(t *testing.T) { typeURL := sdk.MsgTypeURL(&msgSend) msgSendAny, err := cdctypes.NewAnyWithValue(&msgSend) require.NoError(t, err) - grant, err := authz.NewGrant(blockTime, authz.NewGenericAuthorization(typeURL), &expiresAt) + grant, err := authz.NewGrant(blockTime, authz.NewGenericAuthorization(typeURL), &expiresAt, nil) require.NoError(t, err) sendAuthz := banktypes.NewSendAuthorization(sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(1000))), nil) - sendGrant, err := authz.NewGrant(blockTime, sendAuthz, &expiresAt) + sendGrant, err := authz.NewGrant(blockTime, sendAuthz, &expiresAt, nil) require.NoError(t, err) valAddr, err := sdk.ValAddressFromBech32("cosmosvaloper1xcy3els9ua75kdm783c3qu0rfa2eples6eavqq") require.NoError(t, err) stakingAuth, err := stakingtypes.NewStakeAuthorization([]sdk.ValAddress{valAddr}, nil, stakingtypes.AuthorizationType_AUTHORIZATION_TYPE_DELEGATE, &sdk.Coin{Denom: "stake", Amount: sdkmath.NewInt(1000)}) require.NoError(t, err) - delegateGrant, err := authz.NewGrant(blockTime, stakingAuth, nil) + delegateGrant, err := authz.NewGrant(blockTime, stakingAuth, nil, nil) require.NoError(t, err) // Amino JSON encoding has changed in authz since v0.46. diff --git a/x/authz/simulation/decoder_test.go b/x/authz/simulation/decoder_test.go index ffaf441195f1..7a933284309c 100644 --- a/x/authz/simulation/decoder_test.go +++ b/x/authz/simulation/decoder_test.go @@ -26,7 +26,7 @@ func TestDecodeStore(t *testing.T) { now := time.Now().UTC() e := now.Add(1) sendAuthz := banktypes.NewSendAuthorization(sdk.NewCoins(sdk.NewInt64Coin("foo", 123)), nil) - grant, _ := authz.NewGrant(now, sendAuthz, &e) + grant, _ := authz.NewGrant(now, sendAuthz, &e, nil) grantBz, err := encCfg.Codec.Marshal(&grant) require.NoError(t, err) kvPairs := kv.Pairs{ diff --git a/x/authz/tx.pb.go b/x/authz/tx.pb.go index ead6fd14538f..57e48244884a 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 []byte `protobuf:"bytes,4,opt,name=rules,proto3" json:"rules,omitempty"` + Rules []*Rule `protobuf:"bytes,4,rep,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{ - // 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, 0xab, 0x6d, - 0x12, 0xba, 0x55, 0x3b, 0x1c, 0x59, 0x83, 0x80, 0x85, 0x4c, 0x29, 0x0a, 0xd8, 0xe2, 0xb0, 0x95, - 0xc0, 0xda, 0xae, 0x88, 0xb6, 0x38, 0xc7, 0x4e, 0x28, 0xdc, 0xd1, 0x8a, 0x94, 0x51, 0x26, 0xe2, - 0xb1, 0x95, 0x44, 0x77, 0x29, 0x63, 0xb4, 0x4f, 0x6c, 0xee, 0xb5, 0xa3, 0x97, 0xb6, 0xeb, 0x8f, - 0x13, 0xc8, 0x58, 0xdb, 0x80, 0xf8, 0x3d, 0xc1, 0xb8, 0x9d, 0x30, 0x3c, 0xa0, 0xf6, 0xb0, 0x1a, - 0x7f, 0x25, 0xc0, 0xb6, 0xeb, 0xf5, 0x7c, 0x66, 0xf3, 0x4f, 0x11, 0x32, 0x7f, 0x20, 0xfc, 0x5f, - 0x13, 0xe8, 0xa3, 0xc0, 0xf5, 0x43, 0xa5, 0x86, 0x73, 0x34, 0x36, 0x48, 0xa0, 0x22, 0x03, 0x95, - 0xf2, 0x0d, 0xf5, 0xf3, 0x79, 0x45, 0x2a, 0x3a, 0xee, 0x76, 0x03, 0x02, 0xf0, 0x34, 0x0c, 0x7a, - 0x3e, 0x75, 0x24, 0xf1, 0x77, 0x0e, 0x51, 0x37, 0x6e, 0x96, 0x43, 0x94, 0x87, 0x38, 0xcb, 0x4d, - 0x35, 0x6d, 0xa0, 0xd2, 0x56, 0x6d, 0xcf, 0x5a, 0x37, 0x34, 0x8b, 0xf7, 0xd4, 0xc8, 0x4f, 0xbf, - 0x1e, 0xa4, 0xde, 0x2f, 0x26, 0x65, 0xe4, 0x88, 0x24, 0xa5, 0x88, 0xb3, 0x41, 0xd4, 0x27, 0xa0, - 0x66, 0x0c, 0x54, 0x2a, 0x38, 0xc2, 0xa9, 0x1f, 0xbe, 0x59, 0x4c, 0xca, 0xb2, 0xab, 0xb7, 0x8b, - 0x49, 0x79, 0x47, 0x14, 0xad, 0x40, 0xf7, 0xcc, 0x96, 0x0a, 0x4d, 0x05, 0xdf, 0x92, 0xb6, 0x43, - 0x60, 0xc0, 0x7c, 0x20, 0xe6, 0x07, 0x84, 0x73, 0x4d, 0xa0, 0x27, 0x23, 0xd2, 0x59, 0x55, 0x83, - 0x6e, 0xaa, 0xe6, 0x04, 0x67, 0x3c, 0xa0, 0xa0, 0x6e, 0x18, 0xe9, 0xd2, 0x56, 0xad, 0x68, 0x89, - 0xd5, 0x59, 0x72, 0x75, 0xd6, 0xb1, 0x3f, 0x6e, 0xec, 0x7d, 0x3a, 0xaf, 0x24, 0x6b, 0xb1, 0xda, - 0x2e, 0x90, 0xa5, 0xc8, 0x26, 0x50, 0x87, 0xa7, 0xd7, 0xef, 0xac, 0x08, 0x20, 0xb1, 0x00, 0xe5, - 0xb2, 0x80, 0xb8, 0x3f, 0xf3, 0x3e, 0xfe, 0x3f, 0x31, 0x65, 0xfb, 0x8a, 0x8a, 0x73, 0x01, 0x81, - 0xa8, 0x1f, 0x82, 0x8a, 0x8c, 0x74, 0xa9, 0xe0, 0x48, 0xd7, 0xfc, 0x88, 0x70, 0x3e, 0xae, 0x4f, - 0x86, 0xec, 0x8c, 0xfc, 0xb3, 0xe5, 0x1a, 0xb8, 0xe0, 0x01, 0x6d, 0x85, 0xe3, 0x01, 0x69, 0x45, - 0x41, 0x9f, 0xef, 0x38, 0xef, 0x60, 0x0f, 0xe8, 0xb3, 0xf1, 0x80, 0x3c, 0x0f, 0xfa, 0xf5, 0xa3, - 0x3f, 0x57, 0x55, 0xbc, 0xac, 0x54, 0x34, 0x6c, 0xee, 0xe0, 0xed, 0xa5, 0x23, 0xd5, 0xd6, 0x7e, - 0x22, 0x9c, 0x6e, 0x02, 0x55, 0x9e, 0xe0, 0xac, 0xb8, 0x59, 0x7d, 0xfd, 0xf1, 0xc8, 0x2d, 0x6b, - 0x77, 0xaf, 0xc7, 0x97, 0x63, 0x7c, 0x8c, 0x33, 0xfc, 0x02, 0xf6, 0xaf, 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, + // 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, 0x84, 0xc7, 0x53, 0x4b, + 0x44, 0x77, 0x30, 0x21, 0xd8, 0x47, 0x36, 0xf3, 0xbc, 0xe4, 0x95, 0xed, 0x86, 0x23, 0x01, 0x19, + 0x2b, 0x0b, 0xe0, 0xdf, 0xe3, 0x8c, 0xdb, 0x82, 0x11, 0x50, 0x6c, 0x0f, 0x6a, 0xe9, 0x4b, 0x00, + 0x5b, 0x6e, 0xd0, 0x0b, 0x89, 0xcd, 0x9e, 0x3c, 0x64, 0xbe, 0x5b, 0x83, 0x37, 0x5a, 0x14, 0x3f, + 0x8e, 0xdc, 0x30, 0x56, 0xea, 0xb0, 0x80, 0x53, 0x03, 0x45, 0x2a, 0x30, 0x40, 0xb9, 0xd8, 0x54, + 0xbf, 0x9e, 0x55, 0xa5, 0xa2, 0xa3, 0x6e, 0x37, 0x42, 0x94, 0x3e, 0x8b, 0xa3, 0x5e, 0x88, 0x1d, + 0x49, 0xfc, 0x93, 0x83, 0xd4, 0xb5, 0xeb, 0xe5, 0x20, 0xe5, 0x11, 0xcc, 0x33, 0x53, 0xcd, 0x1a, + 0xa0, 0xbc, 0x51, 0xdf, 0xb5, 0x56, 0x35, 0xcd, 0x62, 0x35, 0x35, 0x8b, 0x93, 0xef, 0xfb, 0x99, + 0x8f, 0xf3, 0x71, 0x05, 0x38, 0x3c, 0x49, 0x79, 0x00, 0xf3, 0x51, 0xe2, 0x23, 0xaa, 0xe6, 0x8c, + 0x6c, 0x79, 0xa3, 0xae, 0xad, 0xce, 0x76, 0x12, 0x1f, 0x39, 0x9c, 0xd8, 0x38, 0x78, 0x3b, 0x1f, + 0x57, 0x64, 0xc5, 0xef, 0xe7, 0xe3, 0xca, 0x36, 0x4f, 0xa9, 0xd2, 0xee, 0xa9, 0x2d, 0xd5, 0x9b, + 0x0a, 0xbc, 0x25, 0x6d, 0x07, 0xd1, 0x3e, 0x09, 0x29, 0x32, 0x3f, 0x01, 0x58, 0x68, 0x51, 0x7c, + 0x3c, 0x44, 0x9d, 0x65, 0xa5, 0xe0, 0xba, 0x4a, 0x8f, 0x61, 0x2e, 0xa0, 0x98, 0xaa, 0x6b, 0xac, + 0xd4, 0x92, 0xc5, 0xc7, 0x6a, 0xc9, 0xb1, 0x5a, 0x47, 0xe1, 0xa8, 0xb9, 0xfb, 0xe5, 0xac, 0x2a, + 0x46, 0x66, 0x79, 0x2e, 0x45, 0x0b, 0x09, 0x2d, 0x8a, 0x1d, 0x96, 0xde, 0xb8, 0xb3, 0x24, 0x00, + 0xa5, 0x02, 0x94, 0x8b, 0x02, 0xd2, 0xfa, 0xcc, 0xfb, 0xf0, 0xa6, 0x30, 0x65, 0xf9, 0x8a, 0x0a, + 0x0b, 0x11, 0xa2, 0x89, 0x1f, 0x53, 0x15, 0x18, 0xd9, 0xf2, 0xa6, 0x23, 0x5d, 0xf3, 0x33, 0x80, + 0xc5, 0xf4, 0x7c, 0x34, 0x20, 0xa7, 0xe8, 0xbf, 0x0d, 0xde, 0x80, 0x9b, 0x01, 0xc5, 0xed, 0x78, + 0xd4, 0x47, 0xed, 0x24, 0xf2, 0xd9, 0xfc, 0x8b, 0x0e, 0x0c, 0x28, 0x7e, 0x3e, 0xea, 0xa3, 0x17, + 0x91, 0xdf, 0x38, 0xfc, 0x7b, 0x54, 0xa5, 0x8b, 0x4a, 0x79, 0xc1, 0xe6, 0x36, 0xdc, 0x5a, 0x38, + 0x52, 0x6d, 0xfd, 0x17, 0x80, 0xd9, 0x16, 0xc5, 0xca, 0x53, 0x98, 0xe7, 0xfb, 0xac, 0xaf, 0x5e, + 0x0d, 0x39, 0x65, 0xed, 0xee, 0xd5, 0xf8, 0xa2, 0x8d, 0x4f, 0x60, 0x8e, 0x6d, 0xc0, 0xde, 0xa5, + 0xfc, 0x14, 0xd6, 0x0e, 0xaf, 0x84, 0x17, 0xa7, 0x39, 0x70, 0x5d, 0xb4, 0x7d, 0xff, 0xd2, 0x04, + 0x4e, 0xd0, 0xee, 0xfd, 0x83, 0x20, 0xcf, 0xd4, 0xf2, 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, } // Reference imports to suppress errors if they are not otherwise used. @@ -514,11 +514,18 @@ func (m *MsgGrant) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if len(m.Rules) > 0 { - i -= len(m.Rules) - copy(dAtA[i:], m.Rules) - i = encodeVarintTx(dAtA, i, uint64(len(m.Rules))) - i-- - dAtA[i] = 0x22 + 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 + } } { size, err := m.Grant.MarshalToSizedBuffer(dAtA[:i]) @@ -740,9 +747,11 @@ func (m *MsgGrant) Size() (n int) { } l = m.Grant.Size() n += 1 + l + sovTx(uint64(l)) - l = len(m.Rules) - if l > 0 { - 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)) + } } return n } @@ -956,7 +965,7 @@ func (m *MsgGrant) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Rules", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -966,24 +975,24 @@ func (m *MsgGrant) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Rules = append(m.Rules[:0], dAtA[iNdEx:postIndex]...) - if m.Rules == nil { - m.Rules = []byte{} + m.Rules = append(m.Rules, &Rule{}) + if err := m.Rules[len(m.Rules)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: diff --git a/x/bank/types/send_authorization.go b/x/bank/types/send_authorization.go index 9c174058ea50..22449301700b 100644 --- a/x/bank/types/send_authorization.go +++ b/x/bank/types/send_authorization.go @@ -2,7 +2,6 @@ package types import ( context "context" - "encoding/json" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -97,7 +96,3 @@ func toBech32Addresses(allowed []sdk.AccAddress) []string { return allowedAddrs } - -func (a SendAuthorization) GetOptions() json.RawMessage { - return nil -} diff --git a/x/staking/types/authz.go b/x/staking/types/authz.go index 223e1fe7641e..284be1fa5af8 100644 --- a/x/staking/types/authz.go +++ b/x/staking/types/authz.go @@ -2,7 +2,6 @@ package types import ( context "context" - "encoding/json" errorsmod "cosmossdk.io/errors" @@ -154,10 +153,6 @@ func (a StakeAuthorization) Accept(ctx context.Context, msg sdk.Msg) (authz.Acce }, nil } -func (a StakeAuthorization) GetOptions() json.RawMessage { - return nil -} - func validateAllowAndDenyValidators(allowed, denied []sdk.ValAddress) ([]string, []string, error) { if len(allowed) == 0 && len(denied) == 0 { return nil, nil, sdkerrors.ErrInvalidRequest.Wrap("both allowed & deny list cannot be empty")