From a6a1463d36966e47a3d86b4a9c8ef19382f87a05 Mon Sep 17 00:00:00 2001 From: blushi Date: Thu, 3 Feb 2022 14:38:46 +0100 Subject: [PATCH 01/19] Add Msg/SoftwareUpgrade wip --- .../base/query/v1beta1/pagination.pulsar.go | 7 +- .../tx/signing/v1beta1/signing.pulsar.go | 10 +- api/cosmos/upgrade/v1beta1/tx.pulsar.go | 1088 +++++++++++++++++ api/cosmos/upgrade/v1beta1/tx_grpc.pb.go | 107 ++ proto/cosmos/upgrade/v1beta1/tx.proto | 29 + simapp/app.go | 2 +- x/upgrade/keeper/keeper.go | 4 +- x/upgrade/keeper/msg_server.go | 17 + x/upgrade/module.go | 4 +- x/upgrade/types/expected_keepers.go | 10 + x/upgrade/types/tx.pb.go | 591 +++++++++ 11 files changed, 1855 insertions(+), 14 deletions(-) create mode 100644 api/cosmos/upgrade/v1beta1/tx.pulsar.go create mode 100644 api/cosmos/upgrade/v1beta1/tx_grpc.pb.go create mode 100644 proto/cosmos/upgrade/v1beta1/tx.proto create mode 100644 x/upgrade/keeper/msg_server.go create mode 100644 x/upgrade/types/expected_keepers.go create mode 100644 x/upgrade/types/tx.pb.go diff --git a/api/cosmos/base/query/v1beta1/pagination.pulsar.go b/api/cosmos/base/query/v1beta1/pagination.pulsar.go index 1f9eca212585..ec8b00853c3e 100644 --- a/api/cosmos/base/query/v1beta1/pagination.pulsar.go +++ b/api/cosmos/base/query/v1beta1/pagination.pulsar.go @@ -3,14 +3,13 @@ package queryv1beta1 import ( fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - runtime "github.com/cosmos/cosmos-proto/runtime" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" ) var ( diff --git a/api/cosmos/tx/signing/v1beta1/signing.pulsar.go b/api/cosmos/tx/signing/v1beta1/signing.pulsar.go index d59ff2ba3b4c..63aad962ed0c 100644 --- a/api/cosmos/tx/signing/v1beta1/signing.pulsar.go +++ b/api/cosmos/tx/signing/v1beta1/signing.pulsar.go @@ -3,17 +3,15 @@ package signingv1beta1 import ( fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - runtime "github.com/cosmos/cosmos-proto/runtime" + v1beta1 "github.com/cosmos/cosmos-sdk/api/cosmos/crypto/multisig/v1beta1" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" - - v1beta1 "github.com/cosmos/cosmos-sdk/api/cosmos/crypto/multisig/v1beta1" + io "io" + reflect "reflect" + sync "sync" ) var _ protoreflect.List = (*_SignatureDescriptors_1_list)(nil) diff --git a/api/cosmos/upgrade/v1beta1/tx.pulsar.go b/api/cosmos/upgrade/v1beta1/tx.pulsar.go new file mode 100644 index 000000000000..056c54dac661 --- /dev/null +++ b/api/cosmos/upgrade/v1beta1/tx.pulsar.go @@ -0,0 +1,1088 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package upgradev1beta1 + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/cosmos-sdk/api/cosmos/msg/v1" + _ "github.com/gogo/protobuf/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_MsgSoftwareUpgrade protoreflect.MessageDescriptor + fd_MsgSoftwareUpgrade_authority protoreflect.FieldDescriptor + fd_MsgSoftwareUpgrade_plan protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_upgrade_v1beta1_tx_proto_init() + md_MsgSoftwareUpgrade = File_cosmos_upgrade_v1beta1_tx_proto.Messages().ByName("MsgSoftwareUpgrade") + fd_MsgSoftwareUpgrade_authority = md_MsgSoftwareUpgrade.Fields().ByName("authority") + fd_MsgSoftwareUpgrade_plan = md_MsgSoftwareUpgrade.Fields().ByName("plan") +} + +var _ protoreflect.Message = (*fastReflection_MsgSoftwareUpgrade)(nil) + +type fastReflection_MsgSoftwareUpgrade MsgSoftwareUpgrade + +func (x *MsgSoftwareUpgrade) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgSoftwareUpgrade)(x) +} + +func (x *MsgSoftwareUpgrade) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_upgrade_v1beta1_tx_proto_msgTypes[0] + 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_MsgSoftwareUpgrade_messageType fastReflection_MsgSoftwareUpgrade_messageType +var _ protoreflect.MessageType = fastReflection_MsgSoftwareUpgrade_messageType{} + +type fastReflection_MsgSoftwareUpgrade_messageType struct{} + +func (x fastReflection_MsgSoftwareUpgrade_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgSoftwareUpgrade)(nil) +} +func (x fastReflection_MsgSoftwareUpgrade_messageType) New() protoreflect.Message { + return new(fastReflection_MsgSoftwareUpgrade) +} +func (x fastReflection_MsgSoftwareUpgrade_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSoftwareUpgrade +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgSoftwareUpgrade) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSoftwareUpgrade +} + +// 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_MsgSoftwareUpgrade) Type() protoreflect.MessageType { + return _fastReflection_MsgSoftwareUpgrade_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgSoftwareUpgrade) New() protoreflect.Message { + return new(fastReflection_MsgSoftwareUpgrade) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgSoftwareUpgrade) Interface() protoreflect.ProtoMessage { + return (*MsgSoftwareUpgrade)(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_MsgSoftwareUpgrade) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgSoftwareUpgrade_authority, value) { + return + } + } + if x.Plan != nil { + value := protoreflect.ValueOfMessage(x.Plan.ProtoReflect()) + if !f(fd_MsgSoftwareUpgrade_plan, 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_MsgSoftwareUpgrade) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.upgrade.v1beta1.MsgSoftwareUpgrade.authority": + return x.Authority != "" + case "cosmos.upgrade.v1beta1.MsgSoftwareUpgrade.plan": + return x.Plan != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.MsgSoftwareUpgrade")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgSoftwareUpgrade 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_MsgSoftwareUpgrade) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.upgrade.v1beta1.MsgSoftwareUpgrade.authority": + x.Authority = "" + case "cosmos.upgrade.v1beta1.MsgSoftwareUpgrade.plan": + x.Plan = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.MsgSoftwareUpgrade")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgSoftwareUpgrade 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_MsgSoftwareUpgrade) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.upgrade.v1beta1.MsgSoftwareUpgrade.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "cosmos.upgrade.v1beta1.MsgSoftwareUpgrade.plan": + value := x.Plan + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.MsgSoftwareUpgrade")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgSoftwareUpgrade 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_MsgSoftwareUpgrade) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.upgrade.v1beta1.MsgSoftwareUpgrade.authority": + x.Authority = value.Interface().(string) + case "cosmos.upgrade.v1beta1.MsgSoftwareUpgrade.plan": + x.Plan = value.Message().Interface().(*Plan) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.MsgSoftwareUpgrade")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgSoftwareUpgrade 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_MsgSoftwareUpgrade) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.upgrade.v1beta1.MsgSoftwareUpgrade.plan": + if x.Plan == nil { + x.Plan = new(Plan) + } + return protoreflect.ValueOfMessage(x.Plan.ProtoReflect()) + case "cosmos.upgrade.v1beta1.MsgSoftwareUpgrade.authority": + panic(fmt.Errorf("field authority of message cosmos.upgrade.v1beta1.MsgSoftwareUpgrade is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.MsgSoftwareUpgrade")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgSoftwareUpgrade 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_MsgSoftwareUpgrade) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.upgrade.v1beta1.MsgSoftwareUpgrade.authority": + return protoreflect.ValueOfString("") + case "cosmos.upgrade.v1beta1.MsgSoftwareUpgrade.plan": + m := new(Plan) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.MsgSoftwareUpgrade")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgSoftwareUpgrade 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_MsgSoftwareUpgrade) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", 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_MsgSoftwareUpgrade) 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_MsgSoftwareUpgrade) 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_MsgSoftwareUpgrade) 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_MsgSoftwareUpgrade) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgSoftwareUpgrade) + 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.Plan != nil { + l = options.Size(x.Plan) + 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().(*MsgSoftwareUpgrade) + 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.Plan != nil { + encoded, err := options.Marshal(x.Plan) + 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().(*MsgSoftwareUpgrade) + 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: MsgSoftwareUpgrade: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSoftwareUpgrade: 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 Plan", 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.Plan == nil { + x.Plan = &Plan{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Plan); 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_MsgSoftwareUpgradeResponse protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_upgrade_v1beta1_tx_proto_init() + md_MsgSoftwareUpgradeResponse = File_cosmos_upgrade_v1beta1_tx_proto.Messages().ByName("MsgSoftwareUpgradeResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgSoftwareUpgradeResponse)(nil) + +type fastReflection_MsgSoftwareUpgradeResponse MsgSoftwareUpgradeResponse + +func (x *MsgSoftwareUpgradeResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgSoftwareUpgradeResponse)(x) +} + +func (x *MsgSoftwareUpgradeResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_upgrade_v1beta1_tx_proto_msgTypes[1] + 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_MsgSoftwareUpgradeResponse_messageType fastReflection_MsgSoftwareUpgradeResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgSoftwareUpgradeResponse_messageType{} + +type fastReflection_MsgSoftwareUpgradeResponse_messageType struct{} + +func (x fastReflection_MsgSoftwareUpgradeResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgSoftwareUpgradeResponse)(nil) +} +func (x fastReflection_MsgSoftwareUpgradeResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgSoftwareUpgradeResponse) +} +func (x fastReflection_MsgSoftwareUpgradeResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSoftwareUpgradeResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgSoftwareUpgradeResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSoftwareUpgradeResponse +} + +// 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_MsgSoftwareUpgradeResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgSoftwareUpgradeResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgSoftwareUpgradeResponse) New() protoreflect.Message { + return new(fastReflection_MsgSoftwareUpgradeResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgSoftwareUpgradeResponse) Interface() protoreflect.ProtoMessage { + return (*MsgSoftwareUpgradeResponse)(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_MsgSoftwareUpgradeResponse) 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_MsgSoftwareUpgradeResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse 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_MsgSoftwareUpgradeResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse 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_MsgSoftwareUpgradeResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse 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_MsgSoftwareUpgradeResponse) 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.upgrade.v1beta1.MsgSoftwareUpgradeResponse")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse 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_MsgSoftwareUpgradeResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse 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_MsgSoftwareUpgradeResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse 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_MsgSoftwareUpgradeResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse", 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_MsgSoftwareUpgradeResponse) 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_MsgSoftwareUpgradeResponse) 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_MsgSoftwareUpgradeResponse) 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_MsgSoftwareUpgradeResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgSoftwareUpgradeResponse) + 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().(*MsgSoftwareUpgradeResponse) + 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().(*MsgSoftwareUpgradeResponse) + 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: MsgSoftwareUpgradeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSoftwareUpgradeResponse: 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 +// protoc (unknown) +// source: cosmos/upgrade/v1beta1/tx.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// MsgSoftwareUpgrade is the Msg/MsgSoftwareUpgrade request type. +type MsgSoftwareUpgrade 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"` + // plan is the upgrade plan. + Plan *Plan `protobuf:"bytes,2,opt,name=plan,proto3" json:"plan,omitempty"` +} + +func (x *MsgSoftwareUpgrade) Reset() { + *x = MsgSoftwareUpgrade{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_upgrade_v1beta1_tx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgSoftwareUpgrade) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgSoftwareUpgrade) ProtoMessage() {} + +// Deprecated: Use MsgSoftwareUpgrade.ProtoReflect.Descriptor instead. +func (*MsgSoftwareUpgrade) Descriptor() ([]byte, []int) { + return file_cosmos_upgrade_v1beta1_tx_proto_rawDescGZIP(), []int{0} +} + +func (x *MsgSoftwareUpgrade) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgSoftwareUpgrade) GetPlan() *Plan { + if x != nil { + return x.Plan + } + return nil +} + +// MsgSoftwareUpgradeResponse is the Msg/MsgSoftwareUpgrade response type. +type MsgSoftwareUpgradeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgSoftwareUpgradeResponse) Reset() { + *x = MsgSoftwareUpgradeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_upgrade_v1beta1_tx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgSoftwareUpgradeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgSoftwareUpgradeResponse) ProtoMessage() {} + +// Deprecated: Use MsgSoftwareUpgradeResponse.ProtoReflect.Descriptor instead. +func (*MsgSoftwareUpgradeResponse) Descriptor() ([]byte, []int) { + return file_cosmos_upgrade_v1beta1_tx_proto_rawDescGZIP(), []int{1} +} + +var File_cosmos_upgrade_v1beta1_tx_proto protoreflect.FileDescriptor + +var file_cosmos_upgrade_v1beta1_tx_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, + 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x16, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, + 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x24, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2f, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2f, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, + 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x99, 0x01, 0x0a, 0x12, 0x4d, 0x73, + 0x67, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, + 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, 0x36, 0x0a, 0x04, 0x70, 0x6c, 0x61, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x50, 0x6c, 0x61, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x04, 0x70, 0x6c, 0x61, 0x6e, + 0x3a, 0x13, 0x82, 0xe7, 0xb0, 0x2a, 0x0e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x1c, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x53, 0x6f, 0x66, 0x74, + 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x32, 0x78, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x71, 0x0a, 0x0f, 0x53, 0x6f, + 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x12, 0x2a, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, + 0x72, 0x65, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x1a, 0x32, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, + 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xe7, 0x01, + 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, + 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2f, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x3b, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, + 0x02, 0x03, 0x43, 0x55, 0x58, 0xaa, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x55, + 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, + 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x5c, + 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x5c, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 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, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x3a, 0x3a, + 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_cosmos_upgrade_v1beta1_tx_proto_rawDescOnce sync.Once + file_cosmos_upgrade_v1beta1_tx_proto_rawDescData = file_cosmos_upgrade_v1beta1_tx_proto_rawDesc +) + +func file_cosmos_upgrade_v1beta1_tx_proto_rawDescGZIP() []byte { + file_cosmos_upgrade_v1beta1_tx_proto_rawDescOnce.Do(func() { + file_cosmos_upgrade_v1beta1_tx_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_upgrade_v1beta1_tx_proto_rawDescData) + }) + return file_cosmos_upgrade_v1beta1_tx_proto_rawDescData +} + +var file_cosmos_upgrade_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_cosmos_upgrade_v1beta1_tx_proto_goTypes = []interface{}{ + (*MsgSoftwareUpgrade)(nil), // 0: cosmos.upgrade.v1beta1.MsgSoftwareUpgrade + (*MsgSoftwareUpgradeResponse)(nil), // 1: cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse + (*Plan)(nil), // 2: cosmos.upgrade.v1beta1.Plan +} +var file_cosmos_upgrade_v1beta1_tx_proto_depIdxs = []int32{ + 2, // 0: cosmos.upgrade.v1beta1.MsgSoftwareUpgrade.plan:type_name -> cosmos.upgrade.v1beta1.Plan + 0, // 1: cosmos.upgrade.v1beta1.Msg.SoftwareUpgrade:input_type -> cosmos.upgrade.v1beta1.MsgSoftwareUpgrade + 1, // 2: cosmos.upgrade.v1beta1.Msg.SoftwareUpgrade:output_type -> cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_cosmos_upgrade_v1beta1_tx_proto_init() } +func file_cosmos_upgrade_v1beta1_tx_proto_init() { + if File_cosmos_upgrade_v1beta1_tx_proto != nil { + return + } + file_cosmos_upgrade_v1beta1_upgrade_proto_init() + if !protoimpl.UnsafeEnabled { + file_cosmos_upgrade_v1beta1_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgSoftwareUpgrade); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_upgrade_v1beta1_tx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgSoftwareUpgradeResponse); 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{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_cosmos_upgrade_v1beta1_tx_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_cosmos_upgrade_v1beta1_tx_proto_goTypes, + DependencyIndexes: file_cosmos_upgrade_v1beta1_tx_proto_depIdxs, + MessageInfos: file_cosmos_upgrade_v1beta1_tx_proto_msgTypes, + }.Build() + File_cosmos_upgrade_v1beta1_tx_proto = out.File + file_cosmos_upgrade_v1beta1_tx_proto_rawDesc = nil + file_cosmos_upgrade_v1beta1_tx_proto_goTypes = nil + file_cosmos_upgrade_v1beta1_tx_proto_depIdxs = nil +} diff --git a/api/cosmos/upgrade/v1beta1/tx_grpc.pb.go b/api/cosmos/upgrade/v1beta1/tx_grpc.pb.go new file mode 100644 index 000000000000..5a5d916a8380 --- /dev/null +++ b/api/cosmos/upgrade/v1beta1/tx_grpc.pb.go @@ -0,0 +1,107 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc (unknown) +// source: cosmos/upgrade/v1beta1/tx.proto + +package upgradev1beta1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type MsgClient interface { + // SoftwareUpgrade is a governance operation for initiating a software upgrade. + SoftwareUpgrade(ctx context.Context, in *MsgSoftwareUpgrade, opts ...grpc.CallOption) (*MsgSoftwareUpgradeResponse, error) +} + +type msgClient struct { + cc grpc.ClientConnInterface +} + +func NewMsgClient(cc grpc.ClientConnInterface) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) SoftwareUpgrade(ctx context.Context, in *MsgSoftwareUpgrade, opts ...grpc.CallOption) (*MsgSoftwareUpgradeResponse, error) { + out := new(MsgSoftwareUpgradeResponse) + err := c.cc.Invoke(ctx, "/cosmos.upgrade.v1beta1.Msg/SoftwareUpgrade", 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 +type MsgServer interface { + // SoftwareUpgrade is a governance operation for initiating a software upgrade. + SoftwareUpgrade(context.Context, *MsgSoftwareUpgrade) (*MsgSoftwareUpgradeResponse, error) + mustEmbedUnimplementedMsgServer() +} + +// UnimplementedMsgServer must be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (UnimplementedMsgServer) SoftwareUpgrade(context.Context, *MsgSoftwareUpgrade) (*MsgSoftwareUpgradeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SoftwareUpgrade not implemented") +} +func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} + +// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to MsgServer will +// result in compilation errors. +type UnsafeMsgServer interface { + mustEmbedUnimplementedMsgServer() +} + +func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) { + s.RegisterService(&Msg_ServiceDesc, srv) +} + +func _Msg_SoftwareUpgrade_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSoftwareUpgrade) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SoftwareUpgrade(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.upgrade.v1beta1.Msg/SoftwareUpgrade", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SoftwareUpgrade(ctx, req.(*MsgSoftwareUpgrade)) + } + 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) +var Msg_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos.upgrade.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SoftwareUpgrade", + Handler: _Msg_SoftwareUpgrade_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/upgrade/v1beta1/tx.proto", +} diff --git a/proto/cosmos/upgrade/v1beta1/tx.proto b/proto/cosmos/upgrade/v1beta1/tx.proto new file mode 100644 index 000000000000..a509b355deba --- /dev/null +++ b/proto/cosmos/upgrade/v1beta1/tx.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; +package cosmos.upgrade.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/upgrade/v1beta1/upgrade.proto"; +import "cosmos/msg/v1/msg.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/upgrade/types"; + +// Msg defines the upgrade Msg service. +service Msg { + // SoftwareUpgrade is a governance operation for initiating a software upgrade. + rpc SoftwareUpgrade(MsgSoftwareUpgrade) returns (MsgSoftwareUpgradeResponse); +} + +// MsgSoftwareUpgrade is the Msg/MsgSoftwareUpgrade request type. +message MsgSoftwareUpgrade { + option (cosmos.msg.v1.signer) = "adminauthority"; + + // authority is the address of the governance account. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // plan is the upgrade plan. + Plan plan = 2 [(gogoproto.nullable) = false]; +} + +// MsgSoftwareUpgradeResponse is the Msg/MsgSoftwareUpgrade response type. +message MsgSoftwareUpgradeResponse {} \ No newline at end of file diff --git a/simapp/app.go b/simapp/app.go index dd7127c098f5..90ac6050df4b 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -284,7 +284,7 @@ func NewSimApp( ) app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, keys[feegrant.StoreKey], app.AccountKeeper) - app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp) + app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, app.AccountKeeper) // register the staking hooks // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks diff --git a/x/upgrade/keeper/keeper.go b/x/upgrade/keeper/keeper.go index 8ec103491bff..6ce07096b7ff 100644 --- a/x/upgrade/keeper/keeper.go +++ b/x/upgrade/keeper/keeper.go @@ -36,6 +36,7 @@ type Keeper struct { upgradeHandlers map[string]types.UpgradeHandler // map of plan name to upgrade handler versionSetter xp.ProtocolVersionSetter // implements setting the protocol version field on BaseApp downgradeVerified bool // tells if we've already sanity checked that this binary version isn't being used against an old state. + authKeeper types.AccountKeeper } // NewKeeper constructs an upgrade Keeper which requires the following arguments: @@ -44,7 +45,7 @@ type Keeper struct { // cdc - the app-wide binary codec // homePath - root directory of the application's config // vs - the interface implemented by baseapp which allows setting baseapp's protocol version field -func NewKeeper(skipUpgradeHeights map[int64]bool, storeKey storetypes.StoreKey, cdc codec.BinaryCodec, homePath string, vs xp.ProtocolVersionSetter) Keeper { +func NewKeeper(skipUpgradeHeights map[int64]bool, storeKey storetypes.StoreKey, cdc codec.BinaryCodec, homePath string, vs xp.ProtocolVersionSetter, authKeeper types.AccountKeeper) Keeper { return Keeper{ homePath: homePath, skipUpgradeHeights: skipUpgradeHeights, @@ -52,6 +53,7 @@ func NewKeeper(skipUpgradeHeights map[int64]bool, storeKey storetypes.StoreKey, cdc: cdc, upgradeHandlers: map[string]types.UpgradeHandler{}, versionSetter: vs, + authKeeper: authKeeper, } } diff --git a/x/upgrade/keeper/msg_server.go b/x/upgrade/keeper/msg_server.go new file mode 100644 index 000000000000..66f44dcece92 --- /dev/null +++ b/x/upgrade/keeper/msg_server.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/x/upgrade/types" + gov "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +var _ types.MsgServer = Keeper{} + +func (k Keeper) SoftwareUpgrade(goCtx context.Context, req *types.MsgSoftwareUpgrade) (*types.MsgSoftwareUpgradeResponse, error) { + govAcct := k.authKeeper.GetModuleAddress(gov.ModuleName).String() + if govAcct != req.Authority { + return nil, sdkerrors.Wrapf(types.ErrInvalidSigner, "expected %s got %s", govAcct, msg.Authority) + } +} diff --git a/x/upgrade/module.go b/x/upgrade/module.go index ed4b6e0ed9f3..6284e4b49dfb 100644 --- a/x/upgrade/module.go +++ b/x/upgrade/module.go @@ -97,9 +97,9 @@ func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sd return keeper.NewQuerier(am.keeper, legacyQuerierCdc) } -// RegisterServices registers a GRPC query service to respond to the -// module-specific GRPC queries. +// RegisterServices registers module services. func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), am.keeper) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) } diff --git a/x/upgrade/types/expected_keepers.go b/x/upgrade/types/expected_keepers.go new file mode 100644 index 000000000000..45af1e56d429 --- /dev/null +++ b/x/upgrade/types/expected_keepers.go @@ -0,0 +1,10 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// AccountKeeper defines the expected auth Account Keeper (noalias) +type AccountKeeper interface { + GetModuleAddress(moduleName string) sdk.AccAddress +} diff --git a/x/upgrade/types/tx.pb.go b/x/upgrade/types/tx.pb.go new file mode 100644 index 000000000000..93ed4a963983 --- /dev/null +++ b/x/upgrade/types/tx.pb.go @@ -0,0 +1,591 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/upgrade/v1beta1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgSoftwareUpgrade is the Msg/MsgSoftwareUpgrade request type. +type MsgSoftwareUpgrade struct { + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // plan is the upgrade plan. + Plan Plan `protobuf:"bytes,2,opt,name=plan,proto3" json:"plan"` +} + +func (m *MsgSoftwareUpgrade) Reset() { *m = MsgSoftwareUpgrade{} } +func (m *MsgSoftwareUpgrade) String() string { return proto.CompactTextString(m) } +func (*MsgSoftwareUpgrade) ProtoMessage() {} +func (*MsgSoftwareUpgrade) Descriptor() ([]byte, []int) { + return fileDescriptor_2852c16e3ab79fef, []int{0} +} +func (m *MsgSoftwareUpgrade) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSoftwareUpgrade) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSoftwareUpgrade.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 *MsgSoftwareUpgrade) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSoftwareUpgrade.Merge(m, src) +} +func (m *MsgSoftwareUpgrade) XXX_Size() int { + return m.Size() +} +func (m *MsgSoftwareUpgrade) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSoftwareUpgrade.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSoftwareUpgrade proto.InternalMessageInfo + +func (m *MsgSoftwareUpgrade) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgSoftwareUpgrade) GetPlan() Plan { + if m != nil { + return m.Plan + } + return Plan{} +} + +// MsgSoftwareUpgradeResponse is the Msg/MsgSoftwareUpgrade response type. +type MsgSoftwareUpgradeResponse struct { +} + +func (m *MsgSoftwareUpgradeResponse) Reset() { *m = MsgSoftwareUpgradeResponse{} } +func (m *MsgSoftwareUpgradeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSoftwareUpgradeResponse) ProtoMessage() {} +func (*MsgSoftwareUpgradeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2852c16e3ab79fef, []int{1} +} +func (m *MsgSoftwareUpgradeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSoftwareUpgradeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSoftwareUpgradeResponse.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 *MsgSoftwareUpgradeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSoftwareUpgradeResponse.Merge(m, src) +} +func (m *MsgSoftwareUpgradeResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSoftwareUpgradeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSoftwareUpgradeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSoftwareUpgradeResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgSoftwareUpgrade)(nil), "cosmos.upgrade.v1beta1.MsgSoftwareUpgrade") + proto.RegisterType((*MsgSoftwareUpgradeResponse)(nil), "cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse") +} + +func init() { proto.RegisterFile("cosmos/upgrade/v1beta1/tx.proto", fileDescriptor_2852c16e3ab79fef) } + +var fileDescriptor_2852c16e3ab79fef = []byte{ + // 323 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xce, 0x2f, 0xce, + 0xcd, 0x2f, 0xd6, 0x2f, 0x2d, 0x48, 0x2f, 0x4a, 0x4c, 0x49, 0xd5, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, + 0x49, 0x34, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x83, 0x28, 0xd0, + 0x83, 0x2a, 0xd0, 0x83, 0x2a, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, 0xd1, 0x07, 0xb1, + 0x20, 0xaa, 0xa5, 0x24, 0x21, 0xaa, 0xe3, 0x21, 0x12, 0x50, 0xad, 0x10, 0x29, 0x15, 0x1c, 0x36, + 0xc1, 0x0c, 0x86, 0xa8, 0x12, 0x87, 0xaa, 0xca, 0x2d, 0x4e, 0xd7, 0x2f, 0x33, 0x04, 0x51, 0x10, + 0x09, 0xa5, 0x99, 0x8c, 0x5c, 0x42, 0xbe, 0xc5, 0xe9, 0xc1, 0xf9, 0x69, 0x25, 0xe5, 0x89, 0x45, + 0xa9, 0xa1, 0x10, 0x5d, 0x42, 0x66, 0x5c, 0x9c, 0x89, 0xa5, 0x25, 0x19, 0xf9, 0x45, 0x99, 0x25, + 0x95, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x4e, 0x12, 0x97, 0xb6, 0xe8, 0x8a, 0x40, 0xad, 0x76, + 0x4c, 0x49, 0x29, 0x4a, 0x2d, 0x2e, 0x0e, 0x2e, 0x29, 0xca, 0xcc, 0x4b, 0x0f, 0x42, 0x28, 0x15, + 0x32, 0xe3, 0x62, 0x29, 0xc8, 0x49, 0xcc, 0x93, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x36, 0x92, 0xd1, + 0xc3, 0xee, 0x4b, 0xbd, 0x80, 0x9c, 0xc4, 0x3c, 0x27, 0x96, 0x13, 0xf7, 0xe4, 0x19, 0x82, 0xc0, + 0xea, 0xad, 0x84, 0x9b, 0x9e, 0x6f, 0xd0, 0xe2, 0x4b, 0x4c, 0xc9, 0xcd, 0xcc, 0x83, 0x1b, 0xa6, + 0x24, 0xc3, 0x25, 0x85, 0xe9, 0xb4, 0xa0, 0xd4, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0xa3, 0x0a, + 0x2e, 0x66, 0xdf, 0xe2, 0x74, 0xa1, 0x42, 0x2e, 0x7e, 0x74, 0xc7, 0x6b, 0xe1, 0xb2, 0x16, 0xd3, + 0x34, 0x29, 0x23, 0xe2, 0xd5, 0xc2, 0x6c, 0x76, 0x72, 0x3b, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, + 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, + 0x63, 0x39, 0x86, 0x28, 0x9d, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x68, + 0x2c, 0x41, 0x29, 0xdd, 0xe2, 0x94, 0x6c, 0xfd, 0x0a, 0x78, 0x24, 0x95, 0x54, 0x16, 0xa4, 0x16, + 0x27, 0xb1, 0x81, 0xa3, 0xc0, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x30, 0xd0, 0xe7, 0x5d, 0x2d, + 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // SoftwareUpgrade is a governance operation for initiating a software upgrade. + SoftwareUpgrade(ctx context.Context, in *MsgSoftwareUpgrade, opts ...grpc.CallOption) (*MsgSoftwareUpgradeResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) SoftwareUpgrade(ctx context.Context, in *MsgSoftwareUpgrade, opts ...grpc.CallOption) (*MsgSoftwareUpgradeResponse, error) { + out := new(MsgSoftwareUpgradeResponse) + err := c.cc.Invoke(ctx, "/cosmos.upgrade.v1beta1.Msg/SoftwareUpgrade", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // SoftwareUpgrade is a governance operation for initiating a software upgrade. + SoftwareUpgrade(context.Context, *MsgSoftwareUpgrade) (*MsgSoftwareUpgradeResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) SoftwareUpgrade(ctx context.Context, req *MsgSoftwareUpgrade) (*MsgSoftwareUpgradeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SoftwareUpgrade not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_SoftwareUpgrade_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSoftwareUpgrade) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SoftwareUpgrade(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.upgrade.v1beta1.Msg/SoftwareUpgrade", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SoftwareUpgrade(ctx, req.(*MsgSoftwareUpgrade)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos.upgrade.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SoftwareUpgrade", + Handler: _Msg_SoftwareUpgrade_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/upgrade/v1beta1/tx.proto", +} + +func (m *MsgSoftwareUpgrade) 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 *MsgSoftwareUpgrade) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSoftwareUpgrade) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Plan.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 *MsgSoftwareUpgradeResponse) 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 *MsgSoftwareUpgradeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSoftwareUpgradeResponse) 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 + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgSoftwareUpgrade) 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.Plan.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgSoftwareUpgradeResponse) 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 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgSoftwareUpgrade) 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: MsgSoftwareUpgrade: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSoftwareUpgrade: 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 Plan", 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.Plan.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 *MsgSoftwareUpgradeResponse) 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: MsgSoftwareUpgradeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSoftwareUpgradeResponse: 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 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) From 27059317ec63b8746f4dea9c8b70624e7930bcfe Mon Sep 17 00:00:00 2001 From: blushi Date: Fri, 4 Feb 2022 11:48:43 +0100 Subject: [PATCH 02/19] Add msg server impl and tests --- x/upgrade/keeper/keeper_test.go | 6 ++- x/upgrade/keeper/msg_server.go | 29 ++++++++++-- x/upgrade/keeper/msg_server_test.go | 63 ++++++++++++++++++++++++++ x/upgrade/module.go | 2 +- x/upgrade/types/codec.go | 9 ++++ x/upgrade/types/msgs.go | 43 ++++++++++++++++++ x/upgrade/types/msgs_test.go | 70 +++++++++++++++++++++++++++++ 7 files changed, 216 insertions(+), 6 deletions(-) create mode 100644 x/upgrade/keeper/msg_server_test.go create mode 100644 x/upgrade/types/msgs.go create mode 100644 x/upgrade/types/msgs_test.go diff --git a/x/upgrade/keeper/keeper_test.go b/x/upgrade/keeper/keeper_test.go index b572a89ac1b4..4e36523557dc 100644 --- a/x/upgrade/keeper/keeper_test.go +++ b/x/upgrade/keeper/keeper_test.go @@ -21,13 +21,15 @@ type KeeperTestSuite struct { homeDir string app *simapp.SimApp ctx sdk.Context + msgSrvr types.MsgServer + addrs []sdk.AccAddress } func (s *KeeperTestSuite) SetupTest() { app := simapp.Setup(s.T(), false) homeDir := filepath.Join(s.T().TempDir(), "x_upgrade_keeper_test") app.UpgradeKeeper = keeper.NewKeeper( // recreate keeper in order to use a custom home path - make(map[int64]bool), app.GetKey(types.StoreKey), app.AppCodec(), homeDir, app.BaseApp, + make(map[int64]bool), app.GetKey(types.StoreKey), app.AppCodec(), homeDir, app.BaseApp, app.AccountKeeper, ) s.T().Log("home dir:", homeDir) s.homeDir = homeDir @@ -36,6 +38,8 @@ func (s *KeeperTestSuite) SetupTest() { Time: time.Now(), Height: 10, }) + s.msgSrvr = keeper.NewMsgServerImpl(s.app.UpgradeKeeper) + s.addrs = simapp.AddTestAddrsIncremental(app, s.ctx, 1, sdk.NewInt(30000000)) } func (s *KeeperTestSuite) TestReadUpgradeInfoFromDisk() { diff --git a/x/upgrade/keeper/msg_server.go b/x/upgrade/keeper/msg_server.go index 66f44dcece92..179e73614ebc 100644 --- a/x/upgrade/keeper/msg_server.go +++ b/x/upgrade/keeper/msg_server.go @@ -3,15 +3,36 @@ package keeper import ( "context" - "github.com/cosmos/cosmos-sdk/x/upgrade/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/errors" gov "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) -var _ types.MsgServer = Keeper{} +type msgServer struct { + Keeper +} -func (k Keeper) SoftwareUpgrade(goCtx context.Context, req *types.MsgSoftwareUpgrade) (*types.MsgSoftwareUpgradeResponse, error) { +// NewMsgServerImpl returns an implementation of the upgrade MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(k Keeper) types.MsgServer { + return &msgServer{ + Keeper: k, + } +} + +var _ types.MsgServer = msgServer{} + +func (k msgServer) SoftwareUpgrade(goCtx context.Context, req *types.MsgSoftwareUpgrade) (*types.MsgSoftwareUpgradeResponse, error) { govAcct := k.authKeeper.GetModuleAddress(gov.ModuleName).String() if govAcct != req.Authority { - return nil, sdkerrors.Wrapf(types.ErrInvalidSigner, "expected %s got %s", govAcct, msg.Authority) + return nil, errors.Wrapf(gov.ErrInvalidSigner, "expected %s got %s", govAcct, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + err := k.ScheduleUpgrade(ctx, req.Plan) + if err != nil { + return nil, err } + return &types.MsgSoftwareUpgradeResponse{}, nil } diff --git a/x/upgrade/keeper/msg_server_test.go b/x/upgrade/keeper/msg_server_test.go new file mode 100644 index 000000000000..00af9e06563e --- /dev/null +++ b/x/upgrade/keeper/msg_server_test.go @@ -0,0 +1,63 @@ +package keeper_test + +import ( + "github.com/cosmos/cosmos-sdk/x/upgrade/types" +) + +func (s *KeeperTestSuite) TestSoftwareUpgrade() { + govAccAddr := s.app.GovKeeper.GetGovernanceAccount(s.ctx).GetAddress().String() + + testCases := []struct { + name string + req *types.MsgSoftwareUpgrade + expectErr bool + errMsg string + }{ + { + "unauthorized authority address", + &types.MsgSoftwareUpgrade{ + Authority: s.addrs[0].String(), + Plan: types.Plan{ + Name: "all-good", + Info: "some text here", + Height: 123450000, + }, + }, + true, + "expected gov account as only signer for proposal message", + }, + { + "invalid plan", + &types.MsgSoftwareUpgrade{ + Authority: govAccAddr, + Plan: types.Plan{ + Height: 123450000, + }, + }, + true, + "name cannot be empty: invalid request", + }, + { + "successful upgrade scheduled", + &types.MsgSoftwareUpgrade{ + Authority: govAccAddr, + Plan: types.Plan{ + Name: "all-good", + Info: "some text here", + Height: 123450000, + }, + }, + false, + "", + }, + } + for _, tc := range testCases { + s.Run(tc.name, func() { + _, err := s.msgSrvr.SoftwareUpgrade(s.ctx, tc.req) + if tc.expectErr { + s.Require().Error(err) + s.Require().Contains(err.Error(), tc.errMsg) + } + }) + } +} diff --git a/x/upgrade/module.go b/x/upgrade/module.go index 6284e4b49dfb..045d23370586 100644 --- a/x/upgrade/module.go +++ b/x/upgrade/module.go @@ -99,7 +99,7 @@ func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sd // RegisterServices registers module services. func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), am.keeper) + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) } diff --git a/x/upgrade/types/codec.go b/x/upgrade/types/codec.go index 5ef751d16f3f..a3532d42e76d 100644 --- a/x/upgrade/types/codec.go +++ b/x/upgrade/types/codec.go @@ -3,6 +3,8 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) @@ -11,6 +13,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(Plan{}, "cosmos-sdk/Plan", nil) cdc.RegisterConcrete(&SoftwareUpgradeProposal{}, "cosmos-sdk/SoftwareUpgradeProposal", nil) cdc.RegisterConcrete(&CancelSoftwareUpgradeProposal{}, "cosmos-sdk/CancelSoftwareUpgradeProposal", nil) + cdc.RegisterConcrete(&MsgSoftwareUpgrade{}, "cosmos-sdk/MsgSoftwareUpgrade", nil) } func RegisterInterfaces(registry types.InterfaceRegistry) { @@ -19,4 +22,10 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &SoftwareUpgradeProposal{}, &CancelSoftwareUpgradeProposal{}, ) + + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgSoftwareUpgrade{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/upgrade/types/msgs.go b/x/upgrade/types/msgs.go new file mode 100644 index 000000000000..4efd878d4688 --- /dev/null +++ b/x/upgrade/types/msgs.go @@ -0,0 +1,43 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec/legacy" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" +) + +var ( + _ sdk.Msg = &MsgSoftwareUpgrade{} + _ legacytx.LegacyMsg = &MsgSoftwareUpgrade{} +) + +// Route implements the LegacyMsg interface. +func (m MsgSoftwareUpgrade) Route() string { return sdk.MsgTypeURL(&m) } + +// Type implements the LegacyMsg interface. +func (m MsgSoftwareUpgrade) Type() string { return sdk.MsgTypeURL(&m) } + +// GetSignBytes implements the LegacyMsg interface. +func (m MsgSoftwareUpgrade) GetSignBytes() []byte { + return sdk.MustSortJSON(legacy.Cdc.MustMarshalJSON(&m)) +} + +// ValidateBasic does a sanity check on the provided data. +func (m *MsgSoftwareUpgrade) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return sdkerrors.Wrap(err, "authority") + } + + if err := m.Plan.ValidateBasic(); err != nil { + return sdkerrors.Wrap(err, "plan") + } + + return nil +} + +// GetSigners returns the expected signers for MsgSoftwareUpgrade. +func (m *MsgSoftwareUpgrade) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(m.Authority) + return []sdk.AccAddress{addr} +} diff --git a/x/upgrade/types/msgs_test.go b/x/upgrade/types/msgs_test.go new file mode 100644 index 000000000000..ad907fb5face --- /dev/null +++ b/x/upgrade/types/msgs_test.go @@ -0,0 +1,70 @@ +package types_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/upgrade/types" +) + +var authority = sdk.AccAddress("authority") + +func TestMsgSoftwareUpgrade(t *testing.T) { + testCases := []struct { + name string + msg *types.MsgSoftwareUpgrade + expErr bool + errMsg string + }{ + { + "invalid authority address", + &types.MsgSoftwareUpgrade{ + Authority: "authority", + Plan: types.Plan{ + Name: "all-good", + Height: 123450000, + }, + }, + true, + "authority: decoding bech32 failed", + }, + { + "invalid plan", + &types.MsgSoftwareUpgrade{ + Authority: authority.String(), + Plan: types.Plan{ + Height: 123450000, + }, + }, + true, + "plan", + }, + { + "all good", + &types.MsgSoftwareUpgrade{ + Authority: authority.String(), + Plan: types.Plan{ + Name: "all-good", + Height: 123450000, + }, + }, + false, + "", + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + err := tc.msg.ValidateBasic() + if tc.expErr { + require.Error(t, err) + require.Contains(t, err.Error(), tc.errMsg) + } else { + require.NoError(t, err) + require.Equal(t, tc.msg.Type(), sdk.MsgTypeURL(&types.MsgSoftwareUpgrade{})) + } + }) + } +} From ff85950765dadb7428e304c8c65b32a81f1609d7 Mon Sep 17 00:00:00 2001 From: blushi Date: Fri, 4 Feb 2022 13:50:15 +0100 Subject: [PATCH 03/19] Add CLI --- simapp/app.go | 4 +- x/gov/client/cli/tx.go | 23 +++-- x/gov/module.go | 24 +++-- x/upgrade/client/cli/parse.go | 73 ++++++++++++++++ x/upgrade/client/cli/tx.go | 126 ++++++++++++++++++++------- x/upgrade/client/proposal_handler.go | 1 + 6 files changed, 202 insertions(+), 49 deletions(-) create mode 100644 x/upgrade/client/cli/parse.go diff --git a/simapp/app.go b/simapp/app.go index 90ac6050df4b..1acc5611fd78 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -64,6 +64,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" "github.com/cosmos/cosmos-sdk/x/gov" + govclient "github.com/cosmos/cosmos-sdk/x/gov/client" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" @@ -115,7 +116,8 @@ var ( mint.AppModuleBasic{}, distr.AppModuleBasic{}, gov.NewAppModuleBasic( - paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.ProposalHandler, upgradeclient.CancelProposalHandler, + []govclient.ProposalHandler{upgradeclient.ProposalHandler}, + []govclient.ProposalHandler{paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.LegacyProposalHandler, upgradeclient.CancelProposalHandler}, ), params.AppModuleBasic{}, crisis.AppModuleBasic{}, diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index 17c3db75e4ee..80368e0036bd 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -27,10 +27,10 @@ const ( // Deprecated: only used for v1beta1 legacy proposals. FlagProposalType = "type" // Deprecated: only used for v1beta1 legacy proposals. - FlagDeposit = "deposit" - flagVoter = "voter" - flagDepositor = "depositor" - flagStatus = "status" + FlagDeposit = "deposit" + flagVoter = "voter" + flagDepositor = "depositor" + flagStatus = "status" // Deprecated: only used for v1beta1 legacy proposals. FlagProposal = "proposal" ) @@ -47,10 +47,11 @@ var ProposalFlags = []string{ // NewTxCmd returns the transaction commands for this module // governance ModuleClient is slightly different from other ModuleClients in that -// it contains a slice of "proposal" child commands. These commands are respective +// it contains a slice of "proposal" child commands and a slice of legacy +// "proposal" child commands. These commands are respective // to proposal type handlers that are implemented in other modules but are mounted // under the governance CLI (eg. parameter change proposals). -func NewTxCmd(propCmds []*cobra.Command) *cobra.Command { +func NewTxCmd(propCmds []*cobra.Command, legacyPropCmds []*cobra.Command) *cobra.Command { govTxCmd := &cobra.Command{ Use: types.ModuleName, Short: "Governance transactions subcommands", @@ -59,8 +60,14 @@ func NewTxCmd(propCmds []*cobra.Command) *cobra.Command { RunE: client.ValidateCmd, } - cmdSubmitLegacyProp := NewCmdSubmitLegacyProposal() + cmdSubmitProp := NewCmdSubmitProposal() for _, propCmd := range propCmds { + flags.AddTxFlagsToCmd(propCmd) + cmdSubmitProp.AddCommand(propCmd) + } + + cmdSubmitLegacyProp := NewCmdSubmitLegacyProposal() + for _, propCmd := range legacyPropCmds { flags.AddTxFlagsToCmd(propCmd) cmdSubmitLegacyProp.AddCommand(propCmd) } @@ -69,7 +76,7 @@ func NewTxCmd(propCmds []*cobra.Command) *cobra.Command { NewCmdDeposit(), NewCmdVote(), NewCmdWeightedVote(), - NewCmdSubmitProposal(), + cmdSubmitProp, cmdSubmitLegacyProp, ) diff --git a/x/gov/module.go b/x/gov/module.go index d3ce2703d09c..afa9cccc6181 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -36,14 +36,16 @@ var ( // AppModuleBasic defines the basic application module used by the gov module. type AppModuleBasic struct { - cdc codec.Codec - proposalHandlers []govclient.ProposalHandler // proposal handlers which live in governance cli and rest + cdc codec.Codec + legacyProposalHandlers []govclient.ProposalHandler // legacy proposal handlers which live in governance cli and rest + proposalHandlers []govclient.ProposalHandler // proposal handlers which live in governance cli and rest } // NewAppModuleBasic creates a new AppModuleBasic object -func NewAppModuleBasic(proposalHandlers ...govclient.ProposalHandler) AppModuleBasic { +func NewAppModuleBasic(proposalHandlers []govclient.ProposalHandler, legacyProposalHandlers []govclient.ProposalHandler) AppModuleBasic { return AppModuleBasic{ - proposalHandlers: proposalHandlers, + proposalHandlers: proposalHandlers, + legacyProposalHandlers: legacyProposalHandlers, } } @@ -91,12 +93,18 @@ func (a AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux // GetTxCmd returns the root tx command for the gov module. func (a AppModuleBasic) GetTxCmd() *cobra.Command { - proposalCLIHandlers := make([]*cobra.Command, 0, len(a.proposalHandlers)) - for _, proposalHandler := range a.proposalHandlers { + proposalCLIHandlers := getProposalCLIHandlers(a.proposalHandlers) + legacyProposalCLIHandlers := getProposalCLIHandlers(a.legacyProposalHandlers) + + return cli.NewTxCmd(proposalCLIHandlers, legacyProposalCLIHandlers) +} + +func getProposalCLIHandlers(handlers []govclient.ProposalHandler) []*cobra.Command { + proposalCLIHandlers := make([]*cobra.Command, 0, len(handlers)) + for _, proposalHandler := range handlers { proposalCLIHandlers = append(proposalCLIHandlers, proposalHandler.CLIHandler()) } - - return cli.NewTxCmd(proposalCLIHandlers) + return proposalCLIHandlers } // GetQueryCmd returns the root query command for the gov module. diff --git a/x/upgrade/client/cli/parse.go b/x/upgrade/client/cli/parse.go new file mode 100644 index 000000000000..cee180f06a11 --- /dev/null +++ b/x/upgrade/client/cli/parse.go @@ -0,0 +1,73 @@ +package cli + +import ( + "encoding/json" + "os" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/gov/client/cli" + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + "github.com/cosmos/cosmos-sdk/x/upgrade/types" + "github.com/spf13/cobra" +) + +// softwareUpgradeProposal defines a software upgrade proposal. +type softwareUpgradeProposal struct { + Plan json.RawMessage + Metadata []byte + Deposit string +} + +func parseSubmitSoftwareUpgradeProposal(cdc codec.Codec, path string) (*types.Plan, []byte, sdk.Coins, error) { + var proposal softwareUpgradeProposal + var plan types.Plan + + contents, err := os.ReadFile(path) + if err != nil { + return nil, nil, nil, err + } + + err = json.Unmarshal(contents, &proposal) + if err != nil { + return nil, nil, nil, err + } + + err = cdc.UnmarshalJSON(proposal.Plan, &plan) + if err != nil { + return nil, nil, nil, err + } + + deposit, err := sdk.ParseCoinsNormalized(proposal.Deposit) + if err != nil { + return nil, nil, nil, err + } + + return &plan, proposal.Metadata, deposit, nil +} + +func parseArgsToContent(cmd *cobra.Command, name string) (gov.Content, error) { + title, err := cmd.Flags().GetString(cli.FlagTitle) + if err != nil { + return nil, err + } + + description, err := cmd.Flags().GetString(cli.FlagDescription) + if err != nil { + return nil, err + } + + height, err := cmd.Flags().GetInt64(FlagUpgradeHeight) + if err != nil { + return nil, err + } + + info, err := cmd.Flags().GetString(FlagUpgradeInfo) + if err != nil { + return nil, err + } + + plan := types.Plan{Name: name, Height: height, Info: info} + content := types.NewSoftwareUpgradeProposal(title, description, plan) + return content, nil +} diff --git a/x/upgrade/client/cli/tx.go b/x/upgrade/client/cli/tx.go index aaafe83b82dc..bac74b9789ef 100644 --- a/x/upgrade/client/cli/tx.go +++ b/x/upgrade/client/cli/tx.go @@ -1,25 +1,31 @@ package cli import ( + "fmt" "os" "path/filepath" + "strings" "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/gov/client/cli" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta2" "github.com/cosmos/cosmos-sdk/x/upgrade/plan" "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) const ( + // Deprecated: only used for v1beta1 legacy proposals. FlagUpgradeHeight = "upgrade-height" - FlagUpgradeInfo = "upgrade-info" - FlagNoValidate = "no-validate" - FlagDaemonName = "daemon-name" + // Deprecated: only used for v1beta1 legacy proposals. + FlagUpgradeInfo = "upgrade-info" + FlagNoValidate = "no-validate" + FlagDaemonName = "daemon-name" ) // GetTxCmd returns the transaction commands for this module @@ -34,6 +40,88 @@ func GetTxCmd() *cobra.Command { // NewCmdSubmitUpgradeProposal implements a command handler for submitting a software upgrade proposal transaction. func NewCmdSubmitUpgradeProposal() *cobra.Command { + cmd := &cobra.Command{ + Use: "software-upgrade [proposal_json_file] [flags]", + Args: cobra.ExactArgs(1), + Short: "Submit a software upgrade proposal", + Long: strings.TrimSpace( + fmt.Sprintf(`Submit a software upgrade along with an initial deposit. +Upgrade plan, metadata and deposit are defined in a JSON file. +Please specify a unique name and height for the upgrade to take effect. +You may include info to reference a binary download link, in a format compatible with: https://github.com/cosmos/cosmos-sdk/tree/master/cosmovisor + +Example: +$ %s tx gov submit-proposal software-upgrade path/to/proposal.json + +Where proposal.json contains: + +{ + "plan": [ + { + "name": "upgrade name", + "height": "123...", + "info": "a7fb1..." + } + ], + "metadata: "4pIMOgIGx1vZGU=", // base64-encoded metadata + "deposit": "10stake" +} +`, version.AppName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + upgradePlan, metadata, deposit, err := parseSubmitSoftwareUpgradeProposal(clientCtx.Codec, args[0]) + if err != nil { + return err + } + + noValidate, err := cmd.Flags().GetBool(FlagNoValidate) + if err != nil { + return err + } + if !noValidate { + var daemonName string + if daemonName, err = cmd.Flags().GetString(FlagDaemonName); err != nil { + return err + } + var planInfo *plan.Info + if planInfo, err = plan.ParseInfo(upgradePlan.Info); err != nil { + return err + } + if err = planInfo.ValidateFull(daemonName); err != nil { + return err + } + } + + msgs := []sdk.Msg{ + &types.MsgSoftwareUpgrade{ + Authority: "", + Plan: *upgradePlan, + }, + } + + msg, err := v1beta2.NewMsgSubmitProposal(msgs, deposit, clientCtx.GetFromAddress().String(), metadata) + if err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + cmd.Flags().Bool(FlagNoValidate, false, "Skip validation of the upgrade info") + cmd.Flags().String(FlagDaemonName, getDefaultDaemonName(), "The name of the executable being upgraded (for upgrade-info validation). Default is the DAEMON_NAME env var if set, or else this executable") + + return cmd +} + +// NewCmdSubmitLegacyUpgradeProposal implements a command handler for submitting a software upgrade proposal transaction. +// Deprecated: please use NewCmdSubmitUpgradeProposal instead. +func NewCmdSubmitLegacyUpgradeProposal() *cobra.Command { cmd := &cobra.Command{ Use: "software-upgrade [name] (--upgrade-height [height]) (--upgrade-info [info]) [flags]", Args: cobra.ExactArgs(1), @@ -81,7 +169,7 @@ func NewCmdSubmitUpgradeProposal() *cobra.Command { return err } - msg, err := gov.NewMsgSubmitProposal(content, deposit, from) + msg, err := v1beta1.NewMsgSubmitProposal(content, deposit, from) if err != nil { return err } @@ -137,7 +225,7 @@ func NewCmdSubmitCancelUpgradeProposal() *cobra.Command { content := types.NewCancelSoftwareUpgradeProposal(title, description) - msg, err := gov.NewMsgSubmitProposal(content, deposit, from) + msg, err := v1beta1.NewMsgSubmitProposal(content, deposit, from) if err != nil { return err } @@ -155,32 +243,6 @@ func NewCmdSubmitCancelUpgradeProposal() *cobra.Command { return cmd } -func parseArgsToContent(cmd *cobra.Command, name string) (gov.Content, error) { - title, err := cmd.Flags().GetString(cli.FlagTitle) - if err != nil { - return nil, err - } - - description, err := cmd.Flags().GetString(cli.FlagDescription) - if err != nil { - return nil, err - } - - height, err := cmd.Flags().GetInt64(FlagUpgradeHeight) - if err != nil { - return nil, err - } - - info, err := cmd.Flags().GetString(FlagUpgradeInfo) - if err != nil { - return nil, err - } - - plan := types.Plan{Name: name, Height: height, Info: info} - content := types.NewSoftwareUpgradeProposal(title, description, plan) - return content, nil -} - // getDefaultDaemonName gets the default name to use for the daemon. // If a DAEMON_NAME env var is set, that is used. // Otherwise, the last part of the currently running executable is used. diff --git a/x/upgrade/client/proposal_handler.go b/x/upgrade/client/proposal_handler.go index 048d75295c14..59ccc878a614 100644 --- a/x/upgrade/client/proposal_handler.go +++ b/x/upgrade/client/proposal_handler.go @@ -6,4 +6,5 @@ import ( ) var ProposalHandler = govclient.NewProposalHandler(cli.NewCmdSubmitUpgradeProposal) +var LegacyProposalHandler = govclient.NewProposalHandler(cli.NewCmdSubmitLegacyUpgradeProposal) var CancelProposalHandler = govclient.NewProposalHandler(cli.NewCmdSubmitCancelUpgradeProposal) From ad36272c03609fd11a8e51786298912ab3477f0c Mon Sep 17 00:00:00 2001 From: blushi Date: Fri, 4 Feb 2022 14:18:57 +0100 Subject: [PATCH 04/19] Add parse tests --- x/upgrade/client/cli/parse_test.go | 58 ++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 x/upgrade/client/cli/parse_test.go diff --git a/x/upgrade/client/cli/parse_test.go b/x/upgrade/client/cli/parse_test.go new file mode 100644 index 000000000000..17e90fa44eb6 --- /dev/null +++ b/x/upgrade/client/cli/parse_test.go @@ -0,0 +1,58 @@ +package cli + +import ( + "encoding/base64" + "fmt" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/testutil" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/upgrade/types" +) + +func TestParseSubmitSoftwareUpgradeProposal(t *testing.T) { + interfaceRegistry := codectypes.NewInterfaceRegistry() + cdc := codec.NewProtoCodec(interfaceRegistry) + expectedMetadata := []byte{42} + expectedPlan := &types.Plan{ + Name: "example", + Height: 123450000, + } + + okJSON := testutil.WriteToNewTempFile(t, fmt.Sprintf(` +{ + "plan": { + "name": "%s", + "height": %d + }, + "metadata": "%s", + "deposit": "1000test" +} +`, expectedPlan.Name, expectedPlan.Height, base64.StdEncoding.EncodeToString(expectedMetadata))) + + badJSON := testutil.WriteToNewTempFile(t, "bad json") + + // nonexistent json + _, _, _, err := parseSubmitSoftwareUpgradeProposal(cdc, "fileDoesNotExist") + require.Error(t, err) + + // invalid json + _, _, _, err = parseSubmitSoftwareUpgradeProposal(cdc, badJSON.Name()) + require.Error(t, err) + + // ok json + upgradePlan, metadata, deposit, err := parseSubmitSoftwareUpgradeProposal(cdc, okJSON.Name()) + require.NoError(t, err, "unexpected error") + require.Equal(t, sdk.NewCoins(sdk.NewCoin("test", sdk.NewInt(1000))), deposit) + require.Equal(t, expectedMetadata, metadata) + require.Equal(t, upgradePlan, expectedPlan) + + err = okJSON.Close() + require.Nil(t, err, "unexpected error") + err = badJSON.Close() + require.Nil(t, err, "unexpected error") +} From 8216437e122574508765e7ad374e2d779740b0c7 Mon Sep 17 00:00:00 2001 From: blushi Date: Fri, 4 Feb 2022 14:26:59 +0100 Subject: [PATCH 05/19] Add changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index deaaa63f5986..af49c9a8f803 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features +* (x/upgrade) [\#11116](https://github.com/cosmos/cosmos-sdk/pull/11116) A new `MsgSoftwareUpgrade` has been added to support v1beta2 msgs-based gov proposals. * [\#10977](https://github.com/cosmos/cosmos-sdk/pull/10977) Now every cosmos message protobuf definition must be extended with a ``cosmos.msg.v1.signer`` option to signal the signer fields in a language agnostic way. * [\#10710](https://github.com/cosmos/cosmos-sdk/pull/10710) Chain-id shouldn't be required for creating a transaction with both --generate-only and --offline flags. * [\#10703](https://github.com/cosmos/cosmos-sdk/pull/10703) Create a new grantee account, if the grantee of an authorization does not exist. @@ -63,6 +64,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (gov) [\#11036](https://github.com/cosmos/cosmos-sdk/pull/11036) Add in-place migrations for 0.43->0.46. Add a `migrate v0.46` CLI command for v0.43->0.46 JSON genesis migration. ### API Breaking Changes +* (x/gov) [\#11116](https://github.com/cosmos/cosmos-sdk/pull/11116) The `NewAppModuleBasic` function now accepts both msgs-based proposal CLI handlers and legacy content-based proposal CLI handlers as arguments. * [\#10950](https://github.com/cosmos/cosmos-sdk/pull/10950) Add `envPrefix` parameter to `cmd.Execute`. * (x/mint) [\#10441](https://github.com/cosmos/cosmos-sdk/pull/10441) The `NewAppModule` function now accepts an inflation calculation function as an argument. * [\#10295](https://github.com/cosmos/cosmos-sdk/pull/10295) Remove store type aliases from /types From 3e606b28a7ee59920d5078d4eda3100e30cdc89d Mon Sep 17 00:00:00 2001 From: Marie Gauthier Date: Wed, 9 Feb 2022 15:23:36 +0100 Subject: [PATCH 06/19] Update proto/cosmos/upgrade/v1beta1/tx.proto Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com> --- proto/cosmos/upgrade/v1beta1/tx.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/cosmos/upgrade/v1beta1/tx.proto b/proto/cosmos/upgrade/v1beta1/tx.proto index a509b355deba..1efc838fec3d 100644 --- a/proto/cosmos/upgrade/v1beta1/tx.proto +++ b/proto/cosmos/upgrade/v1beta1/tx.proto @@ -16,7 +16,7 @@ service Msg { // MsgSoftwareUpgrade is the Msg/MsgSoftwareUpgrade request type. message MsgSoftwareUpgrade { - option (cosmos.msg.v1.signer) = "adminauthority"; + option (cosmos.msg.v1.signer) = "authority"; // authority is the address of the governance account. string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; From 3845818831d62c6c3020b789725e950e8b442b99 Mon Sep 17 00:00:00 2001 From: Marie Gauthier Date: Wed, 9 Feb 2022 15:23:44 +0100 Subject: [PATCH 07/19] Update proto/cosmos/upgrade/v1beta1/tx.proto Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com> --- proto/cosmos/upgrade/v1beta1/tx.proto | 2 ++ 1 file changed, 2 insertions(+) diff --git a/proto/cosmos/upgrade/v1beta1/tx.proto b/proto/cosmos/upgrade/v1beta1/tx.proto index 1efc838fec3d..bceb1fb392f2 100644 --- a/proto/cosmos/upgrade/v1beta1/tx.proto +++ b/proto/cosmos/upgrade/v1beta1/tx.proto @@ -11,6 +11,8 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/upgrade/types"; // Msg defines the upgrade Msg service. service Msg { // SoftwareUpgrade is a governance operation for initiating a software upgrade. + // + // Since: cosmos-sdk 0.46 rpc SoftwareUpgrade(MsgSoftwareUpgrade) returns (MsgSoftwareUpgradeResponse); } From be03a49444aa66381b44933b8e92c66d64832e59 Mon Sep 17 00:00:00 2001 From: blushi Date: Wed, 9 Feb 2022 15:31:28 +0100 Subject: [PATCH 08/19] make proto-gen --- api/cosmos/upgrade/v1beta1/tx.pulsar.go | 54 ++++++++++++------------ api/cosmos/upgrade/v1beta1/tx_grpc.pb.go | 4 ++ x/upgrade/types/tx.pb.go | 25 ++++++----- 3 files changed, 45 insertions(+), 38 deletions(-) diff --git a/api/cosmos/upgrade/v1beta1/tx.pulsar.go b/api/cosmos/upgrade/v1beta1/tx.pulsar.go index 056c54dac661..ac734e2817f1 100644 --- a/api/cosmos/upgrade/v1beta1/tx.pulsar.go +++ b/api/cosmos/upgrade/v1beta1/tx.pulsar.go @@ -969,7 +969,7 @@ var file_cosmos_upgrade_v1beta1_tx_proto_rawDesc = []byte{ 0x6f, 0x73, 0x2f, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, - 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x99, 0x01, 0x0a, 0x12, 0x4d, 0x73, + 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x94, 0x01, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 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, @@ -978,32 +978,32 @@ var file_cosmos_upgrade_v1beta1_tx_proto_rawDesc = []byte{ 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x6c, 0x61, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x04, 0x70, 0x6c, 0x61, 0x6e, - 0x3a, 0x13, 0x82, 0xe7, 0xb0, 0x2a, 0x0e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x61, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x1c, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x53, 0x6f, 0x66, 0x74, - 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x32, 0x78, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x71, 0x0a, 0x0f, 0x53, 0x6f, - 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x12, 0x2a, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, - 0x72, 0x65, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x1a, 0x32, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, - 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xe7, 0x01, - 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, - 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2f, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x3b, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, - 0x02, 0x03, 0x43, 0x55, 0x58, 0xaa, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x55, - 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, - 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x5c, - 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x5c, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 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, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x3a, 0x3a, - 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, + 0x22, 0x1c, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x55, + 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x78, + 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x71, 0x0a, 0x0f, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, + 0x65, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x12, 0x2a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x67, + 0x72, 0x61, 0x64, 0x65, 0x1a, 0x32, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, + 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, + 0x67, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xe7, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x75, 0x70, 0x67, 0x72, + 0x61, 0x64, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x75, 0x70, 0x67, 0x72, + 0x61, 0x64, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x55, 0x58, + 0xaa, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, + 0x65, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x5c, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0xe2, 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x55, 0x70, 0x67, 0x72, + 0x61, 0x64, 0x65, 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, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/cosmos/upgrade/v1beta1/tx_grpc.pb.go b/api/cosmos/upgrade/v1beta1/tx_grpc.pb.go index 5a5d916a8380..984de35fafcd 100644 --- a/api/cosmos/upgrade/v1beta1/tx_grpc.pb.go +++ b/api/cosmos/upgrade/v1beta1/tx_grpc.pb.go @@ -23,6 +23,8 @@ const _ = grpc.SupportPackageIsVersion7 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type MsgClient interface { // SoftwareUpgrade is a governance operation for initiating a software upgrade. + // + // Since: cosmos-sdk 0.46 SoftwareUpgrade(ctx context.Context, in *MsgSoftwareUpgrade, opts ...grpc.CallOption) (*MsgSoftwareUpgradeResponse, error) } @@ -48,6 +50,8 @@ func (c *msgClient) SoftwareUpgrade(ctx context.Context, in *MsgSoftwareUpgrade, // for forward compatibility type MsgServer interface { // SoftwareUpgrade is a governance operation for initiating a software upgrade. + // + // Since: cosmos-sdk 0.46 SoftwareUpgrade(context.Context, *MsgSoftwareUpgrade) (*MsgSoftwareUpgradeResponse, error) mustEmbedUnimplementedMsgServer() } diff --git a/x/upgrade/types/tx.pb.go b/x/upgrade/types/tx.pb.go index 93ed4a963983..4693d5db77a7 100644 --- a/x/upgrade/types/tx.pb.go +++ b/x/upgrade/types/tx.pb.go @@ -130,28 +130,27 @@ func init() { func init() { proto.RegisterFile("cosmos/upgrade/v1beta1/tx.proto", fileDescriptor_2852c16e3ab79fef) } var fileDescriptor_2852c16e3ab79fef = []byte{ - // 323 bytes of a gzipped FileDescriptorProto + // 317 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0x2f, 0x2d, 0x48, 0x2f, 0x4a, 0x4c, 0x49, 0xd5, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x83, 0x28, 0xd0, 0x83, 0x2a, 0xd0, 0x83, 0x2a, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, 0xd1, 0x07, 0xb1, 0x20, 0xaa, 0xa5, 0x24, 0x21, 0xaa, 0xe3, 0x21, 0x12, 0x50, 0xad, 0x10, 0x29, 0x15, 0x1c, 0x36, 0xc1, 0x0c, 0x86, 0xa8, 0x12, 0x87, 0xaa, 0xca, 0x2d, 0x4e, 0xd7, 0x2f, 0x33, 0x04, 0x51, 0x10, - 0x09, 0xa5, 0x99, 0x8c, 0x5c, 0x42, 0xbe, 0xc5, 0xe9, 0xc1, 0xf9, 0x69, 0x25, 0xe5, 0x89, 0x45, + 0x09, 0xa5, 0x29, 0x8c, 0x5c, 0x42, 0xbe, 0xc5, 0xe9, 0xc1, 0xf9, 0x69, 0x25, 0xe5, 0x89, 0x45, 0xa9, 0xa1, 0x10, 0x5d, 0x42, 0x66, 0x5c, 0x9c, 0x89, 0xa5, 0x25, 0x19, 0xf9, 0x45, 0x99, 0x25, 0x95, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x4e, 0x12, 0x97, 0xb6, 0xe8, 0x8a, 0x40, 0xad, 0x76, 0x4c, 0x49, 0x29, 0x4a, 0x2d, 0x2e, 0x0e, 0x2e, 0x29, 0xca, 0xcc, 0x4b, 0x0f, 0x42, 0x28, 0x15, 0x32, 0xe3, 0x62, 0x29, 0xc8, 0x49, 0xcc, 0x93, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x36, 0x92, 0xd1, 0xc3, 0xee, 0x4b, 0xbd, 0x80, 0x9c, 0xc4, 0x3c, 0x27, 0x96, 0x13, 0xf7, 0xe4, 0x19, 0x82, 0xc0, - 0xea, 0xad, 0x84, 0x9b, 0x9e, 0x6f, 0xd0, 0xe2, 0x4b, 0x4c, 0xc9, 0xcd, 0xcc, 0x83, 0x1b, 0xa6, - 0x24, 0xc3, 0x25, 0x85, 0xe9, 0xb4, 0xa0, 0xd4, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0xa3, 0x0a, - 0x2e, 0x66, 0xdf, 0xe2, 0x74, 0xa1, 0x42, 0x2e, 0x7e, 0x74, 0xc7, 0x6b, 0xe1, 0xb2, 0x16, 0xd3, - 0x34, 0x29, 0x23, 0xe2, 0xd5, 0xc2, 0x6c, 0x76, 0x72, 0x3b, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, - 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, - 0x63, 0x39, 0x86, 0x28, 0x9d, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x68, - 0x2c, 0x41, 0x29, 0xdd, 0xe2, 0x94, 0x6c, 0xfd, 0x0a, 0x78, 0x24, 0x95, 0x54, 0x16, 0xa4, 0x16, - 0x27, 0xb1, 0x81, 0xa3, 0xc0, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x30, 0xd0, 0xe7, 0x5d, 0x2d, - 0x02, 0x00, 0x00, + 0xea, 0xad, 0xf8, 0x9a, 0x9e, 0x6f, 0xd0, 0x42, 0x98, 0xa3, 0x24, 0xc3, 0x25, 0x85, 0xe9, 0xaa, + 0xa0, 0xd4, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0xa3, 0x0a, 0x2e, 0x66, 0xdf, 0xe2, 0x74, 0xa1, + 0x42, 0x2e, 0x7e, 0x74, 0x77, 0x6b, 0xe1, 0xb2, 0x11, 0xd3, 0x34, 0x29, 0x23, 0xe2, 0xd5, 0xc2, + 0x6c, 0x76, 0x72, 0x3b, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, + 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x9d, 0xf4, + 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x68, 0x04, 0x41, 0x29, 0xdd, 0xe2, 0x94, + 0x6c, 0xfd, 0x0a, 0x78, 0xfc, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x43, 0xdf, 0x18, + 0x10, 0x00, 0x00, 0xff, 0xff, 0x40, 0xd1, 0x2d, 0x6e, 0x28, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -167,6 +166,8 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { // SoftwareUpgrade is a governance operation for initiating a software upgrade. + // + // Since: cosmos-sdk 0.46 SoftwareUpgrade(ctx context.Context, in *MsgSoftwareUpgrade, opts ...grpc.CallOption) (*MsgSoftwareUpgradeResponse, error) } @@ -190,6 +191,8 @@ func (c *msgClient) SoftwareUpgrade(ctx context.Context, in *MsgSoftwareUpgrade, // MsgServer is the server API for Msg service. type MsgServer interface { // SoftwareUpgrade is a governance operation for initiating a software upgrade. + // + // Since: cosmos-sdk 0.46 SoftwareUpgrade(context.Context, *MsgSoftwareUpgrade) (*MsgSoftwareUpgradeResponse, error) } From 30dccb0f5cf66388d724d6c36325d3f48272d7a7 Mon Sep 17 00:00:00 2001 From: Amaury M <1293565+amaurym@users.noreply.github.com> Date: Tue, 15 Feb 2022 12:07:31 +0100 Subject: [PATCH 09/19] Add CancelUpgrade message --- api/cosmos/group/v1beta1/types.pulsar.go | 2 +- api/cosmos/upgrade/v1beta1/tx.pulsar.go | 956 ++++++++++++++++++++- api/cosmos/upgrade/v1beta1/tx_grpc.pb.go | 44 + proto/cosmos/upgrade/v1beta1/tx.proto | 30 +- proto/cosmos/upgrade/v1beta1/upgrade.proto | 6 + simapp/app.go | 4 +- x/group/types.pb.go | 2 +- x/upgrade/client/cli/tx.go | 10 +- x/upgrade/client/proposal_handler.go | 4 +- x/upgrade/keeper/msg_server.go | 24 + x/upgrade/spec/01_concepts.md | 22 +- x/upgrade/types/codec.go | 2 + x/upgrade/types/msgs.go | 30 +- x/upgrade/types/msgs_test.go | 39 + x/upgrade/types/tx.pb.go | 367 +++++++- x/upgrade/types/upgrade.pb.go | 68 +- 16 files changed, 1512 insertions(+), 98 deletions(-) diff --git a/api/cosmos/group/v1beta1/types.pulsar.go b/api/cosmos/group/v1beta1/types.pulsar.go index 0df890979c9c..f9160f288dea 100644 --- a/api/cosmos/group/v1beta1/types.pulsar.go +++ b/api/cosmos/group/v1beta1/types.pulsar.go @@ -7401,7 +7401,7 @@ type Proposal struct { // has ended. FinalTallyResult *TallyResult `protobuf:"bytes,10,opt,name=final_tally_result,json=finalTallyResult,proto3" json:"final_tally_result,omitempty"` // timeout is the timestamp before which both voting and execution must be - // done. If this timestamp is passed, then the proposal can not be executed + // done. If this timestamp is passed, then the proposal cannot be executed // anymore and should be considered pending delete. This timestamp is checked // against the block header's timestamp. Timeout *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=timeout,proto3" json:"timeout,omitempty"` diff --git a/api/cosmos/upgrade/v1beta1/tx.pulsar.go b/api/cosmos/upgrade/v1beta1/tx.pulsar.go index ac734e2817f1..a042d5c25772 100644 --- a/api/cosmos/upgrade/v1beta1/tx.pulsar.go +++ b/api/cosmos/upgrade/v1beta1/tx.pulsar.go @@ -870,6 +870,782 @@ func (x *fastReflection_MsgSoftwareUpgradeResponse) ProtoMethods() *protoiface.M } } +var ( + md_MsgCancelUpgrade protoreflect.MessageDescriptor + fd_MsgCancelUpgrade_authority protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_upgrade_v1beta1_tx_proto_init() + md_MsgCancelUpgrade = File_cosmos_upgrade_v1beta1_tx_proto.Messages().ByName("MsgCancelUpgrade") + fd_MsgCancelUpgrade_authority = md_MsgCancelUpgrade.Fields().ByName("authority") +} + +var _ protoreflect.Message = (*fastReflection_MsgCancelUpgrade)(nil) + +type fastReflection_MsgCancelUpgrade MsgCancelUpgrade + +func (x *MsgCancelUpgrade) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCancelUpgrade)(x) +} + +func (x *MsgCancelUpgrade) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_upgrade_v1beta1_tx_proto_msgTypes[2] + 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_MsgCancelUpgrade_messageType fastReflection_MsgCancelUpgrade_messageType +var _ protoreflect.MessageType = fastReflection_MsgCancelUpgrade_messageType{} + +type fastReflection_MsgCancelUpgrade_messageType struct{} + +func (x fastReflection_MsgCancelUpgrade_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCancelUpgrade)(nil) +} +func (x fastReflection_MsgCancelUpgrade_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCancelUpgrade) +} +func (x fastReflection_MsgCancelUpgrade_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCancelUpgrade +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgCancelUpgrade) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCancelUpgrade +} + +// 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_MsgCancelUpgrade) Type() protoreflect.MessageType { + return _fastReflection_MsgCancelUpgrade_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgCancelUpgrade) New() protoreflect.Message { + return new(fastReflection_MsgCancelUpgrade) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgCancelUpgrade) Interface() protoreflect.ProtoMessage { + return (*MsgCancelUpgrade)(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_MsgCancelUpgrade) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgCancelUpgrade_authority, 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_MsgCancelUpgrade) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.upgrade.v1beta1.MsgCancelUpgrade.authority": + return x.Authority != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.MsgCancelUpgrade")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgCancelUpgrade 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_MsgCancelUpgrade) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.upgrade.v1beta1.MsgCancelUpgrade.authority": + x.Authority = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.MsgCancelUpgrade")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgCancelUpgrade 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_MsgCancelUpgrade) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.upgrade.v1beta1.MsgCancelUpgrade.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.MsgCancelUpgrade")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgCancelUpgrade 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_MsgCancelUpgrade) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.upgrade.v1beta1.MsgCancelUpgrade.authority": + x.Authority = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.MsgCancelUpgrade")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgCancelUpgrade 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_MsgCancelUpgrade) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.upgrade.v1beta1.MsgCancelUpgrade.authority": + panic(fmt.Errorf("field authority of message cosmos.upgrade.v1beta1.MsgCancelUpgrade is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.MsgCancelUpgrade")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgCancelUpgrade 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_MsgCancelUpgrade) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.upgrade.v1beta1.MsgCancelUpgrade.authority": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.MsgCancelUpgrade")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgCancelUpgrade 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_MsgCancelUpgrade) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.upgrade.v1beta1.MsgCancelUpgrade", 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_MsgCancelUpgrade) 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_MsgCancelUpgrade) 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_MsgCancelUpgrade) 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_MsgCancelUpgrade) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgCancelUpgrade) + 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.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().(*MsgCancelUpgrade) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.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().(*MsgCancelUpgrade) + 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: MsgCancelUpgrade: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCancelUpgrade: 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 + 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_MsgCancelUpgradeResponse protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_upgrade_v1beta1_tx_proto_init() + md_MsgCancelUpgradeResponse = File_cosmos_upgrade_v1beta1_tx_proto.Messages().ByName("MsgCancelUpgradeResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgCancelUpgradeResponse)(nil) + +type fastReflection_MsgCancelUpgradeResponse MsgCancelUpgradeResponse + +func (x *MsgCancelUpgradeResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCancelUpgradeResponse)(x) +} + +func (x *MsgCancelUpgradeResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_upgrade_v1beta1_tx_proto_msgTypes[3] + 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_MsgCancelUpgradeResponse_messageType fastReflection_MsgCancelUpgradeResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgCancelUpgradeResponse_messageType{} + +type fastReflection_MsgCancelUpgradeResponse_messageType struct{} + +func (x fastReflection_MsgCancelUpgradeResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCancelUpgradeResponse)(nil) +} +func (x fastReflection_MsgCancelUpgradeResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCancelUpgradeResponse) +} +func (x fastReflection_MsgCancelUpgradeResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCancelUpgradeResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgCancelUpgradeResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCancelUpgradeResponse +} + +// 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_MsgCancelUpgradeResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgCancelUpgradeResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgCancelUpgradeResponse) New() protoreflect.Message { + return new(fastReflection_MsgCancelUpgradeResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgCancelUpgradeResponse) Interface() protoreflect.ProtoMessage { + return (*MsgCancelUpgradeResponse)(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_MsgCancelUpgradeResponse) 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_MsgCancelUpgradeResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse 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_MsgCancelUpgradeResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse 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_MsgCancelUpgradeResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse 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_MsgCancelUpgradeResponse) 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.upgrade.v1beta1.MsgCancelUpgradeResponse")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse 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_MsgCancelUpgradeResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse 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_MsgCancelUpgradeResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse 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_MsgCancelUpgradeResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse", 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_MsgCancelUpgradeResponse) 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_MsgCancelUpgradeResponse) 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_MsgCancelUpgradeResponse) 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_MsgCancelUpgradeResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgCancelUpgradeResponse) + 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().(*MsgCancelUpgradeResponse) + 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().(*MsgCancelUpgradeResponse) + 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: MsgCancelUpgradeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCancelUpgradeResponse: 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 @@ -883,7 +1659,9 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// MsgSoftwareUpgrade is the Msg/MsgSoftwareUpgrade request type. +// MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. +// +// Since: cosmos-sdk 0.46 type MsgSoftwareUpgrade struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -929,7 +1707,9 @@ func (x *MsgSoftwareUpgrade) GetPlan() *Plan { return nil } -// MsgSoftwareUpgradeResponse is the Msg/MsgSoftwareUpgrade response type. +// MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. +// +// Since: cosmos-sdk 0.46 type MsgSoftwareUpgradeResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -956,6 +1736,74 @@ func (*MsgSoftwareUpgradeResponse) Descriptor() ([]byte, []int) { return file_cosmos_upgrade_v1beta1_tx_proto_rawDescGZIP(), []int{1} } +// MsgCancelUpgrade is the Msg/CancelUpgrade request type. +// +// Since: cosmos-sdk 0.46 +type MsgCancelUpgrade 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"` +} + +func (x *MsgCancelUpgrade) Reset() { + *x = MsgCancelUpgrade{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_upgrade_v1beta1_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgCancelUpgrade) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgCancelUpgrade) ProtoMessage() {} + +// Deprecated: Use MsgCancelUpgrade.ProtoReflect.Descriptor instead. +func (*MsgCancelUpgrade) Descriptor() ([]byte, []int) { + return file_cosmos_upgrade_v1beta1_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgCancelUpgrade) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +// MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. +// +// Since: cosmos-sdk 0.46 +type MsgCancelUpgradeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgCancelUpgradeResponse) Reset() { + *x = MsgCancelUpgradeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_upgrade_v1beta1_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgCancelUpgradeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgCancelUpgradeResponse) ProtoMessage() {} + +// Deprecated: Use MsgCancelUpgradeResponse.ProtoReflect.Descriptor instead. +func (*MsgCancelUpgradeResponse) Descriptor() ([]byte, []int) { + return file_cosmos_upgrade_v1beta1_tx_proto_rawDescGZIP(), []int{3} +} + var File_cosmos_upgrade_v1beta1_tx_proto protoreflect.FileDescriptor var file_cosmos_upgrade_v1beta1_tx_proto_rawDesc = []byte{ @@ -980,30 +1828,44 @@ var file_cosmos_upgrade_v1beta1_tx_proto_rawDesc = []byte{ 0x50, 0x6c, 0x61, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x04, 0x70, 0x6c, 0x61, 0x6e, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x1c, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x55, - 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x78, - 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x71, 0x0a, 0x0f, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, - 0x65, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x12, 0x2a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x67, - 0x72, 0x61, 0x64, 0x65, 0x1a, 0x32, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, - 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, - 0x67, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xe7, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, - 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x75, 0x70, 0x67, 0x72, - 0x61, 0x64, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x75, 0x70, 0x67, 0x72, - 0x61, 0x64, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x55, 0x58, - 0xaa, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, - 0x65, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x5c, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0xe2, 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x55, 0x70, 0x67, 0x72, - 0x61, 0x64, 0x65, 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, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x5a, + 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x55, 0x70, 0x67, 0x72, 0x61, + 0x64, 0x65, 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, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, + 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x1a, 0x0a, 0x18, 0x4d, 0x73, + 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xe5, 0x01, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x71, + 0x0a, 0x0f, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, + 0x65, 0x12, 0x2a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, + 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x6f, + 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x1a, 0x32, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, + 0x72, 0x65, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x6b, 0x0a, 0x0d, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x55, 0x70, 0x67, 0x72, 0x61, + 0x64, 0x65, 0x12, 0x28, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, + 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, + 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x1a, 0x30, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x55, + 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xe7, + 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, + 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, + 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2f, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x3b, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0xa2, 0x02, 0x03, 0x43, 0x55, 0x58, 0xaa, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, + 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, + 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x5c, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 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, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x3a, + 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1018,18 +1880,22 @@ func file_cosmos_upgrade_v1beta1_tx_proto_rawDescGZIP() []byte { return file_cosmos_upgrade_v1beta1_tx_proto_rawDescData } -var file_cosmos_upgrade_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_cosmos_upgrade_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_cosmos_upgrade_v1beta1_tx_proto_goTypes = []interface{}{ (*MsgSoftwareUpgrade)(nil), // 0: cosmos.upgrade.v1beta1.MsgSoftwareUpgrade (*MsgSoftwareUpgradeResponse)(nil), // 1: cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse - (*Plan)(nil), // 2: cosmos.upgrade.v1beta1.Plan + (*MsgCancelUpgrade)(nil), // 2: cosmos.upgrade.v1beta1.MsgCancelUpgrade + (*MsgCancelUpgradeResponse)(nil), // 3: cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse + (*Plan)(nil), // 4: cosmos.upgrade.v1beta1.Plan } var file_cosmos_upgrade_v1beta1_tx_proto_depIdxs = []int32{ - 2, // 0: cosmos.upgrade.v1beta1.MsgSoftwareUpgrade.plan:type_name -> cosmos.upgrade.v1beta1.Plan + 4, // 0: cosmos.upgrade.v1beta1.MsgSoftwareUpgrade.plan:type_name -> cosmos.upgrade.v1beta1.Plan 0, // 1: cosmos.upgrade.v1beta1.Msg.SoftwareUpgrade:input_type -> cosmos.upgrade.v1beta1.MsgSoftwareUpgrade - 1, // 2: cosmos.upgrade.v1beta1.Msg.SoftwareUpgrade:output_type -> cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse - 2, // [2:3] is the sub-list for method output_type - 1, // [1:2] is the sub-list for method input_type + 2, // 2: cosmos.upgrade.v1beta1.Msg.CancelUpgrade:input_type -> cosmos.upgrade.v1beta1.MsgCancelUpgrade + 1, // 3: cosmos.upgrade.v1beta1.Msg.SoftwareUpgrade:output_type -> cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse + 3, // 4: cosmos.upgrade.v1beta1.Msg.CancelUpgrade:output_type -> cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse + 3, // [3:5] is the sub-list for method output_type + 1, // [1:3] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name 1, // [1:1] is the sub-list for extension extendee 0, // [0:1] is the sub-list for field type_name @@ -1066,6 +1932,30 @@ func file_cosmos_upgrade_v1beta1_tx_proto_init() { return nil } } + file_cosmos_upgrade_v1beta1_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgCancelUpgrade); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_upgrade_v1beta1_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgCancelUpgradeResponse); 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{ @@ -1073,7 +1963,7 @@ func file_cosmos_upgrade_v1beta1_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_upgrade_v1beta1_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 2, + NumMessages: 4, NumExtensions: 0, NumServices: 1, }, diff --git a/api/cosmos/upgrade/v1beta1/tx_grpc.pb.go b/api/cosmos/upgrade/v1beta1/tx_grpc.pb.go index 984de35fafcd..4fb877813eb7 100644 --- a/api/cosmos/upgrade/v1beta1/tx_grpc.pb.go +++ b/api/cosmos/upgrade/v1beta1/tx_grpc.pb.go @@ -26,6 +26,11 @@ type MsgClient interface { // // Since: cosmos-sdk 0.46 SoftwareUpgrade(ctx context.Context, in *MsgSoftwareUpgrade, opts ...grpc.CallOption) (*MsgSoftwareUpgradeResponse, error) + // CancelUpgrade is a governance operation for cancelling a previously + // approvid software upgrade. + // + // Since: cosmos-sdk 0.46 + CancelUpgrade(ctx context.Context, in *MsgCancelUpgrade, opts ...grpc.CallOption) (*MsgCancelUpgradeResponse, error) } type msgClient struct { @@ -45,6 +50,15 @@ func (c *msgClient) SoftwareUpgrade(ctx context.Context, in *MsgSoftwareUpgrade, return out, nil } +func (c *msgClient) CancelUpgrade(ctx context.Context, in *MsgCancelUpgrade, opts ...grpc.CallOption) (*MsgCancelUpgradeResponse, error) { + out := new(MsgCancelUpgradeResponse) + err := c.cc.Invoke(ctx, "/cosmos.upgrade.v1beta1.Msg/CancelUpgrade", 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 @@ -53,6 +67,11 @@ type MsgServer interface { // // Since: cosmos-sdk 0.46 SoftwareUpgrade(context.Context, *MsgSoftwareUpgrade) (*MsgSoftwareUpgradeResponse, error) + // CancelUpgrade is a governance operation for cancelling a previously + // approvid software upgrade. + // + // Since: cosmos-sdk 0.46 + CancelUpgrade(context.Context, *MsgCancelUpgrade) (*MsgCancelUpgradeResponse, error) mustEmbedUnimplementedMsgServer() } @@ -63,6 +82,9 @@ type UnimplementedMsgServer struct { func (UnimplementedMsgServer) SoftwareUpgrade(context.Context, *MsgSoftwareUpgrade) (*MsgSoftwareUpgradeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SoftwareUpgrade not implemented") } +func (UnimplementedMsgServer) CancelUpgrade(context.Context, *MsgCancelUpgrade) (*MsgCancelUpgradeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CancelUpgrade not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. @@ -94,6 +116,24 @@ func _Msg_SoftwareUpgrade_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _Msg_CancelUpgrade_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCancelUpgrade) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CancelUpgrade(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.upgrade.v1beta1.Msg/CancelUpgrade", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CancelUpgrade(ctx, req.(*MsgCancelUpgrade)) + } + 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) @@ -105,6 +145,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "SoftwareUpgrade", Handler: _Msg_SoftwareUpgrade_Handler, }, + { + MethodName: "CancelUpgrade", + Handler: _Msg_CancelUpgrade_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/upgrade/v1beta1/tx.proto", diff --git a/proto/cosmos/upgrade/v1beta1/tx.proto b/proto/cosmos/upgrade/v1beta1/tx.proto index bceb1fb392f2..a855edc1b13f 100644 --- a/proto/cosmos/upgrade/v1beta1/tx.proto +++ b/proto/cosmos/upgrade/v1beta1/tx.proto @@ -14,9 +14,16 @@ service Msg { // // Since: cosmos-sdk 0.46 rpc SoftwareUpgrade(MsgSoftwareUpgrade) returns (MsgSoftwareUpgradeResponse); + // CancelUpgrade is a governance operation for cancelling a previously + // approvid software upgrade. + // + // Since: cosmos-sdk 0.46 + rpc CancelUpgrade(MsgCancelUpgrade) returns (MsgCancelUpgradeResponse); } -// MsgSoftwareUpgrade is the Msg/MsgSoftwareUpgrade request type. +// MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. +// +// Since: cosmos-sdk 0.46 message MsgSoftwareUpgrade { option (cosmos.msg.v1.signer) = "authority"; @@ -27,5 +34,22 @@ message MsgSoftwareUpgrade { Plan plan = 2 [(gogoproto.nullable) = false]; } -// MsgSoftwareUpgradeResponse is the Msg/MsgSoftwareUpgrade response type. -message MsgSoftwareUpgradeResponse {} \ No newline at end of file +// MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. +// +// Since: cosmos-sdk 0.46 +message MsgSoftwareUpgradeResponse {} + +// MsgCancelUpgrade is the Msg/CancelUpgrade request type. +// +// Since: cosmos-sdk 0.46 +message MsgCancelUpgrade { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address of the governance account. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. +// +// Since: cosmos-sdk 0.46 +message MsgCancelUpgradeResponse {} \ No newline at end of file diff --git a/proto/cosmos/upgrade/v1beta1/upgrade.proto b/proto/cosmos/upgrade/v1beta1/upgrade.proto index e2a155bca53c..f5f9b35f45e6 100644 --- a/proto/cosmos/upgrade/v1beta1/upgrade.proto +++ b/proto/cosmos/upgrade/v1beta1/upgrade.proto @@ -43,7 +43,10 @@ message Plan { // SoftwareUpgradeProposal is a gov Content type for initiating a software // upgrade. +// Deprecated: This legacy proposal is deprecated in favor of Msg-based gov +// proposals, see MsgSoftwareUpgrade. message SoftwareUpgradeProposal { + option deprecated = true; option (gogoproto.equal) = true; option (gogoproto.goproto_stringer) = false; @@ -54,7 +57,10 @@ message SoftwareUpgradeProposal { // CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software // upgrade. +// Deprecated: This legacy proposal is deprecated in favor of Msg-based gov +// proposals, see MsgCancelUpgrade. message CancelSoftwareUpgradeProposal { + option deprecated = true; option (gogoproto.equal) = true; option (gogoproto.goproto_stringer) = false; diff --git a/simapp/app.go b/simapp/app.go index 279095247cc2..c057a8bcf728 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -116,8 +116,8 @@ var ( mint.AppModuleBasic{}, distr.AppModuleBasic{}, gov.NewAppModuleBasic( - []govclient.ProposalHandler{upgradeclient.ProposalHandler}, - []govclient.ProposalHandler{paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.LegacyProposalHandler, upgradeclient.CancelProposalHandler}, + []govclient.ProposalHandler{upgradeclient.ProposalHandler, upgradeclient.CancelProposalHandler}, + []govclient.ProposalHandler{paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.LegacyProposalHandler, upgradeclient.LegacyCancelProposalHandler}, ), params.AppModuleBasic{}, crisis.AppModuleBasic{}, diff --git a/x/group/types.pb.go b/x/group/types.pb.go index 5151d457e1a5..c7c2780863e3 100644 --- a/x/group/types.pb.go +++ b/x/group/types.pb.go @@ -649,7 +649,7 @@ type Proposal struct { // has ended. FinalTallyResult TallyResult `protobuf:"bytes,10,opt,name=final_tally_result,json=finalTallyResult,proto3" json:"final_tally_result"` // timeout is the timestamp before which both voting and execution must be - // done. If this timestamp is passed, then the proposal can not be executed + // done. If this timestamp is passed, then the proposal cannot be executed // anymore and should be considered pending delete. This timestamp is checked // against the block header's timestamp. Timeout time.Time `protobuf:"bytes,11,opt,name=timeout,proto3,stdtime" json:"timeout"` diff --git a/x/upgrade/client/cli/tx.go b/x/upgrade/client/cli/tx.go index bac74b9789ef..5d80411de92e 100644 --- a/x/upgrade/client/cli/tx.go +++ b/x/upgrade/client/cli/tx.go @@ -123,7 +123,7 @@ Where proposal.json contains: // Deprecated: please use NewCmdSubmitUpgradeProposal instead. func NewCmdSubmitLegacyUpgradeProposal() *cobra.Command { cmd := &cobra.Command{ - Use: "software-upgrade [name] (--upgrade-height [height]) (--upgrade-info [info]) [flags]", + Use: "legacy-software-upgrade [name] (--upgrade-height [height]) (--upgrade-info [info]) [flags]", Args: cobra.ExactArgs(1), Short: "Submit a software upgrade proposal", Long: "Submit a software upgrade along with an initial deposit.\n" + @@ -191,8 +191,14 @@ func NewCmdSubmitLegacyUpgradeProposal() *cobra.Command { // NewCmdSubmitCancelUpgradeProposal implements a command handler for submitting a software upgrade cancel proposal transaction. func NewCmdSubmitCancelUpgradeProposal() *cobra.Command { + panic("todo") +} + +// NewCmdSubmitLegacyCancelUpgradeProposal implements a command handler for submitting a software upgrade cancel proposal transaction. +// Deprecated: please use NewCmdSubmitCancelUpgradeProposal instead. +func NewCmdSubmitLegacyCancelUpgradeProposal() *cobra.Command { cmd := &cobra.Command{ - Use: "cancel-software-upgrade [flags]", + Use: "legacy-cancel-software-upgrade [flags]", Args: cobra.ExactArgs(0), Short: "Cancel the current software upgrade proposal", Long: "Cancel a software upgrade along with an initial deposit.", diff --git a/x/upgrade/client/proposal_handler.go b/x/upgrade/client/proposal_handler.go index 59ccc878a614..c0d6c87408ac 100644 --- a/x/upgrade/client/proposal_handler.go +++ b/x/upgrade/client/proposal_handler.go @@ -6,5 +6,7 @@ import ( ) var ProposalHandler = govclient.NewProposalHandler(cli.NewCmdSubmitUpgradeProposal) -var LegacyProposalHandler = govclient.NewProposalHandler(cli.NewCmdSubmitLegacyUpgradeProposal) var CancelProposalHandler = govclient.NewProposalHandler(cli.NewCmdSubmitCancelUpgradeProposal) + +var LegacyProposalHandler = govclient.NewProposalHandler(cli.NewCmdSubmitLegacyUpgradeProposal) +var LegacyCancelProposalHandler = govclient.NewProposalHandler(cli.NewCmdSubmitLegacyCancelUpgradeProposal) diff --git a/x/upgrade/keeper/msg_server.go b/x/upgrade/keeper/msg_server.go index 179e73614ebc..f837c43602c8 100644 --- a/x/upgrade/keeper/msg_server.go +++ b/x/upgrade/keeper/msg_server.go @@ -23,6 +23,7 @@ func NewMsgServerImpl(k Keeper) types.MsgServer { var _ types.MsgServer = msgServer{} +// SoftwareUpgrade implements the Msg/SoftwareUpgrade Msg service. func (k msgServer) SoftwareUpgrade(goCtx context.Context, req *types.MsgSoftwareUpgrade) (*types.MsgSoftwareUpgradeResponse, error) { govAcct := k.authKeeper.GetModuleAddress(gov.ModuleName).String() if govAcct != req.Authority { @@ -34,5 +35,28 @@ func (k msgServer) SoftwareUpgrade(goCtx context.Context, req *types.MsgSoftware if err != nil { return nil, err } + return &types.MsgSoftwareUpgradeResponse{}, nil } + +// CancelUpgrade implements the Msg/CancelUpgrade Msg service. +func (k msgServer) CancelUpgrade(goCtx context.Context, req *types.MsgCancelUpgrade) (*types.MsgCancelUpgradeResponse, error) { + govAcct := k.authKeeper.GetModuleAddress(gov.ModuleName).String() + if govAcct != req.Authority { + return nil, errors.Wrapf(gov.ErrInvalidSigner, "expected %s got %s", govAcct, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + store := ctx.KVStore(k.storeKey) + + // clear any old IBC state stored by previous plan + _, found := k.GetUpgradePlan(ctx) + if !found { + return nil, errors.Wrapf(errors.ErrNotFound, "no plan is currently scheduled") + } + + store.Delete(types.PlanKey()) + + return &types.MsgCancelUpgradeResponse{}, nil +} diff --git a/x/upgrade/spec/01_concepts.md b/x/upgrade/spec/01_concepts.md index fbf6138f7480..826290a11800 100644 --- a/x/upgrade/spec/01_concepts.md +++ b/x/upgrade/spec/01_concepts.md @@ -76,23 +76,19 @@ will ensure these `StoreUpgrades` takes place only in planned upgrade handler. ## Proposal -Typically, a `Plan` is proposed and submitted through governance via a `SoftwareUpgradeProposal`. +Typically, a `Plan` is proposed and submitted through governance via a proposal +containing a `MsgSoftwareUpgrade` message. This proposal prescribes to the standard governance process. If the proposal passes, the `Plan`, which targets a specific `Handler`, is persisted and scheduled. The upgrade can be delayed or hastened by updating the `Plan.Height` in a new proposal. -```go -type SoftwareUpgradeProposal struct { - Title string - Description string - Plan Plan -} -``` ++++ https://github.com/cosmos/cosmos-sdk/blob/08ddb217c176abe31c96af9d5f6c4c6fc645c4d4/proto/cosmos/upgrade/v1beta1/tx.proto#L19-L28 ### Cancelling Upgrade Proposals -Upgrade proposals can be cancelled. There exists a `CancelSoftwareUpgrade` proposal -type, which can be voted on and passed and will remove the scheduled upgrade `Plan`. +Upgrade proposals can be cancelled. There exists a gov-enabled `MsgCancelUpgrade` +message type, which can be embedded in a proposal, voted on and, if passed, will +remove the scheduled upgrade `Plan`. Of course this requires that the upgrade was known to be a bad idea well before the upgrade itself, to allow time for a vote. @@ -101,6 +97,6 @@ If such a possibility is desired, the upgrade height is to be upgrade proposal. The `SafetyDelta` is the time available from the success of an upgrade proposal and the realization it was a bad idea (due to external social consensus). -A `CancelSoftwareUpgrade` proposal can also be made while the original -`SoftwareUpgradeProposal` is still being voted upon, as long as the `VotingPeriod` -ends after the `SoftwareUpgradeProposal`. +A `MsgCancelUpgrade` proposal can also be made while the original +`MsgSoftwareUpgrade` proposal is still being voted upon, as long as the `VotingPeriod` +ends after the `MsgSoftwareUpgrade` proposal. diff --git a/x/upgrade/types/codec.go b/x/upgrade/types/codec.go index a3532d42e76d..13e4048b2a59 100644 --- a/x/upgrade/types/codec.go +++ b/x/upgrade/types/codec.go @@ -14,6 +14,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&SoftwareUpgradeProposal{}, "cosmos-sdk/SoftwareUpgradeProposal", nil) cdc.RegisterConcrete(&CancelSoftwareUpgradeProposal{}, "cosmos-sdk/CancelSoftwareUpgradeProposal", nil) cdc.RegisterConcrete(&MsgSoftwareUpgrade{}, "cosmos-sdk/MsgSoftwareUpgrade", nil) + cdc.RegisterConcrete(&MsgCancelUpgrade{}, "cosmos-sdk/MsgCancelUpgrade", nil) } func RegisterInterfaces(registry types.InterfaceRegistry) { @@ -25,6 +26,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgSoftwareUpgrade{}, + &MsgCancelUpgrade{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/upgrade/types/msgs.go b/x/upgrade/types/msgs.go index 4efd878d4688..5ecc2830f5be 100644 --- a/x/upgrade/types/msgs.go +++ b/x/upgrade/types/msgs.go @@ -8,8 +8,8 @@ import ( ) var ( - _ sdk.Msg = &MsgSoftwareUpgrade{} - _ legacytx.LegacyMsg = &MsgSoftwareUpgrade{} + _, _ sdk.Msg = &MsgSoftwareUpgrade{}, &MsgCancelUpgrade{} + _, _ legacytx.LegacyMsg = &MsgSoftwareUpgrade{}, &MsgCancelUpgrade{} ) // Route implements the LegacyMsg interface. @@ -41,3 +41,29 @@ func (m *MsgSoftwareUpgrade) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(m.Authority) return []sdk.AccAddress{addr} } + +// Route implements the LegacyMsg interface. +func (m MsgCancelUpgrade) Route() string { return sdk.MsgTypeURL(&m) } + +// Type implements the LegacyMsg interface. +func (m MsgCancelUpgrade) Type() string { return sdk.MsgTypeURL(&m) } + +// GetSignBytes implements the LegacyMsg interface. +func (m MsgCancelUpgrade) GetSignBytes() []byte { + return sdk.MustSortJSON(legacy.Cdc.MustMarshalJSON(&m)) +} + +// ValidateBasic does a sanity check on the provided data. +func (m *MsgCancelUpgrade) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return sdkerrors.Wrap(err, "authority") + } + + return nil +} + +// GetSigners returns the expected signers for MsgSoftwareUpgrade. +func (m *MsgCancelUpgrade) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(m.Authority) + return []sdk.AccAddress{addr} +} diff --git a/x/upgrade/types/msgs_test.go b/x/upgrade/types/msgs_test.go index ad907fb5face..feb648be97bd 100644 --- a/x/upgrade/types/msgs_test.go +++ b/x/upgrade/types/msgs_test.go @@ -68,3 +68,42 @@ func TestMsgSoftwareUpgrade(t *testing.T) { }) } } + +func TestMsgCancelUpgrade(t *testing.T) { + testCases := []struct { + name string + msg *types.MsgCancelUpgrade + expErr bool + errMsg string + }{ + { + "invalid authority address", + &types.MsgCancelUpgrade{ + Authority: "authority", + }, + true, + "authority: decoding bech32 failed", + }, + { + "all good", + &types.MsgCancelUpgrade{ + Authority: authority.String(), + }, + false, + "", + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + err := tc.msg.ValidateBasic() + if tc.expErr { + require.Error(t, err) + require.Contains(t, err.Error(), tc.errMsg) + } else { + require.NoError(t, err) + require.Equal(t, tc.msg.Type(), sdk.MsgTypeURL(&types.MsgCancelUpgrade{})) + } + }) + } +} diff --git a/x/upgrade/types/tx.pb.go b/x/upgrade/types/tx.pb.go index 4693d5db77a7..47d9edbfd715 100644 --- a/x/upgrade/types/tx.pb.go +++ b/x/upgrade/types/tx.pb.go @@ -30,7 +30,9 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgSoftwareUpgrade is the Msg/MsgSoftwareUpgrade request type. +// MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. +// +// Since: cosmos-sdk 0.46 type MsgSoftwareUpgrade struct { // authority is the address of the governance account. Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` @@ -85,7 +87,9 @@ func (m *MsgSoftwareUpgrade) GetPlan() Plan { return Plan{} } -// MsgSoftwareUpgradeResponse is the Msg/MsgSoftwareUpgrade response type. +// MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. +// +// Since: cosmos-sdk 0.46 type MsgSoftwareUpgradeResponse struct { } @@ -122,15 +126,104 @@ func (m *MsgSoftwareUpgradeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSoftwareUpgradeResponse proto.InternalMessageInfo +// MsgCancelUpgrade is the Msg/CancelUpgrade request type. +// +// Since: cosmos-sdk 0.46 +type MsgCancelUpgrade struct { + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (m *MsgCancelUpgrade) Reset() { *m = MsgCancelUpgrade{} } +func (m *MsgCancelUpgrade) String() string { return proto.CompactTextString(m) } +func (*MsgCancelUpgrade) ProtoMessage() {} +func (*MsgCancelUpgrade) Descriptor() ([]byte, []int) { + return fileDescriptor_2852c16e3ab79fef, []int{2} +} +func (m *MsgCancelUpgrade) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCancelUpgrade) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCancelUpgrade.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 *MsgCancelUpgrade) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCancelUpgrade.Merge(m, src) +} +func (m *MsgCancelUpgrade) XXX_Size() int { + return m.Size() +} +func (m *MsgCancelUpgrade) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCancelUpgrade.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCancelUpgrade proto.InternalMessageInfo + +func (m *MsgCancelUpgrade) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +// MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. +// +// Since: cosmos-sdk 0.46 +type MsgCancelUpgradeResponse struct { +} + +func (m *MsgCancelUpgradeResponse) Reset() { *m = MsgCancelUpgradeResponse{} } +func (m *MsgCancelUpgradeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCancelUpgradeResponse) ProtoMessage() {} +func (*MsgCancelUpgradeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2852c16e3ab79fef, []int{3} +} +func (m *MsgCancelUpgradeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCancelUpgradeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCancelUpgradeResponse.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 *MsgCancelUpgradeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCancelUpgradeResponse.Merge(m, src) +} +func (m *MsgCancelUpgradeResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCancelUpgradeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCancelUpgradeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCancelUpgradeResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgSoftwareUpgrade)(nil), "cosmos.upgrade.v1beta1.MsgSoftwareUpgrade") proto.RegisterType((*MsgSoftwareUpgradeResponse)(nil), "cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse") + proto.RegisterType((*MsgCancelUpgrade)(nil), "cosmos.upgrade.v1beta1.MsgCancelUpgrade") + proto.RegisterType((*MsgCancelUpgradeResponse)(nil), "cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse") } func init() { proto.RegisterFile("cosmos/upgrade/v1beta1/tx.proto", fileDescriptor_2852c16e3ab79fef) } var fileDescriptor_2852c16e3ab79fef = []byte{ - // 317 bytes of a gzipped FileDescriptorProto + // 363 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0x2f, 0x2d, 0x48, 0x2f, 0x4a, 0x4c, 0x49, 0xd5, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x83, 0x28, 0xd0, @@ -144,13 +237,16 @@ var fileDescriptor_2852c16e3ab79fef = []byte{ 0x32, 0xe3, 0x62, 0x29, 0xc8, 0x49, 0xcc, 0x93, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x36, 0x92, 0xd1, 0xc3, 0xee, 0x4b, 0xbd, 0x80, 0x9c, 0xc4, 0x3c, 0x27, 0x96, 0x13, 0xf7, 0xe4, 0x19, 0x82, 0xc0, 0xea, 0xad, 0xf8, 0x9a, 0x9e, 0x6f, 0xd0, 0x42, 0x98, 0xa3, 0x24, 0xc3, 0x25, 0x85, 0xe9, 0xaa, - 0xa0, 0xd4, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0xa3, 0x0a, 0x2e, 0x66, 0xdf, 0xe2, 0x74, 0xa1, - 0x42, 0x2e, 0x7e, 0x74, 0x77, 0x6b, 0xe1, 0xb2, 0x11, 0xd3, 0x34, 0x29, 0x23, 0xe2, 0xd5, 0xc2, - 0x6c, 0x76, 0x72, 0x3b, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, - 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x9d, 0xf4, - 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x68, 0x04, 0x41, 0x29, 0xdd, 0xe2, 0x94, - 0x6c, 0xfd, 0x0a, 0x78, 0xfc, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x43, 0xdf, 0x18, - 0x10, 0x00, 0x00, 0xff, 0xff, 0x40, 0xd1, 0x2d, 0x6e, 0x28, 0x02, 0x00, 0x00, + 0xa0, 0xd4, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0xa5, 0x28, 0x2e, 0x01, 0xdf, 0xe2, 0x74, 0xe7, + 0xc4, 0xbc, 0xe4, 0xd4, 0x1c, 0x0a, 0x5d, 0x8c, 0x61, 0xb3, 0x14, 0x97, 0x04, 0xba, 0xd9, 0x30, + 0x7b, 0x8d, 0x9e, 0x32, 0x72, 0x31, 0xfb, 0x16, 0xa7, 0x0b, 0x15, 0x72, 0xf1, 0xa3, 0x07, 0x98, + 0x16, 0x2e, 0xaf, 0x62, 0x7a, 0x43, 0xca, 0x88, 0x78, 0xb5, 0x30, 0xab, 0x85, 0xb2, 0xb9, 0x78, + 0x51, 0xfd, 0xab, 0x81, 0xc7, 0x10, 0x14, 0x95, 0x52, 0x06, 0xc4, 0xaa, 0x84, 0x59, 0xe6, 0xe4, + 0x76, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, + 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x3a, 0xe9, 0x99, 0x25, 0x19, + 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xd0, 0x64, 0x08, 0xa5, 0x74, 0x8b, 0x53, 0xb2, 0xf5, 0x2b, + 0xe0, 0xa9, 0xb0, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x9c, 0xc6, 0x8c, 0x01, 0x01, 0x00, + 0x00, 0xff, 0xff, 0x11, 0x7e, 0xae, 0x0d, 0x0e, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -169,6 +265,11 @@ type MsgClient interface { // // Since: cosmos-sdk 0.46 SoftwareUpgrade(ctx context.Context, in *MsgSoftwareUpgrade, opts ...grpc.CallOption) (*MsgSoftwareUpgradeResponse, error) + // CancelUpgrade is a governance operation for cancelling a previously + // approvid software upgrade. + // + // Since: cosmos-sdk 0.46 + CancelUpgrade(ctx context.Context, in *MsgCancelUpgrade, opts ...grpc.CallOption) (*MsgCancelUpgradeResponse, error) } type msgClient struct { @@ -188,12 +289,26 @@ func (c *msgClient) SoftwareUpgrade(ctx context.Context, in *MsgSoftwareUpgrade, return out, nil } +func (c *msgClient) CancelUpgrade(ctx context.Context, in *MsgCancelUpgrade, opts ...grpc.CallOption) (*MsgCancelUpgradeResponse, error) { + out := new(MsgCancelUpgradeResponse) + err := c.cc.Invoke(ctx, "/cosmos.upgrade.v1beta1.Msg/CancelUpgrade", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // SoftwareUpgrade is a governance operation for initiating a software upgrade. // // Since: cosmos-sdk 0.46 SoftwareUpgrade(context.Context, *MsgSoftwareUpgrade) (*MsgSoftwareUpgradeResponse, error) + // CancelUpgrade is a governance operation for cancelling a previously + // approvid software upgrade. + // + // Since: cosmos-sdk 0.46 + CancelUpgrade(context.Context, *MsgCancelUpgrade) (*MsgCancelUpgradeResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -203,6 +318,9 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) SoftwareUpgrade(ctx context.Context, req *MsgSoftwareUpgrade) (*MsgSoftwareUpgradeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SoftwareUpgrade not implemented") } +func (*UnimplementedMsgServer) CancelUpgrade(ctx context.Context, req *MsgCancelUpgrade) (*MsgCancelUpgradeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CancelUpgrade not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -226,6 +344,24 @@ func _Msg_SoftwareUpgrade_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _Msg_CancelUpgrade_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCancelUpgrade) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CancelUpgrade(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.upgrade.v1beta1.Msg/CancelUpgrade", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CancelUpgrade(ctx, req.(*MsgCancelUpgrade)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmos.upgrade.v1beta1.Msg", HandlerType: (*MsgServer)(nil), @@ -234,6 +370,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "SoftwareUpgrade", Handler: _Msg_SoftwareUpgrade_Handler, }, + { + MethodName: "CancelUpgrade", + Handler: _Msg_CancelUpgrade_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/upgrade/v1beta1/tx.proto", @@ -302,6 +442,59 @@ func (m *MsgSoftwareUpgradeResponse) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } +func (m *MsgCancelUpgrade) 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 *MsgCancelUpgrade) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCancelUpgrade) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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 *MsgCancelUpgradeResponse) 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 *MsgCancelUpgradeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCancelUpgradeResponse) 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 @@ -337,6 +530,28 @@ func (m *MsgSoftwareUpgradeResponse) Size() (n int) { return n } +func (m *MsgCancelUpgrade) 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)) + } + return n +} + +func (m *MsgCancelUpgradeResponse) 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 } @@ -508,6 +723,138 @@ func (m *MsgSoftwareUpgradeResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgCancelUpgrade) 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: MsgCancelUpgrade: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCancelUpgrade: 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 + 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 *MsgCancelUpgradeResponse) 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: MsgCancelUpgradeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCancelUpgradeResponse: 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 diff --git a/x/upgrade/types/upgrade.pb.go b/x/upgrade/types/upgrade.pb.go index 20fb4b235077..8a35a8729002 100644 --- a/x/upgrade/types/upgrade.pb.go +++ b/x/upgrade/types/upgrade.pb.go @@ -88,6 +88,10 @@ var xxx_messageInfo_Plan proto.InternalMessageInfo // SoftwareUpgradeProposal is a gov Content type for initiating a software // upgrade. +// Deprecated: This legacy proposal is deprecated in favor of Msg-based gov +// proposals, see MsgSoftwareUpgrade. +// +// Deprecated: Do not use. type SoftwareUpgradeProposal struct { Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` @@ -128,6 +132,10 @@ var xxx_messageInfo_SoftwareUpgradeProposal proto.InternalMessageInfo // CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software // upgrade. +// Deprecated: This legacy proposal is deprecated in favor of Msg-based gov +// proposals, see MsgCancelUpgrade. +// +// Deprecated: Do not use. type CancelSoftwareUpgradeProposal struct { Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` @@ -220,36 +228,36 @@ func init() { } var fileDescriptor_ccf2a7d4d7b48dca = []byte{ - // 450 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0x3f, 0x6f, 0xd4, 0x30, - 0x14, 0x8f, 0xdb, 0xb4, 0x50, 0x9f, 0x58, 0xcc, 0x51, 0xcc, 0x09, 0x92, 0x53, 0xc5, 0x70, 0x03, - 0x38, 0x6a, 0x91, 0x18, 0xba, 0x71, 0x1d, 0x90, 0x10, 0x48, 0x55, 0x0a, 0x0c, 0x2c, 0x95, 0x2f, - 0xf1, 0xe5, 0x2c, 0x1c, 0x3b, 0x8a, 0x9d, 0xc2, 0x7d, 0x8b, 0x4a, 0x2c, 0x8c, 0xfd, 0x38, 0x37, - 0x76, 0x44, 0x0c, 0xfc, 0xb9, 0x5b, 0xf8, 0x18, 0xc8, 0x76, 0x82, 0x4e, 0x70, 0x23, 0x53, 0xde, - 0x7b, 0xf9, 0xfd, 0x79, 0xcf, 0xef, 0xc1, 0x87, 0x99, 0xd2, 0xa5, 0xd2, 0x49, 0x53, 0x15, 0x35, - 0xcd, 0x59, 0x72, 0x71, 0x38, 0x61, 0x86, 0x1e, 0x76, 0x39, 0xa9, 0x6a, 0x65, 0x14, 0xda, 0xf7, - 0x28, 0xd2, 0x55, 0x5b, 0xd4, 0xe0, 0x5e, 0xa1, 0x54, 0x21, 0x58, 0xe2, 0x50, 0x93, 0x66, 0x9a, - 0x50, 0x39, 0xf7, 0x94, 0x41, 0xbf, 0x50, 0x85, 0x72, 0x61, 0x62, 0xa3, 0xb6, 0x1a, 0xff, 0x4d, - 0x30, 0xbc, 0x64, 0xda, 0xd0, 0xb2, 0xf2, 0x80, 0x83, 0xaf, 0x00, 0x86, 0xa7, 0x82, 0x4a, 0x84, - 0x60, 0x28, 0x69, 0xc9, 0x30, 0x18, 0x82, 0xd1, 0x5e, 0xea, 0x62, 0x74, 0x0c, 0x43, 0x8b, 0xc7, - 0x5b, 0x43, 0x30, 0xea, 0x1d, 0x0d, 0x88, 0x17, 0x23, 0x9d, 0x18, 0x79, 0xdd, 0x89, 0x8d, 0xe1, - 0xe2, 0x5b, 0x1c, 0x5c, 0x7e, 0x8f, 0x01, 0x06, 0xa9, 0xe3, 0xa0, 0x7d, 0xb8, 0x3b, 0x63, 0xbc, - 0x98, 0x19, 0xbc, 0x3d, 0x04, 0xa3, 0xed, 0xb4, 0xcd, 0xac, 0x0f, 0x97, 0x53, 0x85, 0x43, 0xef, - 0x63, 0x63, 0xf4, 0x12, 0xde, 0x69, 0x27, 0xcd, 0xcf, 0x33, 0xc1, 0x99, 0x34, 0xe7, 0xda, 0x50, - 0xc3, 0xf0, 0x8e, 0x33, 0xee, 0xff, 0x63, 0xfc, 0x4c, 0xce, 0xc7, 0x5b, 0x18, 0xa4, 0xb7, 0x3b, - 0xda, 0x89, 0x63, 0x9d, 0x59, 0xd2, 0xf1, 0xcd, 0xcf, 0x57, 0x71, 0xf0, 0xeb, 0x2a, 0x06, 0x07, - 0x9f, 0x00, 0xbc, 0x7b, 0xa6, 0xa6, 0xe6, 0x03, 0xad, 0xd9, 0x1b, 0x8f, 0x3c, 0xad, 0x55, 0xa5, - 0x34, 0x15, 0xa8, 0x0f, 0x77, 0x0c, 0x37, 0xa2, 0x1b, 0xd8, 0x27, 0x68, 0x08, 0x7b, 0x39, 0xd3, - 0x59, 0xcd, 0x2b, 0xc3, 0x95, 0x74, 0x83, 0xef, 0xa5, 0xeb, 0x25, 0xf4, 0x14, 0x86, 0x95, 0xa0, - 0xd2, 0x4d, 0xd5, 0x3b, 0xba, 0x4f, 0x36, 0x6f, 0x8a, 0xd8, 0x37, 0x1d, 0x87, 0xf6, 0x55, 0x52, - 0x87, 0x5f, 0xeb, 0x8a, 0xc2, 0x07, 0x27, 0x54, 0x66, 0x4c, 0xfc, 0xe7, 0xd6, 0xd6, 0x2c, 0x9e, - 0xc3, 0x5b, 0xaf, 0x54, 0xde, 0x08, 0xf6, 0x96, 0xd5, 0xda, 0x76, 0xbd, 0x69, 0xbb, 0x18, 0xde, - 0xb8, 0xf0, 0xbf, 0x9d, 0x58, 0x98, 0x76, 0xa9, 0x13, 0x02, 0x56, 0x68, 0xfc, 0x62, 0xf1, 0x33, - 0x0a, 0x16, 0xcb, 0x08, 0x5c, 0x2f, 0x23, 0xf0, 0x63, 0x19, 0x81, 0xcb, 0x55, 0x14, 0x5c, 0xaf, - 0xa2, 0xe0, 0xcb, 0x2a, 0x0a, 0xde, 0x3d, 0x2a, 0xb8, 0x99, 0x35, 0x13, 0x92, 0xa9, 0x32, 0x69, - 0xef, 0xda, 0x7f, 0x1e, 0xeb, 0xfc, 0x7d, 0xf2, 0xf1, 0xcf, 0x91, 0x9b, 0x79, 0xc5, 0xf4, 0x64, - 0xd7, 0xad, 0xef, 0xc9, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6d, 0x2b, 0xd1, 0x8c, 0x03, 0x03, - 0x00, 0x00, + // 453 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0xbb, 0x6f, 0xd4, 0x30, + 0x18, 0x8f, 0xdb, 0xb4, 0x50, 0x9f, 0x58, 0xcc, 0x51, 0xcc, 0x09, 0x92, 0xd3, 0x89, 0xe1, 0x06, + 0x48, 0xd4, 0x22, 0x31, 0xdc, 0xc6, 0x75, 0x40, 0x42, 0x20, 0x55, 0x29, 0x30, 0xb0, 0x54, 0xbe, + 0xc4, 0x97, 0xb3, 0x70, 0xec, 0x28, 0x76, 0x0a, 0xf7, 0x5f, 0x74, 0x41, 0x62, 0xec, 0x9f, 0x73, + 0x63, 0x47, 0xc4, 0xc0, 0xe3, 0x6e, 0xe1, 0xcf, 0x40, 0xb6, 0x63, 0xc4, 0xa3, 0x23, 0x53, 0xbe, + 0xef, 0xcb, 0xef, 0xf1, 0x3d, 0x0c, 0xef, 0xe7, 0x52, 0x55, 0x52, 0xa5, 0x6d, 0x5d, 0x36, 0xa4, + 0xa0, 0xe9, 0xd9, 0xc1, 0x8c, 0x6a, 0x72, 0xe0, 0xf3, 0xa4, 0x6e, 0xa4, 0x96, 0x68, 0xdf, 0xa1, + 0x12, 0x5f, 0xed, 0x50, 0x83, 0x3b, 0xa5, 0x94, 0x25, 0xa7, 0xa9, 0x45, 0xcd, 0xda, 0x79, 0x4a, + 0xc4, 0xd2, 0x51, 0x06, 0xfd, 0x52, 0x96, 0xd2, 0x86, 0xa9, 0x89, 0xba, 0x6a, 0xfc, 0x37, 0x41, + 0xb3, 0x8a, 0x2a, 0x4d, 0xaa, 0xda, 0x01, 0x46, 0x9f, 0x01, 0x0c, 0x8f, 0x39, 0x11, 0x08, 0xc1, + 0x50, 0x90, 0x8a, 0x62, 0x30, 0x04, 0xe3, 0xbd, 0xcc, 0xc6, 0x68, 0x02, 0x43, 0x83, 0xc7, 0x5b, + 0x43, 0x30, 0xee, 0x1d, 0x0e, 0x12, 0x27, 0x96, 0x78, 0xb1, 0xe4, 0xa5, 0x17, 0x9b, 0xc2, 0xd5, + 0x97, 0x38, 0x38, 0xff, 0x1a, 0x03, 0x0c, 0x32, 0xcb, 0x41, 0xfb, 0x70, 0x77, 0x41, 0x59, 0xb9, + 0xd0, 0x78, 0x7b, 0x08, 0xc6, 0xdb, 0x59, 0x97, 0x19, 0x1f, 0x26, 0xe6, 0x12, 0x87, 0xce, 0xc7, + 0xc4, 0xe8, 0x39, 0xbc, 0xd5, 0x4d, 0x5a, 0x9c, 0xe6, 0x9c, 0x51, 0xa1, 0x4f, 0x95, 0x26, 0x9a, + 0xe2, 0x1d, 0x6b, 0xdc, 0xff, 0xc7, 0xf8, 0x89, 0x58, 0x4e, 0xb7, 0x30, 0xc8, 0x6e, 0x7a, 0xda, + 0x91, 0x65, 0x9d, 0x18, 0xd2, 0xe4, 0xfa, 0xc7, 0x8b, 0x38, 0xf8, 0x71, 0x11, 0x83, 0xd1, 0x07, + 0x00, 0x6f, 0x9f, 0xc8, 0xb9, 0x7e, 0x47, 0x1a, 0xfa, 0xca, 0x21, 0x8f, 0x1b, 0x59, 0x4b, 0x45, + 0x38, 0xea, 0xc3, 0x1d, 0xcd, 0x34, 0xf7, 0x03, 0xbb, 0x04, 0x0d, 0x61, 0xaf, 0xa0, 0x2a, 0x6f, + 0x58, 0xad, 0x99, 0x14, 0x76, 0xf0, 0xbd, 0xec, 0xf7, 0x12, 0x7a, 0x0c, 0xc3, 0x9a, 0x13, 0x61, + 0xa7, 0xea, 0x1d, 0xde, 0x4d, 0xae, 0xbe, 0x54, 0x62, 0x76, 0x3a, 0x0d, 0xcd, 0x56, 0x32, 0x8b, + 0x9f, 0x40, 0xdf, 0x15, 0x06, 0xa3, 0x1c, 0xde, 0x3b, 0x22, 0x22, 0xa7, 0xfc, 0x3f, 0x37, 0xf7, + 0x87, 0xc9, 0x53, 0x78, 0xe3, 0x85, 0x2c, 0x5a, 0x4e, 0x5f, 0xd3, 0x46, 0x99, 0xce, 0xaf, 0xba, + 0x30, 0x86, 0xd7, 0xce, 0xdc, 0x6f, 0x2b, 0x17, 0x66, 0x3e, 0xb5, 0x5b, 0x04, 0x46, 0x6a, 0xfa, + 0x6c, 0xf5, 0x3d, 0x0a, 0x56, 0xeb, 0x08, 0x5c, 0xae, 0x23, 0xf0, 0x6d, 0x1d, 0x81, 0xf3, 0x4d, + 0x14, 0x5c, 0x6e, 0xa2, 0xe0, 0xd3, 0x26, 0x0a, 0xde, 0x3c, 0x28, 0x99, 0x5e, 0xb4, 0xb3, 0x24, + 0x97, 0x55, 0xda, 0xbd, 0x6d, 0xf7, 0x79, 0xa8, 0x8a, 0xb7, 0xe9, 0xfb, 0x5f, 0x0f, 0x5d, 0x2f, + 0x6b, 0xaa, 0x66, 0xbb, 0xf6, 0x84, 0x8f, 0x7e, 0x06, 0x00, 0x00, 0xff, 0xff, 0x55, 0x74, 0xf2, + 0xb7, 0x07, 0x03, 0x00, 0x00, } func (this *Plan) Equal(that interface{}) bool { From 756c95cc7d330fad4a0e0547158e23eb19a550e6 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Wed, 16 Feb 2022 16:20:56 +0100 Subject: [PATCH 10/19] add cancel upgrade cli --- x/gov/client/cli/tx.go | 3 +- x/upgrade/client/cli/tx.go | 56 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index 80368e0036bd..e8f543213b6c 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -26,8 +26,9 @@ const ( FlagDescription = "description" // Deprecated: only used for v1beta1 legacy proposals. FlagProposalType = "type" - // Deprecated: only used for v1beta1 legacy proposals. + FlagDeposit = "deposit" + FlagMetadata = "metadata" flagVoter = "voter" flagDepositor = "depositor" flagStatus = "status" diff --git a/x/upgrade/client/cli/tx.go b/x/upgrade/client/cli/tx.go index 5d80411de92e..1431076ff680 100644 --- a/x/upgrade/client/cli/tx.go +++ b/x/upgrade/client/cli/tx.go @@ -12,7 +12,9 @@ import ( "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/gov/client/cli" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta2" "github.com/cosmos/cosmos-sdk/x/upgrade/plan" @@ -98,9 +100,11 @@ Where proposal.json contains: } } + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + msgs := []sdk.Msg{ &types.MsgSoftwareUpgrade{ - Authority: "", + Authority: authority.String(), Plan: *upgradePlan, }, } @@ -191,7 +195,55 @@ func NewCmdSubmitLegacyUpgradeProposal() *cobra.Command { // NewCmdSubmitCancelUpgradeProposal implements a command handler for submitting a software upgrade cancel proposal transaction. func NewCmdSubmitCancelUpgradeProposal() *cobra.Command { - panic("todo") + cmd := &cobra.Command{ + Use: "cancel-software-upgrade [flags]", + Args: cobra.ExactArgs(0), + Short: "Cancel the current software upgrade proposal", + Long: "Submits a proposal to cancel the current software upgrade along. Can also be submitted with an initial deposit and metadata.", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + from := clientCtx.GetFromAddress() + + depositStr, err := cmd.Flags().GetString(cli.FlagDeposit) + if err != nil { + return err + } + + deposit, err := sdk.ParseCoinsNormalized(depositStr) + if err != nil { + return err + } + + var metadata []byte + metadata, err = cmd.Flags().GetBytesBase64(cli.FlagMetadata) + if err != nil { + return err + } + + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + + msgs := []sdk.Msg{ + &types.MsgCancelUpgrade{ + Authority: authority.String(), + }, + } + + msg, err := v1beta2.NewMsgSubmitProposal(msgs, deposit, from.String(), metadata) + if err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + cmd.Flags().BytesBase64(cli.FlagMetadata, []byte{}, "base64 encoded metadata associated with the cancel upgrade proposal") + cmd.Flags().String(cli.FlagDeposit, "", "deposit for the proposal") + + return cmd } // NewCmdSubmitLegacyCancelUpgradeProposal implements a command handler for submitting a software upgrade cancel proposal transaction. From 192528a715975eb41b6bbf6cf8e788cc30265b69 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Mon, 21 Feb 2022 12:02:40 +0100 Subject: [PATCH 11/19] add authority grpc method --- api/cosmos/upgrade/v1beta1/query.pulsar.go | 1037 +++++++++++++++-- api/cosmos/upgrade/v1beta1/query_grpc.pb.go | 38 + api/cosmos/upgrade/v1beta1/upgrade.pulsar.go | 66 +- go.sum | 5 + orm/internal/testpb/bank.proto | 29 +- orm/internal/testpb/test_schema.proto | 126 +- proto/cosmos/app/module/v1alpha1/module.proto | 4 +- proto/cosmos/authz/v1beta1/query.proto | 2 +- proto/cosmos/gov/v1beta1/gov.proto | 12 +- proto/cosmos/gov/v1beta2/gov.proto | 18 +- proto/cosmos/msg/v1/msg.proto | 2 +- proto/cosmos/nft/v1beta1/query.proto | 3 +- proto/cosmos/staking/v1beta1/staking.proto | 4 +- proto/cosmos/upgrade/v1beta1/query.proto | 17 + proto/cosmos/upgrade/v1beta1/tx.proto | 2 +- proto/cosmos/upgrade/v1beta1/upgrade.proto | 4 +- proto/cosmos/vesting/v1beta1/tx.proto | 3 +- proto/tendermint/abci/types.proto | 107 +- proto/tendermint/types/evidence.proto | 16 +- proto/tendermint/types/params.proto | 3 +- proto/tendermint/types/types.proto | 48 +- simapp/app.go | 4 +- x/upgrade/client/cli/tx.go | 4 +- x/upgrade/client/testutil/cli_test.go | 1 + x/upgrade/keeper/grpc_query.go | 5 + x/upgrade/keeper/grpc_query_test.go | 8 + x/upgrade/keeper/keeper.go | 4 +- x/upgrade/keeper/keeper_test.go | 3 + x/upgrade/types/query.pb.go | 408 ++++++- x/upgrade/types/query.pb.gw.go | 62 + 30 files changed, 1699 insertions(+), 346 deletions(-) diff --git a/api/cosmos/upgrade/v1beta1/query.pulsar.go b/api/cosmos/upgrade/v1beta1/query.pulsar.go index 0ad9240dddbc..0d7e0badc6c0 100644 --- a/api/cosmos/upgrade/v1beta1/query.pulsar.go +++ b/api/cosmos/upgrade/v1beta1/query.pulsar.go @@ -3368,6 +3368,782 @@ func (x *fastReflection_QueryModuleVersionsResponse) ProtoMethods() *protoiface. } } +var ( + md_QueryAuthorityRequest protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_upgrade_v1beta1_query_proto_init() + md_QueryAuthorityRequest = File_cosmos_upgrade_v1beta1_query_proto.Messages().ByName("QueryAuthorityRequest") +} + +var _ protoreflect.Message = (*fastReflection_QueryAuthorityRequest)(nil) + +type fastReflection_QueryAuthorityRequest QueryAuthorityRequest + +func (x *QueryAuthorityRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAuthorityRequest)(x) +} + +func (x *QueryAuthorityRequest) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_upgrade_v1beta1_query_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryAuthorityRequest_messageType fastReflection_QueryAuthorityRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryAuthorityRequest_messageType{} + +type fastReflection_QueryAuthorityRequest_messageType struct{} + +func (x fastReflection_QueryAuthorityRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAuthorityRequest)(nil) +} +func (x fastReflection_QueryAuthorityRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAuthorityRequest) +} +func (x fastReflection_QueryAuthorityRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAuthorityRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAuthorityRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAuthorityRequest +} + +// 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_QueryAuthorityRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryAuthorityRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAuthorityRequest) New() protoreflect.Message { + return new(fastReflection_QueryAuthorityRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAuthorityRequest) Interface() protoreflect.ProtoMessage { + return (*QueryAuthorityRequest)(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_QueryAuthorityRequest) 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_QueryAuthorityRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.QueryAuthorityRequest")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.QueryAuthorityRequest 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_QueryAuthorityRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.QueryAuthorityRequest")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.QueryAuthorityRequest 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_QueryAuthorityRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.QueryAuthorityRequest")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.QueryAuthorityRequest 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_QueryAuthorityRequest) 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.upgrade.v1beta1.QueryAuthorityRequest")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.QueryAuthorityRequest 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_QueryAuthorityRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.QueryAuthorityRequest")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.QueryAuthorityRequest 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_QueryAuthorityRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.QueryAuthorityRequest")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.QueryAuthorityRequest 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_QueryAuthorityRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.upgrade.v1beta1.QueryAuthorityRequest", 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_QueryAuthorityRequest) 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_QueryAuthorityRequest) 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_QueryAuthorityRequest) 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_QueryAuthorityRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAuthorityRequest) + 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().(*QueryAuthorityRequest) + 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().(*QueryAuthorityRequest) + 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: QueryAuthorityRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAuthorityRequest: 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, + } +} + +var ( + md_QueryAuthorityResponse protoreflect.MessageDescriptor + fd_QueryAuthorityResponse_address protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_upgrade_v1beta1_query_proto_init() + md_QueryAuthorityResponse = File_cosmos_upgrade_v1beta1_query_proto.Messages().ByName("QueryAuthorityResponse") + fd_QueryAuthorityResponse_address = md_QueryAuthorityResponse.Fields().ByName("address") +} + +var _ protoreflect.Message = (*fastReflection_QueryAuthorityResponse)(nil) + +type fastReflection_QueryAuthorityResponse QueryAuthorityResponse + +func (x *QueryAuthorityResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAuthorityResponse)(x) +} + +func (x *QueryAuthorityResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_upgrade_v1beta1_query_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryAuthorityResponse_messageType fastReflection_QueryAuthorityResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryAuthorityResponse_messageType{} + +type fastReflection_QueryAuthorityResponse_messageType struct{} + +func (x fastReflection_QueryAuthorityResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAuthorityResponse)(nil) +} +func (x fastReflection_QueryAuthorityResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAuthorityResponse) +} +func (x fastReflection_QueryAuthorityResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAuthorityResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAuthorityResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAuthorityResponse +} + +// 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_QueryAuthorityResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryAuthorityResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAuthorityResponse) New() protoreflect.Message { + return new(fastReflection_QueryAuthorityResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAuthorityResponse) Interface() protoreflect.ProtoMessage { + return (*QueryAuthorityResponse)(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_QueryAuthorityResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_QueryAuthorityResponse_address, 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_QueryAuthorityResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.upgrade.v1beta1.QueryAuthorityResponse.address": + return x.Address != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.QueryAuthorityResponse")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.QueryAuthorityResponse 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_QueryAuthorityResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.upgrade.v1beta1.QueryAuthorityResponse.address": + x.Address = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.QueryAuthorityResponse")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.QueryAuthorityResponse 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_QueryAuthorityResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.upgrade.v1beta1.QueryAuthorityResponse.address": + value := x.Address + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.QueryAuthorityResponse")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.QueryAuthorityResponse 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_QueryAuthorityResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.upgrade.v1beta1.QueryAuthorityResponse.address": + x.Address = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.QueryAuthorityResponse")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.QueryAuthorityResponse 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_QueryAuthorityResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.upgrade.v1beta1.QueryAuthorityResponse.address": + panic(fmt.Errorf("field address of message cosmos.upgrade.v1beta1.QueryAuthorityResponse is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.QueryAuthorityResponse")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.QueryAuthorityResponse 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_QueryAuthorityResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.upgrade.v1beta1.QueryAuthorityResponse.address": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.upgrade.v1beta1.QueryAuthorityResponse")) + } + panic(fmt.Errorf("message cosmos.upgrade.v1beta1.QueryAuthorityResponse 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_QueryAuthorityResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.upgrade.v1beta1.QueryAuthorityResponse", 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_QueryAuthorityResponse) 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_QueryAuthorityResponse) 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_QueryAuthorityResponse) 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_QueryAuthorityResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAuthorityResponse) + 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.Address) + if l > 0 { + 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().(*QueryAuthorityResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + 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().(*QueryAuthorityResponse) + 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: QueryAuthorityResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAuthorityResponse: 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 Address", 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.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -3686,6 +4462,69 @@ func (x *QueryModuleVersionsResponse) GetModuleVersions() []*ModuleVersion { return nil } +// QueryAuthorityRequest is the request type for Query/Authority +type QueryAuthorityRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *QueryAuthorityRequest) Reset() { + *x = QueryAuthorityRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_upgrade_v1beta1_query_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAuthorityRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAuthorityRequest) ProtoMessage() {} + +// Deprecated: Use QueryAuthorityRequest.ProtoReflect.Descriptor instead. +func (*QueryAuthorityRequest) Descriptor() ([]byte, []int) { + return file_cosmos_upgrade_v1beta1_query_proto_rawDescGZIP(), []int{8} +} + +// QueryAuthorityResponse is the response type for Query/Authority +type QueryAuthorityResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (x *QueryAuthorityResponse) Reset() { + *x = QueryAuthorityResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_upgrade_v1beta1_query_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAuthorityResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAuthorityResponse) ProtoMessage() {} + +// Deprecated: Use QueryAuthorityResponse.ProtoReflect.Descriptor instead. +func (*QueryAuthorityResponse) Descriptor() ([]byte, []int) { + return file_cosmos_upgrade_v1beta1_query_proto_rawDescGZIP(), []int{9} +} + +func (x *QueryAuthorityResponse) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + var File_cosmos_upgrade_v1beta1_query_proto protoreflect.FileDescriptor var file_cosmos_upgrade_v1beta1_query_proto_rawDesc = []byte{ @@ -3732,68 +4571,82 @@ var file_cosmos_upgrade_v1beta1_query_proto_rawDesc = []byte{ 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, - 0x32, 0xdc, 0x05, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x9e, 0x01, 0x0a, 0x0b, 0x43, - 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x50, 0x6c, 0x61, 0x6e, 0x12, 0x2f, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, - 0x50, 0x6c, 0x61, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, - 0x74, 0x50, 0x6c, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2c, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x26, 0x12, 0x24, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x75, - 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, - 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x12, 0xa5, 0x01, 0x0a, 0x0b, - 0x41, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x64, 0x50, 0x6c, 0x61, 0x6e, 0x12, 0x2f, 0x2e, 0x63, 0x6f, + 0x22, 0x17, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x32, 0x0a, 0x16, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x32, 0xf4, 0x06, + 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x9e, 0x01, 0x0a, 0x0b, 0x43, 0x75, 0x72, 0x72, + 0x65, 0x6e, 0x74, 0x50, 0x6c, 0x61, 0x6e, 0x12, 0x2f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x50, 0x6c, 0x61, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x50, 0x6c, + 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2c, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x26, 0x12, 0x24, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x75, 0x70, 0x67, 0x72, + 0x61, 0x64, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x75, 0x72, 0x72, + 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x12, 0xa5, 0x01, 0x0a, 0x0b, 0x41, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x64, 0x50, 0x6c, 0x61, 0x6e, 0x12, 0x2f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x64, 0x50, 0x6c, + 0x61, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x64, 0x50, + 0x6c, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x33, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x2d, 0x12, 0x2b, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x75, 0x70, 0x67, + 0x72, 0x61, 0x64, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x64, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, + 0x12, 0xdc, 0x01, 0x0a, 0x16, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x64, 0x43, 0x6f, 0x6e, + 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x65, - 0x64, 0x50, 0x6c, 0x61, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x70, 0x70, 0x6c, 0x69, - 0x65, 0x64, 0x50, 0x6c, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x33, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2d, 0x12, 0x2b, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, - 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, - 0x61, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x64, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x2f, 0x7b, 0x6e, 0x61, - 0x6d, 0x65, 0x7d, 0x12, 0xdc, 0x01, 0x0a, 0x16, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x64, - 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3a, - 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x70, 0x67, - 0x72, 0x61, 0x64, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3b, 0x2e, 0x63, 0x6f, 0x73, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, + 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x64, 0x43, 0x6f, + 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x49, 0x88, 0x02, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x40, 0x12, + 0x3e, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, + 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, + 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x74, + 0x65, 0x2f, 0x7b, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x7d, 0x12, + 0xaa, 0x01, 0x0a, 0x0e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x32, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, + 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2f, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x29, 0x12, 0x27, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x75, 0x70, 0x67, + 0x72, 0x61, 0x64, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x95, 0x01, 0x0a, + 0x09, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x2d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, - 0x64, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x49, 0x88, 0x02, 0x01, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x40, 0x12, 0x3e, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x75, 0x70, 0x67, 0x72, - 0x61, 0x64, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x75, 0x70, 0x67, 0x72, - 0x61, 0x64, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x5f, 0x73, - 0x74, 0x61, 0x74, 0x65, 0x2f, 0x7b, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, - 0x74, 0x7d, 0x12, 0xaa, 0x01, 0x0a, 0x0e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x32, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, - 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2f, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x12, 0x27, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, - 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, - 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x42, - 0xea, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, - 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0a, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x46, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2f, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x55, 0x58, 0xaa, 0x02, 0x16, 0x43, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x56, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0xca, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x55, 0x70, 0x67, - 0x72, 0x61, 0x64, 0x65, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x22, 0x43, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 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, 0x55, 0x70, 0x67, 0x72, - 0x61, 0x64, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x23, 0x12, 0x21, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x75, 0x70, 0x67, 0x72, 0x61, + 0x64, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x74, 0x79, 0x42, 0xea, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x75, 0x70, 0x67, 0x72, 0x61, + 0x64, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x75, 0x70, 0x67, 0x72, 0x61, + 0x64, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x55, 0x58, 0xaa, + 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, + 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x5c, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0xe2, 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x55, 0x70, 0x67, 0x72, 0x61, + 0x64, 0x65, 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, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3808,7 +4661,7 @@ func file_cosmos_upgrade_v1beta1_query_proto_rawDescGZIP() []byte { return file_cosmos_upgrade_v1beta1_query_proto_rawDescData } -var file_cosmos_upgrade_v1beta1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_cosmos_upgrade_v1beta1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_cosmos_upgrade_v1beta1_query_proto_goTypes = []interface{}{ (*QueryCurrentPlanRequest)(nil), // 0: cosmos.upgrade.v1beta1.QueryCurrentPlanRequest (*QueryCurrentPlanResponse)(nil), // 1: cosmos.upgrade.v1beta1.QueryCurrentPlanResponse @@ -3818,25 +4671,29 @@ var file_cosmos_upgrade_v1beta1_query_proto_goTypes = []interface{}{ (*QueryUpgradedConsensusStateResponse)(nil), // 5: cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse (*QueryModuleVersionsRequest)(nil), // 6: cosmos.upgrade.v1beta1.QueryModuleVersionsRequest (*QueryModuleVersionsResponse)(nil), // 7: cosmos.upgrade.v1beta1.QueryModuleVersionsResponse - (*Plan)(nil), // 8: cosmos.upgrade.v1beta1.Plan - (*ModuleVersion)(nil), // 9: cosmos.upgrade.v1beta1.ModuleVersion + (*QueryAuthorityRequest)(nil), // 8: cosmos.upgrade.v1beta1.QueryAuthorityRequest + (*QueryAuthorityResponse)(nil), // 9: cosmos.upgrade.v1beta1.QueryAuthorityResponse + (*Plan)(nil), // 10: cosmos.upgrade.v1beta1.Plan + (*ModuleVersion)(nil), // 11: cosmos.upgrade.v1beta1.ModuleVersion } var file_cosmos_upgrade_v1beta1_query_proto_depIdxs = []int32{ - 8, // 0: cosmos.upgrade.v1beta1.QueryCurrentPlanResponse.plan:type_name -> cosmos.upgrade.v1beta1.Plan - 9, // 1: cosmos.upgrade.v1beta1.QueryModuleVersionsResponse.module_versions:type_name -> cosmos.upgrade.v1beta1.ModuleVersion - 0, // 2: cosmos.upgrade.v1beta1.Query.CurrentPlan:input_type -> cosmos.upgrade.v1beta1.QueryCurrentPlanRequest - 2, // 3: cosmos.upgrade.v1beta1.Query.AppliedPlan:input_type -> cosmos.upgrade.v1beta1.QueryAppliedPlanRequest - 4, // 4: cosmos.upgrade.v1beta1.Query.UpgradedConsensusState:input_type -> cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest - 6, // 5: cosmos.upgrade.v1beta1.Query.ModuleVersions:input_type -> cosmos.upgrade.v1beta1.QueryModuleVersionsRequest - 1, // 6: cosmos.upgrade.v1beta1.Query.CurrentPlan:output_type -> cosmos.upgrade.v1beta1.QueryCurrentPlanResponse - 3, // 7: cosmos.upgrade.v1beta1.Query.AppliedPlan:output_type -> cosmos.upgrade.v1beta1.QueryAppliedPlanResponse - 5, // 8: cosmos.upgrade.v1beta1.Query.UpgradedConsensusState:output_type -> cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse - 7, // 9: cosmos.upgrade.v1beta1.Query.ModuleVersions:output_type -> cosmos.upgrade.v1beta1.QueryModuleVersionsResponse - 6, // [6:10] is the sub-list for method output_type - 2, // [2:6] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 10, // 0: cosmos.upgrade.v1beta1.QueryCurrentPlanResponse.plan:type_name -> cosmos.upgrade.v1beta1.Plan + 11, // 1: cosmos.upgrade.v1beta1.QueryModuleVersionsResponse.module_versions:type_name -> cosmos.upgrade.v1beta1.ModuleVersion + 0, // 2: cosmos.upgrade.v1beta1.Query.CurrentPlan:input_type -> cosmos.upgrade.v1beta1.QueryCurrentPlanRequest + 2, // 3: cosmos.upgrade.v1beta1.Query.AppliedPlan:input_type -> cosmos.upgrade.v1beta1.QueryAppliedPlanRequest + 4, // 4: cosmos.upgrade.v1beta1.Query.UpgradedConsensusState:input_type -> cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest + 6, // 5: cosmos.upgrade.v1beta1.Query.ModuleVersions:input_type -> cosmos.upgrade.v1beta1.QueryModuleVersionsRequest + 8, // 6: cosmos.upgrade.v1beta1.Query.Authority:input_type -> cosmos.upgrade.v1beta1.QueryAuthorityRequest + 1, // 7: cosmos.upgrade.v1beta1.Query.CurrentPlan:output_type -> cosmos.upgrade.v1beta1.QueryCurrentPlanResponse + 3, // 8: cosmos.upgrade.v1beta1.Query.AppliedPlan:output_type -> cosmos.upgrade.v1beta1.QueryAppliedPlanResponse + 5, // 9: cosmos.upgrade.v1beta1.Query.UpgradedConsensusState:output_type -> cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse + 7, // 10: cosmos.upgrade.v1beta1.Query.ModuleVersions:output_type -> cosmos.upgrade.v1beta1.QueryModuleVersionsResponse + 9, // 11: cosmos.upgrade.v1beta1.Query.Authority:output_type -> cosmos.upgrade.v1beta1.QueryAuthorityResponse + 7, // [7:12] is the sub-list for method output_type + 2, // [2:7] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_cosmos_upgrade_v1beta1_query_proto_init() } @@ -3942,6 +4799,30 @@ func file_cosmos_upgrade_v1beta1_query_proto_init() { return nil } } + file_cosmos_upgrade_v1beta1_query_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAuthorityRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_upgrade_v1beta1_query_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAuthorityResponse); 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{ @@ -3949,7 +4830,7 @@ func file_cosmos_upgrade_v1beta1_query_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_upgrade_v1beta1_query_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 10, NumExtensions: 0, NumServices: 1, }, diff --git a/api/cosmos/upgrade/v1beta1/query_grpc.pb.go b/api/cosmos/upgrade/v1beta1/query_grpc.pb.go index b812c237e47d..69626cd2fbdb 100644 --- a/api/cosmos/upgrade/v1beta1/query_grpc.pb.go +++ b/api/cosmos/upgrade/v1beta1/query_grpc.pb.go @@ -38,6 +38,8 @@ type QueryClient interface { // // Since: cosmos-sdk 0.43 ModuleVersions(ctx context.Context, in *QueryModuleVersionsRequest, opts ...grpc.CallOption) (*QueryModuleVersionsResponse, error) + // Returns the account with authority to conduct upgrades + Authority(ctx context.Context, in *QueryAuthorityRequest, opts ...grpc.CallOption) (*QueryAuthorityResponse, error) } type queryClient struct { @@ -85,6 +87,15 @@ func (c *queryClient) ModuleVersions(ctx context.Context, in *QueryModuleVersion return out, nil } +func (c *queryClient) Authority(ctx context.Context, in *QueryAuthorityRequest, opts ...grpc.CallOption) (*QueryAuthorityResponse, error) { + out := new(QueryAuthorityResponse) + err := c.cc.Invoke(ctx, "/cosmos.upgrade.v1beta1.Query/Authority", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. // All implementations must embed UnimplementedQueryServer // for forward compatibility @@ -105,6 +116,8 @@ type QueryServer interface { // // Since: cosmos-sdk 0.43 ModuleVersions(context.Context, *QueryModuleVersionsRequest) (*QueryModuleVersionsResponse, error) + // Returns the account with authority to conduct upgrades + Authority(context.Context, *QueryAuthorityRequest) (*QueryAuthorityResponse, error) mustEmbedUnimplementedQueryServer() } @@ -124,6 +137,9 @@ func (UnimplementedQueryServer) UpgradedConsensusState(context.Context, *QueryUp func (UnimplementedQueryServer) ModuleVersions(context.Context, *QueryModuleVersionsRequest) (*QueryModuleVersionsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ModuleVersions not implemented") } +func (UnimplementedQueryServer) Authority(context.Context, *QueryAuthorityRequest) (*QueryAuthorityResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Authority not implemented") +} func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} // UnsafeQueryServer may be embedded to opt out of forward compatibility for this service. @@ -209,6 +225,24 @@ func _Query_ModuleVersions_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +func _Query_Authority_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAuthorityRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Authority(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.upgrade.v1beta1.Query/Authority", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Authority(ctx, req.(*QueryAuthorityRequest)) + } + return interceptor(ctx, in, info, handler) +} + // Query_ServiceDesc is the grpc.ServiceDesc for Query service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -232,6 +266,10 @@ var Query_ServiceDesc = grpc.ServiceDesc{ MethodName: "ModuleVersions", Handler: _Query_ModuleVersions_Handler, }, + { + MethodName: "Authority", + Handler: _Query_Authority_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/upgrade/v1beta1/query.proto", diff --git a/api/cosmos/upgrade/v1beta1/upgrade.pulsar.go b/api/cosmos/upgrade/v1beta1/upgrade.pulsar.go index 7ce4fada4245..16d231f8347b 100644 --- a/api/cosmos/upgrade/v1beta1/upgrade.pulsar.go +++ b/api/cosmos/upgrade/v1beta1/upgrade.pulsar.go @@ -2326,6 +2326,10 @@ func (x *Plan) GetUpgradedClientState() *anypb.Any { // SoftwareUpgradeProposal is a gov Content type for initiating a software // upgrade. +// Deprecated: This legacy proposal is deprecated in favor of Msg-based gov +// proposals, see MsgSoftwareUpgrade. +// +// Deprecated: Do not use. type SoftwareUpgradeProposal struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2379,6 +2383,10 @@ func (x *SoftwareUpgradeProposal) GetPlan() *Plan { // CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software // upgrade. +// Deprecated: This legacy proposal is deprecated in favor of Msg-based gov +// proposals, see MsgCancelUpgrade. +// +// Deprecated: Do not use. type CancelSoftwareUpgradeProposal struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2495,7 +2503,7 @@ var file_cosmos_upgrade_v1beta1_upgrade_proto_rawDesc = []byte{ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x42, 0x02, 0x18, 0x01, 0x52, 0x13, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x64, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x3a, 0x08, 0x98, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x01, 0x22, 0x93, 0x01, + 0x61, 0x74, 0x65, 0x3a, 0x08, 0x98, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x01, 0x22, 0x95, 0x01, 0x0a, 0x17, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, @@ -2504,34 +2512,34 @@ var file_cosmos_upgrade_v1beta1_upgrade_proto_rawDesc = []byte{ 0x6e, 0x12, 0x36, 0x0a, 0x04, 0x70, 0x6c, 0x61, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x6c, 0x61, 0x6e, 0x42, 0x04, 0xc8, - 0xde, 0x1f, 0x00, 0x52, 0x04, 0x70, 0x6c, 0x61, 0x6e, 0x3a, 0x08, 0x98, 0xa0, 0x1f, 0x00, 0xe8, - 0xa0, 0x1f, 0x01, 0x22, 0x61, 0x0a, 0x1d, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x6f, 0x66, - 0x74, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x50, 0x72, 0x6f, 0x70, - 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x08, 0x98, 0xa0, - 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x01, 0x22, 0x47, 0x0a, 0x0d, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, - 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x08, 0x98, 0xa0, 0x1f, 0x01, 0xe8, 0xa0, 0x1f, 0x01, 0x42, - 0xf0, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x75, - 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0c, - 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x46, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2f, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x55, 0x58, 0xaa, 0x02, 0x16, 0x43, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x56, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x55, - 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, - 0x22, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 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, 0x55, 0x70, - 0x67, 0x72, 0x61, 0x64, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xc8, 0xe1, - 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0xde, 0x1f, 0x00, 0x52, 0x04, 0x70, 0x6c, 0x61, 0x6e, 0x3a, 0x0a, 0x18, 0x01, 0x98, 0xa0, 0x1f, + 0x00, 0xe8, 0xa0, 0x1f, 0x01, 0x22, 0x63, 0x0a, 0x1d, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, + 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x50, 0x72, + 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x0a, + 0x18, 0x01, 0x98, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x01, 0x22, 0x47, 0x0a, 0x0d, 0x4d, 0x6f, + 0x64, 0x75, 0x6c, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x08, 0x98, 0xa0, 0x1f, 0x01, 0xe8, + 0xa0, 0x1f, 0x01, 0x42, 0xf0, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x42, 0x0c, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x75, 0x70, 0x67, 0x72, + 0x61, 0x64, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x75, 0x70, 0x67, 0x72, + 0x61, 0x64, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x55, 0x58, + 0xaa, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, + 0x65, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x5c, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0xe2, 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x55, 0x70, 0x67, 0x72, + 0x61, 0x64, 0x65, 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, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0xc8, 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/go.sum b/go.sum index 211c612ffe17..445f0305359a 100644 --- a/go.sum +++ b/go.sum @@ -288,6 +288,7 @@ github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2/go.mod h1:Gi7pzVRnvZ1N16JAXpLA github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= +github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= github.com/cosmos/iavl v0.17.3 h1:s2N819a2olOmiauVa0WAhoIJq9EhSXE9HDBAoR9k+8Y= github.com/cosmos/iavl v0.17.3/go.mod h1:prJoErZFABYZGDHka1R6Oay4z9PrNeFFiMKHDAMOi4w= github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 h1:DdzS1m6o/pCqeZ8VOAit/gyATedRgjvkVI+UCrLpyuU= @@ -323,6 +324,7 @@ github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFM github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk= +github.com/dgraph-io/badger/v3 v3.2103.2/go.mod h1:RHo4/GmYcKKh5Lxu63wLEMHJ70Pac2JqZRYGhlyAo2M= github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgraph-io/ristretto v0.1.0 h1:Jv3CGQHp9OjuMBSne1485aDpUkTKEcUqF+jm/LuerPI= @@ -535,6 +537,8 @@ github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9 github.com/google/certificate-transparency-go v1.0.21/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg= github.com/google/certificate-transparency-go v1.1.1/go.mod h1:FDKqPvSXawb2ecErVRrD+nfy23RCzyl7eqVCEmlT1Zs= github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= +github.com/google/flatbuffers v1.12.1/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= +github.com/google/flatbuffers v2.0.0+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -1653,6 +1657,7 @@ golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211113001501-0c823b97ae02/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/orm/internal/testpb/bank.proto b/orm/internal/testpb/bank.proto index da9709d52b28..919ae5f163f3 100644 --- a/orm/internal/testpb/bank.proto +++ b/orm/internal/testpb/bank.proto @@ -9,21 +9,30 @@ import "cosmos/orm/v1alpha1/orm.proto"; message Balance { option (cosmos.orm.v1alpha1.table) = { id: 1; - primary_key:{fields: "address,denom"} - index: {id: 1 fields: "denom"} - }; +primary_key: { +fields: + "address,denom" +} +index: { +id: + 1 fields: "denom" +} +}; - string address = 1; - string denom = 2; - uint64 amount = 3; +string address = 1; +string denom = 2; +uint64 amount = 3; } message Supply { option (cosmos.orm.v1alpha1.table) = { id: 2; - primary_key:{fields: "denom"} - }; +primary_key: { +fields: + "denom" +} +}; - string denom = 1; - uint64 amount = 2; +string denom = 1; +uint64 amount = 2; } diff --git a/orm/internal/testpb/test_schema.proto b/orm/internal/testpb/test_schema.proto index 875343feaea2..0fb83250ad06 100644 --- a/orm/internal/testpb/test_schema.proto +++ b/orm/internal/testpb/test_schema.proto @@ -9,86 +9,86 @@ import "cosmos/orm/v1alpha1/orm.proto"; message ExampleTable { option (cosmos.orm.v1alpha1.table) = { id: 1; - primary_key: { - fields: "u32,i64,str" - } - index:{ - id: 1; - fields:"u64,str" - unique: true - } - index:{ - id: 2; - fields:"str,u32" - } - index:{ - id: 3; - fields:"bz,str" - } - }; +primary_key: { +fields: + "u32,i64,str" +} +index: { +id: + 1; +fields: + "u64,str" unique: true +} +index: { +id: + 2; +fields: + "str,u32" +} +index: { +id: + 3; +fields: + "bz,str" +} +}; - // Valid key fields: - uint32 u32 = 1; - uint64 u64 = 2; - string str = 3; - bytes bz = 4; - google.protobuf.Timestamp ts = 5; - google.protobuf.Duration dur = 6; - int32 i32 = 7; - sint32 s32 = 8; - sfixed32 sf32 = 9; - int64 i64 = 10; - sint64 s64 = 11; - sfixed64 sf64 = 12; - fixed32 f32 = 13; - fixed64 f64 = 14; - bool b = 15; - Enum e = 16; +// Valid key fields: +uint32 u32 = 1; +uint64 u64 = 2; +string str = 3; +bytes bz = 4; +google.protobuf.Timestamp ts = 5; +google.protobuf.Duration dur = 6; +int32 i32 = 7; +sint32 s32 = 8; +sfixed32 sf32 = 9; +int64 i64 = 10; +sint64 s64 = 11; +sfixed64 sf64 = 12; +fixed32 f32 = 13; +fixed64 f64 = 14; +bool b = 15; +Enum e = 16; - // Invalid key fields: - repeated uint32 repeated = 17; - map map = 18; - ExampleMessage msg = 19; - oneof sum { - uint32 oneof = 20; - } +// Invalid key fields: +repeated uint32 repeated = 17; +map map = 18; +ExampleMessage msg = 19; +oneof sum { + uint32 oneof = 20; +} - message ExampleMessage { - string foo = 1; - int32 bar = 2; - } +message ExampleMessage { + string foo = 1; + int32 bar = 2; +} } enum Enum { ENUM_UNSPECIFIED = 0; - ENUM_ONE = 1; - ENUM_TWO = 2; - ENUM_FIVE = 5; - ENUM_NEG_THREE = -3; + ENUM_ONE = 1; + ENUM_TWO = 2; + ENUM_FIVE = 5; + ENUM_NEG_THREE = -3; } - message ExampleAutoIncrementTable { option (cosmos.orm.v1alpha1.table) = { id: 3 - primary_key:{ - fields:"id" - auto_increment: true - } - index:{ - id: 1 - fields:"x" - unique: true - } + primary_key: {fields: "id" auto_increment: true} + index: {id: 1 fields: "x" unique: true} }; uint64 id = 1; - string x = 2; - int32 y = 3; + string x = 2; + int32 y = 3; } message ExampleSingleton { - option (cosmos.orm.v1alpha1.singleton) = {id: 2}; + option (cosmos.orm.v1alpha1.singleton) = { + id: 2 + }; string foo = 1; - int32 bar = 2; + int32 bar = 2; } diff --git a/proto/cosmos/app/module/v1alpha1/module.proto b/proto/cosmos/app/module/v1alpha1/module.proto index 5d9e95d330ad..a002fd912ed2 100644 --- a/proto/cosmos/app/module/v1alpha1/module.proto +++ b/proto/cosmos/app/module/v1alpha1/module.proto @@ -8,8 +8,6 @@ import "cosmos/app/v1alpha1/module.proto"; message Module { option (cosmos.app.v1alpha1.is_module) = { go_import: "github.com/cosmos/cosmos-sdk/app" - use_package: { - name: "cosmos.app.v1alpha1" - } + use_package: {name: "cosmos.app.v1alpha1"} }; } diff --git a/proto/cosmos/authz/v1beta1/query.proto b/proto/cosmos/authz/v1beta1/query.proto index 72e14c74ab77..62154ac19a43 100644 --- a/proto/cosmos/authz/v1beta1/query.proto +++ b/proto/cosmos/authz/v1beta1/query.proto @@ -24,7 +24,7 @@ service Query { } // GranteeGrants returns a list of `GrantAuthorization` by grantee. - // + // // Since: cosmos-sdk 0.46 rpc GranteeGrants(QueryGranteeGrantsRequest) returns (QueryGranteeGrantsResponse) { option (google.api.http).get = "/cosmos/authz/v1beta1/grants/grantee/{grantee}"; diff --git a/proto/cosmos/gov/v1beta1/gov.proto b/proto/cosmos/gov/v1beta1/gov.proto index 38d10d960c1a..f1487fe4b56e 100644 --- a/proto/cosmos/gov/v1beta1/gov.proto +++ b/proto/cosmos/gov/v1beta1/gov.proto @@ -69,9 +69,9 @@ message Deposit { message Proposal { option (gogoproto.equal) = true; - uint64 proposal_id = 1; - google.protobuf.Any content = 2 [(cosmos_proto.accepts_interface) = "Content"]; - ProposalStatus status = 3; + uint64 proposal_id = 1; + google.protobuf.Any content = 2 [(cosmos_proto.accepts_interface) = "Content"]; + ProposalStatus status = 3; // final_tally_result is the final tally result of the proposal. When // querying a proposal via gRPC, this field is not populated until the // proposal's voting period has ended. @@ -171,11 +171,7 @@ message DepositParams { message VotingParams { // Length of the voting period. google.protobuf.Duration voting_period = 1 - [ - (gogoproto.nullable) = false, - (gogoproto.stdduration) = true, - (gogoproto.jsontag) = "voting_period,omitempty" - ]; + [(gogoproto.nullable) = false, (gogoproto.stdduration) = true, (gogoproto.jsontag) = "voting_period,omitempty"]; } // TallyParams defines the params for tallying votes on governance proposals. diff --git a/proto/cosmos/gov/v1beta2/gov.proto b/proto/cosmos/gov/v1beta2/gov.proto index c641d27c08ae..5590a717094c 100644 --- a/proto/cosmos/gov/v1beta2/gov.proto +++ b/proto/cosmos/gov/v1beta2/gov.proto @@ -41,15 +41,15 @@ message Deposit { // Proposal defines the core field members of a governance proposal. message Proposal { - uint64 id = 1; - repeated google.protobuf.Any messages = 2; - ProposalStatus status = 3; + uint64 id = 1; + repeated google.protobuf.Any messages = 2; + ProposalStatus status = 3; // final_tally_result is the final tally result of the proposal. When // querying a proposal via gRPC, this field is not populated until the // proposal's voting period has ended. - TallyResult final_tally_result = 4; - google.protobuf.Timestamp submit_time = 5 [(gogoproto.stdtime) = true]; - google.protobuf.Timestamp deposit_end_time = 6 [(gogoproto.stdtime) = true]; + TallyResult final_tally_result = 4; + google.protobuf.Timestamp submit_time = 5 [(gogoproto.stdtime) = true]; + google.protobuf.Timestamp deposit_end_time = 6 [(gogoproto.stdtime) = true]; repeated cosmos.base.v1beta1.Coin total_deposit = 7 [(gogoproto.nullable) = false]; google.protobuf.Timestamp voting_start_time = 8 [(gogoproto.stdtime) = true]; google.protobuf.Timestamp voting_end_time = 9 [(gogoproto.stdtime) = true]; @@ -99,11 +99,13 @@ message Vote { // DepositParams defines the params for deposits on governance proposals. message DepositParams { // Minimum deposit for a proposal to enter voting period. - repeated cosmos.base.v1beta1.Coin min_deposit = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "min_deposit,omitempty"]; + repeated cosmos.base.v1beta1.Coin min_deposit = 1 + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "min_deposit,omitempty"]; // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 // months. - google.protobuf.Duration max_deposit_period = 2 [(gogoproto.stdduration) = true, (gogoproto.jsontag) = "max_deposit_period,omitempty"]; + google.protobuf.Duration max_deposit_period = 2 + [(gogoproto.stdduration) = true, (gogoproto.jsontag) = "max_deposit_period,omitempty"]; } // VotingParams defines the params for voting on governance proposals. diff --git a/proto/cosmos/msg/v1/msg.proto b/proto/cosmos/msg/v1/msg.proto index 8c2e29f74726..89bdf3129f32 100644 --- a/proto/cosmos/msg/v1/msg.proto +++ b/proto/cosmos/msg/v1/msg.proto @@ -1,4 +1,4 @@ -syntax="proto3"; +syntax = "proto3"; package cosmos.msg.v1; diff --git a/proto/cosmos/nft/v1beta1/query.proto b/proto/cosmos/nft/v1beta1/query.proto index d343ca6f6695..c1d8070f4da8 100644 --- a/proto/cosmos/nft/v1beta1/query.proto +++ b/proto/cosmos/nft/v1beta1/query.proto @@ -24,7 +24,8 @@ service Query { option (google.api.http).get = "/cosmos/nft/v1beta1/supply/{class_id}"; } - // NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in ERC721Enumerable + // NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in + // ERC721Enumerable rpc NFTs(QueryNFTsRequest) returns (QueryNFTsResponse) { option (google.api.http).get = "/cosmos/nft/v1beta1/nfts"; } diff --git a/proto/cosmos/staking/v1beta1/staking.proto b/proto/cosmos/staking/v1beta1/staking.proto index aa57db052096..dcf2645fa247 100644 --- a/proto/cosmos/staking/v1beta1/staking.proto +++ b/proto/cosmos/staking/v1beta1/staking.proto @@ -214,7 +214,7 @@ message UnbondingDelegation { // validator_address is the bech32-encoded address of the validator. string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // entries are the unbonding delegation entries. - repeated UnbondingDelegationEntry entries = 3 [(gogoproto.nullable) = false]; // unbonding delegation entries + repeated UnbondingDelegationEntry entries = 3 [(gogoproto.nullable) = false]; // unbonding delegation entries } // UnbondingDelegationEntry defines an unbonding object with relevant metadata. @@ -277,7 +277,7 @@ message Redelegation { // validator_dst_address is the validator redelegation destination operator address. string validator_dst_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // entries are the redelegation entries. - repeated RedelegationEntry entries = 4 [(gogoproto.nullable) = false]; // redelegation entries + repeated RedelegationEntry entries = 4 [(gogoproto.nullable) = false]; // redelegation entries } // Params defines the parameters for the staking module. diff --git a/proto/cosmos/upgrade/v1beta1/query.proto b/proto/cosmos/upgrade/v1beta1/query.proto index e5a227bc0d08..e8c4baa0d66b 100644 --- a/proto/cosmos/upgrade/v1beta1/query.proto +++ b/proto/cosmos/upgrade/v1beta1/query.proto @@ -35,6 +35,11 @@ service Query { rpc ModuleVersions(QueryModuleVersionsRequest) returns (QueryModuleVersionsResponse) { option (google.api.http).get = "/cosmos/upgrade/v1beta1/module_versions"; } + + // Returns the account with authority to conduct upgrades + rpc Authority(QueryAuthorityRequest) returns (QueryAuthorityResponse) { + option (google.api.http).get = "/cosmos/upgrade/v1beta1/authority"; + } } // QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC @@ -101,3 +106,15 @@ message QueryModuleVersionsResponse { // module_versions is a list of module names with their consensus versions. repeated ModuleVersion module_versions = 1; } + +// QueryAuthorityRequest is the request type for Query/Authority +// +// Since: cosmos-sdk 0.46 +message QueryAuthorityRequest {} + +// QueryAuthorityResponse is the response type for Query/Authority +// +// Since: cosmos-sdk 0.46 +message QueryAuthorityResponse { + string address = 1; +} \ No newline at end of file diff --git a/proto/cosmos/upgrade/v1beta1/tx.proto b/proto/cosmos/upgrade/v1beta1/tx.proto index a855edc1b13f..9b04bf44bebc 100644 --- a/proto/cosmos/upgrade/v1beta1/tx.proto +++ b/proto/cosmos/upgrade/v1beta1/tx.proto @@ -29,7 +29,7 @@ message MsgSoftwareUpgrade { // authority is the address of the governance account. string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + // plan is the upgrade plan. Plan plan = 2 [(gogoproto.nullable) = false]; } diff --git a/proto/cosmos/upgrade/v1beta1/upgrade.proto b/proto/cosmos/upgrade/v1beta1/upgrade.proto index f5f9b35f45e6..4de7d01fc304 100644 --- a/proto/cosmos/upgrade/v1beta1/upgrade.proto +++ b/proto/cosmos/upgrade/v1beta1/upgrade.proto @@ -46,7 +46,7 @@ message Plan { // Deprecated: This legacy proposal is deprecated in favor of Msg-based gov // proposals, see MsgSoftwareUpgrade. message SoftwareUpgradeProposal { - option deprecated = true; + option deprecated = true; option (gogoproto.equal) = true; option (gogoproto.goproto_stringer) = false; @@ -60,7 +60,7 @@ message SoftwareUpgradeProposal { // Deprecated: This legacy proposal is deprecated in favor of Msg-based gov // proposals, see MsgCancelUpgrade. message CancelSoftwareUpgradeProposal { - option deprecated = true; + option deprecated = true; option (gogoproto.equal) = true; option (gogoproto.goproto_stringer) = false; diff --git a/proto/cosmos/vesting/v1beta1/tx.proto b/proto/cosmos/vesting/v1beta1/tx.proto index 4ba712be579c..211bad09e0ad 100644 --- a/proto/cosmos/vesting/v1beta1/tx.proto +++ b/proto/cosmos/vesting/v1beta1/tx.proto @@ -42,7 +42,6 @@ message MsgCreateVestingAccount { // MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. message MsgCreateVestingAccountResponse {} - // MsgCreatePermanentLockedAccount defines a message that enables creating a permanent // locked account. message MsgCreatePermanentLockedAccount { @@ -51,7 +50,7 @@ message MsgCreatePermanentLockedAccount { string from_address = 1 [(gogoproto.moretags) = "yaml:\"from_address\""]; string to_address = 2 [(gogoproto.moretags) = "yaml:\"to_address\""]; repeated cosmos.base.v1beta1.Coin amount = 3 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; } // MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. diff --git a/proto/tendermint/abci/types.proto b/proto/tendermint/abci/types.proto index 2cbcabb29b33..d41a522689e8 100644 --- a/proto/tendermint/abci/types.proto +++ b/proto/tendermint/abci/types.proto @@ -58,13 +58,12 @@ message RequestSetOption { } message RequestInitChain { - google.protobuf.Timestamp time = 1 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - string chain_id = 2; - ConsensusParams consensus_params = 3; - repeated ValidatorUpdate validators = 4 [(gogoproto.nullable) = false]; - bytes app_state_bytes = 5; - int64 initial_height = 6; + google.protobuf.Timestamp time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + string chain_id = 2; + ConsensusParams consensus_params = 3; + repeated ValidatorUpdate validators = 4 [(gogoproto.nullable) = false]; + bytes app_state_bytes = 5; + int64 initial_height = 6; } message RequestQuery { @@ -102,13 +101,12 @@ message RequestEndBlock { message RequestCommit {} // lists available snapshots -message RequestListSnapshots { -} +message RequestListSnapshots {} // offers a snapshot to the application message RequestOfferSnapshot { - Snapshot snapshot = 1; // snapshot offered by peers - bytes app_hash = 2; // light client-verified app hash for snapshot height + Snapshot snapshot = 1; // snapshot offered by peers + bytes app_hash = 2; // light client-verified app hash for snapshot height } // loads a snapshot chunk @@ -187,8 +185,8 @@ message ResponseInitChain { message ResponseQuery { uint32 code = 1; // bytes data = 2; // use "value" instead. - string log = 3; // nondeterministic - string info = 4; // nondeterministic + string log = 3; // nondeterministic + string info = 4; // nondeterministic int64 index = 5; bytes key = 6; bytes value = 7; @@ -198,40 +196,35 @@ message ResponseQuery { } message ResponseBeginBlock { - repeated Event events = 1 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; + repeated Event events = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; } message ResponseCheckTx { uint32 code = 1; bytes data = 2; - string log = 3; // nondeterministic - string info = 4; // nondeterministic + string log = 3; // nondeterministic + string info = 4; // nondeterministic int64 gas_wanted = 5 [json_name = "gas_wanted"]; int64 gas_used = 6 [json_name = "gas_used"]; - repeated Event events = 7 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; - string codespace = 8; + repeated Event events = 7 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; + string codespace = 8; } message ResponseDeliverTx { uint32 code = 1; bytes data = 2; - string log = 3; // nondeterministic - string info = 4; // nondeterministic + string log = 3; // nondeterministic + string info = 4; // nondeterministic int64 gas_wanted = 5 [json_name = "gas_wanted"]; int64 gas_used = 6 [json_name = "gas_used"]; - repeated Event events = 7 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; - string codespace = 8; + repeated Event events = 7 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; + string codespace = 8; } message ResponseEndBlock { - repeated ValidatorUpdate validator_updates = 1 - [(gogoproto.nullable) = false]; - ConsensusParams consensus_param_updates = 2; - repeated Event events = 3 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; + repeated ValidatorUpdate validator_updates = 1 [(gogoproto.nullable) = false]; + ConsensusParams consensus_param_updates = 2; + repeated Event events = 3 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; } message ResponseCommit { @@ -248,12 +241,12 @@ message ResponseOfferSnapshot { Result result = 1; enum Result { - UNKNOWN = 0; // Unknown result, abort all snapshot restoration - ACCEPT = 1; // Snapshot accepted, apply chunks - ABORT = 2; // Abort all snapshot restoration - REJECT = 3; // Reject this specific snapshot, try others - REJECT_FORMAT = 4; // Reject all snapshots of this format, try others - REJECT_SENDER = 5; // Reject all snapshots from the sender(s), try others + UNKNOWN = 0; // Unknown result, abort all snapshot restoration + ACCEPT = 1; // Snapshot accepted, apply chunks + ABORT = 2; // Abort all snapshot restoration + REJECT = 3; // Reject this specific snapshot, try others + REJECT_FORMAT = 4; // Reject all snapshots of this format, try others + REJECT_SENDER = 5; // Reject all snapshots from the sender(s), try others } } @@ -263,16 +256,16 @@ message ResponseLoadSnapshotChunk { message ResponseApplySnapshotChunk { Result result = 1; - repeated uint32 refetch_chunks = 2; // Chunks to refetch and reapply - repeated string reject_senders = 3; // Chunk senders to reject and ban + repeated uint32 refetch_chunks = 2; // Chunks to refetch and reapply + repeated string reject_senders = 3; // Chunk senders to reject and ban enum Result { - UNKNOWN = 0; // Unknown result, abort all snapshot restoration - ACCEPT = 1; // Chunk successfully accepted - ABORT = 2; // Abort all snapshot restoration - RETRY = 3; // Retry chunk (combine with refetch and reject) - RETRY_SNAPSHOT = 4; // Retry snapshot (combine with refetch and reject) - REJECT_SNAPSHOT = 5; // Reject this snapshot, try others + UNKNOWN = 0; // Unknown result, abort all snapshot restoration + ACCEPT = 1; // Chunk successfully accepted + ABORT = 2; // Abort all snapshot restoration + RETRY = 3; // Retry chunk (combine with refetch and reject) + RETRY_SNAPSHOT = 4; // Retry snapshot (combine with refetch and reject) + REJECT_SNAPSHOT = 5; // Reject this snapshot, try others } } @@ -306,17 +299,14 @@ message LastCommitInfo { // Later, transactions may be queried using these events. message Event { string type = 1; - repeated EventAttribute attributes = 2 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "attributes,omitempty" - ]; + repeated EventAttribute attributes = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "attributes,omitempty"]; } // EventAttribute is a single key-value pair, associated with an event. message EventAttribute { bytes key = 1; bytes value = 2; - bool index = 3; // nondeterministic + bool index = 3; // nondeterministic } // TxResult contains results of executing the transaction. @@ -334,9 +324,9 @@ message TxResult { // Validator message Validator { - bytes address = 1; // The first 20 bytes of SHA256(public key) + bytes address = 1; // The first 20 bytes of SHA256(public key) // PubKey pub_key = 2 [(gogoproto.nullable)=false]; - int64 power = 3; // The voting power + int64 power = 3; // The voting power } // ValidatorUpdate @@ -364,10 +354,7 @@ message Evidence { // The height when the offense occurred int64 height = 3; // The corresponding time where the offense occurred - google.protobuf.Timestamp time = 4 [ - (gogoproto.nullable) = false, - (gogoproto.stdtime) = true - ]; + google.protobuf.Timestamp time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; // Total voting power of the validator set in case the ABCI application does // not store historical validators. // https://github.com/tendermint/tendermint/issues/4581 @@ -378,11 +365,11 @@ message Evidence { // State Sync Types message Snapshot { - uint64 height = 1; // The height at which the snapshot was taken - uint32 format = 2; // The application-specific snapshot format - uint32 chunks = 3; // Number of chunks in the snapshot - bytes hash = 4; // Arbitrary snapshot hash, equal only if identical - bytes metadata = 5; // Arbitrary application metadata + uint64 height = 1; // The height at which the snapshot was taken + uint32 format = 2; // The application-specific snapshot format + uint32 chunks = 3; // Number of chunks in the snapshot + bytes hash = 4; // Arbitrary snapshot hash, equal only if identical + bytes metadata = 5; // Arbitrary application metadata } //---------------------------------------- diff --git a/proto/tendermint/types/evidence.proto b/proto/tendermint/types/evidence.proto index 3b234571ba67..d9548a430296 100644 --- a/proto/tendermint/types/evidence.proto +++ b/proto/tendermint/types/evidence.proto @@ -17,19 +17,19 @@ message Evidence { // DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. message DuplicateVoteEvidence { - tendermint.types.Vote vote_a = 1; - tendermint.types.Vote vote_b = 2; - int64 total_voting_power = 3; - int64 validator_power = 4; - google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + tendermint.types.Vote vote_a = 1; + tendermint.types.Vote vote_b = 2; + int64 total_voting_power = 3; + int64 validator_power = 4; + google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; } // LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. message LightClientAttackEvidence { - tendermint.types.LightBlock conflicting_block = 1; - int64 common_height = 2; + tendermint.types.LightBlock conflicting_block = 1; + int64 common_height = 2; repeated tendermint.types.Validator byzantine_validators = 3; - int64 total_voting_power = 4; + int64 total_voting_power = 4; google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; } diff --git a/proto/tendermint/types/params.proto b/proto/tendermint/types/params.proto index 0de7d846fbd3..70789222a5d3 100644 --- a/proto/tendermint/types/params.proto +++ b/proto/tendermint/types/params.proto @@ -45,8 +45,7 @@ message EvidenceParams { // It should correspond with an app's "unbonding period" or other similar // mechanism for handling [Nothing-At-Stake // attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). - google.protobuf.Duration max_age_duration = 2 - [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; + google.protobuf.Duration max_age_duration = 2 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; // This sets the maximum size of total evidence in bytes that can be committed in a single block. // and should fall comfortably under the max block bytes. diff --git a/proto/tendermint/types/types.proto b/proto/tendermint/types/types.proto index 7f7ea74cac21..57efc33c5b7e 100644 --- a/proto/tendermint/types/types.proto +++ b/proto/tendermint/types/types.proto @@ -66,19 +66,19 @@ message Header { BlockID last_block_id = 5 [(gogoproto.nullable) = false]; // hashes of block data - bytes last_commit_hash = 6; // commit from validators from the last block - bytes data_hash = 7; // transactions + bytes last_commit_hash = 6; // commit from validators from the last block + bytes data_hash = 7; // transactions // hashes from the app output from the prev block - bytes validators_hash = 8; // validators for the current block - bytes next_validators_hash = 9; // validators for the next block - bytes consensus_hash = 10; // consensus params for current block - bytes app_hash = 11; // state after txs from the previous block - bytes last_results_hash = 12; // root hash of all results from the txs from the previous block + bytes validators_hash = 8; // validators for the current block + bytes next_validators_hash = 9; // validators for the next block + bytes consensus_hash = 10; // consensus params for current block + bytes app_hash = 11; // state after txs from the previous block + bytes last_results_hash = 12; // root hash of all results from the txs from the previous block // consensus info - bytes evidence_hash = 13; // evidence included in the block - bytes proposer_address = 14; // original proposer of the block + bytes evidence_hash = 13; // evidence included in the block + bytes proposer_address = 14; // original proposer of the block } // Data contains the set of transactions included in the block @@ -95,30 +95,27 @@ message Vote { SignedMsgType type = 1; int64 height = 2; int32 round = 3; - BlockID block_id = 4 - [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; // zero if vote is nil. - google.protobuf.Timestamp timestamp = 5 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - bytes validator_address = 6; - int32 validator_index = 7; - bytes signature = 8; + BlockID block_id = 4 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; // zero if vote is nil. + google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + bytes validator_address = 6; + int32 validator_index = 7; + bytes signature = 8; } // Commit contains the evidence that a block was committed by a set of validators. message Commit { - int64 height = 1; - int32 round = 2; - BlockID block_id = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; - repeated CommitSig signatures = 4 [(gogoproto.nullable) = false]; + int64 height = 1; + int32 round = 2; + BlockID block_id = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; + repeated CommitSig signatures = 4 [(gogoproto.nullable) = false]; } // CommitSig is a part of the Vote included in a Commit. message CommitSig { BlockIDFlag block_id_flag = 1; bytes validator_address = 2; - google.protobuf.Timestamp timestamp = 3 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - bytes signature = 4; + google.protobuf.Timestamp timestamp = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + bytes signature = 4; } message Proposal { @@ -127,9 +124,8 @@ message Proposal { int32 round = 3; int32 pol_round = 4; BlockID block_id = 5 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; - google.protobuf.Timestamp timestamp = 6 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - bytes signature = 7; + google.protobuf.Timestamp timestamp = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + bytes signature = 7; } message SignedHeader { diff --git a/simapp/app.go b/simapp/app.go index c057a8bcf728..76178bbc0b43 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -286,7 +286,7 @@ func NewSimApp( ) app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, keys[feegrant.StoreKey], app.AccountKeeper) - app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, app.AccountKeeper) + // register the staking hooks // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks @@ -324,6 +324,8 @@ func NewSimApp( // register the governance hooks ), ) + // set the governance module account as the authority for conducting upgrades + app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, app.AccountKeeper, authtypes.NewModuleAddress(govtypes.ModuleName)) app.NFTKeeper = nftkeeper.NewKeeper(keys[nftkeeper.StoreKey], appCodec, app.AccountKeeper, app.BankKeeper) // create evidence keeper with router diff --git a/x/upgrade/client/cli/tx.go b/x/upgrade/client/cli/tx.go index 1431076ff680..55fba0fb30ee 100644 --- a/x/upgrade/client/cli/tx.go +++ b/x/upgrade/client/cli/tx.go @@ -199,7 +199,7 @@ func NewCmdSubmitCancelUpgradeProposal() *cobra.Command { Use: "cancel-software-upgrade [flags]", Args: cobra.ExactArgs(0), Short: "Cancel the current software upgrade proposal", - Long: "Submits a proposal to cancel the current software upgrade along. Can also be submitted with an initial deposit and metadata.", + Long: "Submits a proposal to cancel the current software upgrade. Can also be submitted with an initial deposit and metadata.", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -217,7 +217,7 @@ func NewCmdSubmitCancelUpgradeProposal() *cobra.Command { return err } - var metadata []byte + var metadata []byte metadata, err = cmd.Flags().GetBytesBase64(cli.FlagMetadata) if err != nil { return err diff --git a/x/upgrade/client/testutil/cli_test.go b/x/upgrade/client/testutil/cli_test.go index 3c083e694726..5b3ef61c5a45 100644 --- a/x/upgrade/client/testutil/cli_test.go +++ b/x/upgrade/client/testutil/cli_test.go @@ -1,3 +1,4 @@ +//go:build norace // +build norace package testutil diff --git a/x/upgrade/keeper/grpc_query.go b/x/upgrade/keeper/grpc_query.go index fe6ec3b51275..c30ac915b52a 100644 --- a/x/upgrade/keeper/grpc_query.go +++ b/x/upgrade/keeper/grpc_query.go @@ -70,3 +70,8 @@ func (k Keeper) ModuleVersions(c context.Context, req *types.QueryModuleVersions ModuleVersions: mv, }, nil } + +// Authority implementsthe the Query/Authority gRPC method, returning the account capable of performing upgrades +func (k Keeper) Authority(c context.Context, req *types.QueryAuthorityRequest) (*types.QueryAuthorityResponse, error) { + return &types.QueryAuthorityResponse{Address: k.authority.String()}, nil +} diff --git a/x/upgrade/keeper/grpc_query_test.go b/x/upgrade/keeper/grpc_query_test.go index 506ea0a07486..da54ae7fe4bf 100644 --- a/x/upgrade/keeper/grpc_query_test.go +++ b/x/upgrade/keeper/grpc_query_test.go @@ -12,6 +12,8 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) @@ -203,6 +205,12 @@ func (suite *UpgradeTestSuite) TestModuleVersions() { } } +func (suite *UpgradeTestSuite) TestAuthority() { + res, err := suite.queryClient.Authority(gocontext.Background(), &types.QueryAuthorityRequest{}) + suite.Require().NoError(err) + suite.Require().Equal(authtypes.NewModuleAddress(govtypes.ModuleName).String(), res.Address) +} + func TestUpgradeTestSuite(t *testing.T) { suite.Run(t, new(UpgradeTestSuite)) } diff --git a/x/upgrade/keeper/keeper.go b/x/upgrade/keeper/keeper.go index 6ce07096b7ff..b53cc2750820 100644 --- a/x/upgrade/keeper/keeper.go +++ b/x/upgrade/keeper/keeper.go @@ -37,6 +37,7 @@ type Keeper struct { versionSetter xp.ProtocolVersionSetter // implements setting the protocol version field on BaseApp downgradeVerified bool // tells if we've already sanity checked that this binary version isn't being used against an old state. authKeeper types.AccountKeeper + authority sdk.AccAddress } // NewKeeper constructs an upgrade Keeper which requires the following arguments: @@ -45,7 +46,7 @@ type Keeper struct { // cdc - the app-wide binary codec // homePath - root directory of the application's config // vs - the interface implemented by baseapp which allows setting baseapp's protocol version field -func NewKeeper(skipUpgradeHeights map[int64]bool, storeKey storetypes.StoreKey, cdc codec.BinaryCodec, homePath string, vs xp.ProtocolVersionSetter, authKeeper types.AccountKeeper) Keeper { +func NewKeeper(skipUpgradeHeights map[int64]bool, storeKey storetypes.StoreKey, cdc codec.BinaryCodec, homePath string, vs xp.ProtocolVersionSetter, authKeeper types.AccountKeeper, authority sdk.AccAddress) Keeper { return Keeper{ homePath: homePath, skipUpgradeHeights: skipUpgradeHeights, @@ -54,6 +55,7 @@ func NewKeeper(skipUpgradeHeights map[int64]bool, storeKey storetypes.StoreKey, upgradeHandlers: map[string]types.UpgradeHandler{}, versionSetter: vs, authKeeper: authKeeper, + authority: authority, } } diff --git a/x/upgrade/keeper/keeper_test.go b/x/upgrade/keeper/keeper_test.go index 4e36523557dc..6a9a8241d11f 100644 --- a/x/upgrade/keeper/keeper_test.go +++ b/x/upgrade/keeper/keeper_test.go @@ -11,6 +11,8 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) @@ -30,6 +32,7 @@ func (s *KeeperTestSuite) SetupTest() { homeDir := filepath.Join(s.T().TempDir(), "x_upgrade_keeper_test") app.UpgradeKeeper = keeper.NewKeeper( // recreate keeper in order to use a custom home path make(map[int64]bool), app.GetKey(types.StoreKey), app.AppCodec(), homeDir, app.BaseApp, app.AccountKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName), ) s.T().Log("home dir:", homeDir) s.homeDir = homeDir diff --git a/x/upgrade/types/query.pb.go b/x/upgrade/types/query.pb.go index d79e402c099e..9e4f501d88c4 100644 --- a/x/upgrade/types/query.pb.go +++ b/x/upgrade/types/query.pb.go @@ -406,6 +406,88 @@ func (m *QueryModuleVersionsResponse) GetModuleVersions() []*ModuleVersion { return nil } +// QueryAuthorityRequest is the request type for Query/Authority +type QueryAuthorityRequest struct { +} + +func (m *QueryAuthorityRequest) Reset() { *m = QueryAuthorityRequest{} } +func (m *QueryAuthorityRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAuthorityRequest) ProtoMessage() {} +func (*QueryAuthorityRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_4a334d07ad8374f0, []int{8} +} +func (m *QueryAuthorityRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAuthorityRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAuthorityRequest.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 *QueryAuthorityRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAuthorityRequest.Merge(m, src) +} +func (m *QueryAuthorityRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAuthorityRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAuthorityRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAuthorityRequest proto.InternalMessageInfo + +// QueryAuthorityResponse is the response type for Query/Authority +type QueryAuthorityResponse struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *QueryAuthorityResponse) Reset() { *m = QueryAuthorityResponse{} } +func (m *QueryAuthorityResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAuthorityResponse) ProtoMessage() {} +func (*QueryAuthorityResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4a334d07ad8374f0, []int{9} +} +func (m *QueryAuthorityResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAuthorityResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAuthorityResponse.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 *QueryAuthorityResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAuthorityResponse.Merge(m, src) +} +func (m *QueryAuthorityResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAuthorityResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAuthorityResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAuthorityResponse proto.InternalMessageInfo + +func (m *QueryAuthorityResponse) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + func init() { proto.RegisterType((*QueryCurrentPlanRequest)(nil), "cosmos.upgrade.v1beta1.QueryCurrentPlanRequest") proto.RegisterType((*QueryCurrentPlanResponse)(nil), "cosmos.upgrade.v1beta1.QueryCurrentPlanResponse") @@ -415,6 +497,8 @@ func init() { proto.RegisterType((*QueryUpgradedConsensusStateResponse)(nil), "cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse") proto.RegisterType((*QueryModuleVersionsRequest)(nil), "cosmos.upgrade.v1beta1.QueryModuleVersionsRequest") proto.RegisterType((*QueryModuleVersionsResponse)(nil), "cosmos.upgrade.v1beta1.QueryModuleVersionsResponse") + proto.RegisterType((*QueryAuthorityRequest)(nil), "cosmos.upgrade.v1beta1.QueryAuthorityRequest") + proto.RegisterType((*QueryAuthorityResponse)(nil), "cosmos.upgrade.v1beta1.QueryAuthorityResponse") } func init() { @@ -422,43 +506,48 @@ func init() { } var fileDescriptor_4a334d07ad8374f0 = []byte{ - // 576 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcf, 0x6e, 0xd3, 0x30, - 0x1c, 0xae, 0xbb, 0x6e, 0x02, 0x17, 0x0d, 0xe4, 0x43, 0x09, 0x61, 0x0a, 0x95, 0x19, 0x50, 0xc4, - 0x1a, 0x6f, 0xed, 0x05, 0x0d, 0x81, 0x80, 0x49, 0x88, 0x21, 0x98, 0xa0, 0x08, 0x0e, 0x5c, 0x2a, - 0xb7, 0xb1, 0xda, 0x88, 0x24, 0xce, 0x62, 0x67, 0x62, 0x9a, 0x76, 0xe1, 0xc4, 0x11, 0x89, 0x3b, - 0x37, 0x2e, 0x3c, 0x09, 0xc7, 0x49, 0x5c, 0x38, 0xec, 0x80, 0x5a, 0x1e, 0x04, 0xc5, 0x71, 0x51, - 0x4a, 0x93, 0x0e, 0x76, 0x6a, 0x63, 0x7f, 0xff, 0x7e, 0xf1, 0xe7, 0x40, 0xdc, 0xe7, 0xc2, 0xe7, - 0x82, 0xc4, 0xe1, 0x20, 0xa2, 0x0e, 0x23, 0x7b, 0x1b, 0x3d, 0x26, 0xe9, 0x06, 0xd9, 0x8d, 0x59, - 0xb4, 0x6f, 0x87, 0x11, 0x97, 0x1c, 0xd5, 0x52, 0x8c, 0xad, 0x31, 0xb6, 0xc6, 0x98, 0x2b, 0x03, - 0xce, 0x07, 0x1e, 0x23, 0x34, 0x74, 0x09, 0x0d, 0x02, 0x2e, 0xa9, 0x74, 0x79, 0x20, 0x52, 0x96, - 0xb9, 0x5a, 0xa0, 0x3c, 0x51, 0x51, 0x28, 0x7c, 0x09, 0x5e, 0x7c, 0x91, 0x58, 0x6d, 0xc5, 0x51, - 0xc4, 0x02, 0xf9, 0xdc, 0xa3, 0x41, 0x87, 0xed, 0xc6, 0x4c, 0x48, 0xfc, 0x14, 0x1a, 0xb3, 0x5b, - 0x22, 0xe4, 0x81, 0x60, 0x68, 0x1d, 0x56, 0x42, 0x8f, 0x06, 0x06, 0xa8, 0x83, 0x46, 0xb5, 0xb5, - 0x62, 0xe7, 0x27, 0xb4, 0x15, 0x47, 0x21, 0x71, 0x53, 0x1b, 0x3d, 0x08, 0x43, 0xcf, 0x65, 0x4e, - 0xc6, 0x08, 0x21, 0x58, 0x09, 0xa8, 0xcf, 0x94, 0xd8, 0xd9, 0x8e, 0xfa, 0x8f, 0x5b, 0xda, 0x7c, - 0x0a, 0xae, 0xcd, 0x6b, 0x70, 0x69, 0xc8, 0xdc, 0xc1, 0x50, 0x2a, 0xc6, 0x42, 0x47, 0x3f, 0xe1, - 0x6d, 0x88, 0x15, 0xe7, 0x55, 0x9a, 0xc2, 0xd9, 0x4a, 0xd0, 0x81, 0x88, 0xc5, 0x4b, 0x49, 0x25, - 0x9b, 0xb8, 0x5d, 0x81, 0x55, 0x8f, 0x0a, 0xd9, 0x9d, 0x92, 0x80, 0xc9, 0xd2, 0x63, 0xb5, 0xb2, - 0x59, 0x36, 0x00, 0x76, 0xe1, 0xd5, 0xb9, 0x52, 0x3a, 0xc9, 0x6d, 0x68, 0xe8, 0x91, 0x9d, 0x6e, - 0x7f, 0x02, 0xe9, 0x8a, 0x04, 0x63, 0x94, 0xeb, 0xa0, 0x71, 0xae, 0x53, 0x8b, 0x73, 0x15, 0x12, - 0x93, 0x27, 0x95, 0x33, 0xe0, 0x42, 0x19, 0xdf, 0x85, 0xa6, 0xb2, 0x7a, 0xc6, 0x9d, 0xd8, 0x63, - 0xaf, 0x59, 0x24, 0x92, 0x43, 0xcc, 0xa4, 0xf5, 0xd5, 0x46, 0x37, 0xf3, 0x8a, 0x60, 0xba, 0xb4, - 0x93, 0xbc, 0x28, 0x1f, 0x5e, 0xce, 0xa5, 0xeb, 0x84, 0x3b, 0xf0, 0xbc, 0xe6, 0xef, 0xe9, 0x2d, - 0x03, 0xd4, 0x17, 0x1a, 0xd5, 0xd6, 0xb5, 0xa2, 0x33, 0x9b, 0x12, 0xea, 0x2c, 0xfb, 0x53, 0xba, - 0xad, 0xe3, 0x45, 0xb8, 0xa8, 0xfc, 0xd0, 0x67, 0x00, 0xab, 0x99, 0x6a, 0x20, 0x52, 0x24, 0x58, - 0xd0, 0x2f, 0x73, 0xfd, 0xdf, 0x09, 0xe9, 0x30, 0x78, 0xed, 0xfd, 0xf7, 0x5f, 0x9f, 0xca, 0xd7, - 0xd1, 0x2a, 0x29, 0xe8, 0x76, 0x3f, 0x25, 0x75, 0x93, 0xc6, 0xa1, 0x2f, 0x00, 0x56, 0x33, 0xf5, - 0x39, 0x21, 0xe0, 0x6c, 0x2f, 0x4f, 0x08, 0x98, 0xd3, 0x4c, 0xdc, 0x56, 0x01, 0x9b, 0xe8, 0x56, - 0x51, 0x40, 0x9a, 0x92, 0x54, 0x40, 0x72, 0x90, 0x1c, 0xe9, 0x21, 0x3a, 0x06, 0xb0, 0x96, 0xdf, - 0x33, 0xb4, 0x39, 0x37, 0xc1, 0xdc, 0x9e, 0x9b, 0x77, 0x4e, 0xc5, 0xd5, 0x83, 0x6c, 0xab, 0x41, - 0xee, 0xa3, 0x7b, 0x64, 0xfe, 0x57, 0x64, 0xa6, 0xf6, 0xe4, 0x20, 0x73, 0xb9, 0x0e, 0x3f, 0x94, - 0x01, 0xfa, 0x0a, 0xe0, 0xf2, 0x74, 0x39, 0x51, 0x6b, 0x6e, 0xb4, 0xdc, 0x8b, 0x60, 0xb6, 0xff, - 0x8b, 0xa3, 0xc7, 0x20, 0x6a, 0x8c, 0x9b, 0xe8, 0x46, 0xd1, 0x18, 0x7f, 0xdd, 0x8d, 0x87, 0x8f, - 0xbe, 0x8d, 0x2c, 0x70, 0x34, 0xb2, 0xc0, 0xcf, 0x91, 0x05, 0x3e, 0x8e, 0xad, 0xd2, 0xd1, 0xd8, - 0x2a, 0xfd, 0x18, 0x5b, 0xa5, 0x37, 0x6b, 0x03, 0x57, 0x0e, 0xe3, 0x9e, 0xdd, 0xe7, 0xfe, 0x44, - 0x2c, 0xfd, 0x69, 0x0a, 0xe7, 0x2d, 0x79, 0xf7, 0x47, 0x59, 0xee, 0x87, 0x4c, 0xf4, 0x96, 0xd4, - 0xd7, 0xb5, 0xfd, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xc6, 0x89, 0xe8, 0xba, 0xdf, 0x05, 0x00, 0x00, + // 644 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xc1, 0x4f, 0x13, 0x4f, + 0x14, 0x66, 0x0a, 0x3f, 0x7e, 0xf2, 0x6a, 0xd0, 0x4c, 0x62, 0x59, 0x57, 0x52, 0x71, 0x40, 0x85, + 0x48, 0x77, 0xa0, 0x5c, 0x0c, 0x46, 0xa3, 0x92, 0x18, 0x31, 0x4a, 0xb4, 0x46, 0x0f, 0x5e, 0x9a, + 0xa1, 0x3b, 0x69, 0x37, 0xb6, 0x3b, 0xcb, 0xce, 0x2c, 0x91, 0x10, 0x2e, 0x9e, 0x3c, 0x9a, 0x18, + 0xaf, 0xde, 0xbc, 0xf8, 0x97, 0x78, 0x24, 0xf1, 0xe2, 0xc1, 0x83, 0x01, 0xff, 0x04, 0xff, 0x00, + 0xb3, 0xb3, 0xb3, 0xa4, 0xa5, 0xbb, 0x0b, 0x7a, 0x6a, 0x77, 0xde, 0xf7, 0x7d, 0xef, 0x7b, 0x3b, + 0xdf, 0x6b, 0x81, 0xb4, 0x84, 0xec, 0x09, 0x49, 0xa3, 0xa0, 0x1d, 0x32, 0x97, 0xd3, 0xed, 0xe5, + 0x4d, 0xae, 0xd8, 0x32, 0xdd, 0x8a, 0x78, 0xb8, 0xe3, 0x04, 0xa1, 0x50, 0x02, 0x57, 0x12, 0x8c, + 0x63, 0x30, 0x8e, 0xc1, 0xd8, 0xd3, 0x6d, 0x21, 0xda, 0x5d, 0x4e, 0x59, 0xe0, 0x51, 0xe6, 0xfb, + 0x42, 0x31, 0xe5, 0x09, 0x5f, 0x26, 0x2c, 0x7b, 0x2e, 0x47, 0x39, 0x55, 0xd1, 0x28, 0x72, 0x11, + 0xa6, 0x9e, 0xc5, 0xad, 0xd6, 0xa2, 0x30, 0xe4, 0xbe, 0x7a, 0xda, 0x65, 0x7e, 0x83, 0x6f, 0x45, + 0x5c, 0x2a, 0xf2, 0x18, 0xac, 0xe1, 0x92, 0x0c, 0x84, 0x2f, 0x39, 0x5e, 0x82, 0xb1, 0xa0, 0xcb, + 0x7c, 0x0b, 0xcd, 0xa0, 0xf9, 0x72, 0x7d, 0xda, 0xc9, 0x76, 0xe8, 0x68, 0x8e, 0x46, 0x92, 0x9a, + 0x69, 0x74, 0x2f, 0x08, 0xba, 0x1e, 0x77, 0xfb, 0x1a, 0x61, 0x0c, 0x63, 0x3e, 0xeb, 0x71, 0x2d, + 0x36, 0xd1, 0xd0, 0xdf, 0x49, 0xdd, 0x34, 0x1f, 0x80, 0x9b, 0xe6, 0x15, 0x18, 0xef, 0x70, 0xaf, + 0xdd, 0x51, 0x9a, 0x31, 0xda, 0x30, 0x4f, 0x64, 0x1d, 0x88, 0xe6, 0xbc, 0x48, 0x5c, 0xb8, 0x6b, + 0x31, 0xda, 0x97, 0x91, 0x7c, 0xae, 0x98, 0xe2, 0x69, 0xb7, 0xcb, 0x50, 0xee, 0x32, 0xa9, 0x9a, + 0x03, 0x12, 0x10, 0x1f, 0x3d, 0xd4, 0x27, 0xab, 0x25, 0x0b, 0x11, 0x0f, 0x66, 0x0b, 0xa5, 0x8c, + 0x93, 0x9b, 0x60, 0x99, 0x91, 0xdd, 0x66, 0x2b, 0x85, 0x34, 0x65, 0x8c, 0xb1, 0x4a, 0x33, 0x68, + 0xfe, 0x6c, 0xa3, 0x12, 0x65, 0x2a, 0xc4, 0x4d, 0x1e, 0x8d, 0x9d, 0x41, 0xe7, 0x4b, 0xe4, 0x36, + 0xd8, 0xba, 0xd5, 0x13, 0xe1, 0x46, 0x5d, 0xfe, 0x92, 0x87, 0x32, 0xbe, 0xc4, 0x3e, 0xb7, 0x3d, + 0x5d, 0x68, 0xf6, 0xbd, 0x22, 0x48, 0x8e, 0x36, 0xe2, 0x17, 0xd5, 0x83, 0x4b, 0x99, 0x74, 0xe3, + 0x70, 0x03, 0xce, 0x19, 0xfe, 0xb6, 0x29, 0x59, 0x68, 0x66, 0x74, 0xbe, 0x5c, 0xbf, 0x9a, 0x77, + 0x67, 0x03, 0x42, 0x8d, 0xc9, 0xde, 0x80, 0x2e, 0x99, 0x82, 0x0b, 0xc9, 0xbd, 0x44, 0xaa, 0x23, + 0x42, 0x4f, 0xed, 0xa4, 0x69, 0xa9, 0x43, 0xe5, 0x78, 0xc1, 0x58, 0xb0, 0xe0, 0x7f, 0xe6, 0xba, + 0x21, 0x97, 0xd2, 0xd8, 0x4f, 0x1f, 0xeb, 0xbf, 0xc7, 0xe1, 0x3f, 0x4d, 0xc2, 0x9f, 0x10, 0x94, + 0xfb, 0x72, 0x86, 0x69, 0x9e, 0xbb, 0x9c, 0xb0, 0xda, 0x4b, 0xa7, 0x27, 0x24, 0xb6, 0xc8, 0xe2, + 0xdb, 0x6f, 0xbf, 0x3e, 0x94, 0xae, 0xe1, 0x39, 0x9a, 0xb3, 0x28, 0xad, 0x84, 0xd4, 0x8c, 0xe3, + 0x8b, 0x3f, 0x23, 0x28, 0xf7, 0x65, 0xf1, 0x04, 0x83, 0xc3, 0x21, 0x3f, 0xc1, 0x60, 0x46, 0xcc, + 0xc9, 0x8a, 0x36, 0x58, 0xc3, 0x37, 0xf2, 0x0c, 0xb2, 0x84, 0xa4, 0x0d, 0xd2, 0xdd, 0x38, 0x1f, + 0x7b, 0xf8, 0x07, 0x82, 0x4a, 0x76, 0x68, 0xf1, 0x6a, 0xa1, 0x83, 0xc2, 0xa5, 0xb1, 0x6f, 0xfd, + 0x13, 0xd7, 0x0c, 0xb2, 0xae, 0x07, 0xb9, 0x8b, 0xef, 0xd0, 0xe2, 0x9f, 0xa4, 0xa1, 0x1d, 0xa2, + 0xbb, 0x7d, 0x9b, 0xba, 0xf7, 0xae, 0x84, 0xf0, 0x17, 0x04, 0x93, 0x83, 0x49, 0xc7, 0xf5, 0x42, + 0x6b, 0x99, 0x5b, 0x65, 0xaf, 0xfc, 0x15, 0xc7, 0x8c, 0x41, 0xf5, 0x18, 0x0b, 0xf8, 0x7a, 0xde, + 0x18, 0xc7, 0x16, 0x0d, 0x7f, 0x44, 0x30, 0x71, 0xb4, 0x0e, 0xb8, 0x56, 0x1c, 0x80, 0x63, 0xfb, + 0x64, 0x3b, 0xa7, 0x85, 0x1b, 0x77, 0x0b, 0xda, 0xdd, 0x2c, 0xbe, 0x92, 0x9b, 0x96, 0x94, 0x72, + 0xff, 0xc1, 0xd7, 0x83, 0x2a, 0xda, 0x3f, 0xa8, 0xa2, 0x9f, 0x07, 0x55, 0xf4, 0xfe, 0xb0, 0x3a, + 0xb2, 0x7f, 0x58, 0x1d, 0xf9, 0x7e, 0x58, 0x1d, 0x79, 0xb5, 0xd8, 0xf6, 0x54, 0x27, 0xda, 0x74, + 0x5a, 0xa2, 0x97, 0xca, 0x24, 0x1f, 0x35, 0xe9, 0xbe, 0xa6, 0x6f, 0x8e, 0x34, 0xd5, 0x4e, 0xc0, + 0xe5, 0xe6, 0xb8, 0xfe, 0x0b, 0x59, 0xf9, 0x13, 0x00, 0x00, 0xff, 0xff, 0x18, 0x7f, 0x99, 0xff, + 0xc4, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -488,6 +577,8 @@ type QueryClient interface { // // Since: cosmos-sdk 0.43 ModuleVersions(ctx context.Context, in *QueryModuleVersionsRequest, opts ...grpc.CallOption) (*QueryModuleVersionsResponse, error) + // Returns the account with authority to conduct upgrades + Authority(ctx context.Context, in *QueryAuthorityRequest, opts ...grpc.CallOption) (*QueryAuthorityResponse, error) } type queryClient struct { @@ -535,6 +626,15 @@ func (c *queryClient) ModuleVersions(ctx context.Context, in *QueryModuleVersion return out, nil } +func (c *queryClient) Authority(ctx context.Context, in *QueryAuthorityRequest, opts ...grpc.CallOption) (*QueryAuthorityResponse, error) { + out := new(QueryAuthorityResponse) + err := c.cc.Invoke(ctx, "/cosmos.upgrade.v1beta1.Query/Authority", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // CurrentPlan queries the current upgrade plan. @@ -552,6 +652,8 @@ type QueryServer interface { // // Since: cosmos-sdk 0.43 ModuleVersions(context.Context, *QueryModuleVersionsRequest) (*QueryModuleVersionsResponse, error) + // Returns the account with authority to conduct upgrades + Authority(context.Context, *QueryAuthorityRequest) (*QueryAuthorityResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -570,6 +672,9 @@ func (*UnimplementedQueryServer) UpgradedConsensusState(ctx context.Context, req func (*UnimplementedQueryServer) ModuleVersions(ctx context.Context, req *QueryModuleVersionsRequest) (*QueryModuleVersionsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ModuleVersions not implemented") } +func (*UnimplementedQueryServer) Authority(ctx context.Context, req *QueryAuthorityRequest) (*QueryAuthorityResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Authority not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -647,6 +752,24 @@ func _Query_ModuleVersions_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +func _Query_Authority_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAuthorityRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Authority(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.upgrade.v1beta1.Query/Authority", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Authority(ctx, req.(*QueryAuthorityRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmos.upgrade.v1beta1.Query", HandlerType: (*QueryServer)(nil), @@ -667,6 +790,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "ModuleVersions", Handler: _Query_ModuleVersions_Handler, }, + { + MethodName: "Authority", + Handler: _Query_Authority_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/upgrade/v1beta1/query.proto", @@ -913,6 +1040,59 @@ func (m *QueryModuleVersionsResponse) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } +func (m *QueryAuthorityRequest) 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 *QueryAuthorityRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAuthorityRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryAuthorityResponse) 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 *QueryAuthorityResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAuthorityResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -1024,6 +1204,28 @@ func (m *QueryModuleVersionsResponse) Size() (n int) { return n } +func (m *QueryAuthorityRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryAuthorityResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1636,6 +1838,138 @@ func (m *QueryModuleVersionsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryAuthorityRequest) 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 ErrIntOverflowQuery + } + 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: QueryAuthorityRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAuthorityRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAuthorityResponse) 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 ErrIntOverflowQuery + } + 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: QueryAuthorityResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAuthorityResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/upgrade/types/query.pb.gw.go b/x/upgrade/types/query.pb.gw.go index ab64b67348a6..4b6bdc06f0cb 100644 --- a/x/upgrade/types/query.pb.gw.go +++ b/x/upgrade/types/query.pb.gw.go @@ -193,6 +193,24 @@ func local_request_Query_ModuleVersions_0(ctx context.Context, marshaler runtime } +func request_Query_Authority_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAuthorityRequest + var metadata runtime.ServerMetadata + + msg, err := client.Authority(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Authority_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAuthorityRequest + var metadata runtime.ServerMetadata + + msg, err := server.Authority(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -279,6 +297,26 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_Authority_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Authority_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Authority_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -400,6 +438,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_Authority_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Authority_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Authority_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -411,6 +469,8 @@ var ( pattern_Query_UpgradedConsensusState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "upgrade", "v1beta1", "upgraded_consensus_state", "last_height"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_ModuleVersions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "upgrade", "v1beta1", "module_versions"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Authority_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "upgrade", "v1beta1", "authority"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -421,4 +481,6 @@ var ( forward_Query_UpgradedConsensusState_0 = runtime.ForwardResponseMessage forward_Query_ModuleVersions_0 = runtime.ForwardResponseMessage + + forward_Query_Authority_0 = runtime.ForwardResponseMessage ) From 5da8064f17a340ae3a3d38fd5f518a9e70077583 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Fri, 25 Feb 2022 19:14:28 +0100 Subject: [PATCH 12/19] remove the new upgrade cli --- x/upgrade/client/cli/tx.go | 142 --------------------------- x/upgrade/client/proposal_handler.go | 3 - 2 files changed, 145 deletions(-) diff --git a/x/upgrade/client/cli/tx.go b/x/upgrade/client/cli/tx.go index 55fba0fb30ee..b4ad5e366806 100644 --- a/x/upgrade/client/cli/tx.go +++ b/x/upgrade/client/cli/tx.go @@ -1,22 +1,16 @@ package cli import ( - "fmt" "os" "path/filepath" - "strings" "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/version" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/gov/client/cli" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta2" "github.com/cosmos/cosmos-sdk/x/upgrade/plan" "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) @@ -40,89 +34,6 @@ func GetTxCmd() *cobra.Command { return cmd } -// NewCmdSubmitUpgradeProposal implements a command handler for submitting a software upgrade proposal transaction. -func NewCmdSubmitUpgradeProposal() *cobra.Command { - cmd := &cobra.Command{ - Use: "software-upgrade [proposal_json_file] [flags]", - Args: cobra.ExactArgs(1), - Short: "Submit a software upgrade proposal", - Long: strings.TrimSpace( - fmt.Sprintf(`Submit a software upgrade along with an initial deposit. -Upgrade plan, metadata and deposit are defined in a JSON file. -Please specify a unique name and height for the upgrade to take effect. -You may include info to reference a binary download link, in a format compatible with: https://github.com/cosmos/cosmos-sdk/tree/master/cosmovisor - -Example: -$ %s tx gov submit-proposal software-upgrade path/to/proposal.json - -Where proposal.json contains: - -{ - "plan": [ - { - "name": "upgrade name", - "height": "123...", - "info": "a7fb1..." - } - ], - "metadata: "4pIMOgIGx1vZGU=", // base64-encoded metadata - "deposit": "10stake" -} -`, version.AppName, - ), - ), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - upgradePlan, metadata, deposit, err := parseSubmitSoftwareUpgradeProposal(clientCtx.Codec, args[0]) - if err != nil { - return err - } - - noValidate, err := cmd.Flags().GetBool(FlagNoValidate) - if err != nil { - return err - } - if !noValidate { - var daemonName string - if daemonName, err = cmd.Flags().GetString(FlagDaemonName); err != nil { - return err - } - var planInfo *plan.Info - if planInfo, err = plan.ParseInfo(upgradePlan.Info); err != nil { - return err - } - if err = planInfo.ValidateFull(daemonName); err != nil { - return err - } - } - - authority := authtypes.NewModuleAddress(govtypes.ModuleName) - - msgs := []sdk.Msg{ - &types.MsgSoftwareUpgrade{ - Authority: authority.String(), - Plan: *upgradePlan, - }, - } - - msg, err := v1beta2.NewMsgSubmitProposal(msgs, deposit, clientCtx.GetFromAddress().String(), metadata) - if err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - cmd.Flags().Bool(FlagNoValidate, false, "Skip validation of the upgrade info") - cmd.Flags().String(FlagDaemonName, getDefaultDaemonName(), "The name of the executable being upgraded (for upgrade-info validation). Default is the DAEMON_NAME env var if set, or else this executable") - - return cmd -} - // NewCmdSubmitLegacyUpgradeProposal implements a command handler for submitting a software upgrade proposal transaction. // Deprecated: please use NewCmdSubmitUpgradeProposal instead. func NewCmdSubmitLegacyUpgradeProposal() *cobra.Command { @@ -193,59 +104,6 @@ func NewCmdSubmitLegacyUpgradeProposal() *cobra.Command { return cmd } -// NewCmdSubmitCancelUpgradeProposal implements a command handler for submitting a software upgrade cancel proposal transaction. -func NewCmdSubmitCancelUpgradeProposal() *cobra.Command { - cmd := &cobra.Command{ - Use: "cancel-software-upgrade [flags]", - Args: cobra.ExactArgs(0), - Short: "Cancel the current software upgrade proposal", - Long: "Submits a proposal to cancel the current software upgrade. Can also be submitted with an initial deposit and metadata.", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - from := clientCtx.GetFromAddress() - - depositStr, err := cmd.Flags().GetString(cli.FlagDeposit) - if err != nil { - return err - } - - deposit, err := sdk.ParseCoinsNormalized(depositStr) - if err != nil { - return err - } - - var metadata []byte - metadata, err = cmd.Flags().GetBytesBase64(cli.FlagMetadata) - if err != nil { - return err - } - - authority := authtypes.NewModuleAddress(govtypes.ModuleName) - - msgs := []sdk.Msg{ - &types.MsgCancelUpgrade{ - Authority: authority.String(), - }, - } - - msg, err := v1beta2.NewMsgSubmitProposal(msgs, deposit, from.String(), metadata) - if err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().BytesBase64(cli.FlagMetadata, []byte{}, "base64 encoded metadata associated with the cancel upgrade proposal") - cmd.Flags().String(cli.FlagDeposit, "", "deposit for the proposal") - - return cmd -} - // NewCmdSubmitLegacyCancelUpgradeProposal implements a command handler for submitting a software upgrade cancel proposal transaction. // Deprecated: please use NewCmdSubmitCancelUpgradeProposal instead. func NewCmdSubmitLegacyCancelUpgradeProposal() *cobra.Command { diff --git a/x/upgrade/client/proposal_handler.go b/x/upgrade/client/proposal_handler.go index c0d6c87408ac..082924787441 100644 --- a/x/upgrade/client/proposal_handler.go +++ b/x/upgrade/client/proposal_handler.go @@ -5,8 +5,5 @@ import ( "github.com/cosmos/cosmos-sdk/x/upgrade/client/cli" ) -var ProposalHandler = govclient.NewProposalHandler(cli.NewCmdSubmitUpgradeProposal) -var CancelProposalHandler = govclient.NewProposalHandler(cli.NewCmdSubmitCancelUpgradeProposal) - var LegacyProposalHandler = govclient.NewProposalHandler(cli.NewCmdSubmitLegacyUpgradeProposal) var LegacyCancelProposalHandler = govclient.NewProposalHandler(cli.NewCmdSubmitLegacyCancelUpgradeProposal) From 3df9278bec69f1930836c51feef06a50d82e7998 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Fri, 25 Feb 2022 19:34:14 +0100 Subject: [PATCH 13/19] fix cli build problems --- simapp/app.go | 1 - x/gov/client/cli/tx.go | 12 ++++-------- x/gov/module.go | 7 ++----- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/simapp/app.go b/simapp/app.go index 9dfb79eb87a7..cfe31f48ab1d 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -117,7 +117,6 @@ var ( mint.AppModuleBasic{}, distr.AppModuleBasic{}, gov.NewAppModuleBasic( - []govclient.ProposalHandler{upgradeclient.ProposalHandler, upgradeclient.CancelProposalHandler}, []govclient.ProposalHandler{paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.LegacyProposalHandler, upgradeclient.LegacyCancelProposalHandler}, ), params.AppModuleBasic{}, diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index e8f543213b6c..be9f02845cf2 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -52,7 +52,7 @@ var ProposalFlags = []string{ // "proposal" child commands. These commands are respective // to proposal type handlers that are implemented in other modules but are mounted // under the governance CLI (eg. parameter change proposals). -func NewTxCmd(propCmds []*cobra.Command, legacyPropCmds []*cobra.Command) *cobra.Command { +func NewTxCmd(legacyPropCmds []*cobra.Command) *cobra.Command { govTxCmd := &cobra.Command{ Use: types.ModuleName, Short: "Governance transactions subcommands", @@ -61,12 +61,6 @@ func NewTxCmd(propCmds []*cobra.Command, legacyPropCmds []*cobra.Command) *cobra RunE: client.ValidateCmd, } - cmdSubmitProp := NewCmdSubmitProposal() - for _, propCmd := range propCmds { - flags.AddTxFlagsToCmd(propCmd) - cmdSubmitProp.AddCommand(propCmd) - } - cmdSubmitLegacyProp := NewCmdSubmitLegacyProposal() for _, propCmd := range legacyPropCmds { flags.AddTxFlagsToCmd(propCmd) @@ -77,7 +71,9 @@ func NewTxCmd(propCmds []*cobra.Command, legacyPropCmds []*cobra.Command) *cobra NewCmdDeposit(), NewCmdVote(), NewCmdWeightedVote(), - cmdSubmitProp, + NewCmdSubmitProposal(), + + // Deprecated cmdSubmitLegacyProp, ) diff --git a/x/gov/module.go b/x/gov/module.go index e23f3ebb835f..1c7e14cbf39c 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -38,13 +38,11 @@ var ( type AppModuleBasic struct { cdc codec.Codec legacyProposalHandlers []govclient.ProposalHandler // legacy proposal handlers which live in governance cli and rest - proposalHandlers []govclient.ProposalHandler // proposal handlers which live in governance cli and rest } // NewAppModuleBasic creates a new AppModuleBasic object -func NewAppModuleBasic(proposalHandlers []govclient.ProposalHandler, legacyProposalHandlers []govclient.ProposalHandler) AppModuleBasic { +func NewAppModuleBasic(legacyProposalHandlers []govclient.ProposalHandler) AppModuleBasic { return AppModuleBasic{ - proposalHandlers: proposalHandlers, legacyProposalHandlers: legacyProposalHandlers, } } @@ -93,10 +91,9 @@ func (a AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux // GetTxCmd returns the root tx command for the gov module. func (a AppModuleBasic) GetTxCmd() *cobra.Command { - proposalCLIHandlers := getProposalCLIHandlers(a.proposalHandlers) legacyProposalCLIHandlers := getProposalCLIHandlers(a.legacyProposalHandlers) - return cli.NewTxCmd(proposalCLIHandlers, legacyProposalCLIHandlers) + return cli.NewTxCmd(legacyProposalCLIHandlers) } func getProposalCLIHandlers(handlers []govclient.ProposalHandler) []*cobra.Command { From 650cc3483aed7f5fbecd91d3f2fb59e9b0366df2 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Tue, 1 Mar 2022 15:45:39 +0100 Subject: [PATCH 14/19] add a check for the authority --- x/upgrade/keeper/msg_server.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/x/upgrade/keeper/msg_server.go b/x/upgrade/keeper/msg_server.go index f837c43602c8..791e87e57441 100644 --- a/x/upgrade/keeper/msg_server.go +++ b/x/upgrade/keeper/msg_server.go @@ -25,9 +25,8 @@ var _ types.MsgServer = msgServer{} // SoftwareUpgrade implements the Msg/SoftwareUpgrade Msg service. func (k msgServer) SoftwareUpgrade(goCtx context.Context, req *types.MsgSoftwareUpgrade) (*types.MsgSoftwareUpgradeResponse, error) { - govAcct := k.authKeeper.GetModuleAddress(gov.ModuleName).String() - if govAcct != req.Authority { - return nil, errors.Wrapf(gov.ErrInvalidSigner, "expected %s got %s", govAcct, req.Authority) + if k.authority.String() != req.Authority { + return nil, errors.Wrapf(gov.ErrInvalidSigner, "expected %s got %s", k.authority.String(), req.Authority) } ctx := sdk.UnwrapSDKContext(goCtx) @@ -41,9 +40,8 @@ func (k msgServer) SoftwareUpgrade(goCtx context.Context, req *types.MsgSoftware // CancelUpgrade implements the Msg/CancelUpgrade Msg service. func (k msgServer) CancelUpgrade(goCtx context.Context, req *types.MsgCancelUpgrade) (*types.MsgCancelUpgradeResponse, error) { - govAcct := k.authKeeper.GetModuleAddress(gov.ModuleName).String() - if govAcct != req.Authority { - return nil, errors.Wrapf(gov.ErrInvalidSigner, "expected %s got %s", govAcct, req.Authority) + if k.authority.String() != req.Authority { + return nil, errors.Wrapf(gov.ErrInvalidSigner, "expected %s got %s", k.authority.String(), req.Authority) } ctx := sdk.UnwrapSDKContext(goCtx) From 689789acf85c5534c62b388faa1373f5129c400b Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Tue, 1 Mar 2022 15:50:13 +0100 Subject: [PATCH 15/19] implement code suggestions --- simapp/app.go | 2 +- x/gov/client/cli/tx.go | 3 +-- x/upgrade/keeper/keeper.go | 6 ++---- x/upgrade/types/expected_keepers.go | 10 ---------- 4 files changed, 4 insertions(+), 17 deletions(-) delete mode 100644 x/upgrade/types/expected_keepers.go diff --git a/simapp/app.go b/simapp/app.go index cfe31f48ab1d..041599851034 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -325,7 +325,7 @@ func NewSimApp( ), ) // set the governance module account as the authority for conducting upgrades - app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, app.AccountKeeper, authtypes.NewModuleAddress(govtypes.ModuleName)) + app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName)) app.NFTKeeper = nftkeeper.NewKeeper(keys[nftkeeper.StoreKey], appCodec, app.AccountKeeper, app.BankKeeper) // create evidence keeper with router diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index be9f02845cf2..82aed4db7d0e 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -48,8 +48,7 @@ var ProposalFlags = []string{ // NewTxCmd returns the transaction commands for this module // governance ModuleClient is slightly different from other ModuleClients in that -// it contains a slice of "proposal" child commands and a slice of legacy -// "proposal" child commands. These commands are respective +// it contains a slice of "proposal" child commands. These commands are respective // to proposal type handlers that are implemented in other modules but are mounted // under the governance CLI (eg. parameter change proposals). func NewTxCmd(legacyPropCmds []*cobra.Command) *cobra.Command { diff --git a/x/upgrade/keeper/keeper.go b/x/upgrade/keeper/keeper.go index b53cc2750820..703965f164bc 100644 --- a/x/upgrade/keeper/keeper.go +++ b/x/upgrade/keeper/keeper.go @@ -36,8 +36,7 @@ type Keeper struct { upgradeHandlers map[string]types.UpgradeHandler // map of plan name to upgrade handler versionSetter xp.ProtocolVersionSetter // implements setting the protocol version field on BaseApp downgradeVerified bool // tells if we've already sanity checked that this binary version isn't being used against an old state. - authKeeper types.AccountKeeper - authority sdk.AccAddress + authority sdk.AccAddress // the address capable of executing and cancelling an upgrade. Usually the gov module account } // NewKeeper constructs an upgrade Keeper which requires the following arguments: @@ -46,7 +45,7 @@ type Keeper struct { // cdc - the app-wide binary codec // homePath - root directory of the application's config // vs - the interface implemented by baseapp which allows setting baseapp's protocol version field -func NewKeeper(skipUpgradeHeights map[int64]bool, storeKey storetypes.StoreKey, cdc codec.BinaryCodec, homePath string, vs xp.ProtocolVersionSetter, authKeeper types.AccountKeeper, authority sdk.AccAddress) Keeper { +func NewKeeper(skipUpgradeHeights map[int64]bool, storeKey storetypes.StoreKey, cdc codec.BinaryCodec, homePath string, vs xp.ProtocolVersionSetter, authority sdk.AccAddress) Keeper { return Keeper{ homePath: homePath, skipUpgradeHeights: skipUpgradeHeights, @@ -54,7 +53,6 @@ func NewKeeper(skipUpgradeHeights map[int64]bool, storeKey storetypes.StoreKey, cdc: cdc, upgradeHandlers: map[string]types.UpgradeHandler{}, versionSetter: vs, - authKeeper: authKeeper, authority: authority, } } diff --git a/x/upgrade/types/expected_keepers.go b/x/upgrade/types/expected_keepers.go deleted file mode 100644 index 45af1e56d429..000000000000 --- a/x/upgrade/types/expected_keepers.go +++ /dev/null @@ -1,10 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// AccountKeeper defines the expected auth Account Keeper (noalias) -type AccountKeeper interface { - GetModuleAddress(moduleName string) sdk.AccAddress -} From d3c83e8d0bfba00b294eca0f9b13d2dd1cd31937 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Thu, 3 Mar 2022 12:10:55 +0100 Subject: [PATCH 16/19] implement suggestions --- simapp/app.go | 2 +- x/gov/client/cli/tx.go | 4 ++-- x/upgrade/keeper/grpc_query.go | 2 +- x/upgrade/keeper/keeper.go | 4 ++-- x/upgrade/keeper/keeper_test.go | 4 ++-- x/upgrade/keeper/msg_server.go | 19 +++++-------------- 6 files changed, 13 insertions(+), 22 deletions(-) diff --git a/simapp/app.go b/simapp/app.go index 041599851034..b43aa8eb1236 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -325,7 +325,7 @@ func NewSimApp( ), ) // set the governance module account as the authority for conducting upgrades - app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName)) + app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) app.NFTKeeper = nftkeeper.NewKeeper(keys[nftkeeper.StoreKey], appCodec, app.AccountKeeper, app.BankKeeper) // create evidence keeper with router diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index 82aed4db7d0e..3de591893d91 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -26,9 +26,9 @@ const ( FlagDescription = "description" // Deprecated: only used for v1beta1 legacy proposals. FlagProposalType = "type" - + FlagDeposit = "deposit" - FlagMetadata = "metadata" + FlagMetadata = "metadata" flagVoter = "voter" flagDepositor = "depositor" flagStatus = "status" diff --git a/x/upgrade/keeper/grpc_query.go b/x/upgrade/keeper/grpc_query.go index c30ac915b52a..5757a05f996f 100644 --- a/x/upgrade/keeper/grpc_query.go +++ b/x/upgrade/keeper/grpc_query.go @@ -73,5 +73,5 @@ func (k Keeper) ModuleVersions(c context.Context, req *types.QueryModuleVersions // Authority implementsthe the Query/Authority gRPC method, returning the account capable of performing upgrades func (k Keeper) Authority(c context.Context, req *types.QueryAuthorityRequest) (*types.QueryAuthorityResponse, error) { - return &types.QueryAuthorityResponse{Address: k.authority.String()}, nil + return &types.QueryAuthorityResponse{Address: k.authority}, nil } diff --git a/x/upgrade/keeper/keeper.go b/x/upgrade/keeper/keeper.go index 703965f164bc..52b47755b977 100644 --- a/x/upgrade/keeper/keeper.go +++ b/x/upgrade/keeper/keeper.go @@ -36,7 +36,7 @@ type Keeper struct { upgradeHandlers map[string]types.UpgradeHandler // map of plan name to upgrade handler versionSetter xp.ProtocolVersionSetter // implements setting the protocol version field on BaseApp downgradeVerified bool // tells if we've already sanity checked that this binary version isn't being used against an old state. - authority sdk.AccAddress // the address capable of executing and cancelling an upgrade. Usually the gov module account + authority string // the address capable of executing and cancelling an upgrade. Usually the gov module account } // NewKeeper constructs an upgrade Keeper which requires the following arguments: @@ -45,7 +45,7 @@ type Keeper struct { // cdc - the app-wide binary codec // homePath - root directory of the application's config // vs - the interface implemented by baseapp which allows setting baseapp's protocol version field -func NewKeeper(skipUpgradeHeights map[int64]bool, storeKey storetypes.StoreKey, cdc codec.BinaryCodec, homePath string, vs xp.ProtocolVersionSetter, authority sdk.AccAddress) Keeper { +func NewKeeper(skipUpgradeHeights map[int64]bool, storeKey storetypes.StoreKey, cdc codec.BinaryCodec, homePath string, vs xp.ProtocolVersionSetter, authority string) Keeper { return Keeper{ homePath: homePath, skipUpgradeHeights: skipUpgradeHeights, diff --git a/x/upgrade/keeper/keeper_test.go b/x/upgrade/keeper/keeper_test.go index 6a9a8241d11f..a91b0b748d21 100644 --- a/x/upgrade/keeper/keeper_test.go +++ b/x/upgrade/keeper/keeper_test.go @@ -31,8 +31,8 @@ func (s *KeeperTestSuite) SetupTest() { app := simapp.Setup(s.T(), false) homeDir := filepath.Join(s.T().TempDir(), "x_upgrade_keeper_test") app.UpgradeKeeper = keeper.NewKeeper( // recreate keeper in order to use a custom home path - make(map[int64]bool), app.GetKey(types.StoreKey), app.AppCodec(), homeDir, app.BaseApp, app.AccountKeeper, - authtypes.NewModuleAddress(govtypes.ModuleName), + make(map[int64]bool), app.GetKey(types.StoreKey), app.AppCodec(), homeDir, app.BaseApp, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) s.T().Log("home dir:", homeDir) s.homeDir = homeDir diff --git a/x/upgrade/keeper/msg_server.go b/x/upgrade/keeper/msg_server.go index 791e87e57441..1e1249f5e899 100644 --- a/x/upgrade/keeper/msg_server.go +++ b/x/upgrade/keeper/msg_server.go @@ -25,8 +25,8 @@ var _ types.MsgServer = msgServer{} // SoftwareUpgrade implements the Msg/SoftwareUpgrade Msg service. func (k msgServer) SoftwareUpgrade(goCtx context.Context, req *types.MsgSoftwareUpgrade) (*types.MsgSoftwareUpgradeResponse, error) { - if k.authority.String() != req.Authority { - return nil, errors.Wrapf(gov.ErrInvalidSigner, "expected %s got %s", k.authority.String(), req.Authority) + if k.authority != req.Authority { + return nil, errors.Wrapf(gov.ErrInvalidSigner, "expected %s got %s", k.authority, req.Authority) } ctx := sdk.UnwrapSDKContext(goCtx) @@ -40,21 +40,12 @@ func (k msgServer) SoftwareUpgrade(goCtx context.Context, req *types.MsgSoftware // CancelUpgrade implements the Msg/CancelUpgrade Msg service. func (k msgServer) CancelUpgrade(goCtx context.Context, req *types.MsgCancelUpgrade) (*types.MsgCancelUpgradeResponse, error) { - if k.authority.String() != req.Authority { - return nil, errors.Wrapf(gov.ErrInvalidSigner, "expected %s got %s", k.authority.String(), req.Authority) + if k.authority != req.Authority { + return nil, errors.Wrapf(gov.ErrInvalidSigner, "expected %s got %s", k.authority, req.Authority) } ctx := sdk.UnwrapSDKContext(goCtx) - - store := ctx.KVStore(k.storeKey) - - // clear any old IBC state stored by previous plan - _, found := k.GetUpgradePlan(ctx) - if !found { - return nil, errors.Wrapf(errors.ErrNotFound, "no plan is currently scheduled") - } - - store.Delete(types.PlanKey()) + k.ClearUpgradePlan(ctx) return &types.MsgCancelUpgradeResponse{}, nil } From 7a3a71559a60c97760c21294c3993c130f34abbc Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Thu, 3 Mar 2022 12:31:03 +0100 Subject: [PATCH 17/19] implement suggestions --- CHANGELOG.md | 1 + x/gov/client/cli/tx.go | 2 -- x/upgrade/types/codec.go | 5 +++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d94a3d6767e5..3ecc3607224a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -151,6 +151,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [\#9780](https://github.com/cosmos/cosmos-sdk/pull/9780) Use sigs.k8s.io for yaml, which might lead to minor YAML output changes * [\#10625](https://github.com/cosmos/cosmos-sdk/pull/10625) Rename `--fee-account` CLI flag to `--fee-granter` * [\#10684](https://github.com/cosmos/cosmos-sdk/pull/10684) Rename `edit-validator` command's `--moniker` flag to `--new-moniker` +* [\#11116](https://github.com/cosmos/cosmos-sdk/pull/11116) `software-upgrade` and `cancel-software-upgrade` gov proposal commands have changed to `legacy-software-upgrade` and `legacy-cancel-software-upgrade`. ### Improvements diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index 3de591893d91..92421314dfa1 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -26,9 +26,7 @@ const ( FlagDescription = "description" // Deprecated: only used for v1beta1 legacy proposals. FlagProposalType = "type" - FlagDeposit = "deposit" - FlagMetadata = "metadata" flagVoter = "voter" flagDepositor = "depositor" flagStatus = "status" diff --git a/x/upgrade/types/codec.go b/x/upgrade/types/codec.go index 13e4048b2a59..1d288926fc1c 100644 --- a/x/upgrade/types/codec.go +++ b/x/upgrade/types/codec.go @@ -2,12 +2,17 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) +func init() { + RegisterLegacyAminoCodec(legacy.Cdc) +} + // RegisterLegacyAminoCodec registers concrete types on the LegacyAmino codec func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(Plan{}, "cosmos-sdk/Plan", nil) From d2d3ee2ff583f5715cdb6da8b1ffd547d17658a0 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Thu, 3 Mar 2022 12:36:24 +0100 Subject: [PATCH 18/19] remove redundant parse command --- x/upgrade/client/cli/parse.go | 39 -------------------- x/upgrade/client/cli/parse_test.go | 58 ------------------------------ 2 files changed, 97 deletions(-) delete mode 100644 x/upgrade/client/cli/parse_test.go diff --git a/x/upgrade/client/cli/parse.go b/x/upgrade/client/cli/parse.go index cee180f06a11..2844e73dcdf6 100644 --- a/x/upgrade/client/cli/parse.go +++ b/x/upgrade/client/cli/parse.go @@ -1,51 +1,12 @@ package cli import ( - "encoding/json" - "os" - - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/client/cli" gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/upgrade/types" "github.com/spf13/cobra" ) -// softwareUpgradeProposal defines a software upgrade proposal. -type softwareUpgradeProposal struct { - Plan json.RawMessage - Metadata []byte - Deposit string -} - -func parseSubmitSoftwareUpgradeProposal(cdc codec.Codec, path string) (*types.Plan, []byte, sdk.Coins, error) { - var proposal softwareUpgradeProposal - var plan types.Plan - - contents, err := os.ReadFile(path) - if err != nil { - return nil, nil, nil, err - } - - err = json.Unmarshal(contents, &proposal) - if err != nil { - return nil, nil, nil, err - } - - err = cdc.UnmarshalJSON(proposal.Plan, &plan) - if err != nil { - return nil, nil, nil, err - } - - deposit, err := sdk.ParseCoinsNormalized(proposal.Deposit) - if err != nil { - return nil, nil, nil, err - } - - return &plan, proposal.Metadata, deposit, nil -} - func parseArgsToContent(cmd *cobra.Command, name string) (gov.Content, error) { title, err := cmd.Flags().GetString(cli.FlagTitle) if err != nil { diff --git a/x/upgrade/client/cli/parse_test.go b/x/upgrade/client/cli/parse_test.go deleted file mode 100644 index 17e90fa44eb6..000000000000 --- a/x/upgrade/client/cli/parse_test.go +++ /dev/null @@ -1,58 +0,0 @@ -package cli - -import ( - "encoding/base64" - "fmt" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/testutil" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/upgrade/types" -) - -func TestParseSubmitSoftwareUpgradeProposal(t *testing.T) { - interfaceRegistry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(interfaceRegistry) - expectedMetadata := []byte{42} - expectedPlan := &types.Plan{ - Name: "example", - Height: 123450000, - } - - okJSON := testutil.WriteToNewTempFile(t, fmt.Sprintf(` -{ - "plan": { - "name": "%s", - "height": %d - }, - "metadata": "%s", - "deposit": "1000test" -} -`, expectedPlan.Name, expectedPlan.Height, base64.StdEncoding.EncodeToString(expectedMetadata))) - - badJSON := testutil.WriteToNewTempFile(t, "bad json") - - // nonexistent json - _, _, _, err := parseSubmitSoftwareUpgradeProposal(cdc, "fileDoesNotExist") - require.Error(t, err) - - // invalid json - _, _, _, err = parseSubmitSoftwareUpgradeProposal(cdc, badJSON.Name()) - require.Error(t, err) - - // ok json - upgradePlan, metadata, deposit, err := parseSubmitSoftwareUpgradeProposal(cdc, okJSON.Name()) - require.NoError(t, err, "unexpected error") - require.Equal(t, sdk.NewCoins(sdk.NewCoin("test", sdk.NewInt(1000))), deposit) - require.Equal(t, expectedMetadata, metadata) - require.Equal(t, upgradePlan, expectedPlan) - - err = okJSON.Close() - require.Nil(t, err, "unexpected error") - err = badJSON.Close() - require.Nil(t, err, "unexpected error") -} From f13b5b5fd4e9772a9bcd6c0f3bd91a224b527c9b Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Thu, 3 Mar 2022 12:39:17 +0100 Subject: [PATCH 19/19] clean up changelog --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25d753c0c7a4..f0508c93e215 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,7 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features -* (x/upgrade) [\#11116](https://github.com/cosmos/cosmos-sdk/pull/11116) A new `MsgSoftwareUpgrade` has been added to support v1beta2 msgs-based gov proposals. +* (x/upgrade) [\#11116](https://github.com/cosmos/cosmos-sdk/pull/11116) `MsgSoftwareUpgrade` and has been added to support v1beta2 msgs-based gov proposals. * [\#10977](https://github.com/cosmos/cosmos-sdk/pull/10977) Now every cosmos message protobuf definition must be extended with a ``cosmos.msg.v1.signer`` option to signal the signer fields in a language agnostic way. * [\#10710](https://github.com/cosmos/cosmos-sdk/pull/10710) Chain-id shouldn't be required for creating a transaction with both --generate-only and --offline flags. * [\#10703](https://github.com/cosmos/cosmos-sdk/pull/10703) Create a new grantee account, if the grantee of an authorization does not exist. @@ -71,7 +71,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### API Breaking Changes -* (x/gov) [\#11116](https://github.com/cosmos/cosmos-sdk/pull/11116) The `NewAppModuleBasic` function now accepts both msgs-based proposal CLI handlers and legacy content-based proposal CLI handlers as arguments. * (store)[\#11152](https://github.com/cosmos/cosmos-sdk/pull/11152) Remove `keep-every` from pruning options. * [\#10950](https://github.com/cosmos/cosmos-sdk/pull/10950) Add `envPrefix` parameter to `cmd.Execute`. * (x/mint) [\#10441](https://github.com/cosmos/cosmos-sdk/pull/10441) The `NewAppModule` function now accepts an inflation calculation function as an argument.