diff --git a/CHANGELOG.md b/CHANGELOG.md index 864a64cdf494..9390a7f9e7d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,6 +68,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/mint) [#12363](https://github.com/cosmos/cosmos-sdk/pull/12363) Migrate `x/mint` to self-managed parameters and deprecate it's usage of `x/params`. * (x/distribution) [#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/crisis) [#12445](https://github.com/cosmos/cosmos-sdk/pull/12445) Migrate `x/crisis` to self-managed parameters and deprecate it's usage of `x/params`. +* (x/staking) [#12409](https://github.com/cosmos/cosmos-sdk/pull/12409) Migrate `x/staking` to self-managed parameters and deprecate it's usage of `x/params`. + ### API Breaking Changes @@ -84,6 +86,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (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`. +* (x/staking) [#12409](https://github.com/cosmos/cosmos-sdk/pull/12409) `x/staking` module `SetParams` keeper method definition is now updated to return `error`. * (x/crisis) [#12445](https://github.com/cosmos/cosmos-sdk/pull/12445) `x/crisis` module `SetConstantFee` keeper method definition is now updated to return `error`. ### CLI Breaking Changes diff --git a/api/cosmos/staking/v1beta1/genesis.pulsar.go b/api/cosmos/staking/v1beta1/genesis.pulsar.go index 5e423b11973c..094309b4420f 100644 --- a/api/cosmos/staking/v1beta1/genesis.pulsar.go +++ b/api/cosmos/staking/v1beta1/genesis.pulsar.go @@ -1746,7 +1746,7 @@ type GenesisState struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // params defines all the paramaters of related to deposit. + // params defines all the parameters of related to deposit. Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` // last_total_power tracks the total amounts of bonded tokens recorded during // the previous end block. diff --git a/api/cosmos/staking/v1beta1/staking.pulsar.go b/api/cosmos/staking/v1beta1/staking.pulsar.go index 7e027f3b670a..4fa721fc27c1 100644 --- a/api/cosmos/staking/v1beta1/staking.pulsar.go +++ b/api/cosmos/staking/v1beta1/staking.pulsar.go @@ -12706,7 +12706,7 @@ func (x *Redelegation) GetEntries() []*RedelegationEntry { return nil } -// Params defines the parameters for the staking module. +// Params defines the parameters for the x/staking module. type Params struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/api/cosmos/staking/v1beta1/tx.pulsar.go b/api/cosmos/staking/v1beta1/tx.pulsar.go index a2ff599dec41..b265c158358e 100644 --- a/api/cosmos/staking/v1beta1/tx.pulsar.go +++ b/api/cosmos/staking/v1beta1/tx.pulsar.go @@ -6167,6 +6167,861 @@ func (x *fastReflection_MsgCancelUnbondingDelegationResponse) ProtoMethods() *pr } } +var ( + md_MsgUpdateParams protoreflect.MessageDescriptor + fd_MsgUpdateParams_authority protoreflect.FieldDescriptor + fd_MsgUpdateParams_params protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_staking_v1beta1_tx_proto_init() + md_MsgUpdateParams = File_cosmos_staking_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_staking_v1beta1_tx_proto_msgTypes[12] + 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.staking.v1beta1.MsgUpdateParams.authority": + return x.Authority != "" + case "cosmos.staking.v1beta1.MsgUpdateParams.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.staking.v1beta1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.staking.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.staking.v1beta1.MsgUpdateParams.authority": + x.Authority = "" + case "cosmos.staking.v1beta1.MsgUpdateParams.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.staking.v1beta1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.staking.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.staking.v1beta1.MsgUpdateParams.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "cosmos.staking.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.staking.v1beta1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.staking.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.staking.v1beta1.MsgUpdateParams.authority": + x.Authority = value.Interface().(string) + case "cosmos.staking.v1beta1.MsgUpdateParams.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.staking.v1beta1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.staking.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.staking.v1beta1.MsgUpdateParams.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "cosmos.staking.v1beta1.MsgUpdateParams.authority": + panic(fmt.Errorf("field authority of message cosmos.staking.v1beta1.MsgUpdateParams is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.staking.v1beta1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.staking.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.staking.v1beta1.MsgUpdateParams.authority": + return protoreflect.ValueOfString("") + case "cosmos.staking.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.staking.v1beta1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.staking.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.staking.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_staking_v1beta1_tx_proto_init() + md_MsgUpdateParamsResponse = File_cosmos_staking_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_staking_v1beta1_tx_proto_msgTypes[13] + 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.staking.v1beta1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.staking.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.staking.v1beta1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.staking.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.staking.v1beta1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.staking.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.staking.v1beta1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.staking.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.staking.v1beta1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.staking.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.staking.v1beta1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.staking.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.staking.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 @@ -6741,6 +7596,86 @@ func (*MsgCancelUnbondingDelegationResponse) Descriptor() ([]byte, []int) { return file_cosmos_staking_v1beta1_tx_proto_rawDescGZIP(), []int{11} } +// 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/staking 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_staking_v1beta1_tx_proto_msgTypes[12] + 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_staking_v1beta1_tx_proto_rawDescGZIP(), []int{12} +} + +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_staking_v1beta1_tx_proto_msgTypes[13] + 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_staking_v1beta1_tx_proto_rawDescGZIP(), []int{13} +} + var File_cosmos_staking_v1beta1_tx_proto protoreflect.FileDescriptor var file_cosmos_staking_v1beta1_tx_proto_rawDesc = []byte{ @@ -6916,64 +7851,82 @@ var file_cosmos_staking_v1beta1_tx_proto_rawDesc = []byte{ 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x26, 0x0a, 0x24, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x55, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x32, 0xac, 0x05, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x71, 0x0a, 0x0f, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x2a, 0x2e, 0x63, + 0x65, 0x22, 0x97, 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, 0x3c, 0x0a, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 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, 0x96, 0x06, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x71, + 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, + 0x72, 0x12, 0x2a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, + 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x1a, 0x32, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x6b, 0x0a, 0x0d, 0x45, 0x64, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x6f, 0x72, 0x12, 0x28, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, + 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, + 0x64, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x1a, 0x30, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x1a, 0x32, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6b, 0x0a, 0x0d, - 0x45, 0x64, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x28, 0x2e, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x64, 0x69, 0x74, 0x56, 0x61, 0x6c, + 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, + 0x0a, 0x08, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x12, 0x23, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x1a, + 0x2b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, + 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x71, 0x0a, 0x0f, + 0x42, 0x65, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x12, + 0x2a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x65, 0x67, 0x69, + 0x6e, 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x1a, 0x32, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x65, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x64, + 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x62, 0x0a, 0x0a, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x12, 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x64, 0x69, 0x74, 0x56, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x1a, 0x30, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, + 0x67, 0x61, 0x74, 0x65, 0x1a, 0x2d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, + 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, + 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x8f, 0x01, 0x0a, 0x19, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x55, 0x6e, + 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x34, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, + 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, + 0x6e, 0x63, 0x65, 0x6c, 0x55, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x6c, + 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x3c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x64, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, - 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x08, 0x44, 0x65, 0x6c, - 0x65, 0x67, 0x61, 0x74, 0x65, 0x12, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, + 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x55, 0x6e, 0x62, 0x6f, 0x6e, 0x64, + 0x69, 0x6e, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x68, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, - 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x1a, 0x2b, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x71, 0x0a, 0x0f, 0x42, 0x65, 0x67, 0x69, 0x6e, - 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x12, 0x2a, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x65, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x64, 0x65, - 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x1a, 0x32, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x42, 0x65, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, - 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, 0x0a, 0x0a, 0x55, 0x6e, - 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x12, 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x1a, - 0x2d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, - 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x8f, - 0x01, 0x0a, 0x19, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x55, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, - 0x6e, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x55, - 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x1a, 0x3c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, - 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, - 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x55, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x44, 0x65, - 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x42, 0xd7, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, - 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x36, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x3b, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x53, 0x58, 0xaa, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0xca, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x61, 0x6b, 0x69, - 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x22, 0x43, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x18, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, - 0x67, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2f, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 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, + 0xd7, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, + 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, + 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x36, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x3b, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0xa2, 0x02, 0x03, 0x43, 0x53, 0x58, 0xaa, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0xca, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, + 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x18, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, + 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -6988,7 +7941,7 @@ func file_cosmos_staking_v1beta1_tx_proto_rawDescGZIP() []byte { return file_cosmos_staking_v1beta1_tx_proto_rawDescData } -var file_cosmos_staking_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_cosmos_staking_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_cosmos_staking_v1beta1_tx_proto_goTypes = []interface{}{ (*MsgCreateValidator)(nil), // 0: cosmos.staking.v1beta1.MsgCreateValidator (*MsgCreateValidatorResponse)(nil), // 1: cosmos.staking.v1beta1.MsgCreateValidatorResponse @@ -7002,41 +7955,47 @@ var file_cosmos_staking_v1beta1_tx_proto_goTypes = []interface{}{ (*MsgUndelegateResponse)(nil), // 9: cosmos.staking.v1beta1.MsgUndelegateResponse (*MsgCancelUnbondingDelegation)(nil), // 10: cosmos.staking.v1beta1.MsgCancelUnbondingDelegation (*MsgCancelUnbondingDelegationResponse)(nil), // 11: cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse - (*Description)(nil), // 12: cosmos.staking.v1beta1.Description - (*CommissionRates)(nil), // 13: cosmos.staking.v1beta1.CommissionRates - (*anypb.Any)(nil), // 14: google.protobuf.Any - (*v1beta1.Coin)(nil), // 15: cosmos.base.v1beta1.Coin - (*timestamppb.Timestamp)(nil), // 16: google.protobuf.Timestamp + (*MsgUpdateParams)(nil), // 12: cosmos.staking.v1beta1.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 13: cosmos.staking.v1beta1.MsgUpdateParamsResponse + (*Description)(nil), // 14: cosmos.staking.v1beta1.Description + (*CommissionRates)(nil), // 15: cosmos.staking.v1beta1.CommissionRates + (*anypb.Any)(nil), // 16: google.protobuf.Any + (*v1beta1.Coin)(nil), // 17: cosmos.base.v1beta1.Coin + (*timestamppb.Timestamp)(nil), // 18: google.protobuf.Timestamp + (*Params)(nil), // 19: cosmos.staking.v1beta1.Params } var file_cosmos_staking_v1beta1_tx_proto_depIdxs = []int32{ - 12, // 0: cosmos.staking.v1beta1.MsgCreateValidator.description:type_name -> cosmos.staking.v1beta1.Description - 13, // 1: cosmos.staking.v1beta1.MsgCreateValidator.commission:type_name -> cosmos.staking.v1beta1.CommissionRates - 14, // 2: cosmos.staking.v1beta1.MsgCreateValidator.pubkey:type_name -> google.protobuf.Any - 15, // 3: cosmos.staking.v1beta1.MsgCreateValidator.value:type_name -> cosmos.base.v1beta1.Coin - 12, // 4: cosmos.staking.v1beta1.MsgEditValidator.description:type_name -> cosmos.staking.v1beta1.Description - 15, // 5: cosmos.staking.v1beta1.MsgDelegate.amount:type_name -> cosmos.base.v1beta1.Coin - 15, // 6: cosmos.staking.v1beta1.MsgBeginRedelegate.amount:type_name -> cosmos.base.v1beta1.Coin - 16, // 7: cosmos.staking.v1beta1.MsgBeginRedelegateResponse.completion_time:type_name -> google.protobuf.Timestamp - 15, // 8: cosmos.staking.v1beta1.MsgUndelegate.amount:type_name -> cosmos.base.v1beta1.Coin - 16, // 9: cosmos.staking.v1beta1.MsgUndelegateResponse.completion_time:type_name -> google.protobuf.Timestamp - 15, // 10: cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.amount:type_name -> cosmos.base.v1beta1.Coin - 0, // 11: cosmos.staking.v1beta1.Msg.CreateValidator:input_type -> cosmos.staking.v1beta1.MsgCreateValidator - 2, // 12: cosmos.staking.v1beta1.Msg.EditValidator:input_type -> cosmos.staking.v1beta1.MsgEditValidator - 4, // 13: cosmos.staking.v1beta1.Msg.Delegate:input_type -> cosmos.staking.v1beta1.MsgDelegate - 6, // 14: cosmos.staking.v1beta1.Msg.BeginRedelegate:input_type -> cosmos.staking.v1beta1.MsgBeginRedelegate - 8, // 15: cosmos.staking.v1beta1.Msg.Undelegate:input_type -> cosmos.staking.v1beta1.MsgUndelegate - 10, // 16: cosmos.staking.v1beta1.Msg.CancelUnbondingDelegation:input_type -> cosmos.staking.v1beta1.MsgCancelUnbondingDelegation - 1, // 17: cosmos.staking.v1beta1.Msg.CreateValidator:output_type -> cosmos.staking.v1beta1.MsgCreateValidatorResponse - 3, // 18: cosmos.staking.v1beta1.Msg.EditValidator:output_type -> cosmos.staking.v1beta1.MsgEditValidatorResponse - 5, // 19: cosmos.staking.v1beta1.Msg.Delegate:output_type -> cosmos.staking.v1beta1.MsgDelegateResponse - 7, // 20: cosmos.staking.v1beta1.Msg.BeginRedelegate:output_type -> cosmos.staking.v1beta1.MsgBeginRedelegateResponse - 9, // 21: cosmos.staking.v1beta1.Msg.Undelegate:output_type -> cosmos.staking.v1beta1.MsgUndelegateResponse - 11, // 22: cosmos.staking.v1beta1.Msg.CancelUnbondingDelegation:output_type -> cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse - 17, // [17:23] is the sub-list for method output_type - 11, // [11:17] is the sub-list for method input_type - 11, // [11:11] is the sub-list for extension type_name - 11, // [11:11] is the sub-list for extension extendee - 0, // [0:11] is the sub-list for field type_name + 14, // 0: cosmos.staking.v1beta1.MsgCreateValidator.description:type_name -> cosmos.staking.v1beta1.Description + 15, // 1: cosmos.staking.v1beta1.MsgCreateValidator.commission:type_name -> cosmos.staking.v1beta1.CommissionRates + 16, // 2: cosmos.staking.v1beta1.MsgCreateValidator.pubkey:type_name -> google.protobuf.Any + 17, // 3: cosmos.staking.v1beta1.MsgCreateValidator.value:type_name -> cosmos.base.v1beta1.Coin + 14, // 4: cosmos.staking.v1beta1.MsgEditValidator.description:type_name -> cosmos.staking.v1beta1.Description + 17, // 5: cosmos.staking.v1beta1.MsgDelegate.amount:type_name -> cosmos.base.v1beta1.Coin + 17, // 6: cosmos.staking.v1beta1.MsgBeginRedelegate.amount:type_name -> cosmos.base.v1beta1.Coin + 18, // 7: cosmos.staking.v1beta1.MsgBeginRedelegateResponse.completion_time:type_name -> google.protobuf.Timestamp + 17, // 8: cosmos.staking.v1beta1.MsgUndelegate.amount:type_name -> cosmos.base.v1beta1.Coin + 18, // 9: cosmos.staking.v1beta1.MsgUndelegateResponse.completion_time:type_name -> google.protobuf.Timestamp + 17, // 10: cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.amount:type_name -> cosmos.base.v1beta1.Coin + 19, // 11: cosmos.staking.v1beta1.MsgUpdateParams.params:type_name -> cosmos.staking.v1beta1.Params + 0, // 12: cosmos.staking.v1beta1.Msg.CreateValidator:input_type -> cosmos.staking.v1beta1.MsgCreateValidator + 2, // 13: cosmos.staking.v1beta1.Msg.EditValidator:input_type -> cosmos.staking.v1beta1.MsgEditValidator + 4, // 14: cosmos.staking.v1beta1.Msg.Delegate:input_type -> cosmos.staking.v1beta1.MsgDelegate + 6, // 15: cosmos.staking.v1beta1.Msg.BeginRedelegate:input_type -> cosmos.staking.v1beta1.MsgBeginRedelegate + 8, // 16: cosmos.staking.v1beta1.Msg.Undelegate:input_type -> cosmos.staking.v1beta1.MsgUndelegate + 10, // 17: cosmos.staking.v1beta1.Msg.CancelUnbondingDelegation:input_type -> cosmos.staking.v1beta1.MsgCancelUnbondingDelegation + 12, // 18: cosmos.staking.v1beta1.Msg.UpdateParams:input_type -> cosmos.staking.v1beta1.MsgUpdateParams + 1, // 19: cosmos.staking.v1beta1.Msg.CreateValidator:output_type -> cosmos.staking.v1beta1.MsgCreateValidatorResponse + 3, // 20: cosmos.staking.v1beta1.Msg.EditValidator:output_type -> cosmos.staking.v1beta1.MsgEditValidatorResponse + 5, // 21: cosmos.staking.v1beta1.Msg.Delegate:output_type -> cosmos.staking.v1beta1.MsgDelegateResponse + 7, // 22: cosmos.staking.v1beta1.Msg.BeginRedelegate:output_type -> cosmos.staking.v1beta1.MsgBeginRedelegateResponse + 9, // 23: cosmos.staking.v1beta1.Msg.Undelegate:output_type -> cosmos.staking.v1beta1.MsgUndelegateResponse + 11, // 24: cosmos.staking.v1beta1.Msg.CancelUnbondingDelegation:output_type -> cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse + 13, // 25: cosmos.staking.v1beta1.Msg.UpdateParams:output_type -> cosmos.staking.v1beta1.MsgUpdateParamsResponse + 19, // [19:26] is the sub-list for method output_type + 12, // [12:19] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name } func init() { file_cosmos_staking_v1beta1_tx_proto_init() } @@ -7190,6 +8149,30 @@ func file_cosmos_staking_v1beta1_tx_proto_init() { return nil } } + file_cosmos_staking_v1beta1_tx_proto_msgTypes[12].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_staking_v1beta1_tx_proto_msgTypes[13].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{ @@ -7197,7 +8180,7 @@ func file_cosmos_staking_v1beta1_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_staking_v1beta1_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 12, + NumMessages: 14, NumExtensions: 0, NumServices: 1, }, diff --git a/api/cosmos/staking/v1beta1/tx_grpc.pb.go b/api/cosmos/staking/v1beta1/tx_grpc.pb.go index e9361597b88e..ee50ca5ab56b 100644 --- a/api/cosmos/staking/v1beta1/tx_grpc.pb.go +++ b/api/cosmos/staking/v1beta1/tx_grpc.pb.go @@ -40,6 +40,10 @@ type MsgClient interface { // // Since: cosmos-sdk 0.46 CancelUnbondingDelegation(ctx context.Context, in *MsgCancelUnbondingDelegation, opts ...grpc.CallOption) (*MsgCancelUnbondingDelegationResponse, error) + // UpdateParams defines a operation for updating the x/staking module + // parameters. + // Since: cosmos-sdk 0.47 + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -104,6 +108,15 @@ func (c *msgClient) CancelUnbondingDelegation(ctx context.Context, in *MsgCancel 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.staking.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 @@ -126,6 +139,10 @@ type MsgServer interface { // // Since: cosmos-sdk 0.46 CancelUnbondingDelegation(context.Context, *MsgCancelUnbondingDelegation) (*MsgCancelUnbondingDelegationResponse, error) + // UpdateParams defines a operation for updating the x/staking module + // parameters. + // Since: cosmos-sdk 0.47 + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) mustEmbedUnimplementedMsgServer() } @@ -151,6 +168,9 @@ func (UnimplementedMsgServer) Undelegate(context.Context, *MsgUndelegate) (*MsgU func (UnimplementedMsgServer) CancelUnbondingDelegation(context.Context, *MsgCancelUnbondingDelegation) (*MsgCancelUnbondingDelegationResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CancelUnbondingDelegation 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. @@ -272,6 +292,24 @@ func _Msg_CancelUnbondingDelegation_Handler(srv interface{}, ctx context.Context 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.staking.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) @@ -303,6 +341,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "CancelUnbondingDelegation", Handler: _Msg_CancelUnbondingDelegation_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/staking/v1beta1/tx.proto", diff --git a/proto/cosmos/staking/v1beta1/genesis.proto b/proto/cosmos/staking/v1beta1/genesis.proto index bf3c298e39a6..6d0177217bd0 100644 --- a/proto/cosmos/staking/v1beta1/genesis.proto +++ b/proto/cosmos/staking/v1beta1/genesis.proto @@ -9,7 +9,7 @@ import "cosmos_proto/cosmos.proto"; // GenesisState defines the staking module's genesis state. message GenesisState { - // params defines all the paramaters of related to deposit. + // params defines all the parameters of related to deposit. Params params = 1 [(gogoproto.nullable) = false]; // last_total_power tracks the total amounts of bonded tokens recorded during diff --git a/proto/cosmos/staking/v1beta1/staking.proto b/proto/cosmos/staking/v1beta1/staking.proto index 6dc965feab47..193ff3c0def4 100644 --- a/proto/cosmos/staking/v1beta1/staking.proto +++ b/proto/cosmos/staking/v1beta1/staking.proto @@ -282,7 +282,7 @@ message Redelegation { repeated RedelegationEntry entries = 4 [(gogoproto.nullable) = false]; // redelegation entries } -// Params defines the parameters for the staking module. +// Params defines the parameters for the x/staking module. message Params { option (gogoproto.equal) = true; option (gogoproto.goproto_stringer) = false; diff --git a/proto/cosmos/staking/v1beta1/tx.proto b/proto/cosmos/staking/v1beta1/tx.proto index 8226dd309958..dec72dfe87ff 100644 --- a/proto/cosmos/staking/v1beta1/tx.proto +++ b/proto/cosmos/staking/v1beta1/tx.proto @@ -38,6 +38,11 @@ service Msg { // // Since: cosmos-sdk 0.46 rpc CancelUnbondingDelegation(MsgCancelUnbondingDelegation) returns (MsgCancelUnbondingDelegationResponse); + + // UpdateParams defines an operation for updating the x/staking module + // parameters. + // Since: cosmos-sdk 0.47 + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgCreateValidator defines a SDK message for creating a new validator. @@ -163,3 +168,23 @@ message MsgCancelUnbondingDelegation { // // Since: cosmos-sdk 0.46 message MsgCancelUnbondingDelegationResponse {} + +// 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/staking 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/simapp/app_legacy.go b/simapp/app_legacy.go index 71bb73cc1907..248b9a0e1ff5 100644 --- a/simapp/app_legacy.go +++ b/simapp/app_legacy.go @@ -261,7 +261,7 @@ func NewSimApp( appCodec, keys[banktypes.StoreKey], app.AccountKeeper, app.ModuleAccountAddrs(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) app.StakingKeeper = stakingkeeper.NewKeeper( - appCodec, keys[stakingtypes.StoreKey], app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName), + appCodec, keys[stakingtypes.StoreKey], app.AccountKeeper, app.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) app.MintKeeper = mintkeeper.NewKeeper(appCodec, keys[minttypes.StoreKey], app.StakingKeeper, app.AccountKeeper, app.BankKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String()) @@ -361,7 +361,7 @@ func NewSimApp( mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName)), distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), - staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper), + staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), upgrade.NewAppModule(app.UpgradeKeeper), evidence.NewAppModule(app.EvidenceKeeper), params.NewAppModule(app.ParamsKeeper), @@ -427,7 +427,7 @@ func NewSimApp( feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper), mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), - staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper), + staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName)), params.NewAppModule(app.ParamsKeeper), diff --git a/x/genutil/migrations/v046/migrate.go b/x/genutil/migrations/v046/migrate.go index b3fead6961dd..52a73ec03bc7 100644 --- a/x/genutil/migrations/v046/migrate.go +++ b/x/genutil/migrations/v046/migrate.go @@ -6,8 +6,8 @@ import ( v043gov "github.com/cosmos/cosmos-sdk/x/gov/migrations/v043" v046gov "github.com/cosmos/cosmos-sdk/x/gov/migrations/v046" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - v043staking "github.com/cosmos/cosmos-sdk/x/staking/migrations/v043" - v046staking "github.com/cosmos/cosmos-sdk/x/staking/migrations/v046" + stakingv2 "github.com/cosmos/cosmos-sdk/x/staking/migrations/v2" + stakingv3 "github.com/cosmos/cosmos-sdk/x/staking/migrations/v3" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -32,21 +32,21 @@ func Migrate(appState types.AppMap, clientCtx client.Context) types.AppMap { } // Migrate x/staking. - if appState[v043staking.ModuleName] != nil { + if appState[stakingv2.ModuleName] != nil { // unmarshal relative source genesis application state var old stakingtypes.GenesisState - clientCtx.Codec.MustUnmarshalJSON(appState[v043staking.ModuleName], &old) + clientCtx.Codec.MustUnmarshalJSON(appState[stakingv2.ModuleName], &old) // delete deprecated x/staking genesis state - delete(appState, v043staking.ModuleName) + delete(appState, stakingv2.ModuleName) // Migrate relative source genesis application state and marshal it into // the respective key. - new, err := v046staking.MigrateJSON(old) + new, err := stakingv3.MigrateJSON(old) if err != nil { panic(err) } - appState[v046staking.ModuleName] = clientCtx.Codec.MustMarshalJSON(&new) + appState[stakingv3.ModuleName] = clientCtx.Codec.MustMarshalJSON(&new) } return appState diff --git a/x/gov/keeper/common_test.go b/x/gov/keeper/common_test.go index dab42b637cb0..ab7e23d2d301 100644 --- a/x/gov/keeper/common_test.go +++ b/x/gov/keeper/common_test.go @@ -48,7 +48,7 @@ func createValidators(t *testing.T, ctx sdk.Context, app *simapp.SimApp, powers app.GetKey(stakingtypes.StoreKey), app.AccountKeeper, app.BankKeeper, - app.GetSubspace(stakingtypes.ModuleName), + authtypes.NewModuleAddress(types.ModuleName).String(), ) val1, err := stakingtypes.NewValidator(valAddrs[0], pks[0], stakingtypes.Description{}) diff --git a/x/params/client/testutil/grpc.go b/x/params/client/testutil/grpc.go index 59725fba94fc..502b35fd1d35 100644 --- a/x/params/client/testutil/grpc.go +++ b/x/params/client/testutil/grpc.go @@ -27,53 +27,40 @@ func (s *IntegrationTestSuite) TestQueryParamsGRPC() { map[string]string{}, true, &proposal.QueryParamsResponse{}, - &proposal.QueryParamsResponse{ - Param: proposal.ParamChange{ - Subspace: "staking", - Key: "MaxValidators", - Value: "100", - }, - }, + nil, }, { "with wrong subspace", - fmt.Sprintf("%s/cosmos/params/v1beta1/params?subspace=%s&key=%s", baseURL, "wrongSubspace", "MaxValidators"), + fmt.Sprintf("%s/cosmos/params/v1beta1/params?subspace=%s&key=%s", baseURL, "wrongSubspace", "foo"), map[string]string{}, true, &proposal.QueryParamsResponse{}, - &proposal.QueryParamsResponse{ - Param: proposal.ParamChange{ - Subspace: "staking", - Key: "MaxValidators", - Value: "100", - }, - }, + nil, }, { "with wrong key", - fmt.Sprintf("%s/cosmos/params/v1beta1/params?subspace=%s&key=%s", baseURL, "staking", "wrongKey"), + fmt.Sprintf("%s/cosmos/params/v1beta1/params?subspace=%s&key=%s", baseURL, mySubspace, "wrongKey"), map[string]string{}, false, &proposal.QueryParamsResponse{}, &proposal.QueryParamsResponse{ Param: proposal.ParamChange{ - Subspace: "staking", + Subspace: mySubspace, Key: "wrongKey", - Value: "", }, }, }, { "params", - fmt.Sprintf("%s/cosmos/params/v1beta1/params?subspace=%s&key=%s", baseURL, "staking", "MaxValidators"), + fmt.Sprintf("%s/cosmos/params/v1beta1/params?subspace=%s&key=%s", baseURL, mySubspace, "bar"), map[string]string{}, false, &proposal.QueryParamsResponse{}, &proposal.QueryParamsResponse{ Param: proposal.ParamChange{ - Subspace: "staking", - Key: "MaxValidators", - Value: "100", + Subspace: mySubspace, + Key: "bar", + Value: `"1234"`, }, }, }, diff --git a/x/params/client/testutil/suite.go b/x/params/client/testutil/suite.go index c38d93b9b66e..1318cfbd8630 100644 --- a/x/params/client/testutil/suite.go +++ b/x/params/client/testutil/suite.go @@ -5,13 +5,40 @@ import ( "strings" "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" tmcli "github.com/tendermint/tendermint/libs/cli" + dbm "github.com/tendermint/tm-db" + "cosmossdk.io/depinject" + "github.com/cosmos/cosmos-sdk/baseapp" + pruningtypes "github.com/cosmos/cosmos-sdk/pruning/types" + "github.com/cosmos/cosmos-sdk/runtime" + servertypes "github.com/cosmos/cosmos-sdk/server/types" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/cosmos/cosmos-sdk/testutil/network" + sdk "github.com/cosmos/cosmos-sdk/types" + moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" "github.com/cosmos/cosmos-sdk/x/params/client/cli" + "github.com/cosmos/cosmos-sdk/x/params/keeper" + "github.com/cosmos/cosmos-sdk/x/params/testutil" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) +// mySubspace is a x/params subspace created for the purpose of this +// test suite. +const ( + mySubspace = "foo" +) + +// myParams defines some params in the `mySubspace` subspace. +type myParams struct{} + +func (p *myParams) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair([]byte("bar"), 1234, func(value interface{}) error { return nil }), + } +} + type IntegrationTestSuite struct { suite.Suite @@ -26,6 +53,44 @@ func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite { func (s *IntegrationTestSuite) SetupSuite() { s.T().Log("setting up integration test suite") + // Create a new AppConstructor for this test suite, where we manually + // add a subspace and `myParams` to the x/params store. + s.cfg.AppConstructor = func(val moduletestutil.Validator) servertypes.Application { + var ( + appBuilder *runtime.AppBuilder + paramsKeeper keeper.Keeper + ) + if err := depinject.Inject(testutil.AppConfig, &appBuilder, ¶msKeeper); err != nil { + panic(err) + } + + // Add this test's `myParams` to the x/params store. + paramSet := myParams{} + subspace := paramsKeeper.Subspace(mySubspace).WithKeyTable(paramtypes.NewKeyTable().RegisterParamSet(¶mSet)) + + app := appBuilder.Build( + val.GetCtx().Logger, + dbm.NewMemDB(), + nil, + baseapp.SetPruning(pruningtypes.NewPruningOptionsFromString(val.GetAppConfig().Pruning)), + baseapp.SetMinGasPrices(val.GetAppConfig().MinGasPrices), + ) + + s.Require().NoError(app.Load(false)) + + // Make sure not to forget to persist `myParams` into the actual store, + // this is done in InitChain. + app.SetInitChainer(func(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { + subspace.SetParamSet(ctx, ¶mSet) + + return app.InitChainer(ctx, req) + }) + + s.Require().NoError(app.LoadLatestVersion()) + + return app + } + var err error s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err) @@ -50,20 +115,20 @@ func (s *IntegrationTestSuite) TestNewQuerySubspaceParamsCmd() { { "json output", []string{ - "staking", "MaxValidators", + "foo", "bar", fmt.Sprintf("--%s=json", tmcli.OutputFlag), }, - `{"subspace":"staking","key":"MaxValidators","value":"100"}`, + `{"subspace":"foo","key":"bar","value":"\"1234\""}`, }, { "text output", []string{ - "staking", "MaxValidators", + "foo", "bar", fmt.Sprintf("--%s=text", tmcli.OutputFlag), }, - `key: MaxValidators -subspace: staking -value: "100"`, + `key: bar +subspace: foo +value: '"1234"'`, }, } diff --git a/x/params/proposal_handler_test.go b/x/params/proposal_handler_test.go index 3d9a6b6a1dd5..d7c3ff391c08 100644 --- a/x/params/proposal_handler_test.go +++ b/x/params/proposal_handler_test.go @@ -1,6 +1,7 @@ package params_test import ( + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "testing" "github.com/golang/mock/gomock" @@ -15,7 +16,6 @@ import ( paramstestutil "github.com/cosmos/cosmos-sdk/x/params/testutil" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) // StakingKeeper defines the expected staking keeper @@ -78,23 +78,23 @@ func (suite *HandlerTestSuite) TestProposalHandler() { func() {}, true, }, - // { - // "omit empty fields", - // testProposal(proposal.ParamChange{ - // Subspace: govtypes.ModuleName, - // Key: string(govv1.ParamStoreKeyDepositParams), - // Value: `{"min_deposit": [{"denom": "uatom","amount": "64000000"}], "max_deposit_period": "172800000000000"}`, - // }), - // func() { - // depositParams := suite.app.GovKeeper.GetDepositParams(suite.ctx) - // defaultPeriod := govv1.DefaultPeriod - // suite.Require().Equal(govv1.DepositParams{ - // MinDeposit: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(64000000))), - // MaxDepositPeriod: &defaultPeriod, - // }, depositParams) - // }, - // false, - // }, + //{ + // "omit empty fields", + // testProposal(proposal.ParamChange{ + // Subspace: govtypes.ModuleName, + // Key: string(govv1.ParamStoreKeyDepositParams), + // Value: `{"min_deposit": [{"denom": "uatom","amount": "64000000"}], "max_deposit_period": "172800000000000"}`, + // }), + // func() { + // depositParams := suite.app.GovKeeper.GetDepositParams(suite.ctx) + // defaultPeriod := govv1.DefaultPeriod + // suite.Require().Equal(govv1.DepositParams{ + // MinDeposit: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(64000000))), + // MaxDepositPeriod: &defaultPeriod, + // }, depositParams) + // }, + // false, + //}, } for _, tc := range testCases { diff --git a/x/staking/common_test.go b/x/staking/common_test.go index 4e0fece688e4..bfd50af422cf 100644 --- a/x/staking/common_test.go +++ b/x/staking/common_test.go @@ -1,6 +1,8 @@ package staking_test import ( + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "math/big" "testing" @@ -48,7 +50,7 @@ func getBaseSimappWithCustomKeeper(t *testing.T) (*codec.LegacyAmino, *simapp.Si app.GetKey(types.StoreKey), app.AccountKeeper, app.BankKeeper, - app.GetSubspace(types.ModuleName), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) app.StakingKeeper.SetParams(ctx, types.DefaultParams()) diff --git a/x/staking/exported/exported.go b/x/staking/exported/exported.go new file mode 100644 index 000000000000..2d0c2fd1c391 --- /dev/null +++ b/x/staking/exported/exported.go @@ -0,0 +1,16 @@ +package exported + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +type ( + // 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 paramtypes.ParamSet) + } +) diff --git a/x/staking/keeper/common_test.go b/x/staking/keeper/common_test.go index 1efd4340bef5..ff11199d39f2 100644 --- a/x/staking/keeper/common_test.go +++ b/x/staking/keeper/common_test.go @@ -1,6 +1,8 @@ package keeper_test import ( + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "math/big" "testing" @@ -31,7 +33,7 @@ func createTestInput(t *testing.T) (*codec.LegacyAmino, *simapp.SimApp, sdk.Cont app.GetKey(types.StoreKey), app.AccountKeeper, app.BankKeeper, - app.GetSubspace(types.ModuleName), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) return app.LegacyAmino(), app, ctx } diff --git a/x/staking/keeper/genesis.go b/x/staking/keeper/genesis.go index b47e32de1b3e..7a8a374374d0 100644 --- a/x/staking/keeper/genesis.go +++ b/x/staking/keeper/genesis.go @@ -106,6 +106,7 @@ func (k Keeper) InitGenesis(ctx sdk.Context, data *types.GenesisState) (res []ab } // TODO: remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 + bondedBalance := k.bankKeeper.GetAllBalances(ctx, bondedPool.GetAddress()) if bondedBalance.IsZero() { k.authKeeper.SetModuleAccount(ctx, bondedPool) diff --git a/x/staking/keeper/grpc_query_test.go b/x/staking/keeper/grpc_query_test.go index baba0dbc9eef..c746d0991693 100644 --- a/x/staking/keeper/grpc_query_test.go +++ b/x/staking/keeper/grpc_query_test.go @@ -3,6 +3,8 @@ package keeper_test import ( gocontext "context" "fmt" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "testing" "github.com/stretchr/testify/require" @@ -796,7 +798,7 @@ func createValidators(t *testing.T, ctx sdk.Context, app *simapp.SimApp, powers app.GetKey(types.StoreKey), app.AccountKeeper, app.BankKeeper, - app.GetSubspace(types.ModuleName), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) val1 := teststaking.NewValidator(t, valAddrs[0], pks[0]) diff --git a/x/staking/keeper/keeper.go b/x/staking/keeper/keeper.go index 296c9f3d5034..e37772c0165b 100644 --- a/x/staking/keeper/keeper.go +++ b/x/staking/keeper/keeper.go @@ -1,16 +1,14 @@ package keeper import ( - "fmt" - "cosmossdk.io/math" + "fmt" storetypes "github.com/cosmos/cosmos-sdk/store/types" "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -20,26 +18,24 @@ var _ types.ValidatorSet = Keeper{} // Implements DelegationSet interface var _ types.DelegationSet = Keeper{} -// keeper of the staking store +// Keeper of the x/staking store type Keeper struct { storeKey storetypes.StoreKey cdc codec.BinaryCodec authKeeper types.AccountKeeper bankKeeper types.BankKeeper hooks types.StakingHooks - paramstore paramtypes.Subspace + authority string } // NewKeeper creates a new staking Keeper instance func NewKeeper( - cdc codec.BinaryCodec, key storetypes.StoreKey, ak types.AccountKeeper, bk types.BankKeeper, - ps paramtypes.Subspace, + cdc codec.BinaryCodec, + key storetypes.StoreKey, + ak types.AccountKeeper, + bk types.BankKeeper, + authority string, ) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } - // ensure bonded and not bonded module accounts are set if addr := ak.GetModuleAddress(types.BondedPoolName); addr == nil { panic(fmt.Sprintf("%s module account has not been set", types.BondedPoolName)) @@ -49,13 +45,18 @@ func NewKeeper( panic(fmt.Sprintf("%s module account has not been set", types.NotBondedPoolName)) } + // ensure that authority is a valid AccAddress + if _, err := sdk.AccAddressFromBech32(authority); err != nil { + panic(fmt.Sprintf("authority is not a valid acc address")) + } + return &Keeper{ storeKey: key, cdc: cdc, authKeeper: ak, bankKeeper: bk, - paramstore: ps, hooks: nil, + authority: authority, } } @@ -64,7 +65,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", "x/"+types.ModuleName) } -// Set the validator hooks +// SetHooks Set the validator hooks func (k *Keeper) SetHooks(sh types.StakingHooks) { if k.hooks != nil { panic("cannot set validator hooks twice") @@ -73,7 +74,7 @@ func (k *Keeper) SetHooks(sh types.StakingHooks) { k.hooks = sh } -// Load the last total validator power. +// GetLastTotalPower Load the last total validator power. func (k Keeper) GetLastTotalPower(ctx sdk.Context) math.Int { store := ctx.KVStore(k.storeKey) bz := store.Get(types.LastTotalPowerKey) @@ -88,9 +89,14 @@ func (k Keeper) GetLastTotalPower(ctx sdk.Context) math.Int { return ip.Int } -// Set the last total validator power. +// SetLastTotalPower Set the last total validator power. func (k Keeper) SetLastTotalPower(ctx sdk.Context, power math.Int) { store := ctx.KVStore(k.storeKey) bz := k.cdc.MustMarshal(&sdk.IntProto{Int: power}) store.Set(types.LastTotalPowerKey, bz) } + +// GetAuthority returns the x/staking module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} diff --git a/x/staking/keeper/migrations.go b/x/staking/keeper/migrations.go index 9b6b5f51249b..5e2ff5401d16 100644 --- a/x/staking/keeper/migrations.go +++ b/x/staking/keeper/migrations.go @@ -2,28 +2,37 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - v043 "github.com/cosmos/cosmos-sdk/x/staking/migrations/v043" - v046 "github.com/cosmos/cosmos-sdk/x/staking/migrations/v046" + "github.com/cosmos/cosmos-sdk/x/staking/exported" + "github.com/cosmos/cosmos-sdk/x/staking/migrations/v2" + "github.com/cosmos/cosmos-sdk/x/staking/migrations/v3" + v4 "github.com/cosmos/cosmos-sdk/x/staking/migrations/v4" ) // 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 { +func NewMigrator(keeper *Keeper, legacySubspace exported.Subspace) Migrator { return Migrator{ - keeper: keeper, + 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) + return v2.MigrateStore(ctx, m.keeper.storeKey) } // Migrate2to3 migrates x/staking state from consensus version 2 to 3. func (m Migrator) Migrate2to3(ctx sdk.Context) error { - return v046.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc, m.keeper.paramstore) + return v3.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc, m.legacySubspace) +} + +// Migrate3to4 migrates x/staking state from consensus version 3 to 4. +func (m Migrator) Migrate3to4(ctx sdk.Context) error { + return v4.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc, m.legacySubspace) } diff --git a/x/staking/keeper/msg_server.go b/x/staking/keeper/msg_server.go index cdc2f46f8a64..c5d609cf3db0 100644 --- a/x/staking/keeper/msg_server.go +++ b/x/staking/keeper/msg_server.go @@ -2,6 +2,7 @@ package keeper import ( "context" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "strconv" "time" @@ -499,3 +500,18 @@ func (k msgServer) CancelUnbondingDelegation(goCtx context.Context, msg *types.M return &types.MsgCancelUnbondingDelegationResponse{}, nil } + +func (ms msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if ms.authority != msg.Authority { + return nil, sdkerrors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.authority, msg.Authority) + } + + // store params + if err := ms.SetParams(ctx, msg.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/staking/keeper/msg_server_test.go b/x/staking/keeper/msg_server_test.go index 44538be4d4ae..f21409e2f450 100644 --- a/x/staking/keeper/msg_server_test.go +++ b/x/staking/keeper/msg_server_test.go @@ -144,3 +144,127 @@ func TestCancelUnbondingDelegation(t *testing.T) { }) } } + +func TestMsgUpdateParams(t *testing.T) { + app := simapp.Setup(t, false) + ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + msgServer := keeper.NewMsgServerImpl(app.StakingKeeper) + + testCases := []struct { + name string + input *types.MsgUpdateParams + expErr bool + expErrMsg string + }{ + { + name: "valid params", + input: &types.MsgUpdateParams{ + Authority: app.StakingKeeper.GetAuthority(), + Params: types.DefaultParams(), + }, + expErr: false, + }, + { + name: "invalid authority", + input: &types.MsgUpdateParams{ + Authority: "invalid", + Params: types.DefaultParams(), + }, + expErr: true, + expErrMsg: "invalid authority", + }, + { + name: "negative commission rate", + input: &types.MsgUpdateParams{ + Authority: app.StakingKeeper.GetAuthority(), + Params: types.Params{ + MinCommissionRate: sdk.NewDec(-10), + UnbondingTime: types.DefaultUnbondingTime, + MaxValidators: types.DefaultMaxValidators, + MaxEntries: types.DefaultMaxEntries, + HistoricalEntries: types.DefaultHistoricalEntries, + BondDenom: types.BondStatusBonded, + }, + }, + expErr: true, + expErrMsg: "minimum commission rate cannot be negative", + }, + { + name: "commission rate cannot be bigger than 100", + input: &types.MsgUpdateParams{ + Authority: app.StakingKeeper.GetAuthority(), + Params: types.Params{ + MinCommissionRate: sdk.NewDec(2), + UnbondingTime: types.DefaultUnbondingTime, + MaxValidators: types.DefaultMaxValidators, + MaxEntries: types.DefaultMaxEntries, + HistoricalEntries: types.DefaultHistoricalEntries, + BondDenom: types.BondStatusBonded, + }, + }, + expErr: true, + expErrMsg: "minimum commission rate cannot be greater than 100%", + }, + { + name: "invalid bond denom", + input: &types.MsgUpdateParams{ + Authority: app.StakingKeeper.GetAuthority(), + Params: types.Params{ + MinCommissionRate: types.DefaultMinCommissionRate, + UnbondingTime: types.DefaultUnbondingTime, + MaxValidators: types.DefaultMaxValidators, + MaxEntries: types.DefaultMaxEntries, + HistoricalEntries: types.DefaultHistoricalEntries, + BondDenom: "", + }, + }, + expErr: true, + expErrMsg: "bond denom cannot be blank", + }, + { + name: "max validators most be positive", + input: &types.MsgUpdateParams{ + Authority: app.StakingKeeper.GetAuthority(), + Params: types.Params{ + MinCommissionRate: types.DefaultMinCommissionRate, + UnbondingTime: types.DefaultUnbondingTime, + MaxValidators: 0, + MaxEntries: types.DefaultMaxEntries, + HistoricalEntries: types.DefaultHistoricalEntries, + BondDenom: types.BondStatusBonded, + }, + }, + expErr: true, + expErrMsg: "max validators must be positive", + }, + { + name: "max entries most be positive", + input: &types.MsgUpdateParams{ + Authority: app.StakingKeeper.GetAuthority(), + Params: types.Params{ + MinCommissionRate: types.DefaultMinCommissionRate, + UnbondingTime: types.DefaultUnbondingTime, + MaxValidators: types.DefaultMaxValidators, + MaxEntries: 0, + HistoricalEntries: types.DefaultHistoricalEntries, + BondDenom: types.BondStatusBonded, + }, + }, + expErr: true, + expErrMsg: "max entries must be positive", + }, + } + + for _, tc := range testCases { + tc := tc + t.Run(tc.name, func(t *testing.T) { + _, err := msgServer.UpdateParams(ctx, tc.input) + if tc.expErr { + require.Error(t, err) + require.Contains(t, err.Error(), tc.expErrMsg) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/staking/keeper/params.go b/x/staking/keeper/params.go index 7e816f353143..adce32ac7dc2 100644 --- a/x/staking/keeper/params.go +++ b/x/staking/keeper/params.go @@ -10,35 +10,30 @@ import ( ) // UnbondingTime -func (k Keeper) UnbondingTime(ctx sdk.Context) (res time.Duration) { - k.paramstore.Get(ctx, types.KeyUnbondingTime, &res) - return +func (k Keeper) UnbondingTime(ctx sdk.Context) time.Duration { + return k.GetParams(ctx).UnbondingTime } // MaxValidators - Maximum number of validators -func (k Keeper) MaxValidators(ctx sdk.Context) (res uint32) { - k.paramstore.Get(ctx, types.KeyMaxValidators, &res) - return +func (k Keeper) MaxValidators(ctx sdk.Context) uint32 { + return k.GetParams(ctx).MaxValidators } // MaxEntries - Maximum number of simultaneous unbonding // delegations or redelegations (per pair/trio) -func (k Keeper) MaxEntries(ctx sdk.Context) (res uint32) { - k.paramstore.Get(ctx, types.KeyMaxEntries, &res) - return +func (k Keeper) MaxEntries(ctx sdk.Context) uint32 { + return k.GetParams(ctx).MaxEntries } // HistoricalEntries = number of historical info entries // to persist in store func (k Keeper) HistoricalEntries(ctx sdk.Context) (res uint32) { - k.paramstore.Get(ctx, types.KeyHistoricalEntries, &res) - return + return k.GetParams(ctx).HistoricalEntries } // BondDenom - Bondable coin denomination func (k Keeper) BondDenom(ctx sdk.Context) (res string) { - k.paramstore.Get(ctx, types.KeyBondDenom, &res) - return + return k.GetParams(ctx).BondDenom } // PowerReduction - is the amount of staking tokens required for 1 unit of consensus-engine power. @@ -50,24 +45,34 @@ func (k Keeper) PowerReduction(ctx sdk.Context) math.Int { } // MinCommissionRate - Minimum validator commission rate -func (k Keeper) MinCommissionRate(ctx sdk.Context) (res sdk.Dec) { - k.paramstore.Get(ctx, types.KeyMinCommissionRate, &res) - return +func (k Keeper) MinCommissionRate(ctx sdk.Context) sdk.Dec { + return k.GetParams(ctx).MinCommissionRate } -// Get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams( - k.UnbondingTime(ctx), - k.MaxValidators(ctx), - k.MaxEntries(ctx), - k.HistoricalEntries(ctx), - k.BondDenom(ctx), - k.MinCommissionRate(ctx), - ) +// SetParams sets the x/staking module parameters. +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { + if err := params.Validate(); err != nil { + return err + } + + store := ctx.KVStore(k.storeKey) + bz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } + store.Set(types.ParamsKey, bz) + + return nil } -// set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) +// GetParams sets the x/staking module parameters. +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ParamsKey) + if bz == nil { + return params + } + + k.cdc.MustUnmarshal(bz, ¶ms) + return params } diff --git a/x/staking/migrations/v042/types.go b/x/staking/migrations/v1/types.go similarity index 99% rename from x/staking/migrations/v042/types.go rename to x/staking/migrations/v1/types.go index 097c9ca8bc14..3800d997afb5 100644 --- a/x/staking/migrations/v042/types.go +++ b/x/staking/migrations/v1/types.go @@ -1,4 +1,4 @@ -package v042 +package v1 import ( "bytes" diff --git a/x/staking/migrations/v043/keys.go b/x/staking/migrations/v2/keys.go similarity index 85% rename from x/staking/migrations/v043/keys.go rename to x/staking/migrations/v2/keys.go index bca943d8aec8..439a823206a1 100644 --- a/x/staking/migrations/v043/keys.go +++ b/x/staking/migrations/v2/keys.go @@ -1,4 +1,4 @@ -package v043 +package v2 const ( // ModuleName is the name of the module diff --git a/x/staking/migrations/v043/store.go b/x/staking/migrations/v2/store.go similarity index 72% rename from x/staking/migrations/v043/store.go rename to x/staking/migrations/v2/store.go index 620d9b6a1a07..1691b676d393 100644 --- a/x/staking/migrations/v043/store.go +++ b/x/staking/migrations/v2/store.go @@ -1,4 +1,4 @@ -package v043 +package v2 import ( "github.com/cosmos/cosmos-sdk/store/prefix" @@ -7,7 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/address" v042auth "github.com/cosmos/cosmos-sdk/x/auth/migrations/v042" v043distribution "github.com/cosmos/cosmos-sdk/x/distribution/migrations/v043" - v040staking "github.com/cosmos/cosmos-sdk/x/staking/migrations/v042" + "github.com/cosmos/cosmos-sdk/x/staking/migrations/v1" "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -39,7 +39,7 @@ func migratePrefixAddressAddressAddress(store sdk.KVStore, prefixBz []byte) { const powerBytesLen = 8 func migrateValidatorsByPowerIndexKey(store sdk.KVStore) { - oldStore := prefix.NewStore(store, v040staking.ValidatorsByPowerIndexKey) + oldStore := prefix.NewStore(store, v1.ValidatorsByPowerIndexKey) oldStoreIter := oldStore.Iterator(nil, nil) defer oldStoreIter.Close() @@ -62,18 +62,18 @@ func migrateValidatorsByPowerIndexKey(store sdk.KVStore) { func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey) error { store := ctx.KVStore(storeKey) - v043distribution.MigratePrefixAddress(store, v040staking.LastValidatorPowerKey) + v043distribution.MigratePrefixAddress(store, v1.LastValidatorPowerKey) - v043distribution.MigratePrefixAddress(store, v040staking.ValidatorsKey) - v043distribution.MigratePrefixAddress(store, v040staking.ValidatorsByConsAddrKey) + v043distribution.MigratePrefixAddress(store, v1.ValidatorsKey) + v043distribution.MigratePrefixAddress(store, v1.ValidatorsByConsAddrKey) migrateValidatorsByPowerIndexKey(store) - v043distribution.MigratePrefixAddressAddress(store, v040staking.DelegationKey) - v043distribution.MigratePrefixAddressAddress(store, v040staking.UnbondingDelegationKey) - v043distribution.MigratePrefixAddressAddress(store, v040staking.UnbondingDelegationByValIndexKey) - migratePrefixAddressAddressAddress(store, v040staking.RedelegationKey) - migratePrefixAddressAddressAddress(store, v040staking.RedelegationByValSrcIndexKey) - migratePrefixAddressAddressAddress(store, v040staking.RedelegationByValDstIndexKey) + v043distribution.MigratePrefixAddressAddress(store, v1.DelegationKey) + v043distribution.MigratePrefixAddressAddress(store, v1.UnbondingDelegationKey) + v043distribution.MigratePrefixAddressAddress(store, v1.UnbondingDelegationByValIndexKey) + migratePrefixAddressAddressAddress(store, v1.RedelegationKey) + migratePrefixAddressAddressAddress(store, v1.RedelegationByValSrcIndexKey) + migratePrefixAddressAddressAddress(store, v1.RedelegationByValDstIndexKey) return nil } diff --git a/x/staking/migrations/v043/store_test.go b/x/staking/migrations/v2/store_test.go similarity index 74% rename from x/staking/migrations/v043/store_test.go rename to x/staking/migrations/v2/store_test.go index 920ff55067de..488b8343f807 100644 --- a/x/staking/migrations/v043/store_test.go +++ b/x/staking/migrations/v2/store_test.go @@ -1,4 +1,4 @@ -package v043_test +package v2_test import ( "bytes" @@ -10,8 +10,8 @@ import ( "github.com/cosmos/cosmos-sdk/testutil" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" - v042staking "github.com/cosmos/cosmos-sdk/x/staking/migrations/v042" - v043staking "github.com/cosmos/cosmos-sdk/x/staking/migrations/v043" + "github.com/cosmos/cosmos-sdk/x/staking/migrations/v1" + "github.com/cosmos/cosmos-sdk/x/staking/migrations/v2" "github.com/cosmos/cosmos-sdk/x/staking/teststaking" "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -41,77 +41,77 @@ func TestStoreMigration(t *testing.T) { }{ { "LastValidatorPowerKey", - v042staking.GetLastValidatorPowerKey(valAddr1), + v1.GetLastValidatorPowerKey(valAddr1), types.GetLastValidatorPowerKey(valAddr1), }, { "LastTotalPowerKey", - v042staking.LastTotalPowerKey, + v1.LastTotalPowerKey, types.LastTotalPowerKey, }, { "ValidatorsKey", - v042staking.GetValidatorKey(valAddr1), + v1.GetValidatorKey(valAddr1), types.GetValidatorKey(valAddr1), }, { "ValidatorsByConsAddrKey", - v042staking.GetValidatorByConsAddrKey(consAddr), + v1.GetValidatorByConsAddrKey(consAddr), types.GetValidatorByConsAddrKey(consAddr), }, { "ValidatorsByPowerIndexKey", - v042staking.GetValidatorsByPowerIndexKey(val), + v1.GetValidatorsByPowerIndexKey(val), types.GetValidatorsByPowerIndexKey(val, sdk.DefaultPowerReduction), }, { "DelegationKey", - v042staking.GetDelegationKey(addr4, valAddr1), + v1.GetDelegationKey(addr4, valAddr1), types.GetDelegationKey(addr4, valAddr1), }, { "UnbondingDelegationKey", - v042staking.GetUBDKey(addr4, valAddr1), + v1.GetUBDKey(addr4, valAddr1), types.GetUBDKey(addr4, valAddr1), }, { "UnbondingDelegationByValIndexKey", - v042staking.GetUBDByValIndexKey(addr4, valAddr1), + v1.GetUBDByValIndexKey(addr4, valAddr1), types.GetUBDByValIndexKey(addr4, valAddr1), }, { "RedelegationKey", - v042staking.GetREDKey(addr4, valAddr1, valAddr2), + v1.GetREDKey(addr4, valAddr1, valAddr2), types.GetREDKey(addr4, valAddr1, valAddr2), }, { "RedelegationByValSrcIndexKey", - v042staking.GetREDByValSrcIndexKey(addr4, valAddr1, valAddr2), + v1.GetREDByValSrcIndexKey(addr4, valAddr1, valAddr2), types.GetREDByValSrcIndexKey(addr4, valAddr1, valAddr2), }, { "RedelegationByValDstIndexKey", - v042staking.GetREDByValDstIndexKey(addr4, valAddr1, valAddr2), + v1.GetREDByValDstIndexKey(addr4, valAddr1, valAddr2), types.GetREDByValDstIndexKey(addr4, valAddr1, valAddr2), }, { "UnbondingQueueKey", - v042staking.GetUnbondingDelegationTimeKey(now), + v1.GetUnbondingDelegationTimeKey(now), types.GetUnbondingDelegationTimeKey(now), }, { "RedelegationQueueKey", - v042staking.GetRedelegationTimeKey(now), + v1.GetRedelegationTimeKey(now), types.GetRedelegationTimeKey(now), }, { "ValidatorQueueKey", - v042staking.GetValidatorQueueKey(now, 4), + v1.GetValidatorQueueKey(now, 4), types.GetValidatorQueueKey(now, 4), }, { "HistoricalInfoKey", - v042staking.GetHistoricalInfoKey(4), + v1.GetHistoricalInfoKey(4), types.GetHistoricalInfoKey(4), }, } @@ -122,7 +122,7 @@ func TestStoreMigration(t *testing.T) { } // Run migrations. - err := v043staking.MigrateStore(ctx, stakingKey) + err := v2.MigrateStore(ctx, stakingKey) require.NoError(t, err) // Make sure the new keys are set and old keys are deleted. diff --git a/x/staking/migrations/v046/json.go b/x/staking/migrations/v3/json.go similarity index 96% rename from x/staking/migrations/v046/json.go rename to x/staking/migrations/v3/json.go index e3be292a2c74..22462660826b 100644 --- a/x/staking/migrations/v046/json.go +++ b/x/staking/migrations/v3/json.go @@ -1,4 +1,4 @@ -package v046 +package v3 import "github.com/cosmos/cosmos-sdk/x/staking/types" diff --git a/x/staking/migrations/v046/json_test.go b/x/staking/migrations/v3/json_test.go similarity index 91% rename from x/staking/migrations/v046/json_test.go rename to x/staking/migrations/v3/json_test.go index df1d8db94329..a52a89ad1325 100644 --- a/x/staking/migrations/v046/json_test.go +++ b/x/staking/migrations/v3/json_test.go @@ -1,4 +1,4 @@ -package v046_test +package v3_test import ( "encoding/json" @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/simapp" - v046 "github.com/cosmos/cosmos-sdk/x/staking/migrations/v046" + "github.com/cosmos/cosmos-sdk/x/staking/migrations/v3" "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -21,7 +21,7 @@ func TestMigrateJSON(t *testing.T) { oldState := types.DefaultGenesisState() - newState, err := v046.MigrateJSON(*oldState) + newState, err := v3.MigrateJSON(*oldState) require.NoError(t, err) bz, err := clientCtx.Codec.MarshalJSON(&newState) diff --git a/x/staking/migrations/v046/keys.go b/x/staking/migrations/v3/keys.go similarity index 85% rename from x/staking/migrations/v046/keys.go rename to x/staking/migrations/v3/keys.go index f937f1593058..fd6dd3693a35 100644 --- a/x/staking/migrations/v046/keys.go +++ b/x/staking/migrations/v3/keys.go @@ -1,4 +1,4 @@ -package v046 +package v3 const ( // ModuleName is the name of the module diff --git a/x/staking/migrations/v046/store.go b/x/staking/migrations/v3/store.go similarity index 58% rename from x/staking/migrations/v046/store.go rename to x/staking/migrations/v3/store.go index e2be22cbb1ff..6c5252cef031 100644 --- a/x/staking/migrations/v046/store.go +++ b/x/staking/migrations/v3/store.go @@ -1,24 +1,34 @@ -package v046 +package v3 import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/cosmos/cosmos-sdk/x/staking/exported" "github.com/cosmos/cosmos-sdk/x/staking/types" ) +// subspace contains the method needed for migrations of the +// legacy Params subspace +type subspace interface { + GetParamSet(ctx sdk.Context, ps paramtypes.ParamSet) + HasKeyTable() bool + WithKeyTable(paramtypes.KeyTable) paramtypes.Subspace + Set(ctx sdk.Context, key []byte, value interface{}) +} + // MigrateStore performs in-place store migrations from v0.43/v0.44/v0.45 to v0.46. // The migration includes: // // - Setting the MinCommissionRate param in the paramstore -func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec, paramstore paramtypes.Subspace) error { - migrateParamsStore(ctx, paramstore) +func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec, paramstore exported.Subspace) error { + migrateParamsStore(ctx, paramstore.(subspace)) return nil } -func migrateParamsStore(ctx sdk.Context, paramstore paramtypes.Subspace) { +func migrateParamsStore(ctx sdk.Context, paramstore subspace) { if paramstore.HasKeyTable() { paramstore.Set(ctx, types.KeyMinCommissionRate, types.DefaultMinCommissionRate) } else { diff --git a/x/staking/migrations/v046/store_test.go b/x/staking/migrations/v3/store_test.go similarity index 84% rename from x/staking/migrations/v046/store_test.go rename to x/staking/migrations/v3/store_test.go index 6ac24a9e8a5b..f57ce3de6c7f 100644 --- a/x/staking/migrations/v046/store_test.go +++ b/x/staking/migrations/v3/store_test.go @@ -1,4 +1,4 @@ -package v046_test +package v3_test import ( "testing" @@ -9,7 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - v046staking "github.com/cosmos/cosmos-sdk/x/staking/migrations/v046" + "github.com/cosmos/cosmos-sdk/x/staking/migrations/v3" "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -24,7 +24,7 @@ func TestStoreMigration(t *testing.T) { require.False(t, paramstore.Has(ctx, types.KeyMinCommissionRate)) // Run migrations. - err := v046staking.MigrateStore(ctx, stakingKey, encCfg.Codec, paramstore) + err := v3.MigrateStore(ctx, stakingKey, encCfg.Codec, paramstore) require.NoError(t, err) // Make sure the new params are set. diff --git a/x/staking/migrations/v4/keys.go b/x/staking/migrations/v4/keys.go new file mode 100644 index 000000000000..77bf41bfa93d --- /dev/null +++ b/x/staking/migrations/v4/keys.go @@ -0,0 +1,8 @@ +package v4 + +const ( + // ModuleName is the name of the module + ModuleName = "staking" +) + +var ParamsKey = []byte{0x51} // prefix for parameters for module x/staking diff --git a/x/staking/migrations/v4/migrations_test.go b/x/staking/migrations/v4/migrations_test.go new file mode 100644 index 000000000000..da0bc977c22d --- /dev/null +++ b/x/staking/migrations/v4/migrations_test.go @@ -0,0 +1,45 @@ +package v4_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "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" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/cosmos/cosmos-sdk/x/staking/migrations/v4" + "github.com/cosmos/cosmos-sdk/x/staking/types" +) + +type mockSubspace struct { + ps types.Params +} + +func newMockSubspace(ps types.Params) mockSubspace { + return mockSubspace{ps: ps} +} + +func (ms mockSubspace) GetParamSet(ctx sdk.Context, ps paramtypes.ParamSet) { + *ps.(*types.Params) = ms.ps +} + +func TestMigrate(t *testing.T) { + encCfg := moduletestutil.MakeTestEncodingConfig(distribution.AppModuleBasic{}) + cdc := encCfg.Codec + + storeKey := sdk.NewKVStoreKey(v4.ModuleName) + tKey := sdk.NewTransientStoreKey("transient_test") + ctx := testutil.DefaultContext(storeKey, tKey) + store := ctx.KVStore(storeKey) + + legacySubspace := newMockSubspace(types.DefaultParams()) + require.NoError(t, v4.MigrateStore(ctx, storeKey, cdc, legacySubspace)) + + var res types.Params + bz := store.Get(v4.ParamsKey) + require.NoError(t, cdc.Unmarshal(bz, &res)) + require.Equal(t, legacySubspace.ps, res) +} diff --git a/x/staking/migrations/v4/store.go b/x/staking/migrations/v4/store.go new file mode 100644 index 000000000000..9a2215fc9b28 --- /dev/null +++ b/x/staking/migrations/v4/store.go @@ -0,0 +1,25 @@ +package v4 + +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/staking/exported" + "github.com/cosmos/cosmos-sdk/x/staking/types" +) + +// MigrateStore performs in-place store migrations from v3 to v4. +func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec, legacySubspace exported.Subspace) error { + store := ctx.KVStore(storeKey) + var legacyParams types.Params + legacySubspace.GetParamSet(ctx, &legacyParams) + + if err := legacyParams.Validate(); err != nil { + return err + } + + bz := cdc.MustMarshal(&legacyParams) + store.Set(types.ParamsKey, bz) + + return nil +} diff --git a/x/staking/module.go b/x/staking/module.go index f748d2e5a278..4b3f4c2f197e 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -4,6 +4,9 @@ import ( "context" "encoding/json" "fmt" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/staking/exported" "math/rand" "sort" @@ -23,7 +26,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/cosmos/cosmos-sdk/x/staking/client/cli" "github.com/cosmos/cosmos-sdk/x/staking/keeper" "github.com/cosmos/cosmos-sdk/x/staking/simulation" @@ -31,7 +33,7 @@ import ( ) const ( - consensusVersion uint64 = 3 + consensusVersion uint64 = 4 ) var ( @@ -102,15 +104,25 @@ type AppModule struct { keeper *keeper.Keeper accountKeeper types.AccountKeeper bankKeeper types.BankKeeper + + // legacySubspace is used solely for migration of x/params managed parameters + legacySubspace exported.Subspace } // NewAppModule creates a new AppModule object -func NewAppModule(cdc codec.Codec, keeper *keeper.Keeper, ak types.AccountKeeper, bk types.BankKeeper) AppModule { +func NewAppModule( + cdc codec.Codec, + keeper *keeper.Keeper, + ak types.AccountKeeper, + bk types.BankKeeper, + ls exported.Subspace, +) AppModule { return AppModule{ AppModuleBasic: AppModuleBasic{cdc: cdc}, keeper: keeper, accountKeeper: ak, bankKeeper: bk, + legacySubspace: ls, } } @@ -145,9 +157,18 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { querier := keeper.Querier{Keeper: am.keeper} types.RegisterQueryServer(cfg.QueryServer(), querier) - m := keeper.NewMigrator(am.keeper) - cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2) - cfg.RegisterMigration(types.ModuleName, 2, m.Migrate2to3) + m := keeper.NewMigrator(am.keeper, am.legacySubspace) + 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)) + + } + if err := cfg.RegisterMigration(types.ModuleName, 3, m.Migrate3to4); err != nil { + panic(fmt.Sprintf("failed to migrate x/%s from version 3 to 4: %v", types.ModuleName, err)) + } } // InitGenesis performs genesis initialization for the staking module. It returns @@ -199,8 +220,11 @@ type stakingInputs struct { AccountKeeper types.AccountKeeper BankKeeper types.BankKeeper Cdc codec.Codec - Subspace paramstypes.Subspace Key *store.KVStoreKey + ModuleKey depinject.OwnModuleKey + Authority map[string]sdk.AccAddress `optional:"true"` + // LegacySubspace is used solely for migration of x/params managed parameters + LegacySubspace exported.Subspace } // Dependency Injection Outputs @@ -212,8 +236,20 @@ type stakingOutputs struct { } func provideModule(in stakingInputs) stakingOutputs { - k := keeper.NewKeeper(in.Cdc, in.Key, in.AccountKeeper, in.BankKeeper, in.Subspace) - m := NewAppModule(in.Cdc, k, in.AccountKeeper, in.BankKeeper) + authority, ok := in.Authority[depinject.ModuleKey(in.ModuleKey).Name()] + if !ok { + // default to governance authority if not provided + authority = authtypes.NewModuleAddress(govtypes.ModuleName) + } + + k := keeper.NewKeeper( + in.Cdc, + in.Key, + in.AccountKeeper, + in.BankKeeper, + authority.String(), + ) + m := NewAppModule(in.Cdc, k, in.AccountKeeper, in.BankKeeper, in.LegacySubspace) return stakingOutputs{StakingKeeper: k, Module: runtime.WrapAppModule(m)} } @@ -270,7 +306,7 @@ func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.We // RandomizedParams creates randomized staking param changes for the simulator. func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { - return simulation.ParamChanges(r) + return []simtypes.ParamChange{} } // RegisterStoreDecoder registers a decoder for staking module's types diff --git a/x/staking/spec/01_state.md b/x/staking/spec/01_state.md index fb3c1825bfcd..3d30ae62e080 100644 --- a/x/staking/spec/01_state.md +++ b/x/staking/spec/01_state.md @@ -17,8 +17,10 @@ Store entries prefixed with "Last" must remain unchanged until EndBlock. ## Params -Params is a module-wide configuration structure that stores system parameters -and defines overall functioning of the staking module. +staking module stores it's params in state with the prefix of `0x51`, +it can only be updated with governance. + +* Params: `0x51 | ProtocolBuffer(Params)` +++ https://github.com/cosmos/cosmos-sdk/blob/v0.46.0-rc1/proto/cosmos/staking/v1beta1/staking.proto#L285-L306 diff --git a/x/staking/spec/03_messages.md b/x/staking/spec/03_messages.md index a0222d36dfeb..50dc19dc2622 100644 --- a/x/staking/spec/03_messages.md +++ b/x/staking/spec/03_messages.md @@ -173,3 +173,15 @@ When this message is processed the following actions occur: * under this situation if the delegation is the validator's self-delegation then also jail the validator. ![Begin redelegation sequence](../../../docs/uml/svg/begin_redelegation_sequence.svg) + + +## MsgUpdateParams + +The `MsgUpdateParams` update the staking module parameters. +The params are updated through a governance proposal where the signer is the gov module account address. + ++++ https://github.com/cosmos/cosmos-sdk/blob/e412ce990251768579d49947991be76a87564f7d/proto/cosmos/staking/v1beta1/tx.proto#L172-L190 + +The message handling can fail if: + +* signer is not the authority defined in the staking keeper (usually the gov module account). \ No newline at end of file diff --git a/x/staking/types/codec.go b/x/staking/types/codec.go index 558f2eb038ad..2eaece370201 100644 --- a/x/staking/types/codec.go +++ b/x/staking/types/codec.go @@ -20,11 +20,13 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { legacy.RegisterAminoMsg(cdc, &MsgUndelegate{}, "cosmos-sdk/MsgUndelegate") legacy.RegisterAminoMsg(cdc, &MsgBeginRedelegate{}, "cosmos-sdk/MsgBeginRedelegate") legacy.RegisterAminoMsg(cdc, &MsgCancelUnbondingDelegation{}, "cosmos-sdk/MsgCancelUnbondingDelegation") + legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/x/staking/MsgUpdateParams") cdc.RegisterInterface((*isStakeAuthorization_Validators)(nil), nil) cdc.RegisterConcrete(&StakeAuthorization_AllowList{}, "cosmos-sdk/StakeAuthorization/AllowList", nil) cdc.RegisterConcrete(&StakeAuthorization_DenyList{}, "cosmos-sdk/StakeAuthorization/DenyList", nil) cdc.RegisterConcrete(&StakeAuthorization{}, "cosmos-sdk/StakeAuthorization", nil) + cdc.RegisterConcrete(Params{}, "cosmos-sdk/x/staking/Params", nil) } // RegisterInterfaces registers the x/staking interfaces types with the interface registry @@ -36,6 +38,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &MsgUndelegate{}, &MsgBeginRedelegate{}, &MsgCancelUnbondingDelegation{}, + &MsgUpdateParams{}, ) registry.RegisterImplementations( (*authz.Authorization)(nil), diff --git a/x/staking/types/genesis.pb.go b/x/staking/types/genesis.pb.go index 51a94e79d85b..7de0500b1640 100644 --- a/x/staking/types/genesis.pb.go +++ b/x/staking/types/genesis.pb.go @@ -27,7 +27,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the staking module's genesis state. type GenesisState struct { - // params defines all the paramaters of related to deposit. + // params defines all the parameters of related to deposit. Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` // last_total_power tracks the total amounts of bonded tokens recorded during // the previous end block. diff --git a/x/staking/types/keys.go b/x/staking/types/keys.go index ca0023d71080..1b86e4e5b5a5 100644 --- a/x/staking/types/keys.go +++ b/x/staking/types/keys.go @@ -50,6 +50,8 @@ var ( ValidatorQueueKey = []byte{0x43} // prefix for the timestamps in validator queue HistoricalInfoKey = []byte{0x50} // prefix for the historical info + + ParamsKey = []byte{0x51} // prefix for parameters for module x/staking ) // GetValidatorKey creates the key for the validator with address diff --git a/x/staking/types/msg.go b/x/staking/types/msg.go index 4cacc16ca6c8..5a022d7391f2 100644 --- a/x/staking/types/msg.go +++ b/x/staking/types/msg.go @@ -16,6 +16,7 @@ const ( TypeMsgCreateValidator = "create_validator" TypeMsgDelegate = "delegate" TypeMsgBeginRedelegate = "begin_redelegate" + TypeMsgUpdateParams = "update_params" ) var ( @@ -27,6 +28,7 @@ var ( _ sdk.Msg = &MsgUndelegate{} _ sdk.Msg = &MsgBeginRedelegate{} _ sdk.Msg = &MsgCancelUnbondingDelegation{} + _ sdk.Msg = &MsgUpdateParams{} ) // NewMsgCreateValidator creates a new MsgCreateValidator instance. @@ -393,3 +395,24 @@ func (msg MsgCancelUnbondingDelegation) ValidateBasic() error { return nil } + +// GetSignBytes returns the raw bytes for a MsgUpdateParams message that +// the expected signer needs to sign. +func (m MsgUpdateParams) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&m) + return sdk.MustSortJSON(bz) +} + +// ValidateBasic executes sanity validation on the provided data +func (m *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return sdkerrors.Wrap(err, "invalid authority address") + } + return m.Params.Validate() +} + +// GetSigners returns the expected signers for a MsgUpdateParams message +func (m *MsgUpdateParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(m.Authority) + return []sdk.AccAddress{addr} +} diff --git a/x/staking/types/msg_test.go b/x/staking/types/msg_test.go index f1ba552d9115..49416dbb9cf4 100644 --- a/x/staking/types/msg_test.go +++ b/x/staking/types/msg_test.go @@ -1,7 +1,10 @@ package types_test import ( + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "testing" + "time" "github.com/stretchr/testify/require" @@ -197,3 +200,153 @@ func TestMsgUndelegate(t *testing.T) { } } } + +func TestMsgUpdateParams(t *testing.T) { + msg := types.MsgUpdateParams{ + Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + Params: types.DefaultParams(), + } + + require.Equal(t, []sdk.AccAddress{authtypes.NewModuleAddress(govtypes.ModuleName)}, msg.GetSigners()) +} + +func TestMsgUpdateParamsValidateBasic(t *testing.T) { + tests := []struct { + name string + msgUpdateParams types.MsgUpdateParams + expFail bool + expError string + }{ + { + "valid msg", + types.MsgUpdateParams{ + Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + Params: types.DefaultParams(), + }, + false, + "", + }, + { + "negative unbounding time", + types.MsgUpdateParams{ + Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + Params: types.Params{ + UnbondingTime: time.Hour * 24 * 7 * 3 * -1, + MaxEntries: types.DefaultMaxEntries, + MaxValidators: types.DefaultMaxValidators, + HistoricalEntries: types.DefaultHistoricalEntries, + MinCommissionRate: types.DefaultMinCommissionRate, + BondDenom: "denom", + }, + }, + true, + "unbonding time must be positive:", + }, + { + "cero value max validator", + types.MsgUpdateParams{ + Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + Params: types.Params{ + UnbondingTime: time.Hour * 24 * 7 * 3, + MaxEntries: types.DefaultMaxEntries, + MaxValidators: 0, + HistoricalEntries: types.DefaultHistoricalEntries, + MinCommissionRate: types.DefaultMinCommissionRate, + BondDenom: "denom", + }, + }, + true, + "max validators must be positive:", + }, + { + "cero value max validator", + types.MsgUpdateParams{ + Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + Params: types.Params{ + UnbondingTime: time.Hour * 24 * 7 * 3, + MaxEntries: 0, + MaxValidators: types.DefaultMaxValidators, + HistoricalEntries: types.DefaultHistoricalEntries, + MinCommissionRate: types.DefaultMinCommissionRate, + BondDenom: "denom", + }, + }, + true, + "max entries must be positive:", + }, + { + "negative commission rate", + types.MsgUpdateParams{ + Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + Params: types.Params{ + UnbondingTime: time.Hour * 24 * 7 * 3, + MaxEntries: types.DefaultMaxEntries, + MaxValidators: types.DefaultMaxValidators, + HistoricalEntries: types.DefaultHistoricalEntries, + MinCommissionRate: sdk.NewDec(-1), + BondDenom: "denom", + }, + }, + true, + "minimum commission rate cannot be negative:", + }, + { + "negative commission rate", + types.MsgUpdateParams{ + Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + Params: types.Params{ + UnbondingTime: time.Hour * 24 * 7 * 3, + MaxEntries: types.DefaultMaxEntries, + MaxValidators: types.DefaultMaxValidators, + HistoricalEntries: types.DefaultHistoricalEntries, + MinCommissionRate: sdk.NewDec(2), + BondDenom: "denom", + }, + }, + true, + "minimum commission rate cannot be greater than 100", + }, + { + "blank bonddenom", + types.MsgUpdateParams{ + Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + Params: types.Params{ + UnbondingTime: time.Hour * 24 * 7 * 3, + MaxEntries: types.DefaultMaxEntries, + MaxValidators: types.DefaultMaxValidators, + HistoricalEntries: types.DefaultHistoricalEntries, + MinCommissionRate: types.DefaultMinCommissionRate, + BondDenom: "", + }, + }, + true, + "bond denom cannot be blank", + }, + { + "Invalid authority", + types.MsgUpdateParams{ + Authority: "invalid", + Params: types.Params{ + UnbondingTime: time.Hour * 24 * 7 * 3, + MaxEntries: types.DefaultMaxEntries, + MaxValidators: types.DefaultMaxValidators, + HistoricalEntries: types.DefaultHistoricalEntries, + MinCommissionRate: types.DefaultMinCommissionRate, + BondDenom: "denom", + }, + }, + true, + "invalid authority address", + }, + } + + for _, tc := range tests { + err := tc.msgUpdateParams.ValidateBasic() + if tc.expFail { + require.Error(t, err) + require.Contains(t, err.Error(), tc.expError) + } else { + require.NoError(t, err) + } + } +} diff --git a/x/staking/types/params.go b/x/staking/types/params.go index 46405e3ad308..c28eeea7da15 100644 --- a/x/staking/types/params.go +++ b/x/staking/types/params.go @@ -11,7 +11,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) // Staking params default values @@ -36,22 +35,6 @@ const ( // DefaultMinCommissionRate is set to 0% var DefaultMinCommissionRate = sdk.ZeroDec() -var ( - KeyUnbondingTime = []byte("UnbondingTime") - KeyMaxValidators = []byte("MaxValidators") - KeyMaxEntries = []byte("MaxEntries") - KeyBondDenom = []byte("BondDenom") - KeyHistoricalEntries = []byte("HistoricalEntries") - KeyMinCommissionRate = []byte("MinCommissionRate") -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamTable for staking module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - // NewParams creates a new Params instance func NewParams(unbondingTime time.Duration, maxValidators, maxEntries, historicalEntries uint32, bondDenom string, minCommissionRate sdk.Dec) Params { return Params{ @@ -64,18 +47,6 @@ func NewParams(unbondingTime time.Duration, maxValidators, maxEntries, historica } } -// Implements params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyUnbondingTime, &p.UnbondingTime, validateUnbondingTime), - paramtypes.NewParamSetPair(KeyMaxValidators, &p.MaxValidators, validateMaxValidators), - paramtypes.NewParamSetPair(KeyMaxEntries, &p.MaxEntries, validateMaxEntries), - paramtypes.NewParamSetPair(KeyHistoricalEntries, &p.HistoricalEntries, validateHistoricalEntries), - paramtypes.NewParamSetPair(KeyBondDenom, &p.BondDenom, validateBondDenom), - paramtypes.NewParamSetPair(KeyMinCommissionRate, &p.MinCommissionRate, validateMinCommissionRate), - } -} - // DefaultParams returns a default set of parameters. func DefaultParams() Params { return NewParams( diff --git a/x/staking/types/params_legacy.go b/x/staking/types/params_legacy.go new file mode 100644 index 000000000000..39a125ff4298 --- /dev/null +++ b/x/staking/types/params_legacy.go @@ -0,0 +1,33 @@ +package types + +import paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + +var ( + KeyUnbondingTime = []byte("UnbondingTime") + KeyMaxValidators = []byte("MaxValidators") + KeyMaxEntries = []byte("MaxEntries") + KeyBondDenom = []byte("BondDenom") + KeyHistoricalEntries = []byte("HistoricalEntries") + KeyMinCommissionRate = []byte("MinCommissionRate") +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +// ParamTable for staking module +// NOTE: Deprecated now params can be accesed on key `0x51` on the staking store. +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// Implements params.ParamSet +// NOTE: Deprecated. +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyUnbondingTime, &p.UnbondingTime, validateUnbondingTime), + paramtypes.NewParamSetPair(KeyMaxValidators, &p.MaxValidators, validateMaxValidators), + paramtypes.NewParamSetPair(KeyMaxEntries, &p.MaxEntries, validateMaxEntries), + paramtypes.NewParamSetPair(KeyHistoricalEntries, &p.HistoricalEntries, validateHistoricalEntries), + paramtypes.NewParamSetPair(KeyBondDenom, &p.BondDenom, validateBondDenom), + paramtypes.NewParamSetPair(KeyMinCommissionRate, &p.MinCommissionRate, validateMinCommissionRate), + } +} diff --git a/x/staking/types/staking.pb.go b/x/staking/types/staking.pb.go index 8dbfa99ae59f..af193a3a4bd7 100644 --- a/x/staking/types/staking.pb.go +++ b/x/staking/types/staking.pb.go @@ -834,7 +834,7 @@ func (m *Redelegation) XXX_DiscardUnknown() { var xxx_messageInfo_Redelegation proto.InternalMessageInfo -// Params defines the parameters for the staking module. +// Params defines the parameters for the x/staking module. type Params struct { // unbonding_time is the time duration of unbonding. UnbondingTime time.Duration `protobuf:"bytes,1,opt,name=unbonding_time,json=unbondingTime,proto3,stdduration" json:"unbonding_time"` diff --git a/x/staking/types/tx.pb.go b/x/staking/types/tx.pb.go index 040c6a9233f4..49d737dff750 100644 --- a/x/staking/types/tx.pb.go +++ b/x/staking/types/tx.pb.go @@ -535,6 +535,105 @@ func (m *MsgCancelUnbondingDelegationResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCancelUnbondingDelegationResponse 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/staking 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_0926ef28816b35ab, []int{12} +} +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_0926ef28816b35ab, []int{13} +} +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((*MsgCreateValidator)(nil), "cosmos.staking.v1beta1.MsgCreateValidator") proto.RegisterType((*MsgCreateValidatorResponse)(nil), "cosmos.staking.v1beta1.MsgCreateValidatorResponse") @@ -548,71 +647,78 @@ func init() { proto.RegisterType((*MsgUndelegateResponse)(nil), "cosmos.staking.v1beta1.MsgUndelegateResponse") proto.RegisterType((*MsgCancelUnbondingDelegation)(nil), "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation") proto.RegisterType((*MsgCancelUnbondingDelegationResponse)(nil), "cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "cosmos.staking.v1beta1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "cosmos.staking.v1beta1.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("cosmos/staking/v1beta1/tx.proto", fileDescriptor_0926ef28816b35ab) } var fileDescriptor_0926ef28816b35ab = []byte{ - // 937 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x57, 0x4d, 0x6f, 0x1b, 0x45, - 0x18, 0xf6, 0xc6, 0x4e, 0x28, 0x13, 0xb5, 0x69, 0x37, 0x09, 0x38, 0xab, 0xca, 0xae, 0xdc, 0xd2, - 0x46, 0x85, 0xac, 0x69, 0x28, 0x02, 0x55, 0xbd, 0xd4, 0x75, 0x2b, 0xaa, 0x62, 0x09, 0x6d, 0x28, - 0x07, 0x84, 0x64, 0xcd, 0xee, 0x4e, 0x26, 0x23, 0xef, 0xce, 0xb8, 0x3b, 0xe3, 0xa8, 0xbe, 0x72, - 0xe2, 0x46, 0x25, 0xfe, 0x40, 0x7f, 0x00, 0x42, 0x1c, 0xfa, 0x23, 0x2a, 0x4e, 0x51, 0x4f, 0x88, - 0x43, 0x81, 0xe4, 0x00, 0x3f, 0x00, 0x71, 0x46, 0x3b, 0x3b, 0x3b, 0xfe, 0x58, 0x7b, 0xb3, 0x41, - 0xe9, 0x01, 0x71, 0xf2, 0x6a, 0xe6, 0x79, 0x9f, 0x99, 0x79, 0xde, 0x67, 0xde, 0x77, 0x0c, 0xea, - 0x1e, 0xe3, 0x21, 0xe3, 0x4d, 0x2e, 0x60, 0x8f, 0x50, 0xdc, 0xdc, 0xbf, 0xe1, 0x22, 0x01, 0x6f, - 0x34, 0xc5, 0x13, 0xbb, 0x1f, 0x31, 0xc1, 0xcc, 0xb7, 0x12, 0x80, 0xad, 0x00, 0xb6, 0x02, 0x58, - 0x1b, 0x98, 0x31, 0x1c, 0xa0, 0xa6, 0x44, 0xb9, 0x83, 0xdd, 0x26, 0xa4, 0xc3, 0x24, 0xc4, 0xaa, - 0x4f, 0x4f, 0x09, 0x12, 0x22, 0x2e, 0x60, 0xd8, 0x57, 0x80, 0x35, 0xcc, 0x30, 0x93, 0x9f, 0xcd, - 0xf8, 0x4b, 0x8d, 0x6e, 0x24, 0x2b, 0x75, 0x93, 0x09, 0xb5, 0x6c, 0x32, 0x55, 0x53, 0xbb, 0x74, - 0x21, 0x47, 0x7a, 0x8b, 0x1e, 0x23, 0x54, 0xcd, 0x5f, 0x99, 0x73, 0x8a, 0x74, 0xd3, 0x09, 0xea, - 0x6d, 0x85, 0x0a, 0x79, 0x8c, 0x88, 0x7f, 0x92, 0x89, 0xc6, 0xef, 0x15, 0x60, 0x76, 0x38, 0xbe, - 0x1b, 0x21, 0x28, 0xd0, 0x17, 0x30, 0x20, 0x3e, 0x14, 0x2c, 0x32, 0x1f, 0x82, 0x65, 0x1f, 0x71, - 0x2f, 0x22, 0x7d, 0x41, 0x18, 0xad, 0x1a, 0x97, 0x8c, 0xcd, 0xe5, 0xed, 0xcb, 0xf6, 0x6c, 0x41, - 0xec, 0xf6, 0x08, 0xda, 0xaa, 0xbc, 0x78, 0x55, 0x2f, 0x39, 0xe3, 0xd1, 0x66, 0x07, 0x00, 0x8f, - 0x85, 0x21, 0xe1, 0x3c, 0xe6, 0x5a, 0x90, 0x5c, 0xd7, 0xe6, 0x71, 0xdd, 0xd5, 0x48, 0x07, 0x0a, - 0xc4, 0x15, 0xdf, 0x18, 0x81, 0x19, 0x80, 0xd5, 0x90, 0xd0, 0x2e, 0x47, 0xc1, 0x6e, 0xd7, 0x47, - 0x01, 0xc2, 0x50, 0xee, 0xb1, 0x7c, 0xc9, 0xd8, 0x7c, 0xb3, 0x75, 0x3b, 0x86, 0xff, 0xf2, 0xaa, - 0x7e, 0x15, 0x13, 0xb1, 0x37, 0x70, 0x6d, 0x8f, 0x85, 0x4a, 0x4f, 0xf5, 0xb3, 0xc5, 0xfd, 0x5e, - 0x53, 0x0c, 0xfb, 0x88, 0xdb, 0x0f, 0xa8, 0x78, 0xf9, 0x7c, 0x0b, 0xa8, 0x8d, 0x3c, 0xa0, 0xc2, - 0xb9, 0x10, 0x12, 0xba, 0x83, 0x82, 0xdd, 0xb6, 0xa6, 0x35, 0xef, 0x81, 0x0b, 0x6a, 0x11, 0x16, - 0x75, 0xa1, 0xef, 0x47, 0x88, 0xf3, 0x6a, 0x45, 0xae, 0x55, 0x7d, 0xf9, 0x7c, 0x6b, 0x4d, 0x45, - 0xdf, 0x49, 0x66, 0x76, 0x44, 0x44, 0x28, 0x76, 0xce, 0xeb, 0x10, 0x35, 0x1e, 0xd3, 0xec, 0xa7, - 0xea, 0x6a, 0x9a, 0xc5, 0xe3, 0x68, 0x74, 0x48, 0x4a, 0x73, 0x1f, 0x2c, 0xf5, 0x07, 0x6e, 0x0f, - 0x0d, 0xab, 0x4b, 0x52, 0xc6, 0x35, 0x3b, 0x31, 0x9c, 0x9d, 0x1a, 0xce, 0xbe, 0x43, 0x87, 0xad, - 0xea, 0x4f, 0x23, 0x46, 0x2f, 0x1a, 0xf6, 0x05, 0xb3, 0x3f, 0x1b, 0xb8, 0x0f, 0xd1, 0xd0, 0x51, - 0xd1, 0xe6, 0x87, 0x60, 0x71, 0x1f, 0x06, 0x03, 0x54, 0x7d, 0x43, 0xd2, 0x6c, 0xa4, 0xd9, 0x88, - 0x5d, 0x36, 0x96, 0x0a, 0x92, 0xe6, 0x33, 0x41, 0xdf, 0xba, 0xf9, 0xcd, 0xb3, 0x7a, 0xe9, 0xcf, - 0x67, 0xf5, 0xd2, 0xd7, 0x7f, 0xfc, 0x78, 0x3d, 0xab, 0x8b, 0x1c, 0xcd, 0x1c, 0xb3, 0x71, 0x11, - 0x58, 0x59, 0x8b, 0x39, 0x88, 0xf7, 0x19, 0xe5, 0xa8, 0xf1, 0x5d, 0x19, 0x9c, 0xef, 0x70, 0x7c, - 0xcf, 0x27, 0xe2, 0x35, 0xf9, 0x6f, 0xa6, 0xf6, 0x0b, 0x27, 0xd6, 0x1e, 0x82, 0x95, 0x91, 0x0b, - 0xbb, 0x11, 0x14, 0x48, 0x79, 0xee, 0xe3, 0x82, 0x7e, 0x6b, 0x23, 0x6f, 0xcc, 0x6f, 0x6d, 0xe4, - 0x39, 0xe7, 0xbc, 0x09, 0xb7, 0x9b, 0x7b, 0xb3, 0xad, 0x5d, 0x39, 0xd1, 0x32, 0x45, 0x6c, 0x7d, - 0xab, 0x36, 0x91, 0xc9, 0x6c, 0xce, 0x2c, 0x50, 0x9d, 0x4e, 0x8a, 0xce, 0xd8, 0x5f, 0x06, 0x58, - 0xee, 0x70, 0xac, 0xd8, 0xd0, 0xec, 0x2b, 0x62, 0x9c, 0xce, 0x15, 0x39, 0x79, 0x9a, 0x3e, 0x02, - 0x4b, 0x30, 0x64, 0x03, 0x2a, 0x64, 0x76, 0x0a, 0x78, 0x5b, 0xc1, 0xa7, 0x24, 0xc9, 0x9c, 0xa8, - 0xb1, 0x0e, 0x56, 0xc7, 0x4e, 0xad, 0xd5, 0x38, 0x58, 0x90, 0x15, 0xb4, 0x85, 0x30, 0xa1, 0x0e, - 0xf2, 0x4f, 0x59, 0x94, 0x4f, 0xc1, 0xfa, 0x48, 0x14, 0x1e, 0x79, 0x85, 0x85, 0x59, 0xd5, 0x61, - 0x3b, 0x91, 0x37, 0x93, 0xcd, 0xe7, 0x42, 0xb3, 0x95, 0x0b, 0xb3, 0xb5, 0xb9, 0xc8, 0x2a, 0x5d, - 0x39, 0x5d, 0xa5, 0x7b, 0xb2, 0x60, 0x4c, 0x29, 0x9a, 0x0a, 0x6e, 0x76, 0xe4, 0x3d, 0xec, 0x07, - 0x28, 0x36, 0x72, 0x37, 0x6e, 0xb0, 0xaa, 0x3e, 0x58, 0x99, 0x62, 0xf8, 0x79, 0xda, 0x7d, 0x5b, - 0x67, 0xe2, 0x0d, 0x3c, 0xfd, 0xb5, 0x6e, 0xc8, 0x3b, 0xa7, 0x82, 0xe3, 0xe9, 0xc6, 0xdf, 0x06, - 0x38, 0xdb, 0xe1, 0xf8, 0x11, 0xf5, 0xff, 0x67, 0x7e, 0xde, 0x05, 0xeb, 0x13, 0xe7, 0x7e, 0x5d, - 0x02, 0xff, 0xb0, 0x00, 0x2e, 0xc6, 0xf5, 0x1f, 0x52, 0x0f, 0x05, 0x8f, 0xa8, 0xcb, 0xa8, 0x4f, - 0x28, 0x3e, 0xae, 0xc5, 0xfe, 0xe7, 0xf4, 0x36, 0xaf, 0x81, 0x15, 0x2f, 0xee, 0x71, 0xb1, 0x68, - 0x7b, 0x88, 0xe0, 0xbd, 0xe4, 0x5e, 0x94, 0x9d, 0x73, 0xe9, 0xf0, 0x27, 0x72, 0xf4, 0xd8, 0xc4, - 0x5c, 0x05, 0x57, 0xf2, 0xf4, 0x4a, 0xf3, 0xb4, 0xfd, 0xfd, 0x22, 0x28, 0x77, 0x38, 0x36, 0x1f, - 0x83, 0x95, 0xe9, 0xf7, 0xdb, 0xf5, 0x79, 0xad, 0x32, 0xdb, 0x88, 0xad, 0xed, 0xe2, 0x58, 0x6d, - 0x91, 0x1e, 0x38, 0x3b, 0xd9, 0xb0, 0x37, 0x73, 0x48, 0x26, 0x90, 0xd6, 0xfb, 0x45, 0x91, 0x7a, - 0xb1, 0xaf, 0xc0, 0x19, 0xdd, 0x6b, 0x2e, 0xe7, 0x44, 0xa7, 0x20, 0xeb, 0xdd, 0x02, 0x20, 0xcd, - 0xfe, 0x18, 0xac, 0x4c, 0xd7, 0xee, 0x3c, 0xf5, 0xa6, 0xb0, 0xb9, 0xea, 0xcd, 0xab, 0x60, 0x2e, - 0x00, 0x63, 0xe5, 0xe6, 0x9d, 0x1c, 0x86, 0x11, 0xcc, 0xda, 0x2a, 0x04, 0xd3, 0x6b, 0x7c, 0x6b, - 0x80, 0x8d, 0xf9, 0x57, 0xee, 0x66, 0x5e, 0xce, 0xe7, 0x45, 0x59, 0xb7, 0xff, 0x4d, 0x54, 0xba, - 0xa3, 0xd6, 0xfd, 0x17, 0x87, 0x35, 0xe3, 0xe0, 0xb0, 0x66, 0xfc, 0x76, 0x58, 0x33, 0x9e, 0x1e, - 0xd5, 0x4a, 0x07, 0x47, 0xb5, 0xd2, 0xcf, 0x47, 0xb5, 0xd2, 0x97, 0xef, 0xe5, 0xbe, 0x6a, 0x9e, - 0xe8, 0xff, 0x36, 0xf2, 0x7d, 0xe3, 0x2e, 0xc9, 0xea, 0xf3, 0xc1, 0x3f, 0x01, 0x00, 0x00, 0xff, - 0xff, 0x48, 0x6a, 0x50, 0xaf, 0xc0, 0x0d, 0x00, 0x00, + // 1012 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x57, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xf7, 0x26, 0xae, 0x69, 0x5f, 0x68, 0xdc, 0x6e, 0x12, 0x6a, 0xaf, 0x2a, 0xbb, 0x72, 0x4b, + 0x13, 0x15, 0xb2, 0xa6, 0xa1, 0xfc, 0x51, 0x94, 0x4b, 0x5d, 0xb7, 0xa2, 0x2a, 0x96, 0x2a, 0x87, + 0x72, 0x40, 0x48, 0xd6, 0xec, 0xee, 0x64, 0xbd, 0xf2, 0xee, 0xcc, 0x76, 0x67, 0x1c, 0xd5, 0x57, + 0x4e, 0xdc, 0xa8, 0x84, 0x04, 0xd7, 0x7e, 0x02, 0xc4, 0xa1, 0x1f, 0xa2, 0xe2, 0x14, 0xf5, 0x84, + 0x38, 0x14, 0x48, 0x0e, 0xf0, 0x01, 0x10, 0x67, 0xb4, 0xbb, 0xb3, 0xe3, 0xff, 0x9b, 0x0d, 0x4a, + 0x0f, 0x88, 0x93, 0x57, 0x33, 0xbf, 0xf7, 0x7b, 0xef, 0xfd, 0xde, 0x9b, 0x37, 0x63, 0xa8, 0x9a, + 0x94, 0x79, 0x94, 0xd5, 0x19, 0x47, 0x3d, 0x87, 0xd8, 0xf5, 0xfd, 0x9b, 0x06, 0xe6, 0xe8, 0x66, + 0x9d, 0x3f, 0xd1, 0xfd, 0x80, 0x72, 0xaa, 0xbe, 0x15, 0x03, 0x74, 0x01, 0xd0, 0x05, 0x40, 0x2b, + 0xdb, 0x94, 0xda, 0x2e, 0xae, 0x47, 0x28, 0xa3, 0xbf, 0x57, 0x47, 0x64, 0x10, 0x9b, 0x68, 0xd5, + 0xc9, 0x2d, 0xee, 0x78, 0x98, 0x71, 0xe4, 0xf9, 0x02, 0xb0, 0x6a, 0x53, 0x9b, 0x46, 0x9f, 0xf5, + 0xf0, 0x4b, 0xac, 0x96, 0x63, 0x4f, 0x9d, 0x78, 0x43, 0xb8, 0x8d, 0xb7, 0x2a, 0x22, 0x4a, 0x03, + 0x31, 0x2c, 0x43, 0x34, 0xa9, 0x43, 0xc4, 0xfe, 0xb5, 0x39, 0x59, 0x24, 0x41, 0xc7, 0xa8, 0x4b, + 0x02, 0xe5, 0xb1, 0x10, 0x11, 0xfe, 0xc4, 0x1b, 0xb5, 0xdf, 0xf3, 0xa0, 0xb6, 0x98, 0x7d, 0x27, + 0xc0, 0x88, 0xe3, 0xcf, 0x91, 0xeb, 0x58, 0x88, 0xd3, 0x40, 0x7d, 0x00, 0x4b, 0x16, 0x66, 0x66, + 0xe0, 0xf8, 0xdc, 0xa1, 0xa4, 0xa4, 0x5c, 0x51, 0x36, 0x96, 0xb6, 0xae, 0xea, 0xb3, 0x05, 0xd1, + 0x9b, 0x43, 0x68, 0x23, 0xff, 0xe2, 0x55, 0x35, 0xd7, 0x1e, 0xb5, 0x56, 0x5b, 0x00, 0x26, 0xf5, + 0x3c, 0x87, 0xb1, 0x90, 0x6b, 0x21, 0xe2, 0x5a, 0x9f, 0xc7, 0x75, 0x47, 0x22, 0xdb, 0x88, 0x63, + 0x26, 0xf8, 0x46, 0x08, 0x54, 0x17, 0x56, 0x3c, 0x87, 0x74, 0x18, 0x76, 0xf7, 0x3a, 0x16, 0x76, + 0xb1, 0x8d, 0xa2, 0x18, 0x17, 0xaf, 0x28, 0x1b, 0xe7, 0x1a, 0x3b, 0x21, 0xfc, 0x97, 0x57, 0xd5, + 0xeb, 0xb6, 0xc3, 0xbb, 0x7d, 0x43, 0x37, 0xa9, 0x27, 0xf4, 0x14, 0x3f, 0x9b, 0xcc, 0xea, 0xd5, + 0xf9, 0xc0, 0xc7, 0x4c, 0xbf, 0x4f, 0xf8, 0xcb, 0xe7, 0x9b, 0x20, 0x02, 0xb9, 0x4f, 0x78, 0xfb, + 0xa2, 0xe7, 0x90, 0x5d, 0xec, 0xee, 0x35, 0x25, 0xad, 0x7a, 0x17, 0x2e, 0x0a, 0x27, 0x34, 0xe8, + 0x20, 0xcb, 0x0a, 0x30, 0x63, 0xa5, 0x7c, 0xe4, 0xab, 0xf4, 0xf2, 0xf9, 0xe6, 0xaa, 0xb0, 0xbe, + 0x1d, 0xef, 0xec, 0xf2, 0xc0, 0x21, 0x76, 0xfb, 0x82, 0x34, 0x11, 0xeb, 0x21, 0xcd, 0x7e, 0xa2, + 0xae, 0xa4, 0x39, 0x73, 0x1c, 0x8d, 0x34, 0x49, 0x68, 0xee, 0x41, 0xc1, 0xef, 0x1b, 0x3d, 0x3c, + 0x28, 0x15, 0x22, 0x19, 0x57, 0xf5, 0xb8, 0xe1, 0xf4, 0xa4, 0xe1, 0xf4, 0xdb, 0x64, 0xd0, 0x28, + 0xfd, 0x34, 0x64, 0x34, 0x83, 0x81, 0xcf, 0xa9, 0xfe, 0xb0, 0x6f, 0x3c, 0xc0, 0x83, 0xb6, 0xb0, + 0x56, 0x3f, 0x80, 0x33, 0xfb, 0xc8, 0xed, 0xe3, 0xd2, 0x1b, 0x11, 0x4d, 0x39, 0xa9, 0x46, 0xd8, + 0x65, 0x23, 0xa5, 0x70, 0x92, 0x7a, 0xc6, 0xe8, 0xed, 0x5b, 0x5f, 0x3f, 0xab, 0xe6, 0xfe, 0x7c, + 0x56, 0xcd, 0x7d, 0xf5, 0xc7, 0x8f, 0x37, 0xa6, 0x75, 0x89, 0x56, 0xa7, 0xd2, 0xac, 0x5d, 0x06, + 0x6d, 0xba, 0xc5, 0xda, 0x98, 0xf9, 0x94, 0x30, 0x5c, 0xfb, 0x76, 0x11, 0x2e, 0xb4, 0x98, 0x7d, + 0xd7, 0x72, 0xf8, 0x6b, 0xea, 0xbf, 0x99, 0xda, 0x2f, 0x9c, 0x58, 0x7b, 0x04, 0xc5, 0x61, 0x17, + 0x76, 0x02, 0xc4, 0xb1, 0xe8, 0xb9, 0x8f, 0x33, 0xf6, 0x5b, 0x13, 0x9b, 0x23, 0xfd, 0xd6, 0xc4, + 0x66, 0x7b, 0xd9, 0x1c, 0xeb, 0x76, 0xb5, 0x3b, 0xbb, 0xb5, 0xf3, 0x27, 0x72, 0x93, 0xa5, 0xad, + 0xb7, 0x2b, 0x63, 0x95, 0x9c, 0xae, 0x99, 0x06, 0xa5, 0xc9, 0xa2, 0xc8, 0x8a, 0xfd, 0xa5, 0xc0, + 0x52, 0x8b, 0xd9, 0x82, 0x0d, 0xcf, 0x3e, 0x22, 0xca, 0xe9, 0x1c, 0x91, 0x93, 0x97, 0xe9, 0x23, + 0x28, 0x20, 0x8f, 0xf6, 0x09, 0x8f, 0xaa, 0x93, 0xa1, 0xb7, 0x05, 0x7c, 0x42, 0x92, 0xa9, 0x8c, + 0x6a, 0x6b, 0xb0, 0x32, 0x92, 0xb5, 0x54, 0xe3, 0x60, 0x21, 0x9a, 0xa0, 0x0d, 0x6c, 0x3b, 0xa4, + 0x8d, 0xad, 0x53, 0x16, 0xe5, 0x53, 0x58, 0x1b, 0x8a, 0xc2, 0x02, 0x33, 0xb3, 0x30, 0x2b, 0xd2, + 0x6c, 0x37, 0x30, 0x67, 0xb2, 0x59, 0x8c, 0x4b, 0xb6, 0xc5, 0xcc, 0x6c, 0x4d, 0xc6, 0xa7, 0x95, + 0xce, 0x9f, 0xae, 0xd2, 0xbd, 0x68, 0x60, 0x4c, 0x28, 0x9a, 0x08, 0xae, 0xb6, 0xa2, 0x73, 0xe8, + 0xbb, 0x38, 0x6c, 0xe4, 0x4e, 0x78, 0xc1, 0x8a, 0xf9, 0xa0, 0x4d, 0x0d, 0xc3, 0xcf, 0x92, 0xdb, + 0xb7, 0x71, 0x36, 0x0c, 0xe0, 0xe9, 0xaf, 0x55, 0x25, 0x3a, 0x73, 0xc2, 0x38, 0xdc, 0xae, 0xfd, + 0xad, 0xc0, 0xf9, 0x16, 0xb3, 0x1f, 0x11, 0xeb, 0x7f, 0xd6, 0xcf, 0x7b, 0xb0, 0x36, 0x96, 0xf7, + 0xeb, 0x12, 0xf8, 0x87, 0x05, 0xb8, 0x1c, 0xce, 0x7f, 0x44, 0x4c, 0xec, 0x3e, 0x22, 0x06, 0x25, + 0x96, 0x43, 0xec, 0xe3, 0xae, 0xd8, 0xff, 0x9c, 0xde, 0xea, 0x3a, 0x14, 0xcd, 0xf0, 0x8e, 0x0b, + 0x45, 0xeb, 0x62, 0xc7, 0xee, 0xc6, 0xe7, 0x62, 0xb1, 0xbd, 0x9c, 0x2c, 0x7f, 0x12, 0xad, 0x1e, + 0x5b, 0x98, 0xeb, 0x70, 0x2d, 0x4d, 0x2f, 0x39, 0x79, 0xbe, 0x57, 0xa0, 0x18, 0x56, 0xd0, 0xb7, + 0x10, 0xc7, 0x0f, 0x51, 0x80, 0x3c, 0xa6, 0x7e, 0x08, 0xe7, 0x50, 0x9f, 0x77, 0x69, 0xe0, 0xf0, + 0xc1, 0xb1, 0x1a, 0x0e, 0xa1, 0xea, 0x0e, 0x14, 0xfc, 0x88, 0x41, 0xbc, 0xcf, 0x2a, 0xf3, 0xee, + 0xda, 0xd8, 0x4f, 0x92, 0x7a, 0x6c, 0xb3, 0xbd, 0x1c, 0x66, 0x32, 0x64, 0xab, 0x95, 0xe1, 0xd2, + 0x44, 0x60, 0x49, 0xd0, 0x5b, 0xdf, 0x15, 0x60, 0xb1, 0xc5, 0x6c, 0xf5, 0x31, 0x14, 0x27, 0x1f, + 0x9d, 0x37, 0xe6, 0xf9, 0x9c, 0x7e, 0x3d, 0x68, 0x5b, 0xd9, 0xb1, 0xb2, 0xaf, 0x7b, 0x70, 0x7e, + 0xfc, 0x95, 0xb1, 0x91, 0x42, 0x32, 0x86, 0xd4, 0xde, 0xcb, 0x8a, 0x94, 0xce, 0xbe, 0x84, 0xb3, + 0xf2, 0x82, 0xbc, 0x9a, 0x62, 0x9d, 0x80, 0xb4, 0x77, 0x32, 0x80, 0x24, 0xfb, 0x63, 0x28, 0x4e, + 0x5e, 0x38, 0x69, 0xea, 0x4d, 0x60, 0x53, 0xd5, 0x9b, 0x37, 0x76, 0x0d, 0x80, 0x91, 0x19, 0xf9, + 0x76, 0x0a, 0xc3, 0x10, 0xa6, 0x6d, 0x66, 0x82, 0x49, 0x1f, 0xdf, 0x28, 0x50, 0x9e, 0x3f, 0x27, + 0x6e, 0xa5, 0xd5, 0x7c, 0x9e, 0x95, 0xb6, 0xf3, 0x6f, 0xac, 0x64, 0x44, 0x5d, 0x78, 0x73, 0xec, + 0x7c, 0xad, 0xa7, 0x25, 0x34, 0x02, 0xd4, 0xea, 0x19, 0x81, 0x89, 0xa7, 0xc6, 0xbd, 0x17, 0x87, + 0x15, 0xe5, 0xe0, 0xb0, 0xa2, 0xfc, 0x76, 0x58, 0x51, 0x9e, 0x1e, 0x55, 0x72, 0x07, 0x47, 0x95, + 0xdc, 0xcf, 0x47, 0x95, 0xdc, 0x17, 0xef, 0xa6, 0x3e, 0xfa, 0x9e, 0xc8, 0xbf, 0x7e, 0xd1, 0xf3, + 0xcf, 0x28, 0x44, 0xc3, 0xf9, 0xfd, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x69, 0xfd, 0x9c, 0x84, + 0xdf, 0x0e, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -645,6 +751,10 @@ type MsgClient interface { // // Since: cosmos-sdk 0.46 CancelUnbondingDelegation(ctx context.Context, in *MsgCancelUnbondingDelegation, opts ...grpc.CallOption) (*MsgCancelUnbondingDelegationResponse, error) + // UpdateParams defines a operation for updating the x/staking module + // parameters. + // Since: cosmos-sdk 0.47 + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -709,6 +819,15 @@ func (c *msgClient) CancelUnbondingDelegation(ctx context.Context, in *MsgCancel 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.staking.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 { // CreateValidator defines a method for creating a new validator. @@ -729,6 +848,10 @@ type MsgServer interface { // // Since: cosmos-sdk 0.46 CancelUnbondingDelegation(context.Context, *MsgCancelUnbondingDelegation) (*MsgCancelUnbondingDelegationResponse, error) + // UpdateParams defines a operation for updating the x/staking module + // parameters. + // Since: cosmos-sdk 0.47 + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -753,6 +876,9 @@ func (*UnimplementedMsgServer) Undelegate(ctx context.Context, req *MsgUndelegat func (*UnimplementedMsgServer) CancelUnbondingDelegation(ctx context.Context, req *MsgCancelUnbondingDelegation) (*MsgCancelUnbondingDelegationResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CancelUnbondingDelegation 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) @@ -866,6 +992,24 @@ func _Msg_CancelUnbondingDelegation_Handler(srv interface{}, ctx context.Context 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.staking.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.staking.v1beta1.Msg", HandlerType: (*MsgServer)(nil), @@ -894,6 +1038,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "CancelUnbondingDelegation", Handler: _Msg_CancelUnbondingDelegation_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/staking/v1beta1/tx.proto", @@ -1406,6 +1554,69 @@ func (m *MsgCancelUnbondingDelegationResponse) MarshalToSizedBuffer(dAtA []byte) 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 @@ -1610,6 +1821,30 @@ func (m *MsgCancelUnbondingDelegationResponse) 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 } @@ -3091,6 +3326,171 @@ func (m *MsgCancelUnbondingDelegationResponse) 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