chore: remove crisis modules (#20809)

This commit is contained in:
Marko 2024-07-02 16:20:07 +02:00 committed by GitHub
parent 4e6507462e
commit 7b23e52b0b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
41 changed files with 9 additions and 6314 deletions

View File

@ -277,6 +277,10 @@ Authz was spun out into its own `go.mod`. To import it use `cosmossdk.io/x/authz
Bank was spun out into its own `go.mod`. To import it use `cosmossdk.io/x/bank`
### `x/crsis`
The Crisis module was removed due to it not being supported or functional any longer.
#### `x/distribution`
Distribution was spun out into its own `go.mod`. To import it use `cosmossdk.io/x/distribution`

View File

@ -1,654 +0,0 @@
// Code generated by protoc-gen-go-pulsar. DO NOT EDIT.
package modulev1
import (
_ "cosmossdk.io/api/cosmos/app/v1alpha1"
fmt "fmt"
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 (
md_Module protoreflect.MessageDescriptor
fd_Module_fee_collector_name protoreflect.FieldDescriptor
fd_Module_authority protoreflect.FieldDescriptor
)
func init() {
file_cosmos_crisis_module_v1_module_proto_init()
md_Module = File_cosmos_crisis_module_v1_module_proto.Messages().ByName("Module")
fd_Module_fee_collector_name = md_Module.Fields().ByName("fee_collector_name")
fd_Module_authority = md_Module.Fields().ByName("authority")
}
var _ protoreflect.Message = (*fastReflection_Module)(nil)
type fastReflection_Module Module
func (x *Module) ProtoReflect() protoreflect.Message {
return (*fastReflection_Module)(x)
}
func (x *Module) slowProtoReflect() protoreflect.Message {
mi := &file_cosmos_crisis_module_v1_module_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_Module_messageType fastReflection_Module_messageType
var _ protoreflect.MessageType = fastReflection_Module_messageType{}
type fastReflection_Module_messageType struct{}
func (x fastReflection_Module_messageType) Zero() protoreflect.Message {
return (*fastReflection_Module)(nil)
}
func (x fastReflection_Module_messageType) New() protoreflect.Message {
return new(fastReflection_Module)
}
func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor {
return md_Module
}
// Descriptor returns message descriptor, which contains only the protobuf
// type information for the message.
func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor {
return md_Module
}
// 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_Module) Type() protoreflect.MessageType {
return _fastReflection_Module_messageType
}
// New returns a newly allocated and mutable empty message.
func (x *fastReflection_Module) New() protoreflect.Message {
return new(fastReflection_Module)
}
// Interface unwraps the message reflection interface and
// returns the underlying ProtoMessage interface.
func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage {
return (*Module)(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_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
if x.FeeCollectorName != "" {
value := protoreflect.ValueOfString(x.FeeCollectorName)
if !f(fd_Module_fee_collector_name, value) {
return
}
}
if x.Authority != "" {
value := protoreflect.ValueOfString(x.Authority)
if !f(fd_Module_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_Module) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() {
case "cosmos.crisis.module.v1.Module.fee_collector_name":
return x.FeeCollectorName != ""
case "cosmos.crisis.module.v1.Module.authority":
return x.Authority != ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crisis.module.v1.Module"))
}
panic(fmt.Errorf("message cosmos.crisis.module.v1.Module 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_Module) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() {
case "cosmos.crisis.module.v1.Module.fee_collector_name":
x.FeeCollectorName = ""
case "cosmos.crisis.module.v1.Module.authority":
x.Authority = ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crisis.module.v1.Module"))
}
panic(fmt.Errorf("message cosmos.crisis.module.v1.Module 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_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
switch descriptor.FullName() {
case "cosmos.crisis.module.v1.Module.fee_collector_name":
value := x.FeeCollectorName
return protoreflect.ValueOfString(value)
case "cosmos.crisis.module.v1.Module.authority":
value := x.Authority
return protoreflect.ValueOfString(value)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crisis.module.v1.Module"))
}
panic(fmt.Errorf("message cosmos.crisis.module.v1.Module 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_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
switch fd.FullName() {
case "cosmos.crisis.module.v1.Module.fee_collector_name":
x.FeeCollectorName = value.Interface().(string)
case "cosmos.crisis.module.v1.Module.authority":
x.Authority = value.Interface().(string)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crisis.module.v1.Module"))
}
panic(fmt.Errorf("message cosmos.crisis.module.v1.Module 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_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cosmos.crisis.module.v1.Module.fee_collector_name":
panic(fmt.Errorf("field fee_collector_name of message cosmos.crisis.module.v1.Module is not mutable"))
case "cosmos.crisis.module.v1.Module.authority":
panic(fmt.Errorf("field authority of message cosmos.crisis.module.v1.Module is not mutable"))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crisis.module.v1.Module"))
}
panic(fmt.Errorf("message cosmos.crisis.module.v1.Module 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_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cosmos.crisis.module.v1.Module.fee_collector_name":
return protoreflect.ValueOfString("")
case "cosmos.crisis.module.v1.Module.authority":
return protoreflect.ValueOfString("")
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crisis.module.v1.Module"))
}
panic(fmt.Errorf("message cosmos.crisis.module.v1.Module 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_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
switch d.FullName() {
default:
panic(fmt.Errorf("%s is not a oneof field in cosmos.crisis.module.v1.Module", 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_Module) 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_Module) 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_Module) 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_Module) ProtoMethods() *protoiface.Methods {
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
x := input.Message.Interface().(*Module)
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.FeeCollectorName)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(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().(*Module)
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] = 0x12
}
if len(x.FeeCollectorName) > 0 {
i -= len(x.FeeCollectorName)
copy(dAtA[i:], x.FeeCollectorName)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.FeeCollectorName)))
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().(*Module)
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: Module: wiretype end group for non-group")
}
if fieldNum <= 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: 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 FeeCollectorName", 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.FeeCollectorName = 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 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,
}
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.0
// protoc (unknown)
// source: cosmos/crisis/module/v1/module.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)
)
// Module is the config object of the crisis module.
type Module struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// fee_collector_name is the name of the FeeCollector ModuleAccount.
FeeCollectorName string `protobuf:"bytes,1,opt,name=fee_collector_name,json=feeCollectorName,proto3" json:"fee_collector_name,omitempty"`
// authority defines the custom module authority. If not set, defaults to the governance module.
Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"`
}
func (x *Module) Reset() {
*x = Module{}
if protoimpl.UnsafeEnabled {
mi := &file_cosmos_crisis_module_v1_module_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Module) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Module) ProtoMessage() {}
// Deprecated: Use Module.ProtoReflect.Descriptor instead.
func (*Module) Descriptor() ([]byte, []int) {
return file_cosmos_crisis_module_v1_module_proto_rawDescGZIP(), []int{0}
}
func (x *Module) GetFeeCollectorName() string {
if x != nil {
return x.FeeCollectorName
}
return ""
}
func (x *Module) GetAuthority() string {
if x != nil {
return x.Authority
}
return ""
}
var File_cosmos_crisis_module_v1_module_proto protoreflect.FileDescriptor
var file_cosmos_crisis_module_v1_module_proto_rawDesc = []byte{
0x0a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x72, 0x69, 0x73, 0x69, 0x73, 0x2f,
0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63,
0x72, 0x69, 0x73, 0x69, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a,
0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c,
0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x22, 0x83, 0x01, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x2c, 0x0a, 0x12,
0x66, 0x65, 0x65, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x6e, 0x61,
0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x66, 0x65, 0x65, 0x43, 0x6f, 0x6c,
0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75,
0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61,
0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x2d, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x27,
0x0a, 0x25, 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, 0x78,
0x2f, 0x63, 0x72, 0x69, 0x73, 0x69, 0x73, 0x42, 0xdc, 0x01, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e,
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x72, 0x69, 0x73, 0x69, 0x73, 0x2e, 0x6d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50,
0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64,
0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f,
0x63, 0x72, 0x69, 0x73, 0x69, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31,
0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x43, 0x4d, 0xaa,
0x02, 0x17, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x43, 0x72, 0x69, 0x73, 0x69, 0x73, 0x2e,
0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x17, 0x43, 0x6f, 0x73, 0x6d,
0x6f, 0x73, 0x5c, 0x43, 0x72, 0x69, 0x73, 0x69, 0x73, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
0x5c, 0x56, 0x31, 0xe2, 0x02, 0x23, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x43, 0x72, 0x69,
0x73, 0x69, 0x73, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50,
0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1a, 0x43, 0x6f, 0x73, 0x6d,
0x6f, 0x73, 0x3a, 0x3a, 0x43, 0x72, 0x69, 0x73, 0x69, 0x73, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75,
0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_cosmos_crisis_module_v1_module_proto_rawDescOnce sync.Once
file_cosmos_crisis_module_v1_module_proto_rawDescData = file_cosmos_crisis_module_v1_module_proto_rawDesc
)
func file_cosmos_crisis_module_v1_module_proto_rawDescGZIP() []byte {
file_cosmos_crisis_module_v1_module_proto_rawDescOnce.Do(func() {
file_cosmos_crisis_module_v1_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_crisis_module_v1_module_proto_rawDescData)
})
return file_cosmos_crisis_module_v1_module_proto_rawDescData
}
var file_cosmos_crisis_module_v1_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_cosmos_crisis_module_v1_module_proto_goTypes = []interface{}{
(*Module)(nil), // 0: cosmos.crisis.module.v1.Module
}
var file_cosmos_crisis_module_v1_module_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_cosmos_crisis_module_v1_module_proto_init() }
func file_cosmos_crisis_module_v1_module_proto_init() {
if File_cosmos_crisis_module_v1_module_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_cosmos_crisis_module_v1_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Module); 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_crisis_module_v1_module_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_cosmos_crisis_module_v1_module_proto_goTypes,
DependencyIndexes: file_cosmos_crisis_module_v1_module_proto_depIdxs,
MessageInfos: file_cosmos_crisis_module_v1_module_proto_msgTypes,
}.Build()
File_cosmos_crisis_module_v1_module_proto = out.File
file_cosmos_crisis_module_v1_module_proto_rawDesc = nil
file_cosmos_crisis_module_v1_module_proto_goTypes = nil
file_cosmos_crisis_module_v1_module_proto_depIdxs = nil
}

View File

@ -1,600 +0,0 @@
// Code generated by protoc-gen-go-pulsar. DO NOT EDIT.
package crisisv1beta1
import (
_ "cosmossdk.io/api/amino"
v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1"
fmt "fmt"
runtime "github.com/cosmos/cosmos-proto/runtime"
_ "github.com/cosmos/gogoproto/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_GenesisState protoreflect.MessageDescriptor
fd_GenesisState_constant_fee protoreflect.FieldDescriptor
)
func init() {
file_cosmos_crisis_v1beta1_genesis_proto_init()
md_GenesisState = File_cosmos_crisis_v1beta1_genesis_proto.Messages().ByName("GenesisState")
fd_GenesisState_constant_fee = md_GenesisState.Fields().ByName("constant_fee")
}
var _ protoreflect.Message = (*fastReflection_GenesisState)(nil)
type fastReflection_GenesisState GenesisState
func (x *GenesisState) ProtoReflect() protoreflect.Message {
return (*fastReflection_GenesisState)(x)
}
func (x *GenesisState) slowProtoReflect() protoreflect.Message {
mi := &file_cosmos_crisis_v1beta1_genesis_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_GenesisState_messageType fastReflection_GenesisState_messageType
var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{}
type fastReflection_GenesisState_messageType struct{}
func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message {
return (*fastReflection_GenesisState)(nil)
}
func (x fastReflection_GenesisState_messageType) New() protoreflect.Message {
return new(fastReflection_GenesisState)
}
func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor {
return md_GenesisState
}
// Descriptor returns message descriptor, which contains only the protobuf
// type information for the message.
func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor {
return md_GenesisState
}
// 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_GenesisState) Type() protoreflect.MessageType {
return _fastReflection_GenesisState_messageType
}
// New returns a newly allocated and mutable empty message.
func (x *fastReflection_GenesisState) New() protoreflect.Message {
return new(fastReflection_GenesisState)
}
// Interface unwraps the message reflection interface and
// returns the underlying ProtoMessage interface.
func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage {
return (*GenesisState)(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_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
if x.ConstantFee != nil {
value := protoreflect.ValueOfMessage(x.ConstantFee.ProtoReflect())
if !f(fd_GenesisState_constant_fee, 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_GenesisState) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() {
case "cosmos.crisis.v1beta1.GenesisState.constant_fee":
return x.ConstantFee != nil
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crisis.v1beta1.GenesisState"))
}
panic(fmt.Errorf("message cosmos.crisis.v1beta1.GenesisState 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_GenesisState) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() {
case "cosmos.crisis.v1beta1.GenesisState.constant_fee":
x.ConstantFee = nil
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crisis.v1beta1.GenesisState"))
}
panic(fmt.Errorf("message cosmos.crisis.v1beta1.GenesisState 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_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
switch descriptor.FullName() {
case "cosmos.crisis.v1beta1.GenesisState.constant_fee":
value := x.ConstantFee
return protoreflect.ValueOfMessage(value.ProtoReflect())
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crisis.v1beta1.GenesisState"))
}
panic(fmt.Errorf("message cosmos.crisis.v1beta1.GenesisState 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_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
switch fd.FullName() {
case "cosmos.crisis.v1beta1.GenesisState.constant_fee":
x.ConstantFee = value.Message().Interface().(*v1beta1.Coin)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crisis.v1beta1.GenesisState"))
}
panic(fmt.Errorf("message cosmos.crisis.v1beta1.GenesisState 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_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cosmos.crisis.v1beta1.GenesisState.constant_fee":
if x.ConstantFee == nil {
x.ConstantFee = new(v1beta1.Coin)
}
return protoreflect.ValueOfMessage(x.ConstantFee.ProtoReflect())
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crisis.v1beta1.GenesisState"))
}
panic(fmt.Errorf("message cosmos.crisis.v1beta1.GenesisState 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_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cosmos.crisis.v1beta1.GenesisState.constant_fee":
m := new(v1beta1.Coin)
return protoreflect.ValueOfMessage(m.ProtoReflect())
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crisis.v1beta1.GenesisState"))
}
panic(fmt.Errorf("message cosmos.crisis.v1beta1.GenesisState 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_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
switch d.FullName() {
default:
panic(fmt.Errorf("%s is not a oneof field in cosmos.crisis.v1beta1.GenesisState", 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_GenesisState) 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_GenesisState) 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_GenesisState) 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_GenesisState) ProtoMethods() *protoiface.Methods {
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
x := input.Message.Interface().(*GenesisState)
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.ConstantFee != nil {
l = options.Size(x.ConstantFee)
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().(*GenesisState)
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.ConstantFee != nil {
encoded, err := options.Marshal(x.ConstantFee)
if err != nil {
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, err
}
i -= len(encoded)
copy(dAtA[i:], encoded)
i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))
i--
dAtA[i] = 0x1a
}
if 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().(*GenesisState)
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: GenesisState: wiretype end group for non-group")
}
if fieldNum <= 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 3:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ConstantFee", 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.ConstantFee == nil {
x.ConstantFee = &v1beta1.Coin{}
}
if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ConstantFee); 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,
}
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.0
// protoc (unknown)
// source: cosmos/crisis/v1beta1/genesis.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)
)
// GenesisState defines the crisis module's genesis state.
type GenesisState struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// constant_fee is the fee used to verify the invariant in the crisis
// module.
ConstantFee *v1beta1.Coin `protobuf:"bytes,3,opt,name=constant_fee,json=constantFee,proto3" json:"constant_fee,omitempty"`
}
func (x *GenesisState) Reset() {
*x = GenesisState{}
if protoimpl.UnsafeEnabled {
mi := &file_cosmos_crisis_v1beta1_genesis_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GenesisState) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GenesisState) ProtoMessage() {}
// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead.
func (*GenesisState) Descriptor() ([]byte, []int) {
return file_cosmos_crisis_v1beta1_genesis_proto_rawDescGZIP(), []int{0}
}
func (x *GenesisState) GetConstantFee() *v1beta1.Coin {
if x != nil {
return x.ConstantFee
}
return nil
}
var File_cosmos_crisis_v1beta1_genesis_proto protoreflect.FileDescriptor
var file_cosmos_crisis_v1beta1_genesis_proto_rawDesc = []byte{
0x0a, 0x23, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x72, 0x69, 0x73, 0x69, 0x73, 0x2f,
0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x72,
0x69, 0x73, 0x69, 0x73, 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, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f,
0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x57, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73,
0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x47, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e,
0x74, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f,
0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61,
0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a,
0x01, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x46, 0x65, 0x65, 0x42, 0xd5,
0x01, 0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x72,
0x69, 0x73, 0x69, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0c, 0x47, 0x65,
0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x63, 0x6f,
0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63,
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x72, 0x69, 0x73, 0x69, 0x73, 0x2f, 0x76, 0x31, 0x62,
0x65, 0x74, 0x61, 0x31, 0x3b, 0x63, 0x72, 0x69, 0x73, 0x69, 0x73, 0x76, 0x31, 0x62, 0x65, 0x74,
0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x43, 0x58, 0xaa, 0x02, 0x15, 0x43, 0x6f, 0x73, 0x6d, 0x6f,
0x73, 0x2e, 0x43, 0x72, 0x69, 0x73, 0x69, 0x73, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31,
0xca, 0x02, 0x15, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x43, 0x72, 0x69, 0x73, 0x69, 0x73,
0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x21, 0x43, 0x6f, 0x73, 0x6d, 0x6f,
0x73, 0x5c, 0x43, 0x72, 0x69, 0x73, 0x69, 0x73, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31,
0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x17, 0x43,
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x43, 0x72, 0x69, 0x73, 0x69, 0x73, 0x3a, 0x3a, 0x56,
0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_cosmos_crisis_v1beta1_genesis_proto_rawDescOnce sync.Once
file_cosmos_crisis_v1beta1_genesis_proto_rawDescData = file_cosmos_crisis_v1beta1_genesis_proto_rawDesc
)
func file_cosmos_crisis_v1beta1_genesis_proto_rawDescGZIP() []byte {
file_cosmos_crisis_v1beta1_genesis_proto_rawDescOnce.Do(func() {
file_cosmos_crisis_v1beta1_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_crisis_v1beta1_genesis_proto_rawDescData)
})
return file_cosmos_crisis_v1beta1_genesis_proto_rawDescData
}
var file_cosmos_crisis_v1beta1_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_cosmos_crisis_v1beta1_genesis_proto_goTypes = []interface{}{
(*GenesisState)(nil), // 0: cosmos.crisis.v1beta1.GenesisState
(*v1beta1.Coin)(nil), // 1: cosmos.base.v1beta1.Coin
}
var file_cosmos_crisis_v1beta1_genesis_proto_depIdxs = []int32{
1, // 0: cosmos.crisis.v1beta1.GenesisState.constant_fee:type_name -> cosmos.base.v1beta1.Coin
1, // [1:1] is the sub-list for method output_type
1, // [1:1] 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_crisis_v1beta1_genesis_proto_init() }
func file_cosmos_crisis_v1beta1_genesis_proto_init() {
if File_cosmos_crisis_v1beta1_genesis_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_cosmos_crisis_v1beta1_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GenesisState); 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_crisis_v1beta1_genesis_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_cosmos_crisis_v1beta1_genesis_proto_goTypes,
DependencyIndexes: file_cosmos_crisis_v1beta1_genesis_proto_depIdxs,
MessageInfos: file_cosmos_crisis_v1beta1_genesis_proto_msgTypes,
}.Build()
File_cosmos_crisis_v1beta1_genesis_proto = out.File
file_cosmos_crisis_v1beta1_genesis_proto_rawDesc = nil
file_cosmos_crisis_v1beta1_genesis_proto_goTypes = nil
file_cosmos_crisis_v1beta1_genesis_proto_depIdxs = nil
}

File diff suppressed because it is too large Load Diff

View File

@ -1,152 +0,0 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: cosmos/crisis/v1beta1/tx.proto
package crisisv1beta1
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
const (
Msg_VerifyInvariant_FullMethodName = "/cosmos.crisis.v1beta1.Msg/VerifyInvariant"
Msg_UpdateParams_FullMethodName = "/cosmos.crisis.v1beta1.Msg/UpdateParams"
)
// 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 {
// VerifyInvariant defines a method to verify a particular invariant.
VerifyInvariant(ctx context.Context, in *MsgVerifyInvariant, opts ...grpc.CallOption) (*MsgVerifyInvariantResponse, error)
// UpdateParams defines a governance operation for updating the x/crisis module
// parameters. The authority is defined in the keeper.
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
}
type msgClient struct {
cc grpc.ClientConnInterface
}
func NewMsgClient(cc grpc.ClientConnInterface) MsgClient {
return &msgClient{cc}
}
func (c *msgClient) VerifyInvariant(ctx context.Context, in *MsgVerifyInvariant, opts ...grpc.CallOption) (*MsgVerifyInvariantResponse, error) {
out := new(MsgVerifyInvariantResponse)
err := c.cc.Invoke(ctx, Msg_VerifyInvariant_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, 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 {
// VerifyInvariant defines a method to verify a particular invariant.
VerifyInvariant(context.Context, *MsgVerifyInvariant) (*MsgVerifyInvariantResponse, error)
// UpdateParams defines a governance operation for updating the x/crisis module
// parameters. The authority is defined in the keeper.
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
mustEmbedUnimplementedMsgServer()
}
// UnimplementedMsgServer must be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct {
}
func (UnimplementedMsgServer) VerifyInvariant(context.Context, *MsgVerifyInvariant) (*MsgVerifyInvariantResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method VerifyInvariant not implemented")
}
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
// 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_VerifyInvariant_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgVerifyInvariant)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).VerifyInvariant(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_VerifyInvariant_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).VerifyInvariant(ctx, req.(*MsgVerifyInvariant))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateParams)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateParams(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_UpdateParams_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams))
}
return interceptor(ctx, in, info, handler)
}
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Msg_ServiceDesc = grpc.ServiceDesc{
ServiceName: "cosmos.crisis.v1beta1.Msg",
HandlerType: (*MsgServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "VerifyInvariant",
Handler: _Msg_VerifyInvariant_Handler,
},
{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cosmos/crisis/v1beta1/tx.proto",
}

View File

@ -7,7 +7,6 @@ directories:
- x/bank/proto
- x/circuit/proto
- x/consensus/proto
- x/crisis/proto
- x/distribution/proto
- x/evidence/proto
- x/feegrant/proto

View File

@ -10,8 +10,6 @@ import (
epochstypes "cosmossdk.io/x/epochs/types"
protocolpooltypes "cosmossdk.io/x/protocolpool/types"
upgradetypes "cosmossdk.io/x/upgrade/types"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
)
// UpgradeName defines the on-chain upgrade name for the sample SimApp upgrade
@ -48,9 +46,7 @@ func (app SimApp) RegisterUpgradeHandlers() {
protocolpooltypes.StoreKey,
epochstypes.StoreKey,
},
Deleted: []string{
crisistypes.StoreKey, // The SDK discontinued the crisis module in v0.51.0
},
Deleted: []string{"crisis"}, // The SDK discontinued the crisis module in v0.52.0
}
// configure store loader that checks if version == upgradeHeight and applies store upgrades

View File

@ -8,8 +8,6 @@ import (
"cosmossdk.io/x/accounts"
protocolpooltypes "cosmossdk.io/x/protocolpool/types"
upgradetypes "cosmossdk.io/x/upgrade/types"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
)
// UpgradeName defines the on-chain upgrade name for the sample SimApp upgrade
@ -39,9 +37,7 @@ func (app *SimApp[T]) RegisterUpgradeHandlers() {
accounts.ModuleName,
protocolpooltypes.ModuleName,
},
Deleted: []string{
crisistypes.ModuleName, // The SDK discontinued the crisis module in v0.51.0
},
Deleted: []string{"crisis"}, // The SDK discontinued the crisis module in v0.52.0
}
// configure store loader that checks if version == upgradeHeight and applies store upgrades

View File

@ -56,7 +56,6 @@ func defaultConfig() *Config {
testutil.AuthModuleName,
testutil.BankModuleName,
testutil.GovModuleName,
"crisis",
"genutil",
testutil.AuthzModuleName,
testutil.FeegrantModuleName,
@ -69,7 +68,6 @@ func defaultConfig() *Config {
testutil.EpochsModuleName,
},
EndBlockersOrder: []string{
"crisis",
testutil.GovModuleName,
testutil.StakingModuleName,
testutil.AuthModuleName,
@ -98,7 +96,6 @@ func defaultConfig() *Config {
testutil.SlashingModuleName,
testutil.GovModuleName,
testutil.MintModuleName,
"crisis",
"genutil",
testutil.EvidenceModuleName,
testutil.AuthzModuleName,

View File

@ -9,7 +9,6 @@ Here are some production-grade modules that can be used in Cosmos SDK applicatio
* [Auth](./auth/README.md) - Authentication of accounts and transactions for Cosmos SDK applications.
* [Authz](./authz/README.md) - Authorization for accounts to perform actions on behalf of other accounts.
* [Bank](./bank/README.md) - Token transfer functionalities.
* [Crisis](./crisis/README.md) - Halting the blockchain under certain circumstances (e.g. if an invariant is broken).
* [Distribution](./distribution/README.md) - Fee distribution, and staking token provision distribution.
* [Epochs](./epochs/README.md) - Allow other modules to set that they would like to be signaled once every period
* [Evidence](./evidence/README.md) - Evidence handling for double signing, misbehaviour, etc.

View File

@ -1,110 +0,0 @@
---
sidebar_position: 1
---
# `x/crisis`
## Overview
The crisis module halts the blockchain under the circumstance that a blockchain
invariant is broken. Invariants can be registered with the application during the
application initialization process.
## Contents
* [State](#state)
* [Messages](#messages)
* [Events](#events)
* [Parameters](#parameters)
* [Client](#client)
* [CLI](#cli)
## State
### ConstantFee
Due to the anticipated large gas cost requirement to verify an invariant (and
potential to exceed the maximum allowable block gas limit) a constant fee is
used instead of the standard gas consumption method. The constant fee is
intended to be larger than the anticipated gas cost of running the invariant
with the standard gas consumption method.
The ConstantFee param is stored in the module params state with the prefix of `0x01`,
it can be updated with governance or the address with authority.
* Params: `mint/params -> legacy_amino(sdk.Coin)`
## Messages
In this section we describe the processing of the crisis messages and the
corresponding updates to the state.
### MsgVerifyInvariant
Blockchain invariants can be checked using the `MsgVerifyInvariant` message.
```protobuf reference
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/crisis/v1beta1/tx.proto#L26-L42
```
This message is expected to fail if:
* the sender does not have enough coins for the constant fee
* the invariant route is not registered
This message checks the invariant provided, and if the invariant is broken it
panics, halting the blockchain. If the invariant is broken, the constant fee is
never deducted as the transaction is never committed to a block (equivalent to
being refunded). However, if the invariant is not broken, the constant fee will
not be refunded.
## Events
The crisis module emits the following events:
### Handlers
#### MsgVerifyInvariance
| Type | Attribute Key | Attribute Value |
|-----------|---------------|------------------|
| invariant | route | {invariantRoute} |
| message | module | crisis |
| message | action | verify_invariant |
| message | sender | {senderAddress} |
## Parameters
The crisis module contains the following parameters:
| Key | Type | Example |
|-------------|---------------|-----------------------------------|
| ConstantFee | object (coin) | {"denom":"uatom","amount":"1000"} |
## Client
### CLI
A user can query and interact with the `crisis` module using the CLI.
#### Transactions
The `tx` commands allow users to interact with the `crisis` module.
```bash
simd tx crisis --help
```
##### invariant-broken
The `invariant-broken` command submits proof when an invariant was broken to halt the chain
```bash
simd tx crisis invariant-broken [module-name] [invariant-route] [flags]
```
Example:
```bash
simd tx crisis invariant-broken bank total-supply --from=[keyname or address]
```

View File

@ -1,22 +0,0 @@
package crisis
import (
"context"
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/crisis/keeper"
"github.com/cosmos/cosmos-sdk/x/crisis/types"
)
// check all registered invariants
func EndBlocker(ctx context.Context, k keeper.Keeper) {
defer telemetry.ModuleMeasureSince(types.ModuleName, telemetry.Now(), telemetry.MetricKeyEndBlocker)
sdkCtx := sdk.UnwrapSDKContext(ctx)
if k.InvCheckPeriod() == 0 || sdkCtx.BlockHeight()%int64(k.InvCheckPeriod()) != 0 {
// skip running the invariant check
return
}
k.AssertInvariants(sdkCtx)
}

View File

@ -1,38 +0,0 @@
package crisis
import (
"fmt"
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
crisisv1beta1 "cosmossdk.io/api/cosmos/crisis/v1beta1"
"github.com/cosmos/cosmos-sdk/version"
)
// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface.
func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
return &autocliv1.ModuleOptions{
Tx: &autocliv1.ServiceCommandDescriptor{
Service: crisisv1beta1.Msg_ServiceDesc.ServiceName,
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
{
RpcMethod: "VerifyInvariant",
Use: "invariant-broken [module-name] [invariant-route] --from mykey",
Short: "Submit proof that an invariant broken",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{
{ProtoField: "invariant_module_name"},
{ProtoField: "invariant_route"},
},
},
{
RpcMethod: "UpdateParams",
Use: "update-params-proposal [params]",
Short: "Submit a proposal to update crisis module params. Note: the entire params must be provided.",
Example: fmt.Sprintf(`%s tx crisis update-params-proposal '{ "constant_fee": {"denom": "stake", "amount": "1000"} }'`, version.AppName),
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "params"}},
GovProposal: true,
},
},
},
}
}

View File

@ -1,92 +0,0 @@
package crisis
import (
"github.com/spf13/cast"
modulev1 "cosmossdk.io/api/cosmos/crisis/module/v1"
"cosmossdk.io/core/address"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/core/store"
"cosmossdk.io/depinject"
"cosmossdk.io/depinject/appconfig"
authtypes "cosmossdk.io/x/auth/types"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/server"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/x/crisis/keeper"
"github.com/cosmos/cosmos-sdk/x/crisis/types"
)
var _ depinject.OnePerModuleType = AppModule{}
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}
func init() {
appconfig.RegisterModule(
&modulev1.Module{},
appconfig.Provide(ProvideModule),
)
}
type ModuleInputs struct {
depinject.In
Config *modulev1.Module
StoreService store.KVStoreService
Codec codec.Codec
AppOpts servertypes.AppOptions `optional:"true"`
BankKeeper types.SupplyKeeper
AddressCodec address.Codec
}
type ModuleOutputs struct {
depinject.Out
Module appmodule.AppModule
CrisisKeeper *keeper.Keeper
}
func ProvideModule(in ModuleInputs) ModuleOutputs {
var invalidCheckPeriod uint
if in.AppOpts != nil {
invalidCheckPeriod = cast.ToUint(in.AppOpts.Get(server.FlagInvCheckPeriod))
}
feeCollectorName := in.Config.FeeCollectorName
if feeCollectorName == "" {
feeCollectorName = authtypes.FeeCollectorName
}
// default to governance authority if not provided
authority := authtypes.NewModuleAddress(types.GovModuleName)
if in.Config.Authority != "" {
authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority)
}
authorityAddr, err := in.AddressCodec.BytesToString(authority)
if err != nil {
panic(err)
}
k := keeper.NewKeeper(
in.Codec,
in.StoreService,
invalidCheckPeriod,
in.BankKeeper,
feeCollectorName,
authorityAddr,
in.AddressCodec,
)
var skipGenesisInvariants bool
if in.AppOpts != nil {
skipGenesisInvariants = cast.ToBool(in.AppOpts.Get(FlagSkipGenesisInvariants))
}
m := NewAppModule(k, in.Codec, skipGenesisInvariants)
return ModuleOutputs{CrisisKeeper: k, Module: m}
}

View File

@ -1,23 +0,0 @@
package keeper
import (
"context"
"github.com/cosmos/cosmos-sdk/x/crisis/types"
)
// new crisis genesis
func (k *Keeper) InitGenesis(ctx context.Context, data *types.GenesisState) {
if err := k.ConstantFee.Set(ctx, data.ConstantFee); err != nil {
panic(err)
}
}
// ExportGenesis returns a GenesisState for a given context and keeper.
func (k *Keeper) ExportGenesis(ctx context.Context) (*types.GenesisState, error) {
constantFee, err := k.ConstantFee.Get(ctx)
if err != nil {
return nil, err
}
return types.NewGenesisState(constantFee), nil
}

View File

@ -1,80 +0,0 @@
package keeper_test
import (
"testing"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/suite"
sdkmath "cosmossdk.io/math"
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/codec"
addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil"
"github.com/cosmos/cosmos-sdk/runtime"
"github.com/cosmos/cosmos-sdk/testutil"
sdk "github.com/cosmos/cosmos-sdk/types"
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
"github.com/cosmos/cosmos-sdk/x/crisis"
"github.com/cosmos/cosmos-sdk/x/crisis/keeper"
crisistestutil "github.com/cosmos/cosmos-sdk/x/crisis/testutil"
"github.com/cosmos/cosmos-sdk/x/crisis/types"
)
type GenesisTestSuite struct {
suite.Suite
sdkCtx sdk.Context
keeper keeper.Keeper
cdc codec.BinaryCodec
}
func TestGenesisTestSuite(t *testing.T) {
suite.Run(t, new(GenesisTestSuite))
}
func (s *GenesisTestSuite) SetupTest() {
key := storetypes.NewKVStoreKey(types.StoreKey)
storeService := runtime.NewKVStoreService(key)
testCtx := testutil.DefaultContextWithDB(s.T(), key, storetypes.NewTransientStoreKey("transient_test"))
encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, crisis.AppModule{})
// gomock initializations
ctrl := gomock.NewController(s.T())
s.cdc = codec.NewProtoCodec(encCfg.InterfaceRegistry)
s.sdkCtx = testCtx.Ctx
supplyKeeper := crisistestutil.NewMockSupplyKeeper(ctrl)
s.keeper = *keeper.NewKeeper(s.cdc, storeService, 5, supplyKeeper, "", "", addresscodec.NewBech32Codec("cosmos"))
}
func (s *GenesisTestSuite) TestImportExportGenesis() {
// default params
constantFee := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(1000))
err := s.keeper.ConstantFee.Set(s.sdkCtx, constantFee)
s.Require().NoError(err)
genesis, err := s.keeper.ExportGenesis(s.sdkCtx)
s.Require().NoError(err)
// set constant fee to zero
constantFee = sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(0))
err = s.keeper.ConstantFee.Set(s.sdkCtx, constantFee)
s.Require().NoError(err)
s.keeper.InitGenesis(s.sdkCtx, genesis)
newGenesis, err := s.keeper.ExportGenesis(s.sdkCtx)
s.Require().NoError(err)
s.Require().Equal(genesis, newGenesis)
}
func (s *GenesisTestSuite) TestInitGenesis() {
genesisState := types.DefaultGenesisState()
genesisState.ConstantFee = sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(1000))
s.keeper.InitGenesis(s.sdkCtx, genesisState)
constantFee, err := s.keeper.ConstantFee.Get(s.sdkCtx)
s.Require().NoError(err)
s.Require().Equal(genesisState.ConstantFee, constantFee)
}

View File

@ -1,126 +0,0 @@
package keeper
import (
"context"
"fmt"
"time"
"cosmossdk.io/collections"
"cosmossdk.io/core/address"
"cosmossdk.io/core/log"
storetypes "cosmossdk.io/core/store"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/crisis/types"
)
// Keeper - crisis keeper
type Keeper struct {
routes []types.InvarRoute
invCheckPeriod uint
storeService storetypes.KVStoreService
cdc codec.BinaryCodec
addressCodec address.Codec
// the address capable of executing a MsgUpdateParams message. Typically, this
// should be the x/gov module account.
authority string
supplyKeeper types.SupplyKeeper
feeCollectorName string // name of the FeeCollector ModuleAccount
Schema collections.Schema
ConstantFee collections.Item[sdk.Coin]
}
// NewKeeper creates a new Keeper object
func NewKeeper(
cdc codec.BinaryCodec, storeService storetypes.KVStoreService, invCheckPeriod uint,
supplyKeeper types.SupplyKeeper, feeCollectorName, authority string, ac address.Codec,
) *Keeper {
sb := collections.NewSchemaBuilder(storeService)
k := &Keeper{
storeService: storeService,
cdc: cdc,
routes: make([]types.InvarRoute, 0),
invCheckPeriod: invCheckPeriod,
supplyKeeper: supplyKeeper,
feeCollectorName: feeCollectorName,
authority: authority,
addressCodec: ac,
ConstantFee: collections.NewItem(sb, types.ConstantFeeKey, "constant_fee", codec.CollValue[sdk.Coin](cdc)),
}
schema, err := sb.Build()
if err != nil {
panic(err)
}
k.Schema = schema
return k
}
// GetAuthority returns the x/crisis module's authority.
func (k *Keeper) GetAuthority() string {
return k.authority
}
// Logger returns a module-specific logger.
func (k *Keeper) Logger(ctx context.Context) log.Logger {
sdkCtx := sdk.UnwrapSDKContext(ctx)
return sdkCtx.Logger().With("module", "x/"+types.ModuleName)
}
// RegisterRoute register the routes for each of the invariants
func (k *Keeper) RegisterRoute(moduleName, route string, invar sdk.Invariant) {
invarRoute := types.NewInvarRoute(moduleName, route, invar)
k.routes = append(k.routes, invarRoute)
}
// Routes - return the keeper's invariant routes
func (k *Keeper) Routes() []types.InvarRoute {
return k.routes
}
// Invariants returns a copy of all registered Crisis keeper invariants.
func (k *Keeper) Invariants() []sdk.Invariant {
invars := make([]sdk.Invariant, len(k.routes))
for i, route := range k.routes {
invars[i] = route.Invar
}
return invars
}
// AssertInvariants asserts all registered invariants. If any invariant fails,
// the method panics.
func (k *Keeper) AssertInvariants(ctx context.Context) {
logger := k.Logger(ctx)
start := time.Now()
invarRoutes := k.Routes()
n := len(invarRoutes)
sdkCtx := sdk.UnwrapSDKContext(ctx)
for i, ir := range invarRoutes {
logger.Info("asserting crisis invariants", "inv", fmt.Sprint(i+1, "/", n), "name", ir.FullRoute())
invCtx, _ := sdkCtx.CacheContext()
if res, stop := ir.Invar(invCtx); stop {
// TODO: Include app name as part of context to allow for this to be
// variable.
panic(fmt.Errorf("invariant broken: %s\n"+
"\tCRITICAL please submit the following transaction:\n"+
"\t\t tx crisis invariant-broken %s %s", res, ir.ModuleName, ir.Route))
}
}
diff := time.Since(start)
logger.Info("asserted all invariants", "duration", diff, "height", sdkCtx.BlockHeight())
}
// InvCheckPeriod returns the invariant checks period.
func (k *Keeper) InvCheckPeriod() uint { return k.invCheckPeriod }
// SendCoinsFromAccountToFeeCollector transfers amt to the fee collector account.
func (k *Keeper) SendCoinsFromAccountToFeeCollector(ctx context.Context, senderAddr sdk.AccAddress, amt sdk.Coins) error {
return k.supplyKeeper.SendCoinsFromAccountToModule(ctx, senderAddr, k.feeCollectorName, amt)
}

View File

@ -1,69 +0,0 @@
package keeper_test
import (
"testing"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
storetypes "cosmossdk.io/store/types"
addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil"
"github.com/cosmos/cosmos-sdk/runtime"
"github.com/cosmos/cosmos-sdk/testutil"
sdk "github.com/cosmos/cosmos-sdk/types"
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
"github.com/cosmos/cosmos-sdk/x/crisis"
"github.com/cosmos/cosmos-sdk/x/crisis/keeper"
crisistestutil "github.com/cosmos/cosmos-sdk/x/crisis/testutil"
"github.com/cosmos/cosmos-sdk/x/crisis/types"
)
func TestLogger(t *testing.T) {
ctrl := gomock.NewController(t)
supplyKeeper := crisistestutil.NewMockSupplyKeeper(ctrl)
key := storetypes.NewKVStoreKey(types.StoreKey)
storeService := runtime.NewKVStoreService(key)
testCtx := testutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test"))
encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, crisis.AppModule{})
keeper := keeper.NewKeeper(encCfg.Codec, storeService, 5, supplyKeeper, "", "", addresscodec.NewBech32Codec("cosmos"))
require.Equal(t,
testCtx.Ctx.Logger().With("module", "x/"+types.ModuleName),
keeper.Logger(testCtx.Ctx))
}
func TestInvariants(t *testing.T) {
ctrl := gomock.NewController(t)
supplyKeeper := crisistestutil.NewMockSupplyKeeper(ctrl)
key := storetypes.NewKVStoreKey(types.StoreKey)
storeService := runtime.NewKVStoreService(key)
encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, crisis.AppModule{})
keeper := keeper.NewKeeper(encCfg.Codec, storeService, 5, supplyKeeper, "", "", addresscodec.NewBech32Codec("cosmos"))
require.Equal(t, keeper.InvCheckPeriod(), uint(5))
orgInvRoutes := keeper.Routes()
keeper.RegisterRoute("testModule", "testRoute", func(sdk.Context) (string, bool) { return "", false })
invar := keeper.Invariants()
require.Equal(t, len(invar), len(orgInvRoutes)+1)
}
func TestAssertInvariants(t *testing.T) {
ctrl := gomock.NewController(t)
supplyKeeper := crisistestutil.NewMockSupplyKeeper(ctrl)
key := storetypes.NewKVStoreKey(types.StoreKey)
storeService := runtime.NewKVStoreService(key)
testCtx := testutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test"))
encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, crisis.AppModule{})
keeper := keeper.NewKeeper(encCfg.Codec, storeService, 5, supplyKeeper, "", "", addresscodec.NewBech32Codec("cosmos"))
keeper.RegisterRoute("testModule", "testRoute1", func(sdk.Context) (string, bool) { return "", false })
require.NotPanics(t, func() { keeper.AssertInvariants(testCtx.Ctx) })
keeper.RegisterRoute("testModule", "testRoute2", func(sdk.Context) (string, bool) { return "", true })
require.Panics(t, func() { keeper.AssertInvariants(testCtx.Ctx) })
}

View File

@ -1,23 +0,0 @@
package keeper
import "context"
// Migrator is a struct for handling in-place state migrations.
type Migrator struct {
keeper *Keeper
}
// NewMigrator returns a new Migrator.
func NewMigrator(k *Keeper) Migrator {
return Migrator{
keeper: k,
}
}
// Migrate1to2 migrates the x/crisis module state from the consensus version 1 to
// version 2. Specifically, it takes the parameters that are currently stored
// and managed by the x/params modules and stores them directly into the x/crisis
// module state.
func (m Migrator) Migrate1to2(ctx context.Context) error {
return nil
}

View File

@ -1,96 +0,0 @@
package keeper
import (
"context"
"cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/crisis/types"
)
var _ types.MsgServer = &Keeper{}
// VerifyInvariant implements MsgServer.VerifyInvariant method.
// It defines a method to verify a particular invariant.
func (k *Keeper) VerifyInvariant(goCtx context.Context, msg *types.MsgVerifyInvariant) (*types.MsgVerifyInvariantResponse, error) {
if msg.Sender == "" {
return nil, sdkerrors.ErrInvalidAddress.Wrap("empty address string is not allowed")
}
sender, err := k.addressCodec.StringToBytes(msg.Sender)
if err != nil {
return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid sender address: %s", err)
}
ctx := sdk.UnwrapSDKContext(goCtx)
params, err := k.ConstantFee.Get(goCtx)
if err != nil {
return nil, err
}
constantFee := sdk.NewCoins(params)
if err := k.SendCoinsFromAccountToFeeCollector(ctx, sender, constantFee); err != nil {
return nil, err
}
// use a cached context to avoid gas costs during invariants
cacheCtx, _ := ctx.CacheContext()
found := false
msgFullRoute := msg.FullInvariantRoute()
var res string
var stop bool
for _, invarRoute := range k.Routes() {
if invarRoute.FullRoute() == msgFullRoute {
res, stop = invarRoute.Invar(cacheCtx)
found = true
break
}
}
if !found {
return nil, types.ErrUnknownInvariant
}
if stop {
// Currently, because the chain halts here, this transaction will never be included in the
// blockchain thus the constant fee will have never been deducted. Thus no refund is required.
// TODO replace with circuit breaker
panic(res)
}
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
types.EventTypeInvariant,
sdk.NewAttribute(types.AttributeKeyRoute, msg.InvariantRoute),
),
})
return &types.MsgVerifyInvariantResponse{}, nil
}
// UpdateParams implements MsgServer.UpdateParams method.
// It defines a method to update the x/crisis module parameters.
func (k *Keeper) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
if k.authority != msg.Authority {
return nil, errors.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority)
}
if !msg.ConstantFee.IsValid() {
return nil, errors.Wrap(sdkerrors.ErrInvalidCoins, "invalid constant fee")
}
if msg.ConstantFee.IsNegative() {
return nil, errors.Wrap(sdkerrors.ErrInvalidCoins, "negative constant fee")
}
if err := k.ConstantFee.Set(ctx, msg.ConstantFee); err != nil {
return nil, err
}
return &types.MsgUpdateParamsResponse{}, nil
}

View File

@ -1,191 +0,0 @@
package keeper_test
import (
"testing"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/suite"
sdkmath "cosmossdk.io/math"
storetypes "cosmossdk.io/store/types"
addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/runtime"
"github.com/cosmos/cosmos-sdk/testutil"
sdk "github.com/cosmos/cosmos-sdk/types"
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
"github.com/cosmos/cosmos-sdk/x/crisis"
"github.com/cosmos/cosmos-sdk/x/crisis/keeper"
crisistestutil "github.com/cosmos/cosmos-sdk/x/crisis/testutil"
"github.com/cosmos/cosmos-sdk/x/crisis/types"
)
type KeeperTestSuite struct {
suite.Suite
ctx sdk.Context
supplyKeeper *crisistestutil.MockSupplyKeeper
keeper *keeper.Keeper
}
func (s *KeeperTestSuite) SetupTest() {
// gomock initializations
ctrl := gomock.NewController(s.T())
supplyKeeper := crisistestutil.NewMockSupplyKeeper(ctrl)
key := storetypes.NewKVStoreKey(types.StoreKey)
storeService := runtime.NewKVStoreService(key)
testCtx := testutil.DefaultContextWithDB(s.T(), key, storetypes.NewTransientStoreKey("transient_test"))
encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, crisis.AppModule{})
addr, err := codectestutil.CodecOptions{}.GetAddressCodec().BytesToString([]byte("addr1_______________"))
s.Require().NoError(err)
keeper := keeper.NewKeeper(encCfg.Codec, storeService, 5, supplyKeeper, "", addr, addresscodec.NewBech32Codec("cosmos"))
s.ctx = testCtx.Ctx
s.keeper = keeper
s.supplyKeeper = supplyKeeper
}
func (s *KeeperTestSuite) TestMsgVerifyInvariant() {
// default params
constantFee := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(1000))
err := s.keeper.ConstantFee.Set(s.ctx, constantFee)
s.Require().NoError(err)
encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, crisis.AppModule{})
kr := keyring.NewInMemory(encCfg.Codec)
testutil.CreateKeyringAccounts(s.T(), kr, 1)
sender := testutil.CreateKeyringAccounts(s.T(), kr, 1)[0]
senderAddr, err := codectestutil.CodecOptions{}.GetAddressCodec().BytesToString(sender.Address)
s.Require().NoError(err)
s.supplyKeeper.EXPECT().SendCoinsFromAccountToModule(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(2)
s.keeper.RegisterRoute("bank", "total-supply", func(sdk.Context) (string, bool) { return "", false })
testCases := []struct {
name string
input *types.MsgVerifyInvariant
expErr bool
expErrMsg string
}{
{
name: "empty sender not allowed",
input: &types.MsgVerifyInvariant{
Sender: "",
InvariantModuleName: "bank",
InvariantRoute: "total-supply",
},
expErr: true,
expErrMsg: "empty address string is not allowed",
},
{
name: "invalid sender address",
input: &types.MsgVerifyInvariant{
Sender: "invalid address",
InvariantModuleName: "bank",
InvariantRoute: "total-supply",
},
expErr: true,
expErrMsg: "decoding bech32 failed",
},
{
name: "unregistered invariant route",
input: &types.MsgVerifyInvariant{
Sender: senderAddr,
InvariantModuleName: "module",
InvariantRoute: "invalidroute",
},
expErr: true,
expErrMsg: "unknown invariant",
},
{
name: "valid invariant",
input: &types.MsgVerifyInvariant{
Sender: senderAddr,
InvariantModuleName: "bank",
InvariantRoute: "total-supply",
},
expErr: false,
},
}
for _, tc := range testCases {
tc := tc
s.Run(tc.name, func() {
_, err = s.keeper.VerifyInvariant(s.ctx, tc.input)
if tc.expErr {
s.Require().Error(err)
s.Require().Contains(err.Error(), tc.expErrMsg)
} else {
s.Require().NoError(err)
}
})
}
}
func (s *KeeperTestSuite) TestMsgUpdateParams() {
// default params
constantFee := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(1000))
testCases := []struct {
name string
input *types.MsgUpdateParams
expErr bool
expErrMsg string
}{
{
name: "invalid authority",
input: &types.MsgUpdateParams{
Authority: "invalid",
ConstantFee: constantFee,
},
expErr: true,
expErrMsg: "invalid authority",
},
{
name: "invalid constant fee",
input: &types.MsgUpdateParams{
Authority: s.keeper.GetAuthority(),
ConstantFee: sdk.Coin{},
},
expErr: true,
},
{
name: "negative constant fee",
input: &types.MsgUpdateParams{
Authority: s.keeper.GetAuthority(),
ConstantFee: sdk.Coin{Denom: sdk.DefaultBondDenom, Amount: sdkmath.NewInt(-1000)},
},
expErr: true,
},
{
name: "all good",
input: &types.MsgUpdateParams{
Authority: s.keeper.GetAuthority(),
ConstantFee: constantFee,
},
expErr: false,
},
}
for _, tc := range testCases {
tc := tc
s.Run(tc.name, func() {
_, err := s.keeper.UpdateParams(s.ctx, tc.input)
if tc.expErr {
s.Require().Error(err)
s.Require().Contains(err.Error(), tc.expErrMsg)
} else {
s.Require().NoError(err)
}
})
}
}
func TestKeeperTestSuite(t *testing.T) {
suite.Run(t, new(KeeperTestSuite))
}

View File

@ -1,149 +0,0 @@
package crisis
import (
"context"
"encoding/json"
"fmt"
"github.com/spf13/cobra"
"google.golang.org/grpc"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/core/legacy"
"cosmossdk.io/core/registry"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/crisis/keeper"
"github.com/cosmos/cosmos-sdk/x/crisis/types"
)
// ConsensusVersion defines the current x/crisis module consensus version.
const ConsensusVersion = 2
var (
_ module.HasName = AppModule{}
_ module.HasAminoCodec = AppModule{}
_ appmodule.AppModule = AppModule{}
_ appmodule.HasEndBlocker = AppModule{}
_ appmodule.HasServices = AppModule{}
_ appmodule.HasMigrations = AppModule{}
_ appmodule.HasRegisterInterfaces = AppModule{}
_ appmodule.HasGenesis = AppModule{}
)
// Module init related flags
const FlagSkipGenesisInvariants = "x-crisis-skip-assert-invariants"
// AppModule implements an application module for the crisis module.
type AppModule struct {
// NOTE: We store a reference to the keeper here so that after a module
// manager is created, the invariants can be properly registered and
// executed.
keeper *keeper.Keeper
cdc codec.Codec
skipGenesisInvariants bool
}
// NewAppModule creates a new AppModule object. If initChainAssertInvariants is set,
// we will call keeper.AssertInvariants during InitGenesis (it may take a significant time)
// - which doesn't impact the chain security unless 66+% of validators have a wrongly
// modified genesis file.
func NewAppModule(keeper *keeper.Keeper, cdc codec.Codec, skipGenesisInvariants bool) AppModule {
return AppModule{
keeper: keeper,
skipGenesisInvariants: skipGenesisInvariants,
cdc: cdc,
}
}
// IsAppModule implements the appmodule.AppModule interface.
func (am AppModule) IsAppModule() {}
// Name returns the crisis module's name.
func (AppModule) Name() string {
return types.ModuleName
}
// RegisterLegacyAminoCodec registers the crisis module's types on the given LegacyAmino codec.
func (AppModule) RegisterLegacyAminoCodec(cdc legacy.Amino) {
types.RegisterLegacyAminoCodec(cdc)
}
// RegisterInterfaces registers interfaces and implementations of the crisis
// module.
func (AppModule) RegisterInterfaces(registrar registry.InterfaceRegistrar) {
types.RegisterInterfaces(registrar)
}
// AddModuleInitFlags implements servertypes.ModuleInitFlags interface.
func AddModuleInitFlags(startCmd *cobra.Command) {
startCmd.Flags().Bool(FlagSkipGenesisInvariants, false, "Skip x/crisis invariants check on startup")
}
// RegisterServices registers module services.
func (am AppModule) RegisterServices(registrar grpc.ServiceRegistrar) error {
types.RegisterMsgServer(registrar, am.keeper)
return nil
}
// RegisterMigrations registers the crisis module migrations.
func (am AppModule) RegisterMigrations(mr appmodule.MigrationRegistrar) error {
m := keeper.NewMigrator(am.keeper)
if err := mr.Register(types.ModuleName, 1, m.Migrate1to2); err != nil {
return fmt.Errorf("failed to migrate x/%s from version 1 to 2: %w", types.ModuleName, err)
}
return nil
}
// DefaultGenesis returns default genesis state as raw bytes for the crisis module.
func (am AppModule) DefaultGenesis() json.RawMessage {
return am.cdc.MustMarshalJSON(types.DefaultGenesisState())
}
// ValidateGenesis performs genesis state validation for the crisis module.
func (am AppModule) ValidateGenesis(bz json.RawMessage) error {
var data types.GenesisState
if err := am.cdc.UnmarshalJSON(bz, &data); err != nil {
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
}
return types.ValidateGenesis(&data)
}
// InitGenesis performs genesis initialization for the crisis module.
func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) error {
var genesisState types.GenesisState
if err := am.cdc.UnmarshalJSON(data, &genesisState); err != nil {
return err
}
am.keeper.InitGenesis(ctx, &genesisState)
if !am.skipGenesisInvariants {
am.keeper.AssertInvariants(ctx)
}
return nil
}
// ExportGenesis returns the exported genesis state as raw bytes for the crisis module.
func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) {
gs, err := am.keeper.ExportGenesis(ctx)
if err != nil {
return nil, err
}
return am.cdc.MarshalJSON(gs)
}
// ConsensusVersion implements HasConsensusVersion
func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion }
// EndBlock returns the end blocker for the crisis module. It returns no validator
// updates.
func (am AppModule) EndBlock(ctx context.Context) error {
EndBlocker(ctx, *am.keeper)
return nil
}

View File

@ -1,8 +0,0 @@
version: v1
plugins:
- name: gocosmos
out: ..
opt: plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/gogoproto/types/any
- name: grpc-gateway
out: ..
opt: logtostderr=true,allow_colon_final_segments=true

View File

@ -1,18 +0,0 @@
version: v1
managed:
enabled: true
go_package_prefix:
default: cosmossdk.io/api
except:
- buf.build/googleapis/googleapis
- buf.build/cosmos/gogo-proto
- buf.build/cosmos/cosmos-proto
override:
buf.build/cosmos/cosmos-sdk: cosmossdk.io/api
plugins:
- name: go-pulsar
out: ..
opt: paths=source_relative
- name: go-grpc
out: ..
opt: paths=source_relative

View File

@ -1,28 +0,0 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: cosmos
repository: cosmos-proto
commit: 04467658e59e44bbb22fe568206e1f70
digest: shake256:73a640bd60e0c523b0f8237ff34eab67c45a38b64bbbde1d80224819d272dbf316ac183526bd245f994af6608b025f5130483d0133c5edd385531326b5990466
- remote: buf.build
owner: cosmos
repository: cosmos-sdk
commit: cf13c7d232dd405180c2af616fa8a075
digest: shake256:769a38e306a98339b549bc96991c97fae8bd3ceb1a7646c7bfe9a74e406ab068372970fbc5abda1891e2f3c36527cf2d3a25f631739d36900787226e564bb612
- remote: buf.build
owner: cosmos
repository: gogo-proto
commit: 5e5b9fdd01804356895f8f79a6f1ddc1
digest: shake256:0b85da49e2e5f9ebc4806eae058e2f56096ff3b1c59d1fb7c190413dd15f45dd456f0b69ced9059341c80795d2b6c943de15b120a9e0308b499e43e4b5fc2952
- remote: buf.build
owner: googleapis
repository: googleapis
commit: 28151c0d0a1641bf938a7672c500e01d
digest: shake256:49215edf8ef57f7863004539deff8834cfb2195113f0b890dd1f67815d9353e28e668019165b9d872395871eeafcbab3ccfdb2b5f11734d3cca95be9e8d139de
- remote: buf.build
owner: protocolbuffers
repository: wellknowntypes
commit: 657250e6a39648cbb169d079a60bd9ba
digest: shake256:00de25001b8dd2e29d85fc4bcc3ede7aed886d76d67f5e0f7a9b320b90f871d3eb73507d50818d823a0512f3f8db77a11c043685528403e31ff3fef18323a9fb

View File

@ -1,17 +0,0 @@
version: v1
deps:
- buf.build/cosmos/cosmos-sdk # pin the Cosmos SDK version
- buf.build/cosmos/cosmos-proto
- buf.build/cosmos/gogo-proto
- buf.build/googleapis/googleapis
lint:
use:
- DEFAULT
- COMMENTS
- FILE_LOWER_SNAKE_CASE
except:
- UNARY_RPC
- COMMENT_FIELD
- SERVICE_SUFFIX
- PACKAGE_VERSION_SUFFIX
- RPC_REQUEST_STANDARD_NAME

View File

@ -1,18 +0,0 @@
syntax = "proto3";
package cosmos.crisis.module.v1;
import "cosmos/app/v1alpha1/module.proto";
// Module is the config object of the crisis module.
message Module {
option (cosmos.app.v1alpha1.module) = {
go_import: "github.com/cosmos/cosmos-sdk/x/crisis"
};
// fee_collector_name is the name of the FeeCollector ModuleAccount.
string fee_collector_name = 1;
// authority defines the custom module authority. If not set, defaults to the governance module.
string authority = 2;
}

View File

@ -1,15 +0,0 @@
syntax = "proto3";
package cosmos.crisis.v1beta1;
option go_package = "github.com/cosmos/cosmos-sdk/x/crisis/types";
import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "amino/amino.proto";
// GenesisState defines the crisis module's genesis state.
message GenesisState {
// constant_fee is the fee used to verify the invariant in the crisis
// module.
cosmos.base.v1beta1.Coin constant_fee = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
}

View File

@ -1,64 +0,0 @@
syntax = "proto3";
package cosmos.crisis.v1beta1;
option go_package = "github.com/cosmos/cosmos-sdk/x/crisis/types";
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/msg/v1/msg.proto";
import "amino/amino.proto";
import "cosmos/base/v1beta1/coin.proto";
// Msg defines the bank Msg service.
service Msg {
option (cosmos.msg.v1.service) = true;
// VerifyInvariant defines a method to verify a particular invariant.
rpc VerifyInvariant(MsgVerifyInvariant) returns (MsgVerifyInvariantResponse);
// UpdateParams defines a governance operation for updating the x/crisis module
// parameters. The authority is defined in the keeper.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) {
option (cosmos_proto.method_added_in) = "cosmos-sdk 0.47";
}
}
// MsgVerifyInvariant represents a message to verify a particular invariance.
message MsgVerifyInvariant {
option (cosmos.msg.v1.signer) = "sender";
option (amino.name) = "cosmos-sdk/MsgVerifyInvariant";
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
// sender is the account address of private key to send coins to fee collector account.
string sender = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// name of the invariant module.
string invariant_module_name = 2;
// invariant_route is the msg's invariant route.
string invariant_route = 3;
}
// MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type.
message MsgVerifyInvariantResponse {}
// MsgUpdateParams is the Msg/UpdateParams request type.
message MsgUpdateParams {
option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47";
option (cosmos.msg.v1.signer) = "authority";
option (amino.name) = "cosmos-sdk/x/crisis/MsgUpdateParams";
// authority is the address that controls the module (defaults to x/gov unless overwritten).
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// constant_fee defines the x/crisis parameter.
cosmos.base.v1beta1.Coin constant_fee = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
}
// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
message MsgUpdateParamsResponse {
option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47";
}

View File

@ -1,50 +0,0 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: x/crisis/types/expected_keepers.go
// Package testutil is a generated GoMock package.
package testutil
import (
context "context"
reflect "reflect"
types "github.com/cosmos/cosmos-sdk/types"
gomock "github.com/golang/mock/gomock"
)
// MockSupplyKeeper is a mock of SupplyKeeper interface.
type MockSupplyKeeper struct {
ctrl *gomock.Controller
recorder *MockSupplyKeeperMockRecorder
}
// MockSupplyKeeperMockRecorder is the mock recorder for MockSupplyKeeper.
type MockSupplyKeeperMockRecorder struct {
mock *MockSupplyKeeper
}
// NewMockSupplyKeeper creates a new mock instance.
func NewMockSupplyKeeper(ctrl *gomock.Controller) *MockSupplyKeeper {
mock := &MockSupplyKeeper{ctrl: ctrl}
mock.recorder = &MockSupplyKeeperMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockSupplyKeeper) EXPECT() *MockSupplyKeeperMockRecorder {
return m.recorder
}
// SendCoinsFromAccountToModule mocks base method.
func (m *MockSupplyKeeper) SendCoinsFromAccountToModule(ctx context.Context, senderAddr types.AccAddress, recipientModule string, amt types.Coins) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SendCoinsFromAccountToModule", ctx, senderAddr, recipientModule, amt)
ret0, _ := ret[0].(error)
return ret0
}
// SendCoinsFromAccountToModule indicates an expected call of SendCoinsFromAccountToModule.
func (mr *MockSupplyKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromAccountToModule", reflect.TypeOf((*MockSupplyKeeper)(nil).SendCoinsFromAccountToModule), ctx, senderAddr, recipientModule, amt)
}

View File

@ -1,27 +0,0 @@
package types
import (
corelegacy "cosmossdk.io/core/legacy"
"cosmossdk.io/core/registry"
coretransaction "cosmossdk.io/core/transaction"
"github.com/cosmos/cosmos-sdk/codec/legacy"
"github.com/cosmos/cosmos-sdk/types/msgservice"
)
// RegisterLegacyAminoCodec registers the necessary x/crisis interfaces and concrete types
// on the provided LegacyAmino codec. These types are used for Amino JSON serialization.
func RegisterLegacyAminoCodec(cdc corelegacy.Amino) {
legacy.RegisterAminoMsg(cdc, &MsgVerifyInvariant{}, "cosmos-sdk/MsgVerifyInvariant")
legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/x/crisis/MsgUpdateParams")
}
// RegisterInterfaces registers the interfaces types with the Interface Registry.
func RegisterInterfaces(registrar registry.InterfaceRegistrar) {
registrar.RegisterImplementations((*coretransaction.Msg)(nil),
&MsgVerifyInvariant{},
&MsgUpdateParams{},
)
msgservice.RegisterMsgServiceDesc(registrar, &_Msg_serviceDesc)
}

View File

@ -1,10 +0,0 @@
package types
import "cosmossdk.io/errors"
// x/crisis module sentinel errors
var (
ErrNoSender = errors.Register(ModuleName, 2, "sender address is empty")
ErrUnknownInvariant = errors.Register(ModuleName, 3, "unknown invariant")
ErrInvalidSigner = errors.Register(ModuleName, 4, "expected authority account as only signer for proposal message")
)

View File

@ -1,8 +0,0 @@
package types
// crisis module event types
const (
EventTypeInvariant = "invariant"
AttributeKeyRoute = "route"
)

View File

@ -1,12 +0,0 @@
package types
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// SupplyKeeper defines the expected supply keeper (noalias)
type SupplyKeeper interface {
SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
}

View File

@ -1,34 +0,0 @@
package types
import (
"fmt"
sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// NewGenesisState creates a new GenesisState object
func NewGenesisState(constantFee sdk.Coin) *GenesisState {
return &GenesisState{
ConstantFee: constantFee,
}
}
// DefaultGenesisState creates a default GenesisState object
func DefaultGenesisState() *GenesisState {
return &GenesisState{
ConstantFee: sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(1000)),
}
}
// ValidateGenesis - validate crisis genesis data
func ValidateGenesis(data *GenesisState) error {
if !data.ConstantFee.IsValid() {
return fmt.Errorf("constant fee is invalid")
}
if !data.ConstantFee.IsPositive() {
return fmt.Errorf("constant fee must be positive: %s", data.ConstantFee)
}
return nil
}

View File

@ -1,330 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: cosmos/crisis/v1beta1/genesis.proto
package types
import (
fmt "fmt"
types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/cosmos/cosmos-sdk/types/tx/amino"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/cosmos/gogoproto/proto"
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
// GenesisState defines the crisis module's genesis state.
type GenesisState struct {
// constant_fee is the fee used to verify the invariant in the crisis
// module.
ConstantFee types.Coin `protobuf:"bytes,3,opt,name=constant_fee,json=constantFee,proto3" json:"constant_fee"`
}
func (m *GenesisState) Reset() { *m = GenesisState{} }
func (m *GenesisState) String() string { return proto.CompactTextString(m) }
func (*GenesisState) ProtoMessage() {}
func (*GenesisState) Descriptor() ([]byte, []int) {
return fileDescriptor_7a9c2781aa8a27ae, []int{0}
}
func (m *GenesisState) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) {
xxx_messageInfo_GenesisState.Merge(m, src)
}
func (m *GenesisState) XXX_Size() int {
return m.Size()
}
func (m *GenesisState) XXX_DiscardUnknown() {
xxx_messageInfo_GenesisState.DiscardUnknown(m)
}
var xxx_messageInfo_GenesisState proto.InternalMessageInfo
func (m *GenesisState) GetConstantFee() types.Coin {
if m != nil {
return m.ConstantFee
}
return types.Coin{}
}
func init() {
proto.RegisterType((*GenesisState)(nil), "cosmos.crisis.v1beta1.GenesisState")
}
func init() {
proto.RegisterFile("cosmos/crisis/v1beta1/genesis.proto", fileDescriptor_7a9c2781aa8a27ae)
}
var fileDescriptor_7a9c2781aa8a27ae = []byte{
// 241 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4e, 0xce, 0x2f, 0xce,
0xcd, 0x2f, 0xd6, 0x4f, 0x2e, 0xca, 0x2c, 0xce, 0x2c, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49,
0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17,
0x12, 0x85, 0x28, 0xd2, 0x83, 0x28, 0xd2, 0x83, 0x2a, 0x92, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07,
0xab, 0xd0, 0x07, 0xb1, 0x20, 0x8a, 0xa5, 0xe4, 0xa0, 0x26, 0x26, 0x25, 0x16, 0xa7, 0xc2, 0xcd,
0x4b, 0xce, 0xcf, 0xcc, 0x83, 0xca, 0x0b, 0x26, 0xe6, 0x66, 0xe6, 0xe5, 0xeb, 0x83, 0x49, 0x88,
0x90, 0x52, 0x38, 0x17, 0x8f, 0x3b, 0xc4, 0xc2, 0xe0, 0x92, 0xc4, 0x92, 0x54, 0x21, 0x77, 0x2e,
0x9e, 0xe4, 0xfc, 0xbc, 0xe2, 0x92, 0xc4, 0xbc, 0x92, 0xf8, 0xb4, 0xd4, 0x54, 0x09, 0x66, 0x05,
0x46, 0x0d, 0x6e, 0x23, 0x49, 0x3d, 0xa8, 0x33, 0x40, 0x26, 0xc3, 0x1c, 0xa1, 0xe7, 0x9c, 0x9f,
0x99, 0xe7, 0xc4, 0x79, 0xe2, 0x9e, 0x3c, 0xc3, 0x8a, 0xe7, 0x1b, 0xb4, 0x18, 0x83, 0xb8, 0x61,
0x3a, 0xdd, 0x52, 0x53, 0x9d, 0x5c, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1,
0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21,
0x4a, 0x3b, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0x16, 0x04, 0x60,
0x4a, 0xb7, 0x38, 0x25, 0x5b, 0xbf, 0x02, 0x16, 0x1e, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c,
0x60, 0x67, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x98, 0x45, 0xfd, 0x02, 0x2d, 0x01, 0x00,
0x00,
}
func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.ConstantFee.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
return len(dAtA) - i, nil
}
func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int {
offset -= sovGenesis(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *GenesisState) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.ConstantFee.Size()
n += 1 + l + sovGenesis(uint64(l))
return n
}
func sovGenesis(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozGenesis(x uint64) (n int) {
return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *GenesisState) 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 ErrIntOverflowGenesis
}
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: GenesisState: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ConstantFee", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ConstantFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthGenesis
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipGenesis(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, ErrIntOverflowGenesis
}
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, ErrIntOverflowGenesis
}
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, ErrIntOverflowGenesis
}
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, ErrInvalidLengthGenesis
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupGenesis
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthGenesis
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)

View File

@ -1,17 +0,0 @@
package types
import "cosmossdk.io/collections"
const (
// module name
ModuleName = "crisis"
StoreKey = ModuleName
// GovModuleName duplicates the gov module's name to avoid a cyclic dependency with x/gov.
// It should be synced with the gov module's name if it is ever changed.
// See: https://github.com/cosmos/cosmos-sdk/blob/b62a28aac041829da5ded4aeacfcd7a42873d1c8/x/gov/types/keys.go#L9
GovModuleName = "gov"
)
var ConstantFeeKey = collections.NewPrefix(1)

View File

@ -1,24 +0,0 @@
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// ensure Msg interface compliance at compile time
var (
_, _ sdk.Msg = &MsgVerifyInvariant{}, &MsgUpdateParams{}
)
// NewMsgVerifyInvariant creates a new MsgVerifyInvariant object
func NewMsgVerifyInvariant(sender, invModeName, invRoute string) *MsgVerifyInvariant {
return &MsgVerifyInvariant{
Sender: sender,
InvariantModuleName: invModeName,
InvariantRoute: invRoute,
}
}
// FullInvariantRoute - get the messages full invariant route
func (msg MsgVerifyInvariant) FullInvariantRoute() string {
return msg.InvariantModuleName + "/" + msg.InvariantRoute
}

View File

@ -1,26 +0,0 @@
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// invariant route
type InvarRoute struct {
ModuleName string
Route string
Invar sdk.Invariant
}
// NewInvarRoute - create an InvarRoute object
func NewInvarRoute(moduleName, route string, invar sdk.Invariant) InvarRoute {
return InvarRoute{
ModuleName: moduleName,
Route: route,
Invar: invar,
}
}
// get the full invariance route
func (i InvarRoute) FullRoute() string {
return i.ModuleName + "/" + i.Route
}

File diff suppressed because it is too large Load Diff

View File

@ -22,9 +22,9 @@ recover from.
* [State](#state)
* [Events](#events)
* [Client](#client)
* [CLI](#cli)
* [REST](#rest)
* [gRPC](#grpc)
* [CLI](#cli)
* [REST](#rest)
* [gRPC](#grpc)
* [Resources](#resources)
## Concepts
@ -246,8 +246,6 @@ module_versions:
version: "1"
- name: bank
version: "2"
- name: crisis
version: "1"
- name: distribution
version: "2"
- name: evidence
@ -410,10 +408,6 @@ Example Output:
"name": "bank",
"version": "2"
},
{
"name": "crisis",
"version": "1"
},
{
"name": "distribution",
"version": "2"
@ -552,10 +546,6 @@ Example Output:
"name": "bank",
"version": "2"
},
{
"name": "crisis",
"version": "1"
},
{
"name": "distribution",
"version": "2"