feat(x/gov): extend governance config (#18428)

This commit is contained in:
emidev98
2023-11-10 15:17:56 +00:00
committed by GitHub
parent 5741c320b9
commit 89296ccdd3
12 changed files with 228 additions and 47 deletions
+142 -21
View File
@@ -17,6 +17,8 @@ var (
md_Module protoreflect.MessageDescriptor
fd_Module_max_metadata_len protoreflect.FieldDescriptor
fd_Module_authority protoreflect.FieldDescriptor
fd_Module_max_title_len protoreflect.FieldDescriptor
fd_Module_max_summary_len protoreflect.FieldDescriptor
)
func init() {
@@ -24,6 +26,8 @@ func init() {
md_Module = File_cosmos_gov_module_v1_module_proto.Messages().ByName("Module")
fd_Module_max_metadata_len = md_Module.Fields().ByName("max_metadata_len")
fd_Module_authority = md_Module.Fields().ByName("authority")
fd_Module_max_title_len = md_Module.Fields().ByName("max_title_len")
fd_Module_max_summary_len = md_Module.Fields().ByName("max_summary_len")
}
var _ protoreflect.Message = (*fastReflection_Module)(nil)
@@ -103,6 +107,18 @@ func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, proto
return
}
}
if x.MaxTitleLen != uint64(0) {
value := protoreflect.ValueOfUint64(x.MaxTitleLen)
if !f(fd_Module_max_title_len, value) {
return
}
}
if x.MaxSummaryLen != uint64(0) {
value := protoreflect.ValueOfUint64(x.MaxSummaryLen)
if !f(fd_Module_max_summary_len, value) {
return
}
}
}
// Has reports whether a field is populated.
@@ -122,6 +138,10 @@ func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool {
return x.MaxMetadataLen != uint64(0)
case "cosmos.gov.module.v1.Module.authority":
return x.Authority != ""
case "cosmos.gov.module.v1.Module.max_title_len":
return x.MaxTitleLen != uint64(0)
case "cosmos.gov.module.v1.Module.max_summary_len":
return x.MaxSummaryLen != uint64(0)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.module.v1.Module"))
@@ -142,6 +162,10 @@ func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) {
x.MaxMetadataLen = uint64(0)
case "cosmos.gov.module.v1.Module.authority":
x.Authority = ""
case "cosmos.gov.module.v1.Module.max_title_len":
x.MaxTitleLen = uint64(0)
case "cosmos.gov.module.v1.Module.max_summary_len":
x.MaxSummaryLen = uint64(0)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.module.v1.Module"))
@@ -164,6 +188,12 @@ func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) pro
case "cosmos.gov.module.v1.Module.authority":
value := x.Authority
return protoreflect.ValueOfString(value)
case "cosmos.gov.module.v1.Module.max_title_len":
value := x.MaxTitleLen
return protoreflect.ValueOfUint64(value)
case "cosmos.gov.module.v1.Module.max_summary_len":
value := x.MaxSummaryLen
return protoreflect.ValueOfUint64(value)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.module.v1.Module"))
@@ -188,6 +218,10 @@ func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value proto
x.MaxMetadataLen = value.Uint()
case "cosmos.gov.module.v1.Module.authority":
x.Authority = value.Interface().(string)
case "cosmos.gov.module.v1.Module.max_title_len":
x.MaxTitleLen = value.Uint()
case "cosmos.gov.module.v1.Module.max_summary_len":
x.MaxSummaryLen = value.Uint()
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.module.v1.Module"))
@@ -212,6 +246,10 @@ func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protore
panic(fmt.Errorf("field max_metadata_len of message cosmos.gov.module.v1.Module is not mutable"))
case "cosmos.gov.module.v1.Module.authority":
panic(fmt.Errorf("field authority of message cosmos.gov.module.v1.Module is not mutable"))
case "cosmos.gov.module.v1.Module.max_title_len":
panic(fmt.Errorf("field max_title_len of message cosmos.gov.module.v1.Module is not mutable"))
case "cosmos.gov.module.v1.Module.max_summary_len":
panic(fmt.Errorf("field max_summary_len of message cosmos.gov.module.v1.Module is not mutable"))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.module.v1.Module"))
@@ -229,6 +267,10 @@ func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protor
return protoreflect.ValueOfUint64(uint64(0))
case "cosmos.gov.module.v1.Module.authority":
return protoreflect.ValueOfString("")
case "cosmos.gov.module.v1.Module.max_title_len":
return protoreflect.ValueOfUint64(uint64(0))
case "cosmos.gov.module.v1.Module.max_summary_len":
return protoreflect.ValueOfUint64(uint64(0))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.module.v1.Module"))
@@ -305,6 +347,12 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
if x.MaxTitleLen != 0 {
n += 1 + runtime.Sov(uint64(x.MaxTitleLen))
}
if x.MaxSummaryLen != 0 {
n += 1 + runtime.Sov(uint64(x.MaxSummaryLen))
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
@@ -334,6 +382,16 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if x.MaxSummaryLen != 0 {
i = runtime.EncodeVarint(dAtA, i, uint64(x.MaxSummaryLen))
i--
dAtA[i] = 0x20
}
if x.MaxTitleLen != 0 {
i = runtime.EncodeVarint(dAtA, i, uint64(x.MaxTitleLen))
i--
dAtA[i] = 0x18
}
if len(x.Authority) > 0 {
i -= len(x.Authority)
copy(dAtA[i:], x.Authority)
@@ -446,6 +504,44 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
}
x.Authority = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MaxTitleLen", wireType)
}
x.MaxTitleLen = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
x.MaxTitleLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MaxSummaryLen", wireType)
}
x.MaxSummaryLen = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
x.MaxSummaryLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
@@ -505,6 +601,12 @@ type Module struct {
MaxMetadataLen uint64 `protobuf:"varint,1,opt,name=max_metadata_len,json=maxMetadataLen,proto3" json:"max_metadata_len,omitempty"`
// authority defines the custom module authority. If not set, defaults to the governance module.
Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"`
// max_title_len defines the maximum proposal title length.
// Defaults to 255 if not explicitly set.
MaxTitleLen uint64 `protobuf:"varint,3,opt,name=max_title_len,json=maxTitleLen,proto3" json:"max_title_len,omitempty"`
// max_summary_len defines the maximum proposal summary length.
// Defaults to 10200 if not explicitly set.
MaxSummaryLen uint64 `protobuf:"varint,4,opt,name=max_summary_len,json=maxSummaryLen,proto3" json:"max_summary_len,omitempty"`
}
func (x *Module) Reset() {
@@ -541,6 +643,20 @@ func (x *Module) GetAuthority() string {
return ""
}
func (x *Module) GetMaxTitleLen() uint64 {
if x != nil {
return x.MaxTitleLen
}
return 0
}
func (x *Module) GetMaxSummaryLen() uint64 {
if x != nil {
return x.MaxSummaryLen
}
return 0
}
var File_cosmos_gov_module_v1_module_proto protoreflect.FileDescriptor
var file_cosmos_gov_module_v1_module_proto_rawDesc = []byte{
@@ -549,27 +665,32 @@ var file_cosmos_gov_module_v1_module_proto_rawDesc = []byte{
0x6f, 0x74, 0x6f, 0x12, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e,
0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f,
0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6c, 0x0a, 0x06, 0x4d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x5f, 0x6d, 0x65, 0x74,
0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6c, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52,
0x0e, 0x6d, 0x61, 0x78, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4c, 0x65, 0x6e, 0x12,
0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0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d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31,
0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x17, 0x43,
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x47, 0x6f, 0x76, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75,
0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb8, 0x01, 0x0a, 0x06,
0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x5f, 0x6d, 0x65,
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6c, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04,
0x52, 0x0e, 0x6d, 0x61, 0x78, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4c, 0x65, 0x6e,
0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x22,
0x0a, 0x0d, 0x6d, 0x61, 0x78, 0x5f, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x18,
0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x78, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x4c,
0x65, 0x6e, 0x12, 0x26, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72,
0x79, 0x5f, 0x6c, 0x65, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x6d, 0x61, 0x78,
0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x4c, 0x65, 0x6e, 0x3a, 0x1a, 0xba, 0xc0, 0x96, 0xda,
0x01, 0x14, 0x0a, 0x12, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f,
0x2f, 0x78, 0x2f, 0x67, 0x6f, 0x76, 0x42, 0xca, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x63,
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f,
0x50, 0x01, 0x5a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f,
0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x67, 0x6f, 0x76, 0x2f,
0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x47, 0x4d, 0xaa, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f,
0x73, 0x2e, 0x47, 0x6f, 0x76, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca,
0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x6f, 0x76, 0x5c, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x20, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c,
0x47, 0x6f, 0x76, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50,
0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x17, 0x43, 0x6f, 0x73, 0x6d,
0x6f, 0x73, 0x3a, 0x3a, 0x47, 0x6f, 0x76, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a,
0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (