From c44408ca0c7ae51575480204a4f87a3825060fac Mon Sep 17 00:00:00 2001 From: atheesh Date: Fri, 1 Jul 2022 15:04:44 +0530 Subject: [PATCH 01/23] WIP: distribution params --- api/cosmos/auth/v1beta1/query.pulsar.go | 4 +- .../distribution/v1beta1/genesis.pulsar.go | 8 +- api/cosmos/distribution/v1beta1/tx.pulsar.go | 1128 ++++++++++++++++- api/cosmos/distribution/v1beta1/tx_grpc.pb.go | 44 + .../cosmos/distribution/v1beta1/genesis.proto | 8 +- proto/cosmos/distribution/v1beta1/tx.proto | 28 + x/auth/types/query.pb.go | 4 +- x/distribution/keeper/keeper.go | 6 +- x/distribution/keeper/msg_server.go | 17 + x/distribution/types/genesis.pb.go | 8 +- x/distribution/types/tx.pb.go | 527 +++++++- 11 files changed, 1666 insertions(+), 116 deletions(-) diff --git a/api/cosmos/auth/v1beta1/query.pulsar.go b/api/cosmos/auth/v1beta1/query.pulsar.go index a8c80520a731..cabd51fb4fc1 100644 --- a/api/cosmos/auth/v1beta1/query.pulsar.go +++ b/api/cosmos/auth/v1beta1/query.pulsar.go @@ -7329,7 +7329,7 @@ func (x *AddressStringToBytesResponse) GetAddressBytes() []byte { return nil } -// QueryAccountAddressByIDRequest is the request type for AccountAddressById rpc method +// QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method type QueryAccountAddressByIDRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -7365,7 +7365,7 @@ func (x *QueryAccountAddressByIDRequest) GetId() int64 { return 0 } -// QueryAccountAddressByIDResponse is the response type for AccountAddressById rpc method +// QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method type QueryAccountAddressByIDResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/api/cosmos/distribution/v1beta1/genesis.pulsar.go b/api/cosmos/distribution/v1beta1/genesis.pulsar.go index a005a8f1238c..5baddfce8c11 100644 --- a/api/cosmos/distribution/v1beta1/genesis.pulsar.go +++ b/api/cosmos/distribution/v1beta1/genesis.pulsar.go @@ -5685,7 +5685,13 @@ type GenesisState struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // params defines all the paramaters of the module. + // params defines all the parameters of the module. + // + // Deprecated: Use governance to submit a MsgUpdateParams message to instruct + // the x/distribution module to update the relevant parameters. + // + // Since the cosmos-sdk 0.47 version, this only exists for backwards + // compatibility of genesis state. Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` // fee_pool defines the fee pool at genesis. FeePool *FeePool `protobuf:"bytes,2,opt,name=fee_pool,json=feePool,proto3" json:"fee_pool,omitempty"` diff --git a/api/cosmos/distribution/v1beta1/tx.pulsar.go b/api/cosmos/distribution/v1beta1/tx.pulsar.go index eebf41d9e62f..7278b963e550 100644 --- a/api/cosmos/distribution/v1beta1/tx.pulsar.go +++ b/api/cosmos/distribution/v1beta1/tx.pulsar.go @@ -3662,6 +3662,861 @@ func (x *fastReflection_MsgFundCommunityPoolResponse) ProtoMethods() *protoiface } } +var ( + md_MsgUpdateParams protoreflect.MessageDescriptor + fd_MsgUpdateParams_authority protoreflect.FieldDescriptor + fd_MsgUpdateParams_params protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_distribution_v1beta1_tx_proto_init() + md_MsgUpdateParams = File_cosmos_distribution_v1beta1_tx_proto.Messages().ByName("MsgUpdateParams") + fd_MsgUpdateParams_authority = md_MsgUpdateParams.Fields().ByName("authority") + fd_MsgUpdateParams_params = md_MsgUpdateParams.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParams)(nil) + +type fastReflection_MsgUpdateParams MsgUpdateParams + +func (x *MsgUpdateParams) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(x) +} + +func (x *MsgUpdateParams) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_distribution_v1beta1_tx_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParams_messageType fastReflection_MsgUpdateParams_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParams_messageType{} + +type fastReflection_MsgUpdateParams_messageType struct{} + +func (x fastReflection_MsgUpdateParams_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(nil) +} +func (x fastReflection_MsgUpdateParams_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} +func (x fastReflection_MsgUpdateParams_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// 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_MsgUpdateParams) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParams_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParams) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParams) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParams)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgUpdateParams_authority, value) { + return + } + } + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_MsgUpdateParams_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParams) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.distribution.v1beta1.MsgUpdateParams.authority": + return x.Authority != "" + case "cosmos.distribution.v1beta1.MsgUpdateParams.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.distribution.v1beta1.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.distribution.v1beta1.MsgUpdateParams.authority": + x.Authority = "" + case "cosmos.distribution.v1beta1.MsgUpdateParams.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.distribution.v1beta1.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.distribution.v1beta1.MsgUpdateParams.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "cosmos.distribution.v1beta1.MsgUpdateParams.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.distribution.v1beta1.MsgUpdateParams does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.distribution.v1beta1.MsgUpdateParams.authority": + x.Authority = value.Interface().(string) + case "cosmos.distribution.v1beta1.MsgUpdateParams.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.distribution.v1beta1.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.distribution.v1beta1.MsgUpdateParams.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "cosmos.distribution.v1beta1.MsgUpdateParams.authority": + panic(fmt.Errorf("field authority of message cosmos.distribution.v1beta1.MsgUpdateParams is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.distribution.v1beta1.MsgUpdateParams 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_MsgUpdateParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.distribution.v1beta1.MsgUpdateParams.authority": + return protoreflect.ValueOfString("") + case "cosmos.distribution.v1beta1.MsgUpdateParams.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.distribution.v1beta1.MsgUpdateParams 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_MsgUpdateParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.distribution.v1beta1.MsgUpdateParams", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParams) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParams) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParams) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: 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 Authority", 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.Authority = 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 Params", 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.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUpdateParamsResponse protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_distribution_v1beta1_tx_proto_init() + md_MsgUpdateParamsResponse = File_cosmos_distribution_v1beta1_tx_proto.Messages().ByName("MsgUpdateParamsResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParamsResponse)(nil) + +type fastReflection_MsgUpdateParamsResponse MsgUpdateParamsResponse + +func (x *MsgUpdateParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(x) +} + +func (x *MsgUpdateParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_distribution_v1beta1_tx_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParamsResponse_messageType fastReflection_MsgUpdateParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParamsResponse_messageType{} + +type fastReflection_MsgUpdateParamsResponse_messageType struct{} + +func (x fastReflection_MsgUpdateParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(nil) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// 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_MsgUpdateParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParamsResponse) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParamsResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParamsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.distribution.v1beta1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.distribution.v1beta1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.distribution.v1beta1.MsgUpdateParamsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.distribution.v1beta1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.distribution.v1beta1.MsgUpdateParamsResponse 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_MsgUpdateParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.distribution.v1beta1.MsgUpdateParamsResponse 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_MsgUpdateParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.distribution.v1beta1.MsgUpdateParamsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParamsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParamsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -3975,6 +4830,86 @@ func (*MsgFundCommunityPoolResponse) Descriptor() ([]byte, []int) { return file_cosmos_distribution_v1beta1_tx_proto_rawDescGZIP(), []int{7} } +// MsgUpdateParams is the Msg/UpdateParams request type. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/distribution parameters to update. + // + // NOTE: All parameters must be supplied. + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParams) Reset() { + *x = MsgUpdateParams{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_distribution_v1beta1_tx_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParams) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return file_cosmos_distribution_v1beta1_tx_proto_rawDescGZIP(), []int{8} +} + +func (x *MsgUpdateParams) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgUpdateParams) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUpdateParamsResponse) Reset() { + *x = MsgUpdateParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_distribution_v1beta1_tx_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParamsResponse) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return file_cosmos_distribution_v1beta1_tx_proto_rawDescGZIP(), []int{9} +} + var File_cosmos_distribution_v1beta1_tx_proto protoreflect.FileDescriptor var file_cosmos_distribution_v1beta1_tx_proto_rawDesc = []byte{ @@ -3988,7 +4923,10 @@ var file_cosmos_distribution_v1beta1_tx_proto_rawDesc = []byte{ 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 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, 0x22, 0xc3, 0x01, + 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, + 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x64, 0x69, 0x73, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc3, 0x01, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x74, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x45, 0x0a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, @@ -4057,60 +4995,79 @@ var file_cosmos_distribution_v1beta1_tx_proto_rawDesc = []byte{ 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x22, 0x1e, 0x0a, 0x1c, 0x4d, 0x73, 0x67, 0x46, 0x75, 0x6e, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc8, 0x04, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x84, 0x01, - 0x0a, 0x12, 0x53, 0x65, 0x74, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x12, 0x32, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x64, 0x69, - 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x74, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, - 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x1a, 0x3a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x74, 0x57, 0x69, 0x74, - 0x68, 0x64, 0x72, 0x61, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x93, 0x01, 0x0a, 0x17, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, - 0x77, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, - 0x12, 0x37, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, - 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, - 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, - 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x1a, 0x3f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, - 0x72, 0x61, 0x77, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, - 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x9f, 0x01, 0x0a, 0x1b, 0x57, - 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, - 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x3b, 0x2e, 0x63, 0x6f, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x9c, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 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, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x12, 0x41, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x64, 0x69, 0x73, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x74, 0x79, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, + 0xbc, 0x05, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x84, 0x01, 0x0a, 0x12, 0x53, 0x65, 0x74, 0x57, + 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x32, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, + 0x53, 0x65, 0x74, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x1a, 0x3a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x64, 0x69, 0x73, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x74, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x93, + 0x01, 0x0a, 0x17, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x44, 0x65, 0x6c, 0x65, 0x67, + 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x37, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, - 0x64, 0x72, 0x61, 0x77, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x43, 0x6f, 0x6d, - 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0x43, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, + 0x64, 0x72, 0x61, 0x77, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, + 0x61, 0x72, 0x64, 0x1a, 0x3f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x64, 0x69, 0x73, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x44, 0x65, 0x6c, + 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x9f, 0x01, 0x0a, 0x1b, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x81, 0x01, 0x0a, - 0x11, 0x46, 0x75, 0x6e, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x50, 0x6f, - 0x6f, 0x6c, 0x12, 0x31, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x64, 0x69, 0x73, 0x74, - 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x4d, 0x73, 0x67, 0x46, 0x75, 0x6e, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, - 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x1a, 0x39, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x64, - 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x46, 0x75, 0x6e, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x75, - 0x6e, 0x69, 0x74, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x42, 0xfe, 0x01, 0x0a, 0x1f, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x40, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, - 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x64, 0x69, - 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0xa2, 0x02, 0x03, 0x43, 0x44, 0x58, 0xaa, 0x02, 0x1b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x1b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x44, - 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0xe2, 0x02, 0x27, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x44, 0x69, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x3b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x64, 0x69, + 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x56, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x1a, 0x43, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x64, 0x69, 0x73, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x56, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x6f, 0x72, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x81, 0x01, 0x0a, 0x11, 0x46, 0x75, 0x6e, 0x64, 0x43, + 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x31, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x46, 0x75, + 0x6e, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x1a, + 0x39, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, + 0x67, 0x46, 0x75, 0x6e, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x50, 0x6f, + 0x6f, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x72, 0x0a, 0x0c, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2c, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x34, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xfe, + 0x01, 0x0a, 0x1f, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x64, 0x69, + 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x40, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x64, 0x69, 0x73, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, + 0x02, 0x03, 0x43, 0x44, 0x58, 0xaa, 0x02, 0x1b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, + 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0xca, 0x02, 0x1b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1d, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa8, 0xe2, 0x1e, - 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x31, 0xe2, 0x02, 0x27, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x44, 0x69, 0x73, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1d, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, + 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa8, 0xe2, 0x1e, 0x01, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -4125,7 +5082,7 @@ func file_cosmos_distribution_v1beta1_tx_proto_rawDescGZIP() []byte { return file_cosmos_distribution_v1beta1_tx_proto_rawDescData } -var file_cosmos_distribution_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_cosmos_distribution_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_cosmos_distribution_v1beta1_tx_proto_goTypes = []interface{}{ (*MsgSetWithdrawAddress)(nil), // 0: cosmos.distribution.v1beta1.MsgSetWithdrawAddress (*MsgSetWithdrawAddressResponse)(nil), // 1: cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse @@ -4135,25 +5092,31 @@ var file_cosmos_distribution_v1beta1_tx_proto_goTypes = []interface{}{ (*MsgWithdrawValidatorCommissionResponse)(nil), // 5: cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse (*MsgFundCommunityPool)(nil), // 6: cosmos.distribution.v1beta1.MsgFundCommunityPool (*MsgFundCommunityPoolResponse)(nil), // 7: cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse - (*v1beta1.Coin)(nil), // 8: cosmos.base.v1beta1.Coin + (*MsgUpdateParams)(nil), // 8: cosmos.distribution.v1beta1.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 9: cosmos.distribution.v1beta1.MsgUpdateParamsResponse + (*v1beta1.Coin)(nil), // 10: cosmos.base.v1beta1.Coin + (*Params)(nil), // 11: cosmos.distribution.v1beta1.Params } var file_cosmos_distribution_v1beta1_tx_proto_depIdxs = []int32{ - 8, // 0: cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse.amount:type_name -> cosmos.base.v1beta1.Coin - 8, // 1: cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse.amount:type_name -> cosmos.base.v1beta1.Coin - 8, // 2: cosmos.distribution.v1beta1.MsgFundCommunityPool.amount:type_name -> cosmos.base.v1beta1.Coin - 0, // 3: cosmos.distribution.v1beta1.Msg.SetWithdrawAddress:input_type -> cosmos.distribution.v1beta1.MsgSetWithdrawAddress - 2, // 4: cosmos.distribution.v1beta1.Msg.WithdrawDelegatorReward:input_type -> cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward - 4, // 5: cosmos.distribution.v1beta1.Msg.WithdrawValidatorCommission:input_type -> cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission - 6, // 6: cosmos.distribution.v1beta1.Msg.FundCommunityPool:input_type -> cosmos.distribution.v1beta1.MsgFundCommunityPool - 1, // 7: cosmos.distribution.v1beta1.Msg.SetWithdrawAddress:output_type -> cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse - 3, // 8: cosmos.distribution.v1beta1.Msg.WithdrawDelegatorReward:output_type -> cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse - 5, // 9: cosmos.distribution.v1beta1.Msg.WithdrawValidatorCommission:output_type -> cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse - 7, // 10: cosmos.distribution.v1beta1.Msg.FundCommunityPool:output_type -> cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse - 7, // [7:11] is the sub-list for method output_type - 3, // [3:7] 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 + 10, // 0: cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse.amount:type_name -> cosmos.base.v1beta1.Coin + 10, // 1: cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse.amount:type_name -> cosmos.base.v1beta1.Coin + 10, // 2: cosmos.distribution.v1beta1.MsgFundCommunityPool.amount:type_name -> cosmos.base.v1beta1.Coin + 11, // 3: cosmos.distribution.v1beta1.MsgUpdateParams.params:type_name -> cosmos.distribution.v1beta1.Params + 0, // 4: cosmos.distribution.v1beta1.Msg.SetWithdrawAddress:input_type -> cosmos.distribution.v1beta1.MsgSetWithdrawAddress + 2, // 5: cosmos.distribution.v1beta1.Msg.WithdrawDelegatorReward:input_type -> cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward + 4, // 6: cosmos.distribution.v1beta1.Msg.WithdrawValidatorCommission:input_type -> cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission + 6, // 7: cosmos.distribution.v1beta1.Msg.FundCommunityPool:input_type -> cosmos.distribution.v1beta1.MsgFundCommunityPool + 8, // 8: cosmos.distribution.v1beta1.Msg.UpdateParams:input_type -> cosmos.distribution.v1beta1.MsgUpdateParams + 1, // 9: cosmos.distribution.v1beta1.Msg.SetWithdrawAddress:output_type -> cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse + 3, // 10: cosmos.distribution.v1beta1.Msg.WithdrawDelegatorReward:output_type -> cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse + 5, // 11: cosmos.distribution.v1beta1.Msg.WithdrawValidatorCommission:output_type -> cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse + 7, // 12: cosmos.distribution.v1beta1.Msg.FundCommunityPool:output_type -> cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse + 9, // 13: cosmos.distribution.v1beta1.Msg.UpdateParams:output_type -> cosmos.distribution.v1beta1.MsgUpdateParamsResponse + 9, // [9:14] is the sub-list for method output_type + 4, // [4:9] 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 } func init() { file_cosmos_distribution_v1beta1_tx_proto_init() } @@ -4161,6 +5124,7 @@ func file_cosmos_distribution_v1beta1_tx_proto_init() { if File_cosmos_distribution_v1beta1_tx_proto != nil { return } + file_cosmos_distribution_v1beta1_distribution_proto_init() if !protoimpl.UnsafeEnabled { file_cosmos_distribution_v1beta1_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MsgSetWithdrawAddress); i { @@ -4258,6 +5222,30 @@ func file_cosmos_distribution_v1beta1_tx_proto_init() { return nil } } + file_cosmos_distribution_v1beta1_tx_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_distribution_v1beta1_tx_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -4265,7 +5253,7 @@ func file_cosmos_distribution_v1beta1_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_distribution_v1beta1_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 10, NumExtensions: 0, NumServices: 1, }, diff --git a/api/cosmos/distribution/v1beta1/tx_grpc.pb.go b/api/cosmos/distribution/v1beta1/tx_grpc.pb.go index 22dce9ef26e9..40c32fb20b28 100644 --- a/api/cosmos/distribution/v1beta1/tx_grpc.pb.go +++ b/api/cosmos/distribution/v1beta1/tx_grpc.pb.go @@ -34,6 +34,11 @@ type MsgClient interface { // FundCommunityPool defines a method to allow an account to directly // fund the community pool. FundCommunityPool(ctx context.Context, in *MsgFundCommunityPool, opts ...grpc.CallOption) (*MsgFundCommunityPoolResponse, error) + // UpdateParams defines a governance operation for updating the x/distribution module + // parameters. The authority is hard-coded to the x/gov module account. + // + // Since: cosmos-sdk 0.47 + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -80,6 +85,15 @@ func (c *msgClient) FundCommunityPool(ctx context.Context, in *MsgFundCommunityP return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/cosmos.distribution.v1beta1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. // All implementations must embed UnimplementedMsgServer // for forward compatibility @@ -96,6 +110,11 @@ type MsgServer interface { // FundCommunityPool defines a method to allow an account to directly // fund the community pool. FundCommunityPool(context.Context, *MsgFundCommunityPool) (*MsgFundCommunityPoolResponse, error) + // UpdateParams defines a governance operation for updating the x/distribution module + // parameters. The authority is hard-coded to the x/gov module account. + // + // Since: cosmos-sdk 0.47 + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) mustEmbedUnimplementedMsgServer() } @@ -115,6 +134,9 @@ func (UnimplementedMsgServer) WithdrawValidatorCommission(context.Context, *MsgW func (UnimplementedMsgServer) FundCommunityPool(context.Context, *MsgFundCommunityPool) (*MsgFundCommunityPoolResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method FundCommunityPool not implemented") } +func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. @@ -200,6 +222,24 @@ func _Msg_FundCommunityPool_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.distribution.v1beta1.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + // Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -223,6 +263,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "FundCommunityPool", Handler: _Msg_FundCommunityPool_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/distribution/v1beta1/tx.proto", diff --git a/proto/cosmos/distribution/v1beta1/genesis.proto b/proto/cosmos/distribution/v1beta1/genesis.proto index 4662e8df42be..4fcdc5118d93 100644 --- a/proto/cosmos/distribution/v1beta1/genesis.proto +++ b/proto/cosmos/distribution/v1beta1/genesis.proto @@ -112,7 +112,13 @@ message GenesisState { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - // params defines all the paramaters of the module. + // params defines all the parameters of the module. + // + // Deprecated: Use governance to submit a MsgUpdateParams message to instruct + // the x/distribution module to update the relevant parameters. + // + // Since the cosmos-sdk 0.47 version, this only exists for backwards + // compatibility of genesis state. Params params = 1 [(gogoproto.nullable) = false]; // fee_pool defines the fee pool at genesis. diff --git a/proto/cosmos/distribution/v1beta1/tx.proto b/proto/cosmos/distribution/v1beta1/tx.proto index 68fea0c27c16..d6b7e23a6108 100644 --- a/proto/cosmos/distribution/v1beta1/tx.proto +++ b/proto/cosmos/distribution/v1beta1/tx.proto @@ -8,6 +8,7 @@ import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; +import "cosmos/distribution/v1beta1/distribution.proto"; // Msg defines the distribution Msg service. service Msg { @@ -26,6 +27,12 @@ service Msg { // FundCommunityPool defines a method to allow an account to directly // fund the community pool. rpc FundCommunityPool(MsgFundCommunityPool) returns (MsgFundCommunityPoolResponse); + + // UpdateParams defines a governance operation for updating the x/distribution module + // parameters. The authority is hard-coded to the x/gov module account. + // + // Since: cosmos-sdk 0.47 + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgSetWithdrawAddress sets the withdraw address for @@ -95,3 +102,24 @@ message MsgFundCommunityPool { // MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type. message MsgFundCommunityPoolResponse {} + +// MsgUpdateParams is the Msg/UpdateParams request type. +// +// Since: cosmos-sdk 0.47 +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address of the governance account. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the x/distribution parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: cosmos-sdk 0.47 +message MsgUpdateParamsResponse {} diff --git a/x/auth/types/query.pb.go b/x/auth/types/query.pb.go index a943f9bf7ff1..bbfd57379cd8 100644 --- a/x/auth/types/query.pb.go +++ b/x/auth/types/query.pb.go @@ -665,7 +665,7 @@ func (m *AddressStringToBytesResponse) GetAddressBytes() []byte { return nil } -// QueryAccountAddressByIDRequest is the request type for AccountAddressById rpc method +// QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method type QueryAccountAddressByIDRequest struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` } @@ -710,7 +710,7 @@ func (m *QueryAccountAddressByIDRequest) GetId() int64 { return 0 } -// QueryAccountAddressByIDResponse is the response type for AccountAddressById rpc method +// QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method type QueryAccountAddressByIDResponse struct { AccountAddress string `protobuf:"bytes,1,opt,name=account_address,json=accountAddress,proto3" json:"account_address,omitempty"` } diff --git a/x/distribution/keeper/keeper.go b/x/distribution/keeper/keeper.go index 6af1ede7e5cd..b9b866821a55 100644 --- a/x/distribution/keeper/keeper.go +++ b/x/distribution/keeper/keeper.go @@ -21,6 +21,9 @@ type Keeper struct { authKeeper types.AccountKeeper bankKeeper types.BankKeeper stakingKeeper types.StakingKeeper + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string feeCollectorName string // name of the FeeCollector ModuleAccount } @@ -29,7 +32,7 @@ type Keeper struct { func NewKeeper( cdc codec.BinaryCodec, key storetypes.StoreKey, paramSpace paramtypes.Subspace, ak types.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper, - feeCollectorName string, + feeCollectorName string, authority string, ) Keeper { // ensure distribution module account is set if addr := ak.GetModuleAddress(types.ModuleName); addr == nil { @@ -49,6 +52,7 @@ func NewKeeper( bankKeeper: bk, stakingKeeper: sk, feeCollectorName: feeCollectorName, + authority: authority, } } diff --git a/x/distribution/keeper/msg_server.go b/x/distribution/keeper/msg_server.go index 40ba0ce25727..7619017c1e61 100644 --- a/x/distribution/keeper/msg_server.go +++ b/x/distribution/keeper/msg_server.go @@ -7,7 +7,9 @@ import ( "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/distribution/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) type msgServer struct { @@ -143,3 +145,18 @@ func (k msgServer) FundCommunityPool(goCtx context.Context, msg *types.MsgFundCo return &types.MsgFundCommunityPoolResponse{}, nil } + +func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if k.authority != req.Authority { + return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/distribution/types/genesis.pb.go b/x/distribution/types/genesis.pb.go index a1f2d7ba7b70..a2e0c208d018 100644 --- a/x/distribution/types/genesis.pb.go +++ b/x/distribution/types/genesis.pb.go @@ -327,7 +327,13 @@ var xxx_messageInfo_ValidatorSlashEventRecord proto.InternalMessageInfo // GenesisState defines the distribution module's genesis state. type GenesisState struct { - // params defines all the paramaters of the module. + // params defines all the parameters of the module. + // + // Deprecated: Use governance to submit a MsgUpdateParams message to instruct + // the x/distribution module to update the relevant parameters. + // + // Since the cosmos-sdk 0.47 version, this only exists for backwards + // compatibility of genesis state. Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` // fee_pool defines the fee pool at genesis. FeePool FeePool `protobuf:"bytes,2,opt,name=fee_pool,json=feePool,proto3" json:"fee_pool"` diff --git a/x/distribution/types/tx.pb.go b/x/distribution/types/tx.pb.go index 0eaca3be21c9..59227418de76 100644 --- a/x/distribution/types/tx.pb.go +++ b/x/distribution/types/tx.pb.go @@ -359,6 +359,105 @@ func (m *MsgFundCommunityPoolResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgFundCommunityPoolResponse proto.InternalMessageInfo +// MsgUpdateParams is the Msg/UpdateParams request type. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateParams struct { + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/distribution parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_ed4f433d965e58ca, []int{8} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ed4f433d965e58ca, []int{9} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgSetWithdrawAddress)(nil), "cosmos.distribution.v1beta1.MsgSetWithdrawAddress") proto.RegisterType((*MsgSetWithdrawAddressResponse)(nil), "cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse") @@ -368,6 +467,8 @@ func init() { proto.RegisterType((*MsgWithdrawValidatorCommissionResponse)(nil), "cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse") proto.RegisterType((*MsgFundCommunityPool)(nil), "cosmos.distribution.v1beta1.MsgFundCommunityPool") proto.RegisterType((*MsgFundCommunityPoolResponse)(nil), "cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "cosmos.distribution.v1beta1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "cosmos.distribution.v1beta1.MsgUpdateParamsResponse") } func init() { @@ -375,44 +476,50 @@ func init() { } var fileDescriptor_ed4f433d965e58ca = []byte{ - // 589 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0x41, 0x6b, 0x13, 0x41, - 0x14, 0xde, 0xb1, 0x52, 0xe8, 0x78, 0x30, 0x59, 0xa2, 0x4d, 0xb7, 0x3a, 0x29, 0x8b, 0x48, 0x10, - 0xba, 0x6b, 0x22, 0x28, 0xc6, 0x83, 0x98, 0x58, 0x6f, 0x41, 0x49, 0x41, 0xc1, 0x4b, 0xd9, 0x64, - 0x86, 0xe9, 0x60, 0x76, 0x27, 0xec, 0x4c, 0x92, 0xf6, 0xa8, 0x08, 0xea, 0x41, 0x10, 0xfc, 0x01, - 0xf6, 0x28, 0x9e, 0x3c, 0xf8, 0x0f, 0xbc, 0x04, 0xbd, 0x14, 0x4f, 0x9e, 0x54, 0x92, 0x83, 0xfe, - 0x0c, 0x49, 0x76, 0x76, 0x9b, 0x90, 0x4d, 0xb6, 0xb5, 0xd2, 0xd3, 0x2c, 0xf3, 0xde, 0xf7, 0xcd, - 0xf7, 0xbd, 0x7d, 0x6f, 0x06, 0x5e, 0x6a, 0x70, 0xe1, 0x72, 0x61, 0x63, 0x26, 0xa4, 0xcf, 0xea, - 0x6d, 0xc9, 0xb8, 0x67, 0x77, 0x0a, 0x75, 0x22, 0x9d, 0x82, 0x2d, 0x77, 0xac, 0x96, 0xcf, 0x25, - 0xd7, 0x57, 0x83, 0x2c, 0x6b, 0x3c, 0xcb, 0x52, 0x59, 0x46, 0x86, 0x72, 0xca, 0x47, 0x79, 0xf6, - 0xf0, 0x2b, 0x80, 0x18, 0x48, 0x11, 0xd7, 0x1d, 0x41, 0x22, 0xc2, 0x06, 0x67, 0x9e, 0x8a, 0xaf, - 0x04, 0xf1, 0xad, 0x00, 0xa8, 0xf8, 0x83, 0xd0, 0xb2, 0x82, 0xba, 0x82, 0xda, 0x9d, 0xc2, 0x70, - 0x09, 0x02, 0xe6, 0x67, 0x00, 0xcf, 0x55, 0x05, 0xdd, 0x24, 0xf2, 0x11, 0x93, 0xdb, 0xd8, 0x77, - 0xba, 0x77, 0x30, 0xf6, 0x89, 0x10, 0xfa, 0x06, 0x4c, 0x63, 0xd2, 0x24, 0xd4, 0x91, 0xdc, 0xdf, - 0x72, 0x82, 0xcd, 0x2c, 0x58, 0x03, 0xf9, 0xa5, 0x72, 0xf6, 0xdb, 0xa7, 0xf5, 0x8c, 0xe2, 0x57, - 0xe9, 0x9b, 0xd2, 0x67, 0x1e, 0xad, 0xa5, 0x22, 0x48, 0x48, 0x53, 0x81, 0xa9, 0xae, 0x62, 0x8e, - 0x58, 0x4e, 0x25, 0xb0, 0x9c, 0xed, 0x4e, 0x6a, 0x29, 0xa1, 0x97, 0x7b, 0x39, 0xed, 0xcf, 0x5e, - 0x4e, 0x7b, 0xf6, 0xfb, 0xe3, 0x95, 0x69, 0x59, 0x66, 0x0e, 0x5e, 0x8c, 0x35, 0x51, 0x23, 0xa2, - 0xc5, 0x3d, 0x41, 0xcc, 0x2f, 0x00, 0x1a, 0x55, 0x41, 0xc3, 0xf0, 0xdd, 0x90, 0xa1, 0x46, 0xba, - 0x8e, 0x8f, 0xff, 0x97, 0xd7, 0x0d, 0x98, 0xee, 0x38, 0x4d, 0x86, 0x27, 0x68, 0x92, 0xcc, 0xa6, - 0x22, 0xc8, 0x61, 0xdd, 0xbe, 0x02, 0xd0, 0x9c, 0x6d, 0x26, 0xf4, 0xac, 0x37, 0xe0, 0xa2, 0xe3, - 0xf2, 0xb6, 0x27, 0xb3, 0x60, 0x6d, 0x21, 0x7f, 0xa6, 0xb8, 0x62, 0xa9, 0xf3, 0x87, 0xfd, 0x13, - 0xb6, 0x9a, 0x55, 0xe1, 0xcc, 0x2b, 0x5f, 0xed, 0xfd, 0xc8, 0x69, 0x1f, 0x7e, 0xe6, 0xf2, 0x94, - 0xc9, 0xed, 0x76, 0xdd, 0x6a, 0x70, 0x57, 0xf5, 0x8f, 0x5a, 0xd6, 0x05, 0x7e, 0x62, 0xcb, 0xdd, - 0x16, 0x11, 0x23, 0x80, 0xa8, 0x29, 0x6a, 0xf3, 0x05, 0x80, 0x68, 0x4c, 0xcb, 0xc3, 0xd0, 0x4b, - 0x85, 0xbb, 0x2e, 0x13, 0x82, 0x71, 0x2f, 0xbe, 0x2a, 0xe0, 0x98, 0x55, 0x99, 0x62, 0x34, 0x5f, - 0x03, 0x78, 0x79, 0xbe, 0x92, 0x93, 0xad, 0xcc, 0x57, 0x00, 0x33, 0x55, 0x41, 0xef, 0xb5, 0x3d, - 0x3c, 0x94, 0xd0, 0xf6, 0x98, 0xdc, 0x7d, 0xc0, 0x79, 0xf3, 0x44, 0x4e, 0xd7, 0xaf, 0xc3, 0x25, - 0x4c, 0x5a, 0x5c, 0x30, 0xc9, 0xfd, 0xc4, 0x16, 0x3c, 0x48, 0x2d, 0x9d, 0x1f, 0xaf, 0xf2, 0xc1, - 0xbe, 0x89, 0xe0, 0x85, 0x38, 0x33, 0x61, 0x49, 0x8b, 0xbd, 0xd3, 0x70, 0xa1, 0x2a, 0xa8, 0xfe, - 0x1c, 0x40, 0x3d, 0xe6, 0x32, 0x29, 0x5a, 0x73, 0xae, 0x3b, 0x2b, 0x76, 0x76, 0x8d, 0xd2, 0xd1, - 0x31, 0xd1, 0x1f, 0x7e, 0x0b, 0xe0, 0xf2, 0xac, 0x61, 0xbf, 0x91, 0xc4, 0x3b, 0x03, 0x68, 0xdc, - 0xfe, 0x47, 0x60, 0xa4, 0xea, 0x1d, 0x80, 0xab, 0xf3, 0x26, 0xe5, 0xd6, 0x61, 0x0f, 0x88, 0x01, - 0x1b, 0x95, 0x63, 0x80, 0x23, 0x85, 0x4f, 0x01, 0x4c, 0x4f, 0x77, 0x6c, 0x21, 0x89, 0x7a, 0x0a, - 0x62, 0xdc, 0x3c, 0x32, 0x24, 0xd4, 0x50, 0xbe, 0xff, 0xbe, 0x8f, 0x40, 0xaf, 0x8f, 0xc0, 0x7e, - 0x1f, 0x81, 0x5f, 0x7d, 0x04, 0xde, 0x0c, 0x90, 0xb6, 0x3f, 0x40, 0xda, 0xf7, 0x01, 0xd2, 0x1e, - 0x17, 0xe6, 0x8e, 0xc2, 0xce, 0xe4, 0xab, 0x3b, 0x9a, 0x8c, 0xfa, 0xe2, 0xe8, 0xa9, 0xbb, 0xf6, - 0x37, 0x00, 0x00, 0xff, 0xff, 0x8b, 0x65, 0x3b, 0xae, 0x99, 0x07, 0x00, 0x00, + // 680 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x41, 0x6b, 0xd4, 0x40, + 0x14, 0xce, 0x58, 0x2d, 0x74, 0x2a, 0xb6, 0x0d, 0xd5, 0xb6, 0xa9, 0x66, 0x4b, 0x14, 0x29, 0x62, + 0x13, 0x77, 0x15, 0xc5, 0xf5, 0x20, 0xdd, 0xb5, 0xde, 0x16, 0xcb, 0x16, 0x15, 0xbc, 0x94, 0xd9, + 0xcd, 0x90, 0x0e, 0x36, 0x99, 0x90, 0x99, 0x74, 0xdb, 0xa3, 0x22, 0xa8, 0x07, 0x41, 0xf0, 0x2a, + 0xd8, 0xa3, 0x78, 0xf2, 0xe0, 0xd1, 0x9b, 0x97, 0xa2, 0x97, 0xe2, 0xc9, 0x93, 0xca, 0xf6, 0xa0, + 0x3f, 0x43, 0x92, 0x4c, 0xd2, 0x5d, 0x37, 0x4d, 0xba, 0x56, 0x7a, 0xca, 0x92, 0xf7, 0x7d, 0xdf, + 0xfb, 0xde, 0xdb, 0xf7, 0x1e, 0x81, 0xe7, 0x9a, 0x94, 0xd9, 0x94, 0x19, 0x26, 0x61, 0xdc, 0x23, + 0x0d, 0x9f, 0x13, 0xea, 0x18, 0x6b, 0xc5, 0x06, 0xe6, 0xa8, 0x68, 0xf0, 0x75, 0xdd, 0xf5, 0x28, + 0xa7, 0xf2, 0x74, 0x84, 0xd2, 0x3b, 0x51, 0xba, 0x40, 0x29, 0xe3, 0x16, 0xb5, 0x68, 0x88, 0x33, + 0x82, 0x5f, 0x11, 0x45, 0x51, 0x85, 0x70, 0x03, 0x31, 0x9c, 0x08, 0x36, 0x29, 0x71, 0x44, 0x7c, + 0x2a, 0x8a, 0x2f, 0x47, 0x44, 0xa1, 0x1f, 0x85, 0x26, 0x04, 0xd5, 0x66, 0x96, 0xb1, 0x56, 0x0c, + 0x1e, 0x22, 0xa0, 0x67, 0x99, 0xed, 0xf2, 0x16, 0xe2, 0xb5, 0x4f, 0x00, 0x9e, 0xac, 0x31, 0x6b, + 0x09, 0xf3, 0xfb, 0x84, 0xaf, 0x98, 0x1e, 0x6a, 0xcd, 0x9b, 0xa6, 0x87, 0x19, 0x93, 0x17, 0xe0, + 0x98, 0x89, 0x57, 0xb1, 0x85, 0x38, 0xf5, 0x96, 0x51, 0xf4, 0x72, 0x12, 0xcc, 0x80, 0xd9, 0xa1, + 0xca, 0xe4, 0xd7, 0x0f, 0x73, 0xe3, 0xc2, 0x8f, 0x80, 0x2f, 0x71, 0x8f, 0x38, 0x56, 0x7d, 0x34, + 0xa1, 0xc4, 0x32, 0x55, 0x38, 0xda, 0x12, 0xca, 0x89, 0xca, 0x91, 0x1c, 0x95, 0x91, 0x56, 0xb7, + 0x97, 0xb2, 0xfa, 0x6c, 0xb3, 0x20, 0xfd, 0xde, 0x2c, 0x48, 0x8f, 0x7f, 0xbd, 0xbf, 0xd0, 0x6b, + 0x4b, 0x2b, 0xc0, 0x33, 0xa9, 0x45, 0xd4, 0x31, 0x73, 0xa9, 0xc3, 0xb0, 0xf6, 0x19, 0x40, 0xa5, + 0xc6, 0xac, 0x38, 0x7c, 0x2b, 0x56, 0xa8, 0xe3, 0x16, 0xf2, 0xcc, 0xff, 0x55, 0xeb, 0x02, 0x1c, + 0x5b, 0x43, 0xab, 0xc4, 0xec, 0x92, 0xc9, 0x2b, 0x76, 0x34, 0xa1, 0xec, 0xb7, 0xda, 0xe7, 0x00, + 0x6a, 0x7b, 0x17, 0x13, 0xd7, 0x2c, 0x37, 0xe1, 0x20, 0xb2, 0xa9, 0xef, 0xf0, 0x49, 0x30, 0x33, + 0x30, 0x3b, 0x5c, 0x9a, 0x12, 0xb3, 0xa1, 0x07, 0xf3, 0x16, 0x8f, 0xa6, 0x5e, 0xa5, 0xc4, 0xa9, + 0x5c, 0xda, 0xfa, 0x5e, 0x90, 0xde, 0xfd, 0x28, 0xcc, 0x5a, 0x84, 0xaf, 0xf8, 0x0d, 0xbd, 0x49, + 0x6d, 0x31, 0x6f, 0xe2, 0x31, 0xc7, 0xcc, 0x87, 0x06, 0xdf, 0x70, 0x31, 0x0b, 0x09, 0xac, 0x2e, + 0xa4, 0xb5, 0xa7, 0x00, 0xaa, 0x1d, 0x5e, 0xee, 0xc5, 0xb5, 0x54, 0xa9, 0x6d, 0x13, 0xc6, 0x08, + 0x75, 0xd2, 0xbb, 0x02, 0x0e, 0xd8, 0x95, 0x1e, 0x45, 0xed, 0x05, 0x80, 0xe7, 0xb3, 0x9d, 0x1c, + 0x6e, 0x67, 0xbe, 0x00, 0x38, 0x5e, 0x63, 0xd6, 0x6d, 0xdf, 0x31, 0x03, 0x0b, 0xbe, 0x43, 0xf8, + 0xc6, 0x22, 0xa5, 0xab, 0x87, 0x92, 0x5d, 0xbe, 0x0a, 0x87, 0x4c, 0xec, 0x52, 0x46, 0x38, 0xf5, + 0x72, 0x47, 0x70, 0x17, 0x5a, 0x3e, 0xd5, 0xd9, 0xe5, 0xdd, 0xf7, 0x9a, 0x0a, 0x4f, 0xa7, 0x15, + 0x93, 0x2c, 0xd8, 0x6b, 0x00, 0x47, 0x6a, 0xcc, 0xba, 0xeb, 0x9a, 0x88, 0xe3, 0x45, 0xe4, 0x21, + 0x9b, 0x05, 0x1e, 0x90, 0xcf, 0x57, 0xa8, 0x47, 0xf8, 0x46, 0xee, 0x1f, 0xbe, 0x0b, 0x95, 0xe7, + 0xe1, 0xa0, 0x1b, 0x2a, 0x84, 0xc6, 0x87, 0x4b, 0x67, 0xf5, 0x8c, 0xdb, 0xaa, 0x47, 0xc9, 0x2a, + 0x47, 0x83, 0x56, 0xd5, 0x05, 0xb1, 0x7c, 0x22, 0xb4, 0x9f, 0x48, 0x6a, 0x53, 0x70, 0xe2, 0x2f, + 0x77, 0xb1, 0xf3, 0xd2, 0xc7, 0x63, 0x70, 0xa0, 0xc6, 0x2c, 0xf9, 0x09, 0x80, 0x72, 0xca, 0x19, + 0x2c, 0x65, 0x26, 0x4f, 0xbd, 0x3a, 0x4a, 0xb9, 0x7f, 0x4e, 0x32, 0x9b, 0xaf, 0x00, 0x9c, 0xd8, + 0xeb, 0x4c, 0x5d, 0xcb, 0xd3, 0xdd, 0x83, 0xa8, 0xdc, 0xfc, 0x47, 0x62, 0xe2, 0xea, 0x0d, 0x80, + 0xd3, 0x59, 0x3b, 0x7e, 0x63, 0xbf, 0x09, 0x52, 0xc8, 0x4a, 0xf5, 0x00, 0xe4, 0xc4, 0xe1, 0x23, + 0x00, 0xc7, 0x7a, 0x77, 0xad, 0x98, 0x27, 0xdd, 0x43, 0x51, 0xae, 0xf7, 0x4d, 0x49, 0x3c, 0x78, + 0xf0, 0x78, 0xd7, 0x02, 0x5c, 0xcc, 0x93, 0xea, 0x44, 0x2b, 0x57, 0xfa, 0x41, 0xc7, 0x39, 0x2b, + 0x77, 0xde, 0xb6, 0x55, 0xb0, 0xd5, 0x56, 0xc1, 0x76, 0x5b, 0x05, 0x3f, 0xdb, 0x2a, 0x78, 0xb9, + 0xa3, 0x4a, 0xdb, 0x3b, 0xaa, 0xf4, 0x6d, 0x47, 0x95, 0x1e, 0x14, 0x33, 0x0f, 0xc7, 0x7a, 0xf7, + 0x67, 0x42, 0x78, 0x47, 0x1a, 0x83, 0xe1, 0x87, 0xc1, 0xe5, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, + 0xf9, 0xb3, 0x17, 0x49, 0xf7, 0x08, 0x00, 0x00, } func (this *MsgSetWithdrawAddressResponse) Equal(that interface{}) bool { @@ -515,6 +622,54 @@ func (this *MsgFundCommunityPoolResponse) Equal(that interface{}) bool { } return true } +func (this *MsgUpdateParams) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgUpdateParams) + if !ok { + that2, ok := that.(MsgUpdateParams) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Authority != that1.Authority { + return false + } + if !this.Params.Equal(&that1.Params) { + return false + } + return true +} +func (this *MsgUpdateParamsResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgUpdateParamsResponse) + if !ok { + that2, ok := that.(MsgUpdateParamsResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + return true +} // Reference imports to suppress errors if they are not otherwise used. var _ context.Context @@ -540,6 +695,11 @@ type MsgClient interface { // FundCommunityPool defines a method to allow an account to directly // fund the community pool. FundCommunityPool(ctx context.Context, in *MsgFundCommunityPool, opts ...grpc.CallOption) (*MsgFundCommunityPoolResponse, error) + // UpdateParams defines a governance operation for updating the x/distribution module + // parameters. The authority is hard-coded to the x/gov module account. + // + // Since: cosmos-sdk 0.47 + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -586,6 +746,15 @@ func (c *msgClient) FundCommunityPool(ctx context.Context, in *MsgFundCommunityP return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/cosmos.distribution.v1beta1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // SetWithdrawAddress defines a method to change the withdraw address @@ -600,6 +769,11 @@ type MsgServer interface { // FundCommunityPool defines a method to allow an account to directly // fund the community pool. FundCommunityPool(context.Context, *MsgFundCommunityPool) (*MsgFundCommunityPoolResponse, error) + // UpdateParams defines a governance operation for updating the x/distribution module + // parameters. The authority is hard-coded to the x/gov module account. + // + // Since: cosmos-sdk 0.47 + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -618,6 +792,9 @@ func (*UnimplementedMsgServer) WithdrawValidatorCommission(ctx context.Context, func (*UnimplementedMsgServer) FundCommunityPool(ctx context.Context, req *MsgFundCommunityPool) (*MsgFundCommunityPoolResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method FundCommunityPool not implemented") } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -695,6 +872,24 @@ func _Msg_FundCommunityPool_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.distribution.v1beta1.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmos.distribution.v1beta1.Msg", HandlerType: (*MsgServer)(nil), @@ -715,6 +910,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "FundCommunityPool", Handler: _Msg_FundCommunityPool_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/distribution/v1beta1/tx.proto", @@ -988,6 +1187,69 @@ func (m *MsgFundCommunityPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } +func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -1113,6 +1375,30 @@ func (m *MsgFundCommunityPoolResponse) Size() (n int) { return n } +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1813,6 +2099,171 @@ func (m *MsgFundCommunityPoolResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From 996e987e8c5c5d0466df22e0284ef3ed418a21d4 Mon Sep 17 00:00:00 2001 From: atheesh Date: Mon, 4 Jul 2022 11:53:53 +0530 Subject: [PATCH 02/23] git changes --- x/distribution/keeper/msg_server.go | 2 -- x/distribution/keeper/params.go | 20 +++++++++++++++++--- x/distribution/types/keys.go | 2 ++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/x/distribution/keeper/msg_server.go b/x/distribution/keeper/msg_server.go index 7619017c1e61..9393d97a78ff 100644 --- a/x/distribution/keeper/msg_server.go +++ b/x/distribution/keeper/msg_server.go @@ -157,6 +157,4 @@ func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParam } return &types.MsgUpdateParamsResponse{}, nil - - return &types.MsgUpdateParamsResponse{}, nil } diff --git a/x/distribution/keeper/params.go b/x/distribution/keeper/params.go index 23b4bbeb8118..78d867d953ae 100644 --- a/x/distribution/keeper/params.go +++ b/x/distribution/keeper/params.go @@ -7,13 +7,27 @@ import ( // GetParams returns the total set of distribution parameters. func (k Keeper) GetParams(clientCtx sdk.Context) (params types.Params) { - k.paramSpace.GetParamSet(clientCtx, ¶ms) + store := clientCtx.KVStore(k.storeKey) + bz := store.Get(types.ParamsKey) + if bz == nil { + return params + } + + k.cdc.MustUnmarshal(bz, ¶ms) return params } // SetParams sets the distribution parameters to the param space. -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramSpace.SetParamSet(ctx, ¶ms) +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { + if err := params.ValidateBasic(); err != nil { + return err + } + + store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(¶ms) + store.Set(types.ParamsKey, bz) + + return nil } // GetCommunityTax returns the current distribution community tax. diff --git a/x/distribution/types/keys.go b/x/distribution/types/keys.go index e0458459d080..04d7f43299f1 100644 --- a/x/distribution/types/keys.go +++ b/x/distribution/types/keys.go @@ -53,6 +53,8 @@ var ( ValidatorCurrentRewardsPrefix = []byte{0x06} // key for current validator rewards ValidatorAccumulatedCommissionPrefix = []byte{0x07} // key for accumulated validator commission ValidatorSlashEventPrefix = []byte{0x08} // key for validator slash fraction + + ParamsKey = []byte{0x09} // key for distribution module params ) // GetValidatorOutstandingRewardsAddress creates an address from a validator's outstanding rewards key. From f2b8e7f9e679fae7f5696a473ea50fae35c944e7 Mon Sep 17 00:00:00 2001 From: atheesh Date: Mon, 4 Jul 2022 12:15:25 +0530 Subject: [PATCH 03/23] legacy params --- x/distribution/keeper/keeper.go | 8 +----- x/distribution/module.go | 35 +++++++++++++++++++++------ x/distribution/types/params.go | 24 ------------------ x/distribution/types/params_legacy.go | 26 ++++++++++++++++++++ 4 files changed, 54 insertions(+), 39 deletions(-) create mode 100644 x/distribution/types/params_legacy.go diff --git a/x/distribution/keeper/keeper.go b/x/distribution/keeper/keeper.go index b9b866821a55..0aaad5ce2cd1 100644 --- a/x/distribution/keeper/keeper.go +++ b/x/distribution/keeper/keeper.go @@ -30,7 +30,7 @@ type Keeper struct { // NewKeeper creates a new distribution Keeper instance func NewKeeper( - cdc codec.BinaryCodec, key storetypes.StoreKey, paramSpace paramtypes.Subspace, + cdc codec.BinaryCodec, key storetypes.StoreKey, ak types.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper, feeCollectorName string, authority string, ) Keeper { @@ -39,15 +39,9 @@ func NewKeeper( panic(fmt.Sprintf("%s module account has not been set", types.ModuleName)) } - // set KeyTable if it has not already been set - if !paramSpace.HasKeyTable() { - paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) - } - return Keeper{ storeKey: key, cdc: cdc, - paramSpace: paramSpace, authKeeper: ak, bankKeeper: bk, stakingKeeper: sk, diff --git a/x/distribution/module.go b/x/distribution/module.go index 532d7e61580a..2e7af680bf7b 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -21,6 +21,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" staking "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -31,6 +32,9 @@ import ( "github.com/cosmos/cosmos-sdk/x/distribution/types" ) +// ConsensusVersion defines the current x/distribution module consensus version. +const ConsensusVersion = 3 + var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} @@ -98,12 +102,15 @@ type AppModule struct { accountKeeper types.AccountKeeper bankKeeper types.BankKeeper stakingKeeper types.StakingKeeper + + // legacySubspace is used solely for migration of x/params managed parameters + legacySubspace paramstypes.Subspace } // NewAppModule creates a new AppModule object func NewAppModule( cdc codec.Codec, keeper keeper.Keeper, accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, stakingKeeper types.StakingKeeper, + bankKeeper types.BankKeeper, stakingKeeper types.StakingKeeper, ss paramstypes.Subspace, ) AppModule { return AppModule{ AppModuleBasic: AppModuleBasic{cdc: cdc}, @@ -111,6 +118,7 @@ func NewAppModule( accountKeeper: accountKeeper, bankKeeper: bankKeeper, stakingKeeper: stakingKeeper, + legacySubspace: ss, } } @@ -165,7 +173,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 2 } +func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } // BeginBlock returns the begin blocker for the distribution module. func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { @@ -225,14 +233,16 @@ func provideModuleBasic() runtime.AppModuleBasicWrapper { type distrInputs struct { depinject.In - Config *modulev1.Module - Key *store.KVStoreKey - Cdc codec.Codec - Subspace paramstypes.Subspace + Config *modulev1.Module + Key *store.KVStoreKey + Cdc codec.Codec AccountKeeper types.AccountKeeper BankKeeper types.BankKeeper StakingKeeper types.StakingKeeper + + // LegacySubspace is used solely for migration of x/params managed parameters + LegacySubspace paramstypes.Subspace } type distrOutputs struct { @@ -249,8 +259,17 @@ func provideModule(in distrInputs) distrOutputs { feeCollectorName = authtypes.FeeCollectorName } - k := keeper.NewKeeper(in.Cdc, in.Key, in.Subspace, in.AccountKeeper, in.BankKeeper, in.StakingKeeper, feeCollectorName) - m := NewAppModule(in.Cdc, k, in.AccountKeeper, in.BankKeeper, in.StakingKeeper) + k := keeper.NewKeeper( + in.Cdc, + in.Key, + in.AccountKeeper, + in.BankKeeper, + in.StakingKeeper, + feeCollectorName, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + m := NewAppModule(in.Cdc, k, in.AccountKeeper, in.BankKeeper, in.StakingKeeper, in.LegacySubspace) return distrOutputs{ DistrKeeper: k, diff --git a/x/distribution/types/params.go b/x/distribution/types/params.go index a4ea2ddea005..3a780dee8610 100644 --- a/x/distribution/types/params.go +++ b/x/distribution/types/params.go @@ -6,22 +6,8 @@ import ( "sigs.k8s.io/yaml" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) -// Parameter keys -var ( - ParamStoreKeyCommunityTax = []byte("communitytax") - ParamStoreKeyBaseProposerReward = []byte("baseproposerreward") - ParamStoreKeyBonusProposerReward = []byte("bonusproposerreward") - ParamStoreKeyWithdrawAddrEnabled = []byte("withdrawaddrenabled") -) - -// ParamKeyTable returns the parameter key table. -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - // DefaultParams returns default distribution parameters func DefaultParams() Params { return Params{ @@ -37,16 +23,6 @@ func (p Params) String() string { return string(out) } -// ParamSetPairs returns the parameter set pairs. -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(ParamStoreKeyCommunityTax, &p.CommunityTax, validateCommunityTax), - paramtypes.NewParamSetPair(ParamStoreKeyBaseProposerReward, &p.BaseProposerReward, validateBaseProposerReward), - paramtypes.NewParamSetPair(ParamStoreKeyBonusProposerReward, &p.BonusProposerReward, validateBonusProposerReward), - paramtypes.NewParamSetPair(ParamStoreKeyWithdrawAddrEnabled, &p.WithdrawAddrEnabled, validateWithdrawAddrEnabled), - } -} - // ValidateBasic performs basic validation on distribution parameters. func (p Params) ValidateBasic() error { if p.CommunityTax.IsNegative() || p.CommunityTax.GT(sdk.OneDec()) { diff --git a/x/distribution/types/params_legacy.go b/x/distribution/types/params_legacy.go new file mode 100644 index 000000000000..f82901383df1 --- /dev/null +++ b/x/distribution/types/params_legacy.go @@ -0,0 +1,26 @@ +package types + +import paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + +// Parameter keys +var ( + ParamStoreKeyCommunityTax = []byte("communitytax") + ParamStoreKeyBaseProposerReward = []byte("baseproposerreward") + ParamStoreKeyBonusProposerReward = []byte("bonusproposerreward") + ParamStoreKeyWithdrawAddrEnabled = []byte("withdrawaddrenabled") +) + +// ParamKeyTable returns the parameter key table. +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// ParamSetPairs returns the parameter set pairs. +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(ParamStoreKeyCommunityTax, &p.CommunityTax, validateCommunityTax), + paramtypes.NewParamSetPair(ParamStoreKeyBaseProposerReward, &p.BaseProposerReward, validateBaseProposerReward), + paramtypes.NewParamSetPair(ParamStoreKeyBonusProposerReward, &p.BonusProposerReward, validateBonusProposerReward), + paramtypes.NewParamSetPair(ParamStoreKeyWithdrawAddrEnabled, &p.WithdrawAddrEnabled, validateWithdrawAddrEnabled), + } +} From bb67de02c19061130f23321f3955f9e716a5a1f4 Mon Sep 17 00:00:00 2001 From: atheesh Date: Mon, 4 Jul 2022 13:19:25 +0530 Subject: [PATCH 04/23] add migrations --- x/distribution/exported/exported.go | 18 ++++++++++++ x/distribution/keeper/keeper.go | 5 ++++ x/distribution/keeper/migrations.go | 17 +++++++++-- x/distribution/keeper/msg_server.go | 4 +-- x/distribution/keeper/params.go | 16 ++++------ x/distribution/migrations/v046/migrate.go | 36 +++++++++++++++++++++++ x/distribution/module.go | 2 +- x/distribution/types/keys.go | 2 ++ 8 files changed, 84 insertions(+), 16 deletions(-) create mode 100644 x/distribution/exported/exported.go create mode 100644 x/distribution/migrations/v046/migrate.go diff --git a/x/distribution/exported/exported.go b/x/distribution/exported/exported.go new file mode 100644 index 000000000000..000114e6194d --- /dev/null +++ b/x/distribution/exported/exported.go @@ -0,0 +1,18 @@ +package exported + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +type ( + ParamSet = paramtypes.ParamSet + + // Subspace defines an interface that implements the legacy x/params Subspace + // type. + // + // NOTE: This is used solely for migration of x/params managed parameters. + Subspace interface { + GetParamSet(ctx sdk.Context, ps ParamSet) + } +) diff --git a/x/distribution/keeper/keeper.go b/x/distribution/keeper/keeper.go index 0aaad5ce2cd1..c20893659227 100644 --- a/x/distribution/keeper/keeper.go +++ b/x/distribution/keeper/keeper.go @@ -50,6 +50,11 @@ func NewKeeper( } } +// GetAuthority returns the x/distribution module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} + // Logger returns a module-specific logger. func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", "x/"+types.ModuleName) diff --git a/x/distribution/keeper/migrations.go b/x/distribution/keeper/migrations.go index 7439dfbee4ef..cc928e3f79b6 100644 --- a/x/distribution/keeper/migrations.go +++ b/x/distribution/keeper/migrations.go @@ -2,20 +2,31 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/distribution/exported" v043 "github.com/cosmos/cosmos-sdk/x/distribution/migrations/v043" + v046 "github.com/cosmos/cosmos-sdk/x/distribution/migrations/v046" ) // Migrator is a struct for handling in-place store migrations. type Migrator struct { - keeper Keeper + keeper Keeper + legacySubspace exported.Subspace } // NewMigrator returns a new Migrator. -func NewMigrator(keeper Keeper) Migrator { - return Migrator{keeper: keeper} +func NewMigrator(keeper Keeper, legacySubspace exported.Subspace) Migrator { + return Migrator{keeper: keeper, legacySubspace: legacySubspace} } // Migrate1to2 migrates from version 1 to 2. func (m Migrator) Migrate1to2(ctx sdk.Context) error { return v043.MigrateStore(ctx, m.keeper.storeKey) } + +// Migrate2to3 migrates the x/distribution module state from the consensus +// version 2 to version 3. Specifically, it takes the parameters that are currently stored +// and managed by the x/params module and stores them directly into the x/distribution +// module state. +func (m Migrator) Migrate2to3(ctx sdk.Context) error { + return v046.MigrateStore(ctx, m.keeper.storeKey, m.legacySubspace, m.keeper.cdc) +} diff --git a/x/distribution/keeper/msg_server.go b/x/distribution/keeper/msg_server.go index 9393d97a78ff..8e8f73f6e319 100644 --- a/x/distribution/keeper/msg_server.go +++ b/x/distribution/keeper/msg_server.go @@ -16,14 +16,14 @@ type msgServer struct { Keeper } +var _ types.MsgServer = msgServer{} + // NewMsgServerImpl returns an implementation of the distribution MsgServer interface // for the provided Keeper. func NewMsgServerImpl(keeper Keeper) types.MsgServer { return &msgServer{Keeper: keeper} } -var _ types.MsgServer = msgServer{} - func (k msgServer) SetWithdrawAddress(goCtx context.Context, msg *types.MsgSetWithdrawAddress) (*types.MsgSetWithdrawAddressResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) diff --git a/x/distribution/keeper/params.go b/x/distribution/keeper/params.go index 78d867d953ae..e8a1297827e5 100644 --- a/x/distribution/keeper/params.go +++ b/x/distribution/keeper/params.go @@ -31,27 +31,23 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { } // GetCommunityTax returns the current distribution community tax. -func (k Keeper) GetCommunityTax(ctx sdk.Context) (percent sdk.Dec) { - k.paramSpace.Get(ctx, types.ParamStoreKeyCommunityTax, &percent) - return percent +func (k Keeper) GetCommunityTax(ctx sdk.Context) sdk.Dec { + return k.GetParams(ctx).CommunityTax } // GetBaseProposerReward returns the current distribution base proposer rate. -func (k Keeper) GetBaseProposerReward(ctx sdk.Context) (percent sdk.Dec) { - k.paramSpace.Get(ctx, types.ParamStoreKeyBaseProposerReward, &percent) - return percent +func (k Keeper) GetBaseProposerReward(ctx sdk.Context) sdk.Dec { + return k.GetParams(ctx).BaseProposerReward } // GetBonusProposerReward returns the current distribution bonus proposer reward // rate. func (k Keeper) GetBonusProposerReward(ctx sdk.Context) (percent sdk.Dec) { - k.paramSpace.Get(ctx, types.ParamStoreKeyBonusProposerReward, &percent) - return percent + return k.GetParams(ctx).BonusProposerReward } // GetWithdrawAddrEnabled returns the current distribution withdraw address // enabled parameter. func (k Keeper) GetWithdrawAddrEnabled(ctx sdk.Context) (enabled bool) { - k.paramSpace.Get(ctx, types.ParamStoreKeyWithdrawAddrEnabled, &enabled) - return enabled + return k.GetParams(ctx).WithdrawAddrEnabled } diff --git a/x/distribution/migrations/v046/migrate.go b/x/distribution/migrations/v046/migrate.go new file mode 100644 index 000000000000..71e2fbc46929 --- /dev/null +++ b/x/distribution/migrations/v046/migrate.go @@ -0,0 +1,36 @@ +package v046 + +import ( + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/distribution/exported" + "github.com/cosmos/cosmos-sdk/x/distribution/types" +) + +const ( + ModuleName = "distribution" +) + +var ( + ParamsKey = []byte{0x09} +) + +// MigrateStore migrates the x/distribution module state from the consensus version 2 to +// version 3. Specifically, it takes the parameters that are currently stored +// and managed by the x/params module and stores them directly into the x/distribution +// module state. +func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, legacySubspace exported.Subspace, cdc codec.BinaryCodec) error { + store := ctx.KVStore(storeKey) + var currParams types.Params + legacySubspace.GetParamSet(ctx, &currParams) + + if err := currParams.ValidateBasic(); err != nil { + return err + } + + bz := cdc.MustMarshal(&currParams) + store.Set(ParamsKey, bz) + + return nil +} diff --git a/x/distribution/module.go b/x/distribution/module.go index 2e7af680bf7b..1c8c500f3228 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -152,7 +152,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) - m := keeper.NewMigrator(am.keeper) + m := keeper.NewMigrator(am.keeper, am.legacySubspace) cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2) } diff --git a/x/distribution/types/keys.go b/x/distribution/types/keys.go index 04d7f43299f1..e5e182f5ac8c 100644 --- a/x/distribution/types/keys.go +++ b/x/distribution/types/keys.go @@ -42,6 +42,8 @@ const ( // - 0x07: ValidatorCurrentCommission // // - 0x08: ValidatorSlashEvent +// +// - 0x09: Params var ( FeePoolKey = []byte{0x00} // key for global distribution state ProposerKey = []byte{0x01} // key for the proposer operator address From 64d0385d9f7ede4025a275a87e65584e9bcb99bc Mon Sep 17 00:00:00 2001 From: atheesh Date: Mon, 4 Jul 2022 16:20:23 +0530 Subject: [PATCH 05/23] add keeper tests --- x/distribution/keeper/grpc_query.go | 3 +- x/distribution/keeper/grpc_query_test.go | 2 + x/distribution/keeper/params_test.go | 117 +++++++++++++++++++++++ x/distribution/types/msg.go | 28 +++++- 4 files changed, 147 insertions(+), 3 deletions(-) create mode 100644 x/distribution/keeper/params_test.go diff --git a/x/distribution/keeper/grpc_query.go b/x/distribution/keeper/grpc_query.go index bbc884276a06..2daceeafbc08 100644 --- a/x/distribution/keeper/grpc_query.go +++ b/x/distribution/keeper/grpc_query.go @@ -19,8 +19,7 @@ var _ types.QueryServer = Keeper{} // Params queries params of distribution module func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { ctx := sdk.UnwrapSDKContext(c) - var params types.Params - k.paramSpace.GetParamSet(ctx, ¶ms) + params := k.GetParams(ctx) return &types.QueryParamsResponse{Params: params}, nil } diff --git a/x/distribution/keeper/grpc_query_test.go b/x/distribution/keeper/grpc_query_test.go index 03e5e2a3aa86..d145e8d39389 100644 --- a/x/distribution/keeper/grpc_query_test.go +++ b/x/distribution/keeper/grpc_query_test.go @@ -58,6 +58,8 @@ func (suite *KeeperTestSuite) SetupTest() { suite.addrs = simtestutil.AddTestAddrs(suite.bankKeeper, suite.stakingKeeper, ctx, 2, sdk.NewInt(1000000000)) suite.valAddrs = simtestutil.ConvertAddrsToValAddrs(suite.addrs) + + suite.distrKeeper.SetParams(suite.ctx, types.DefaultParams()) } func (suite *KeeperTestSuite) TestGRPCParams() { diff --git a/x/distribution/keeper/params_test.go b/x/distribution/keeper/params_test.go new file mode 100644 index 000000000000..16ae36d69fee --- /dev/null +++ b/x/distribution/keeper/params_test.go @@ -0,0 +1,117 @@ +package keeper_test + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/distribution/types" +) + +func (s *KeeperTestSuite) TestParams() { + // default params + communityTax := sdk.NewDecWithPrec(2, 2) // 2% + baseProposerReward := sdk.NewDecWithPrec(1, 2) // 1% + bonusProposerReward := sdk.NewDecWithPrec(4, 2) // 4% + withdrawAddrEnabled := true + + testCases := []struct { + name string + input types.Params + expErr bool + expErrMsg string + }{ + { + name: "community tax > 1", + input: types.Params{ + CommunityTax: sdk.NewDecWithPrec(2, 0), + BaseProposerReward: baseProposerReward, + BonusProposerReward: bonusProposerReward, + WithdrawAddrEnabled: withdrawAddrEnabled, + }, + expErr: true, + expErrMsg: "community tax should be non-negative and less than one", + }, + { + name: "negative community tax", + input: types.Params{ + CommunityTax: sdk.NewDecWithPrec(-2, 1), + BaseProposerReward: baseProposerReward, + BonusProposerReward: bonusProposerReward, + WithdrawAddrEnabled: withdrawAddrEnabled, + }, + expErr: true, + expErrMsg: "community tax should be non-negative and less than one", + }, + { + name: "base proposer reward > 1", + input: types.Params{ + CommunityTax: communityTax, + BaseProposerReward: sdk.NewDecWithPrec(2, 0), + BonusProposerReward: bonusProposerReward, + WithdrawAddrEnabled: withdrawAddrEnabled, + }, + expErr: true, + expErrMsg: "sum of base, bonus proposer rewards, and community tax cannot be greater than one", + }, + { + name: "negative base proposer reward", + input: types.Params{ + CommunityTax: communityTax, + BaseProposerReward: sdk.NewDecWithPrec(-2, 0), + BonusProposerReward: bonusProposerReward, + WithdrawAddrEnabled: withdrawAddrEnabled, + }, + expErr: true, + expErrMsg: "base proposer reward should be positive", + }, + { + name: "bonus proposer reward > 1", + input: types.Params{ + CommunityTax: communityTax, + BaseProposerReward: baseProposerReward, + BonusProposerReward: sdk.NewDecWithPrec(2, 0), + WithdrawAddrEnabled: withdrawAddrEnabled, + }, + expErr: true, + expErrMsg: "sum of base, bonus proposer rewards, and community tax cannot be greater than one", + }, + { + name: "negative bonus proposer reward", + input: types.Params{ + CommunityTax: communityTax, + BaseProposerReward: baseProposerReward, + BonusProposerReward: sdk.NewDecWithPrec(-2, 0), + WithdrawAddrEnabled: withdrawAddrEnabled, + }, + expErr: true, + expErrMsg: "bonus proposer reward should be positive", + }, + { + name: "all good", + input: types.Params{ + CommunityTax: communityTax, + BaseProposerReward: baseProposerReward, + BonusProposerReward: bonusProposerReward, + WithdrawAddrEnabled: withdrawAddrEnabled, + }, + expErr: false, + }, + } + + for _, tc := range testCases { + tc := tc + s.Run(tc.name, func() { + expected := s.distrKeeper.GetParams(s.ctx) + err := s.distrKeeper.SetParams(s.ctx, tc.input) + + if tc.expErr { + s.Require().Error(err) + s.Require().Contains(err.Error(), tc.expErrMsg) + } else { + expected = tc.input + s.Require().NoError(err) + } + + params := s.distrKeeper.GetParams(s.ctx) + s.Require().Equal(expected, params) + }) + } +} diff --git a/x/distribution/types/msg.go b/x/distribution/types/msg.go index 2071ca0282e8..36dc021e0486 100644 --- a/x/distribution/types/msg.go +++ b/x/distribution/types/msg.go @@ -11,10 +11,11 @@ const ( TypeMsgWithdrawDelegatorReward = "withdraw_delegator_reward" TypeMsgWithdrawValidatorCommission = "withdraw_validator_commission" TypeMsgFundCommunityPool = "fund_community_pool" + TypeMsgUpdateParams = "update_params" ) // Verify interface at compile time -var _, _, _ sdk.Msg = &MsgSetWithdrawAddress{}, &MsgWithdrawDelegatorReward{}, &MsgWithdrawValidatorCommission{} +var _, _, _, _ sdk.Msg = &MsgSetWithdrawAddress{}, &MsgWithdrawDelegatorReward{}, &MsgWithdrawValidatorCommission{}, &MsgUpdateParams{} func NewMsgSetWithdrawAddress(delAddr, withdrawAddr sdk.AccAddress) *MsgSetWithdrawAddress { return &MsgSetWithdrawAddress{ @@ -151,3 +152,28 @@ func (msg MsgFundCommunityPool) ValidateBasic() error { } return nil } + +// Route returns the MsgUpdateParams message route. +func (msg MsgUpdateParams) Route() string { return ModuleName } + +// Type returns the MsgUpdateParams message type. +func (msg MsgUpdateParams) Type() string { return TypeMsgUpdateParams } + +// GetSigners returns the signer addresses that are expected to sign the result +// of GetSignBytes. +func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress { + authority, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{authority} +} + +// GetSignBytes returns the raw bytes for a MsgUpdateParams message that +// the expected signer needs to sign. +func (msg MsgUpdateParams) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// ValidateBasic performs basic MsgUpdateParams message validation. +func (msg MsgUpdateParams) ValidateBasic() error { + return msg.Params.ValidateBasic() +} From 03046ccfb5b1ccb9fa2f9bb8b2ffc2e1d35a3ad8 Mon Sep 17 00:00:00 2001 From: atheesh Date: Mon, 4 Jul 2022 16:50:09 +0530 Subject: [PATCH 06/23] add msg server tests --- x/distribution/keeper/grpc_query_test.go | 2 + x/distribution/keeper/msg_server_test.go | 147 +++++++++++++++++++++++ 2 files changed, 149 insertions(+) create mode 100644 x/distribution/keeper/msg_server_test.go diff --git a/x/distribution/keeper/grpc_query_test.go b/x/distribution/keeper/grpc_query_test.go index d145e8d39389..943374534858 100644 --- a/x/distribution/keeper/grpc_query_test.go +++ b/x/distribution/keeper/grpc_query_test.go @@ -36,6 +36,7 @@ type KeeperTestSuite struct { bankKeeper bankkeeper.Keeper distrKeeper keeper.Keeper stakingKeeper *stakingkeeper.Keeper + msgServer types.MsgServer } func (suite *KeeperTestSuite) SetupTest() { @@ -60,6 +61,7 @@ func (suite *KeeperTestSuite) SetupTest() { suite.valAddrs = simtestutil.ConvertAddrsToValAddrs(suite.addrs) suite.distrKeeper.SetParams(suite.ctx, types.DefaultParams()) + suite.msgServer = keeper.NewMsgServerImpl(suite.distrKeeper) } func (suite *KeeperTestSuite) TestGRPCParams() { diff --git a/x/distribution/keeper/msg_server_test.go b/x/distribution/keeper/msg_server_test.go new file mode 100644 index 000000000000..fef8c9802294 --- /dev/null +++ b/x/distribution/keeper/msg_server_test.go @@ -0,0 +1,147 @@ +package keeper_test + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/distribution/types" +) + +func (s *KeeperTestSuite) TestMsgUpdateParams() { + // default params + communityTax := sdk.NewDecWithPrec(2, 2) // 2% + baseProposerReward := sdk.NewDecWithPrec(1, 2) // 1% + bonusProposerReward := sdk.NewDecWithPrec(4, 2) // 4% + withdrawAddrEnabled := true + + testCases := []struct { + name string + input *types.MsgUpdateParams + expErr bool + expErrMsg string + }{ + { + name: "invalid authority", + input: &types.MsgUpdateParams{ + Authority: "invalid", + Params: types.Params{ + CommunityTax: sdk.NewDecWithPrec(2, 0), + BaseProposerReward: baseProposerReward, + BonusProposerReward: bonusProposerReward, + WithdrawAddrEnabled: withdrawAddrEnabled, + }, + }, + expErr: true, + expErrMsg: "invalid authority", + }, + { + name: "community tax > 1", + input: &types.MsgUpdateParams{ + Authority: s.distrKeeper.GetAuthority(), + Params: types.Params{ + CommunityTax: sdk.NewDecWithPrec(2, 0), + BaseProposerReward: baseProposerReward, + BonusProposerReward: bonusProposerReward, + WithdrawAddrEnabled: withdrawAddrEnabled, + }, + }, + expErr: true, + expErrMsg: "community tax should be non-negative and less than one", + }, + { + name: "negative community tax", + input: &types.MsgUpdateParams{ + Authority: s.distrKeeper.GetAuthority(), + Params: types.Params{ + CommunityTax: sdk.NewDecWithPrec(-2, 1), + BaseProposerReward: baseProposerReward, + BonusProposerReward: bonusProposerReward, + WithdrawAddrEnabled: withdrawAddrEnabled, + }, + }, + expErr: true, + expErrMsg: "community tax should be non-negative and less than one", + }, + { + name: "base proposer reward > 1", + input: &types.MsgUpdateParams{ + Authority: s.distrKeeper.GetAuthority(), + Params: types.Params{ + CommunityTax: communityTax, + BaseProposerReward: sdk.NewDecWithPrec(2, 0), + BonusProposerReward: bonusProposerReward, + WithdrawAddrEnabled: withdrawAddrEnabled, + }, + }, + expErr: true, + expErrMsg: "sum of base, bonus proposer rewards, and community tax cannot be greater than one", + }, + { + name: "negative base proposer reward", + input: &types.MsgUpdateParams{ + Authority: s.distrKeeper.GetAuthority(), + Params: types.Params{ + CommunityTax: communityTax, + BaseProposerReward: sdk.NewDecWithPrec(-2, 0), + BonusProposerReward: bonusProposerReward, + WithdrawAddrEnabled: withdrawAddrEnabled, + }, + }, + expErr: true, + expErrMsg: "base proposer reward should be positive", + }, + { + name: "bonus proposer reward > 1", + input: &types.MsgUpdateParams{ + Authority: s.distrKeeper.GetAuthority(), + Params: types.Params{ + CommunityTax: communityTax, + BaseProposerReward: baseProposerReward, + BonusProposerReward: sdk.NewDecWithPrec(2, 0), + WithdrawAddrEnabled: withdrawAddrEnabled, + }, + }, + expErr: true, + expErrMsg: "sum of base, bonus proposer rewards, and community tax cannot be greater than one", + }, + { + name: "negative bonus proposer reward", + input: &types.MsgUpdateParams{ + Authority: s.distrKeeper.GetAuthority(), + Params: types.Params{ + CommunityTax: communityTax, + BaseProposerReward: baseProposerReward, + BonusProposerReward: sdk.NewDecWithPrec(-2, 0), + WithdrawAddrEnabled: withdrawAddrEnabled, + }, + }, + expErr: true, + expErrMsg: "bonus proposer reward should be positive", + }, + { + name: "all good", + input: &types.MsgUpdateParams{ + Authority: s.distrKeeper.GetAuthority(), + Params: types.Params{ + CommunityTax: communityTax, + BaseProposerReward: baseProposerReward, + BonusProposerReward: bonusProposerReward, + WithdrawAddrEnabled: withdrawAddrEnabled, + }, + }, + expErr: false, + }, + } + + for _, tc := range testCases { + tc := tc + s.Run(tc.name, func() { + _, err := s.msgServer.UpdateParams(s.ctx, tc.input) + + if tc.expErr { + s.Require().Error(err) + s.Require().Contains(err.Error(), tc.expErrMsg) + } else { + s.Require().NoError(err) + } + }) + } +} From 772538ad1c241ead604d829574b40542f4aea785 Mon Sep 17 00:00:00 2001 From: atheesh Date: Mon, 4 Jul 2022 17:22:41 +0530 Subject: [PATCH 07/23] add migrate tests --- .../migrations/v046/migrate_test.go | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 x/distribution/migrations/v046/migrate_test.go diff --git a/x/distribution/migrations/v046/migrate_test.go b/x/distribution/migrations/v046/migrate_test.go new file mode 100644 index 000000000000..712d9a6f0d9c --- /dev/null +++ b/x/distribution/migrations/v046/migrate_test.go @@ -0,0 +1,44 @@ +package v046_test + +import ( + "testing" + + "github.com/cosmos/cosmos-sdk/testutil" + sdk "github.com/cosmos/cosmos-sdk/types" + moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/distribution" + "github.com/cosmos/cosmos-sdk/x/distribution/exported" + v046 "github.com/cosmos/cosmos-sdk/x/distribution/migrations/v046" + "github.com/cosmos/cosmos-sdk/x/distribution/types" + "github.com/stretchr/testify/require" +) + +type mockSubspace struct { + ps types.Params +} + +func newMockSubspace(ps types.Params) mockSubspace { + return mockSubspace{ps: ps} +} + +func (ms mockSubspace) GetParamSet(ctx sdk.Context, ps exported.ParamSet) { + *ps.(*types.Params) = ms.ps +} + +func TestMigrate(t *testing.T) { + encCfg := moduletestutil.MakeTestEncodingConfig(distribution.AppModuleBasic{}) + cdc := encCfg.Codec + + storeKey := sdk.NewKVStoreKey(v046.ModuleName) + tKey := sdk.NewTransientStoreKey("transient_test") + ctx := testutil.DefaultContext(storeKey, tKey) + store := ctx.KVStore(storeKey) + + legacySubspace := newMockSubspace(types.DefaultParams()) + require.NoError(t, v046.MigrateStore(ctx, store, legacySubspace, cdc)) + + var res types.Params + bz := store.Get(v046.ParamsKey) + require.NoError(t, cdc.Unmarshal(bz, &res)) + require.Equal(t, legacySubspace.ps, res) +} From 39b630dff5335481bf8f95687b26336961589b7b Mon Sep 17 00:00:00 2001 From: atheesh Date: Mon, 4 Jul 2022 17:35:42 +0530 Subject: [PATCH 08/23] add change log --- CHANGELOG.md | 4 ++ types/module/testutil/codec.go | 43 +++++++++++++++++++ .../migrations/v046/migrate_test.go | 2 +- 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 types/module/testutil/codec.go diff --git a/CHANGELOG.md b/CHANGELOG.md index a517e23d6210..74911bd198bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#12153](https://github.com/cosmos/cosmos-sdk/pull/12153) Add a new `NewSimulationManagerFromAppModules` constructor, to simplify simulation wiring. * [#12187](https://github.com/cosmos/cosmos-sdk/pull/12187) Add batch operation for x/nft module. +### State Machine Breaking + +* (x/mint) [#12434](https://github.com/cosmos/cosmos-sdk/pull/12434) Migrate `x/distribution` to self-managed parameters and deprecate it's usage of `x/params`. + ### API Breaking Changes * (simapp) [#12270](https://github.com/cosmos/cosmos-sdk/pull/12270) Remove `invCheckPeriod uint` attribute from `SimApp` struct as per migration of `x/crisis` to app wiring diff --git a/types/module/testutil/codec.go b/types/module/testutil/codec.go new file mode 100644 index 000000000000..b54085c584e7 --- /dev/null +++ b/types/module/testutil/codec.go @@ -0,0 +1,43 @@ +package testutil + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/std" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/x/auth/tx" +) + +// TestEncodingConfig defines an encoding configuration that is used for testing +// purposes. Note, MakeTestEncodingConfig takes a series of AppModuleBasic types +// which should only contain the relevant module being tested and any potential +// dependencies. +type TestEncodingConfig struct { + InterfaceRegistry types.InterfaceRegistry + Codec codec.Codec + TxConfig client.TxConfig + Amino *codec.LegacyAmino +} + +func MakeTestEncodingConfig(modules ...module.AppModuleBasic) TestEncodingConfig { + cdc := codec.NewLegacyAmino() + interfaceRegistry := types.NewInterfaceRegistry() + codec := codec.NewProtoCodec(interfaceRegistry) + + encCfg := TestEncodingConfig{ + InterfaceRegistry: interfaceRegistry, + Codec: codec, + TxConfig: tx.NewTxConfig(codec, tx.DefaultSignModes), + Amino: cdc, + } + + mb := module.NewBasicManager(modules...) + + std.RegisterLegacyAminoCodec(encCfg.Amino) + std.RegisterInterfaces(encCfg.InterfaceRegistry) + mb.RegisterLegacyAminoCodec(encCfg.Amino) + mb.RegisterInterfaces(encCfg.InterfaceRegistry) + + return encCfg +} diff --git a/x/distribution/migrations/v046/migrate_test.go b/x/distribution/migrations/v046/migrate_test.go index 712d9a6f0d9c..56bf5df0447b 100644 --- a/x/distribution/migrations/v046/migrate_test.go +++ b/x/distribution/migrations/v046/migrate_test.go @@ -35,7 +35,7 @@ func TestMigrate(t *testing.T) { store := ctx.KVStore(storeKey) legacySubspace := newMockSubspace(types.DefaultParams()) - require.NoError(t, v046.MigrateStore(ctx, store, legacySubspace, cdc)) + require.NoError(t, v046.MigrateStore(ctx, storeKey, legacySubspace, cdc)) var res types.Params bz := store.Get(v046.ParamsKey) From bee77f657bbad644929f94f35e140f03d669d536 Mon Sep 17 00:00:00 2001 From: atheesh Date: Mon, 4 Jul 2022 19:39:32 +0530 Subject: [PATCH 09/23] review changes --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74911bd198bd..9d660f9681fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,7 +50,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### State Machine Breaking -* (x/mint) [#12434](https://github.com/cosmos/cosmos-sdk/pull/12434) Migrate `x/distribution` to self-managed parameters and deprecate it's usage of `x/params`. +* (x/slashing) [#12434](https://github.com/cosmos/cosmos-sdk/pull/12434) Migrate `x/distribution` to self-managed parameters and deprecate it's usage of `x/params`. ### API Breaking Changes From 3b79ecb6a6c138223177ce3d84a66a2dedc2463c Mon Sep 17 00:00:00 2001 From: atheesh Date: Wed, 6 Jul 2022 11:09:26 +0530 Subject: [PATCH 10/23] review changes --- proto/cosmos/distribution/v1beta1/genesis.proto | 7 ------- x/distribution/module.go | 11 +++++++++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/proto/cosmos/distribution/v1beta1/genesis.proto b/proto/cosmos/distribution/v1beta1/genesis.proto index 4fcdc5118d93..4008ecd91509 100644 --- a/proto/cosmos/distribution/v1beta1/genesis.proto +++ b/proto/cosmos/distribution/v1beta1/genesis.proto @@ -112,13 +112,6 @@ message GenesisState { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - // params defines all the parameters of the module. - // - // Deprecated: Use governance to submit a MsgUpdateParams message to instruct - // the x/distribution module to update the relevant parameters. - // - // Since the cosmos-sdk 0.47 version, this only exists for backwards - // compatibility of genesis state. Params params = 1 [(gogoproto.nullable) = false]; // fee_pool defines the fee pool at genesis. diff --git a/x/distribution/module.go b/x/distribution/module.go index 96e447c7e0a5..1e6fc69286a2 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -4,9 +4,10 @@ import ( "context" "encoding/json" "fmt" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "math/rand" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -154,7 +155,13 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterQueryServer(cfg.QueryServer(), am.keeper) m := keeper.NewMigrator(am.keeper, am.legacySubspace) - cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2) + if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { + panic(fmt.Sprintf("failed to migrate x/%s from version 1 to 2: %v", types.ModuleName, err)) + } + + if err := cfg.RegisterMigration(types.ModuleName, 2, m.Migrate2to3); err != nil { + panic(fmt.Sprintf("failed to migrate x/%s from version 2 to 3: %v", types.ModuleName, err)) + } } // InitGenesis performs genesis initialization for the distribution module. It returns From 89ada2aac2225237ba66ef97dfaca40e9a3f9745 Mon Sep 17 00:00:00 2001 From: atheesh Date: Wed, 6 Jul 2022 12:22:13 +0530 Subject: [PATCH 11/23] update codec --- x/distribution/types/codec.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/x/distribution/types/codec.go b/x/distribution/types/codec.go index 0bff07d87340..6ea1060b95cb 100644 --- a/x/distribution/types/codec.go +++ b/x/distribution/types/codec.go @@ -18,6 +18,9 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { legacy.RegisterAminoMsg(cdc, &MsgWithdrawValidatorCommission{}, "cosmos-sdk/MsgWithdrawValCommission") legacy.RegisterAminoMsg(cdc, &MsgSetWithdrawAddress{}, "cosmos-sdk/MsgModifyWithdrawAddress") legacy.RegisterAminoMsg(cdc, &MsgFundCommunityPool{}, "cosmos-sdk/MsgFundCommunityPool") + legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/x/mint/MsgUpdateParams") + + cdc.RegisterConcrete(Params{}, "cosmos-sdk/x/distribution/Params", nil) cdc.RegisterConcrete(&CommunityPoolSpendProposal{}, "cosmos-sdk/CommunityPoolSpendProposal", nil) } @@ -28,6 +31,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &MsgWithdrawValidatorCommission{}, &MsgSetWithdrawAddress{}, &MsgFundCommunityPool{}, + &MsgUpdateParams{}, ) registry.RegisterImplementations( (*govtypes.Content)(nil), From f2bead1a923a088570ff6905e9a46bd269a48fe9 Mon Sep 17 00:00:00 2001 From: atheesh Date: Wed, 6 Jul 2022 12:27:02 +0530 Subject: [PATCH 12/23] review --- x/distribution/types/codec.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/distribution/types/codec.go b/x/distribution/types/codec.go index 6ea1060b95cb..7b0d410f2b54 100644 --- a/x/distribution/types/codec.go +++ b/x/distribution/types/codec.go @@ -18,7 +18,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { legacy.RegisterAminoMsg(cdc, &MsgWithdrawValidatorCommission{}, "cosmos-sdk/MsgWithdrawValCommission") legacy.RegisterAminoMsg(cdc, &MsgSetWithdrawAddress{}, "cosmos-sdk/MsgModifyWithdrawAddress") legacy.RegisterAminoMsg(cdc, &MsgFundCommunityPool{}, "cosmos-sdk/MsgFundCommunityPool") - legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/x/mint/MsgUpdateParams") + legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/x/disribution/MsgUpdateParams") cdc.RegisterConcrete(Params{}, "cosmos-sdk/x/distribution/Params", nil) cdc.RegisterConcrete(&CommunityPoolSpendProposal{}, "cosmos-sdk/CommunityPoolSpendProposal", nil) From 17dc70c8b60b9ce8ad40f1e18c264cb972564f65 Mon Sep 17 00:00:00 2001 From: atheesh Date: Wed, 6 Jul 2022 12:33:06 +0530 Subject: [PATCH 13/23] fix error --- x/distribution/types/codec.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/distribution/types/codec.go b/x/distribution/types/codec.go index 7b0d410f2b54..92a3c358523a 100644 --- a/x/distribution/types/codec.go +++ b/x/distribution/types/codec.go @@ -18,7 +18,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { legacy.RegisterAminoMsg(cdc, &MsgWithdrawValidatorCommission{}, "cosmos-sdk/MsgWithdrawValCommission") legacy.RegisterAminoMsg(cdc, &MsgSetWithdrawAddress{}, "cosmos-sdk/MsgModifyWithdrawAddress") legacy.RegisterAminoMsg(cdc, &MsgFundCommunityPool{}, "cosmos-sdk/MsgFundCommunityPool") - legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/x/disribution/MsgUpdateParams") + legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/x/distribution/MsgUpdateParams") cdc.RegisterConcrete(Params{}, "cosmos-sdk/x/distribution/Params", nil) cdc.RegisterConcrete(&CommunityPoolSpendProposal{}, "cosmos-sdk/CommunityPoolSpendProposal", nil) From 6da117e4dc17d7dc65c4ab7a54ed58d50ba30356 Mon Sep 17 00:00:00 2001 From: atheesh Date: Wed, 6 Jul 2022 12:44:57 +0530 Subject: [PATCH 14/23] fix error --- x/distribution/types/codec.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/distribution/types/codec.go b/x/distribution/types/codec.go index 92a3c358523a..4180513eef58 100644 --- a/x/distribution/types/codec.go +++ b/x/distribution/types/codec.go @@ -18,7 +18,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { legacy.RegisterAminoMsg(cdc, &MsgWithdrawValidatorCommission{}, "cosmos-sdk/MsgWithdrawValCommission") legacy.RegisterAminoMsg(cdc, &MsgSetWithdrawAddress{}, "cosmos-sdk/MsgModifyWithdrawAddress") legacy.RegisterAminoMsg(cdc, &MsgFundCommunityPool{}, "cosmos-sdk/MsgFundCommunityPool") - legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/x/distribution/MsgUpdateParams") + legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/distribution/MsgUpdateParams") cdc.RegisterConcrete(Params{}, "cosmos-sdk/x/distribution/Params", nil) cdc.RegisterConcrete(&CommunityPoolSpendProposal{}, "cosmos-sdk/CommunityPoolSpendProposal", nil) From 366d17cf8adb6b53b77727daffa87602874a2eac Mon Sep 17 00:00:00 2001 From: atheesh Date: Wed, 6 Jul 2022 15:44:17 +0530 Subject: [PATCH 15/23] fix tests --- x/distribution/module.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/x/distribution/module.go b/x/distribution/module.go index 1e6fc69286a2..ff76320605f9 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -208,8 +208,12 @@ func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes } // RandomizedParams creates randomized distribution param changes for the simulator. + +// TODO: Returns an empty slice which will make parameter changes a no-op during +// simulations. Once all modules are migrated, remove RandomizedParams from +// the simulation interface. func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { - return simulation.ParamChanges(r) + return []simtypes.ParamChange{} } // RegisterStoreDecoder registers a decoder for distribution module's types From be784e293aef7d931af471030130e747d7288768 Mon Sep 17 00:00:00 2001 From: atheesh Date: Wed, 6 Jul 2022 15:49:07 +0530 Subject: [PATCH 16/23] review --- x/distribution/module.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/distribution/module.go b/x/distribution/module.go index ff76320605f9..6963b54db885 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -212,7 +212,7 @@ func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes // TODO: Returns an empty slice which will make parameter changes a no-op during // simulations. Once all modules are migrated, remove RandomizedParams from // the simulation interface. -func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { +func (AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { return []simtypes.ParamChange{} } From 55455728b78dbf9460ebdc1ae03dc74b758f92a7 Mon Sep 17 00:00:00 2001 From: atheesh Date: Wed, 6 Jul 2022 16:32:56 +0530 Subject: [PATCH 17/23] review changes --- api/cosmos/app/v1alpha1/config.pulsar.go | 2 +- api/cosmos/distribution/v1beta1/genesis.pulsar.go | 6 ------ api/cosmos/distribution/v1beta1/tx_grpc.pb.go | 4 ++-- proto/cosmos/distribution/v1beta1/genesis.proto | 1 + proto/cosmos/distribution/v1beta1/tx.proto | 2 +- x/distribution/keeper/params.go | 5 ++++- x/distribution/types/genesis.pb.go | 6 ------ x/distribution/types/tx.pb.go | 4 ++-- 8 files changed, 11 insertions(+), 19 deletions(-) diff --git a/api/cosmos/app/v1alpha1/config.pulsar.go b/api/cosmos/app/v1alpha1/config.pulsar.go index 7359179ac6ac..34dfc0d7459c 100644 --- a/api/cosmos/app/v1alpha1/config.pulsar.go +++ b/api/cosmos/app/v1alpha1/config.pulsar.go @@ -1850,7 +1850,7 @@ type ModuleConfig struct { // that the v1 module had. Note: modules should provide info on which versions // they can migrate from in the ModuleDescriptor.can_migration_from field. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // config is the config object for the module. Module config messages shouldA + // config is the config object for the module. Module config messages should // define a ModuleDescriptor using the cosmos.app.v1alpha1.is_module extension. Config *anypb.Any `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"` // golang_bindings specifies explicit interface to implementation type bindings which diff --git a/api/cosmos/distribution/v1beta1/genesis.pulsar.go b/api/cosmos/distribution/v1beta1/genesis.pulsar.go index 5baddfce8c11..50aedee2a4e3 100644 --- a/api/cosmos/distribution/v1beta1/genesis.pulsar.go +++ b/api/cosmos/distribution/v1beta1/genesis.pulsar.go @@ -5686,12 +5686,6 @@ type GenesisState struct { unknownFields protoimpl.UnknownFields // params defines all the parameters of the module. - // - // Deprecated: Use governance to submit a MsgUpdateParams message to instruct - // the x/distribution module to update the relevant parameters. - // - // Since the cosmos-sdk 0.47 version, this only exists for backwards - // compatibility of genesis state. Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` // fee_pool defines the fee pool at genesis. FeePool *FeePool `protobuf:"bytes,2,opt,name=fee_pool,json=feePool,proto3" json:"fee_pool,omitempty"` diff --git a/api/cosmos/distribution/v1beta1/tx_grpc.pb.go b/api/cosmos/distribution/v1beta1/tx_grpc.pb.go index 40c32fb20b28..d94242df65bc 100644 --- a/api/cosmos/distribution/v1beta1/tx_grpc.pb.go +++ b/api/cosmos/distribution/v1beta1/tx_grpc.pb.go @@ -35,7 +35,7 @@ type MsgClient interface { // fund the community pool. FundCommunityPool(ctx context.Context, in *MsgFundCommunityPool, opts ...grpc.CallOption) (*MsgFundCommunityPoolResponse, error) // UpdateParams defines a governance operation for updating the x/distribution module - // parameters. The authority is hard-coded to the x/gov module account. + // parameters. The authority is defined in the keeper. // // Since: cosmos-sdk 0.47 UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) @@ -111,7 +111,7 @@ type MsgServer interface { // fund the community pool. FundCommunityPool(context.Context, *MsgFundCommunityPool) (*MsgFundCommunityPoolResponse, error) // UpdateParams defines a governance operation for updating the x/distribution module - // parameters. The authority is hard-coded to the x/gov module account. + // parameters. The authority is defined in the keeper. // // Since: cosmos-sdk 0.47 UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) diff --git a/proto/cosmos/distribution/v1beta1/genesis.proto b/proto/cosmos/distribution/v1beta1/genesis.proto index 4008ecd91509..239ba42f61b0 100644 --- a/proto/cosmos/distribution/v1beta1/genesis.proto +++ b/proto/cosmos/distribution/v1beta1/genesis.proto @@ -112,6 +112,7 @@ message GenesisState { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; + // params defines all the parameters of the module. Params params = 1 [(gogoproto.nullable) = false]; // fee_pool defines the fee pool at genesis. diff --git a/proto/cosmos/distribution/v1beta1/tx.proto b/proto/cosmos/distribution/v1beta1/tx.proto index d6b7e23a6108..25f6433d2f56 100644 --- a/proto/cosmos/distribution/v1beta1/tx.proto +++ b/proto/cosmos/distribution/v1beta1/tx.proto @@ -29,7 +29,7 @@ service Msg { rpc FundCommunityPool(MsgFundCommunityPool) returns (MsgFundCommunityPoolResponse); // UpdateParams defines a governance operation for updating the x/distribution module - // parameters. The authority is hard-coded to the x/gov module account. + // parameters. The authority is defined in the keeper. // // Since: cosmos-sdk 0.47 rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); diff --git a/x/distribution/keeper/params.go b/x/distribution/keeper/params.go index e8a1297827e5..bac1edb5dfb5 100644 --- a/x/distribution/keeper/params.go +++ b/x/distribution/keeper/params.go @@ -24,7 +24,10 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { } store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshal(¶ms) + bz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } store.Set(types.ParamsKey, bz) return nil diff --git a/x/distribution/types/genesis.pb.go b/x/distribution/types/genesis.pb.go index a2e0c208d018..59014e032a67 100644 --- a/x/distribution/types/genesis.pb.go +++ b/x/distribution/types/genesis.pb.go @@ -328,12 +328,6 @@ var xxx_messageInfo_ValidatorSlashEventRecord proto.InternalMessageInfo // GenesisState defines the distribution module's genesis state. type GenesisState struct { // params defines all the parameters of the module. - // - // Deprecated: Use governance to submit a MsgUpdateParams message to instruct - // the x/distribution module to update the relevant parameters. - // - // Since the cosmos-sdk 0.47 version, this only exists for backwards - // compatibility of genesis state. Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` // fee_pool defines the fee pool at genesis. FeePool FeePool `protobuf:"bytes,2,opt,name=fee_pool,json=feePool,proto3" json:"fee_pool"` diff --git a/x/distribution/types/tx.pb.go b/x/distribution/types/tx.pb.go index 59227418de76..a0d2bb14f58d 100644 --- a/x/distribution/types/tx.pb.go +++ b/x/distribution/types/tx.pb.go @@ -696,7 +696,7 @@ type MsgClient interface { // fund the community pool. FundCommunityPool(ctx context.Context, in *MsgFundCommunityPool, opts ...grpc.CallOption) (*MsgFundCommunityPoolResponse, error) // UpdateParams defines a governance operation for updating the x/distribution module - // parameters. The authority is hard-coded to the x/gov module account. + // parameters. The authority is defined in the keeper. // // Since: cosmos-sdk 0.47 UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) @@ -770,7 +770,7 @@ type MsgServer interface { // fund the community pool. FundCommunityPool(context.Context, *MsgFundCommunityPool) (*MsgFundCommunityPoolResponse, error) // UpdateParams defines a governance operation for updating the x/distribution module - // parameters. The authority is hard-coded to the x/gov module account. + // parameters. The authority is defined in the keeper. // // Since: cosmos-sdk 0.47 UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) From 8822ef2695a1eb8cb30b7432f58f631c73951f1d Mon Sep 17 00:00:00 2001 From: atheesh Date: Wed, 6 Jul 2022 16:34:08 +0530 Subject: [PATCH 18/23] review changes --- x/distribution/migrations/v046/migrate.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/x/distribution/migrations/v046/migrate.go b/x/distribution/migrations/v046/migrate.go index 71e2fbc46929..0a4c99a111f1 100644 --- a/x/distribution/migrations/v046/migrate.go +++ b/x/distribution/migrations/v046/migrate.go @@ -29,7 +29,11 @@ func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, legacySubspace return err } - bz := cdc.MustMarshal(&currParams) + bz, err := cdc.Marshal(&currParams) + if err != nil { + return err + } + store.Set(ParamsKey, bz) return nil From b6f89342f82d977bf284f02831d4962b604407d3 Mon Sep 17 00:00:00 2001 From: atheesh Date: Thu, 7 Jul 2022 10:29:44 +0530 Subject: [PATCH 19/23] update changelog --- CHANGELOG.md | 1 + x/distribution/keeper/genesis.go | 5 ++++- x/distribution/keeper/grpc_query_test.go | 4 ++-- x/distribution/keeper/keeper_test.go | 4 ++-- x/distribution/keeper/querier_test.go | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d229cf109ce2..3c4ec4fe56fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (testutil) [#12233](https://github.com/cosmos/cosmos-sdk/pull/12233) Move `simapp.TestAddr` to `simtestutil.TestAddr` (`testutil/sims`) * (x/staking) [#12102](https://github.com/cosmos/cosmos-sdk/pull/12102) Staking keeper now is passed by reference instead of copy. Keeper's SetHooks no longer returns keeper. It updates the keeper in place instead. * (linting) [#12141](https://github.com/cosmos/cosmos-sdk/pull/12141) Fix usability related linting for database. This means removing the infix Prefix from `prefix.NewPrefixWriter` and such so that it is `prefix.NewWriter` and making `db.DBConnection` and such into `db.Connection` +* (x/distribution) [#12434](https://github.com/cosmos/cosmos-sdk/pull/12434) `x/distribution` module `SetParams` keeper method definition is now updated to return `error`. ### Bug Fixes diff --git a/x/distribution/keeper/genesis.go b/x/distribution/keeper/genesis.go index 6236e74902c8..ef80f1fd14db 100644 --- a/x/distribution/keeper/genesis.go +++ b/x/distribution/keeper/genesis.go @@ -12,7 +12,10 @@ func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState) { var moduleHoldings sdk.DecCoins k.SetFeePool(ctx, data.FeePool) - k.SetParams(ctx, data.Params) + + if err := k.SetParams(ctx, data.Params); err != nil { + panic(err) + } for _, dwi := range data.DelegatorWithdrawInfos { delegatorAddress := sdk.MustAccAddressFromBech32(dwi.DelegatorAddress) diff --git a/x/distribution/keeper/grpc_query_test.go b/x/distribution/keeper/grpc_query_test.go index 943374534858..07ef93ba9acd 100644 --- a/x/distribution/keeper/grpc_query_test.go +++ b/x/distribution/keeper/grpc_query_test.go @@ -60,7 +60,7 @@ func (suite *KeeperTestSuite) SetupTest() { suite.addrs = simtestutil.AddTestAddrs(suite.bankKeeper, suite.stakingKeeper, ctx, 2, sdk.NewInt(1000000000)) suite.valAddrs = simtestutil.ConvertAddrsToValAddrs(suite.addrs) - suite.distrKeeper.SetParams(suite.ctx, types.DefaultParams()) + suite.NoError(suite.distrKeeper.SetParams(suite.ctx, types.DefaultParams())) suite.msgServer = keeper.NewMsgServerImpl(suite.distrKeeper) } @@ -96,7 +96,7 @@ func (suite *KeeperTestSuite) TestGRPCParams() { WithdrawAddrEnabled: true, } - suite.distrKeeper.SetParams(ctx, params) + suite.NoError(suite.distrKeeper.SetParams(ctx, params)) req = &types.QueryParamsRequest{} expParams = params }, diff --git a/x/distribution/keeper/keeper_test.go b/x/distribution/keeper/keeper_test.go index 4d671d7329d0..7786928a43a7 100644 --- a/x/distribution/keeper/keeper_test.go +++ b/x/distribution/keeper/keeper_test.go @@ -37,13 +37,13 @@ func TestSetWithdrawAddr(t *testing.T) { params := distrKeeper.GetParams(ctx) params.WithdrawAddrEnabled = false - distrKeeper.SetParams(ctx, params) + require.NoError(t, distrKeeper.SetParams(ctx, params)) err = distrKeeper.SetWithdrawAddr(ctx, addr[0], addr[1]) require.NotNil(t, err) params.WithdrawAddrEnabled = true - distrKeeper.SetParams(ctx, params) + require.NoError(t, distrKeeper.SetParams(ctx, params)) err = distrKeeper.SetWithdrawAddr(ctx, addr[0], addr[1]) require.Nil(t, err) diff --git a/x/distribution/keeper/querier_test.go b/x/distribution/keeper/querier_test.go index 126b55b0a09c..cc739bd6cf95 100644 --- a/x/distribution/keeper/querier_test.go +++ b/x/distribution/keeper/querier_test.go @@ -151,7 +151,7 @@ func TestQueries(t *testing.T) { WithdrawAddrEnabled: true, } - distrKeeper.SetParams(ctx, params) + require.NoError(t, distrKeeper.SetParams(ctx, params)) paramsRes := getQueriedParams(t, ctx, cdc, querier) require.Equal(t, params.CommunityTax, paramsRes.CommunityTax) From 22eb721fbe1c821cff5ae906c170858aba18a03c Mon Sep 17 00:00:00 2001 From: atheesh Date: Thu, 7 Jul 2022 10:33:53 +0530 Subject: [PATCH 20/23] review --- x/distribution/keeper/keeper.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/x/distribution/keeper/keeper.go b/x/distribution/keeper/keeper.go index c20893659227..453199037492 100644 --- a/x/distribution/keeper/keeper.go +++ b/x/distribution/keeper/keeper.go @@ -10,14 +10,12 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/distribution/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) // Keeper of the distribution store type Keeper struct { storeKey storetypes.StoreKey cdc codec.BinaryCodec - paramSpace paramtypes.Subspace authKeeper types.AccountKeeper bankKeeper types.BankKeeper stakingKeeper types.StakingKeeper From 4c125b309b300e6c571b5b3256b81c800b9e0331 Mon Sep 17 00:00:00 2001 From: atheesh Date: Thu, 7 Jul 2022 11:09:55 +0530 Subject: [PATCH 21/23] update spec --- x/distribution/spec/02_state.md | 9 +++++++++ x/distribution/spec/04_messages.md | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/x/distribution/spec/02_state.md b/x/distribution/spec/02_state.md index e914ce25364d..ec79f2aae5a1 100644 --- a/x/distribution/spec/02_state.md +++ b/x/distribution/spec/02_state.md @@ -63,3 +63,12 @@ type DelegationDistInfo struct { WithdrawalHeight int64 // last time this delegation withdrew rewards } ``` + +## Params + +distribution module stores it's params in state with the prefix of `0x09`, +it can only updated with governance. + +* Params: `0x09 | ProtocolBuffer(Params)` + ++++ https://github.com/cosmos/cosmos-sdk/blob/v0.46.0-rc1/proto/cosmos/distribution/v1beta1/distribution.proto#L11-L30 diff --git a/x/distribution/spec/04_messages.md b/x/distribution/spec/04_messages.md index 87d608842e5b..8e48d543abd8 100644 --- a/x/distribution/spec/04_messages.md +++ b/x/distribution/spec/04_messages.md @@ -120,3 +120,12 @@ func (k Keeper) initializeDelegation(ctx sdk.Context, val sdk.ValAddress, del sd k.SetDelegatorStartingInfo(ctx, val, del, types.NewDelegatorStartingInfo(previousPeriod, stake, uint64(ctx.BlockHeight()))) } ``` + +## MsgUpdateParams +Distribution module params can be updated through `MsgUpdateParams`, which can be done using governance proposal and the signer will always be gov module account address. + ++++ https://github.com/cosmos/cosmos-sdk/blob/8822ef2695a1eb8cb30b7432f58f631c73951f1d/proto/cosmos/distribution/v1beta1/tx.proto#L106-L119 + +The message handling can fail if: + +* signer is not the gov module account address. From 29028f36ca0610466048a25a7e2100b9f9267b85 Mon Sep 17 00:00:00 2001 From: atheesh Date: Fri, 8 Jul 2022 15:22:01 +0530 Subject: [PATCH 22/23] update evetns --- x/distribution/keeper/msg_server.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/x/distribution/keeper/msg_server.go b/x/distribution/keeper/msg_server.go index 8e8f73f6e319..e2b863d892d9 100644 --- a/x/distribution/keeper/msg_server.go +++ b/x/distribution/keeper/msg_server.go @@ -156,5 +156,13 @@ func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParam return nil, err } + ctx.EventManager().EmitEvent( + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, req.Authority), + ), + ) + return &types.MsgUpdateParamsResponse{}, nil } From 7aefd9c87b709813abf1ecc039e2db5b812d6993 Mon Sep 17 00:00:00 2001 From: atheesh Date: Fri, 8 Jul 2022 15:23:11 +0530 Subject: [PATCH 23/23] review changes --- x/distribution/spec/04_messages.md | 1 + 1 file changed, 1 insertion(+) diff --git a/x/distribution/spec/04_messages.md b/x/distribution/spec/04_messages.md index 8e48d543abd8..406b6d9b8bb9 100644 --- a/x/distribution/spec/04_messages.md +++ b/x/distribution/spec/04_messages.md @@ -122,6 +122,7 @@ func (k Keeper) initializeDelegation(ctx sdk.Context, val sdk.ValAddress, del sd ``` ## MsgUpdateParams + Distribution module params can be updated through `MsgUpdateParams`, which can be done using governance proposal and the signer will always be gov module account address. +++ https://github.com/cosmos/cosmos-sdk/blob/8822ef2695a1eb8cb30b7432f58f631c73951f1d/proto/cosmos/distribution/v1beta1/tx.proto#L106-L119