From 4930576991ed792c3e9f695e3084606516d82856 Mon Sep 17 00:00:00 2001 From: Vishal Potpelliwar <71565171+vishal-kanna@users.noreply.github.com> Date: Wed, 25 Sep 2024 20:38:30 +0530 Subject: [PATCH] feat: Added MsgBurn per signer (#783) * feat: integrated feemarket * chore: updated anteHandler and postHandler * chore: use replace for feemarket in go.mod * chore: changed go version in docker file * fix : fix testing in antehandler * fix: fix lint issues * chore: updated antehandler * fix: fix lint issues * fix: fix lint issues * fix: lint issus * chore: updated ante and fix test cases * fix: gofumt errors * fix: golint issues * chore: updated postHandler * testing * chore: added test cases * fix * fix * fix: golint issues * fix : fix testcase * fix: fix lint issues * disable update tests * disable report test * fix: added response check in tests * fix * chore: added param subsace for feemarket * feat: added burn mechanism * chore: added burn msg proto * addressed review comments * fix * fix * fix * TODO in app.go * fix: golint error * chore: made changes in setup for tests * fix: lint issues * chore: added tests for burn msg * chore: added tests for burnMsg * chore: fix tests * Temporarily disabled upgrade test runs + references * chore: added upgradeHandler and upgraded the store loader * chore: changes in burnMsg logic * chore: added burn integration test * fix : fix lint issue * fix tests * fix * fix * fix * fix * fix * fix * Switch literal * chore: added tests * fix * Simplify burn integration test cases --------- Co-authored-by: Tasos Derisiotis <50984242+Eengineer1@users.noreply.github.com> --- api/cheqd/did/v2/query_grpc.pb.go | 38 +- api/cheqd/did/v2/tx.pulsar.go | 1381 +++++++++++++++-- api/cheqd/did/v2/tx_grpc.pb.go | 76 +- api/cheqd/resource/v2/query_grpc.pb.go | 38 +- api/cheqd/resource/v2/tx_grpc.pb.go | 32 +- app/app.go | 2 + proto/cheqd/did/v2/tx.proto | 24 + tests/integration/cli/tx.go | 4 + tests/integration/cli_defi_test.go | 85 + tests/integration/helpers/fee.go | 2 +- tests/upgrade/integration/v3/burn_test.go | 25 + tests/upgrade/integration/v3/cli/config.go | 48 + tests/upgrade/integration/v3/cli/docker.go | 88 ++ tests/upgrade/integration/v3/cli/exec.go | 34 + tests/upgrade/integration/v3/cli/helpers.go | 224 +++ tests/upgrade/integration/v3/cli/query.go | 128 ++ tests/upgrade/integration/v3/cli/tx.go | 185 +++ tests/upgrade/integration/v3/helpers.go | 26 + tests/upgrade/integration/v3/loader.go | 60 + .../integration/v3/upgrade_suite_test.go | 15 + x/did/client/cli/burn_cli.go | 46 + x/did/client/cli/tx.go | 1 + x/did/keeper/burn.go | 22 + x/did/keeper/keeper.go | 20 +- x/did/keeper/msg_server.go | 48 + x/did/tests/burn_test.go | 127 ++ x/did/tests/setup/setup.go | 66 +- x/did/types/codec.go | 2 + x/did/types/error.go | 3 + x/did/types/expected_keepers.go | 27 + x/did/types/tx.pb.go | 482 +++++- x/did/types/tx_msg_burn.go | 40 + x/resource/tests/setup/setup.go | 45 +- 33 files changed, 3175 insertions(+), 269 deletions(-) create mode 100644 tests/integration/cli_defi_test.go create mode 100644 tests/upgrade/integration/v3/burn_test.go create mode 100644 tests/upgrade/integration/v3/cli/config.go create mode 100644 tests/upgrade/integration/v3/cli/docker.go create mode 100644 tests/upgrade/integration/v3/cli/exec.go create mode 100644 tests/upgrade/integration/v3/cli/helpers.go create mode 100644 tests/upgrade/integration/v3/cli/query.go create mode 100644 tests/upgrade/integration/v3/cli/tx.go create mode 100644 tests/upgrade/integration/v3/helpers.go create mode 100644 tests/upgrade/integration/v3/loader.go create mode 100644 tests/upgrade/integration/v3/upgrade_suite_test.go create mode 100644 x/did/client/cli/burn_cli.go create mode 100644 x/did/keeper/burn.go create mode 100644 x/did/tests/burn_test.go create mode 100644 x/did/types/tx_msg_burn.go diff --git a/api/cheqd/did/v2/query_grpc.pb.go b/api/cheqd/did/v2/query_grpc.pb.go index f516fc4ac..e32f7cccd 100644 --- a/api/cheqd/did/v2/query_grpc.pb.go +++ b/api/cheqd/did/v2/query_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: cheqd/did/v2/query.proto @@ -15,8 +15,8 @@ import ( // 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 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Query_DidDoc_FullMethodName = "/cheqd.did.v2.Query/DidDoc" @@ -27,6 +27,8 @@ const ( // QueryClient is the client API for Query 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. +// +// Query defines the gRPC querier service for the DID module type QueryClient interface { // Fetch latest version of a DID Document for a given DID DidDoc(ctx context.Context, in *QueryDidDocRequest, opts ...grpc.CallOption) (*QueryDidDocResponse, error) @@ -45,8 +47,9 @@ func NewQueryClient(cc grpc.ClientConnInterface) QueryClient { } func (c *queryClient) DidDoc(ctx context.Context, in *QueryDidDocRequest, opts ...grpc.CallOption) (*QueryDidDocResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(QueryDidDocResponse) - err := c.cc.Invoke(ctx, Query_DidDoc_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Query_DidDoc_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -54,8 +57,9 @@ func (c *queryClient) DidDoc(ctx context.Context, in *QueryDidDocRequest, opts . } func (c *queryClient) DidDocVersion(ctx context.Context, in *QueryDidDocVersionRequest, opts ...grpc.CallOption) (*QueryDidDocVersionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(QueryDidDocVersionResponse) - err := c.cc.Invoke(ctx, Query_DidDocVersion_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Query_DidDocVersion_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -63,8 +67,9 @@ func (c *queryClient) DidDocVersion(ctx context.Context, in *QueryDidDocVersionR } func (c *queryClient) AllDidDocVersionsMetadata(ctx context.Context, in *QueryAllDidDocVersionsMetadataRequest, opts ...grpc.CallOption) (*QueryAllDidDocVersionsMetadataResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(QueryAllDidDocVersionsMetadataResponse) - err := c.cc.Invoke(ctx, Query_AllDidDocVersionsMetadata_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Query_AllDidDocVersionsMetadata_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -73,7 +78,9 @@ func (c *queryClient) AllDidDocVersionsMetadata(ctx context.Context, in *QueryAl // QueryServer is the server API for Query service. // All implementations must embed UnimplementedQueryServer -// for forward compatibility +// for forward compatibility. +// +// Query defines the gRPC querier service for the DID module type QueryServer interface { // Fetch latest version of a DID Document for a given DID DidDoc(context.Context, *QueryDidDocRequest) (*QueryDidDocResponse, error) @@ -84,9 +91,12 @@ type QueryServer interface { mustEmbedUnimplementedQueryServer() } -// UnimplementedQueryServer must be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} +// UnimplementedQueryServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedQueryServer struct{} func (UnimplementedQueryServer) DidDoc(context.Context, *QueryDidDocRequest) (*QueryDidDocResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DidDoc not implemented") @@ -98,6 +108,7 @@ func (UnimplementedQueryServer) AllDidDocVersionsMetadata(context.Context, *Quer return nil, status.Errorf(codes.Unimplemented, "method AllDidDocVersionsMetadata not implemented") } func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} +func (UnimplementedQueryServer) testEmbeddedByValue() {} // UnsafeQueryServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to QueryServer will @@ -107,6 +118,13 @@ type UnsafeQueryServer interface { } func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) { + // If the following call pancis, it indicates UnimplementedQueryServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Query_ServiceDesc, srv) } diff --git a/api/cheqd/did/v2/tx.pulsar.go b/api/cheqd/did/v2/tx.pulsar.go index 55b90bbb9..3c9bfa0c0 100644 --- a/api/cheqd/did/v2/tx.pulsar.go +++ b/api/cheqd/did/v2/tx.pulsar.go @@ -3,7 +3,12 @@ package didv2 import ( fmt "fmt" + _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/cosmos-sdk/api/amino" + v1beta1 "github.com/cosmos/cosmos-sdk/api/cosmos/base/v1beta1" + _ "github.com/cosmos/cosmos-sdk/api/cosmos/msg/v1" + _ "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" @@ -7510,6 +7515,920 @@ func (x *fastReflection_MsgDeactivateDidDocResponse) ProtoMethods() *protoiface. } } +var _ protoreflect.List = (*_MsgBurn_2_list)(nil) + +type _MsgBurn_2_list struct { + list *[]*v1beta1.Coin +} + +func (x *_MsgBurn_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgBurn_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_MsgBurn_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta1.Coin) + (*x.list)[i] = concreteValue +} + +func (x *_MsgBurn_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta1.Coin) + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgBurn_2_list) AppendMutable() protoreflect.Value { + v := new(v1beta1.Coin) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgBurn_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_MsgBurn_2_list) NewElement() protoreflect.Value { + v := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgBurn_2_list) IsValid() bool { + return x.list != nil +} + +var ( + md_MsgBurn protoreflect.MessageDescriptor + fd_MsgBurn_from_address protoreflect.FieldDescriptor + fd_MsgBurn_amount protoreflect.FieldDescriptor +) + +func init() { + file_cheqd_did_v2_tx_proto_init() + md_MsgBurn = File_cheqd_did_v2_tx_proto.Messages().ByName("MsgBurn") + fd_MsgBurn_from_address = md_MsgBurn.Fields().ByName("from_address") + fd_MsgBurn_amount = md_MsgBurn.Fields().ByName("amount") +} + +var _ protoreflect.Message = (*fastReflection_MsgBurn)(nil) + +type fastReflection_MsgBurn MsgBurn + +func (x *MsgBurn) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgBurn)(x) +} + +func (x *MsgBurn) slowProtoReflect() protoreflect.Message { + mi := &file_cheqd_did_v2_tx_proto_msgTypes[10] + 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_MsgBurn_messageType fastReflection_MsgBurn_messageType +var _ protoreflect.MessageType = fastReflection_MsgBurn_messageType{} + +type fastReflection_MsgBurn_messageType struct{} + +func (x fastReflection_MsgBurn_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgBurn)(nil) +} +func (x fastReflection_MsgBurn_messageType) New() protoreflect.Message { + return new(fastReflection_MsgBurn) +} +func (x fastReflection_MsgBurn_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgBurn +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgBurn) Descriptor() protoreflect.MessageDescriptor { + return md_MsgBurn +} + +// 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_MsgBurn) Type() protoreflect.MessageType { + return _fastReflection_MsgBurn_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgBurn) New() protoreflect.Message { + return new(fastReflection_MsgBurn) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgBurn) Interface() protoreflect.ProtoMessage { + return (*MsgBurn)(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_MsgBurn) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.FromAddress != "" { + value := protoreflect.ValueOfString(x.FromAddress) + if !f(fd_MsgBurn_from_address, value) { + return + } + } + if len(x.Amount) != 0 { + value := protoreflect.ValueOfList(&_MsgBurn_2_list{list: &x.Amount}) + if !f(fd_MsgBurn_amount, 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_MsgBurn) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cheqd.did.v2.MsgBurn.from_address": + return x.FromAddress != "" + case "cheqd.did.v2.MsgBurn.amount": + return len(x.Amount) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cheqd.did.v2.MsgBurn")) + } + panic(fmt.Errorf("message cheqd.did.v2.MsgBurn 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_MsgBurn) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cheqd.did.v2.MsgBurn.from_address": + x.FromAddress = "" + case "cheqd.did.v2.MsgBurn.amount": + x.Amount = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cheqd.did.v2.MsgBurn")) + } + panic(fmt.Errorf("message cheqd.did.v2.MsgBurn 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_MsgBurn) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cheqd.did.v2.MsgBurn.from_address": + value := x.FromAddress + return protoreflect.ValueOfString(value) + case "cheqd.did.v2.MsgBurn.amount": + if len(x.Amount) == 0 { + return protoreflect.ValueOfList(&_MsgBurn_2_list{}) + } + listValue := &_MsgBurn_2_list{list: &x.Amount} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cheqd.did.v2.MsgBurn")) + } + panic(fmt.Errorf("message cheqd.did.v2.MsgBurn 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_MsgBurn) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cheqd.did.v2.MsgBurn.from_address": + x.FromAddress = value.Interface().(string) + case "cheqd.did.v2.MsgBurn.amount": + lv := value.List() + clv := lv.(*_MsgBurn_2_list) + x.Amount = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cheqd.did.v2.MsgBurn")) + } + panic(fmt.Errorf("message cheqd.did.v2.MsgBurn 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_MsgBurn) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cheqd.did.v2.MsgBurn.amount": + if x.Amount == nil { + x.Amount = []*v1beta1.Coin{} + } + value := &_MsgBurn_2_list{list: &x.Amount} + return protoreflect.ValueOfList(value) + case "cheqd.did.v2.MsgBurn.from_address": + panic(fmt.Errorf("field from_address of message cheqd.did.v2.MsgBurn is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cheqd.did.v2.MsgBurn")) + } + panic(fmt.Errorf("message cheqd.did.v2.MsgBurn 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_MsgBurn) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cheqd.did.v2.MsgBurn.from_address": + return protoreflect.ValueOfString("") + case "cheqd.did.v2.MsgBurn.amount": + list := []*v1beta1.Coin{} + return protoreflect.ValueOfList(&_MsgBurn_2_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cheqd.did.v2.MsgBurn")) + } + panic(fmt.Errorf("message cheqd.did.v2.MsgBurn 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_MsgBurn) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cheqd.did.v2.MsgBurn", 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_MsgBurn) 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_MsgBurn) 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_MsgBurn) 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_MsgBurn) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgBurn) + 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.FromAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.Amount) > 0 { + for _, e := range x.Amount { + l = options.Size(e) + 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().(*MsgBurn) + 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.Amount) > 0 { + for iNdEx := len(x.Amount) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Amount[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + } + if len(x.FromAddress) > 0 { + i -= len(x.FromAddress) + copy(dAtA[i:], x.FromAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.FromAddress))) + 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().(*MsgBurn) + 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: MsgBurn: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgBurn: 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 FromAddress", 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.FromAddress = 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 Amount", 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 + } + x.Amount = append(x.Amount, &v1beta1.Coin{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Amount[len(x.Amount)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgBurnResponse protoreflect.MessageDescriptor +) + +func init() { + file_cheqd_did_v2_tx_proto_init() + md_MsgBurnResponse = File_cheqd_did_v2_tx_proto.Messages().ByName("MsgBurnResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgBurnResponse)(nil) + +type fastReflection_MsgBurnResponse MsgBurnResponse + +func (x *MsgBurnResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgBurnResponse)(x) +} + +func (x *MsgBurnResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cheqd_did_v2_tx_proto_msgTypes[11] + 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_MsgBurnResponse_messageType fastReflection_MsgBurnResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgBurnResponse_messageType{} + +type fastReflection_MsgBurnResponse_messageType struct{} + +func (x fastReflection_MsgBurnResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgBurnResponse)(nil) +} +func (x fastReflection_MsgBurnResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgBurnResponse) +} +func (x fastReflection_MsgBurnResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgBurnResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgBurnResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgBurnResponse +} + +// 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_MsgBurnResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgBurnResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgBurnResponse) New() protoreflect.Message { + return new(fastReflection_MsgBurnResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgBurnResponse) Interface() protoreflect.ProtoMessage { + return (*MsgBurnResponse)(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_MsgBurnResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgBurnResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cheqd.did.v2.MsgBurnResponse")) + } + panic(fmt.Errorf("message cheqd.did.v2.MsgBurnResponse 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_MsgBurnResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cheqd.did.v2.MsgBurnResponse")) + } + panic(fmt.Errorf("message cheqd.did.v2.MsgBurnResponse 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_MsgBurnResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cheqd.did.v2.MsgBurnResponse")) + } + panic(fmt.Errorf("message cheqd.did.v2.MsgBurnResponse 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_MsgBurnResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cheqd.did.v2.MsgBurnResponse")) + } + panic(fmt.Errorf("message cheqd.did.v2.MsgBurnResponse 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_MsgBurnResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cheqd.did.v2.MsgBurnResponse")) + } + panic(fmt.Errorf("message cheqd.did.v2.MsgBurnResponse 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_MsgBurnResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cheqd.did.v2.MsgBurnResponse")) + } + panic(fmt.Errorf("message cheqd.did.v2.MsgBurnResponse 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_MsgBurnResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cheqd.did.v2.MsgBurnResponse", 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_MsgBurnResponse) 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_MsgBurnResponse) 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_MsgBurnResponse) 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_MsgBurnResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgBurnResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgBurnResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgBurnResponse) + 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: MsgBurnResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgBurnResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -8186,6 +9105,76 @@ func (x *MsgDeactivateDidDocResponse) GetValue() *DidDocWithMetadata { return nil } +// MsgBurn represents a message to burn coins from the message signer account +type MsgBurn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + Amount []*v1beta1.Coin `protobuf:"bytes,2,rep,name=amount,proto3" json:"amount,omitempty"` +} + +func (x *MsgBurn) Reset() { + *x = MsgBurn{} + if protoimpl.UnsafeEnabled { + mi := &file_cheqd_did_v2_tx_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgBurn) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgBurn) ProtoMessage() {} + +// Deprecated: Use MsgBurn.ProtoReflect.Descriptor instead. +func (*MsgBurn) Descriptor() ([]byte, []int) { + return file_cheqd_did_v2_tx_proto_rawDescGZIP(), []int{10} +} + +func (x *MsgBurn) GetFromAddress() string { + if x != nil { + return x.FromAddress + } + return "" +} + +func (x *MsgBurn) GetAmount() []*v1beta1.Coin { + if x != nil { + return x.Amount + } + return nil +} + +type MsgBurnResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgBurnResponse) Reset() { + *x = MsgBurnResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cheqd_did_v2_tx_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgBurnResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgBurnResponse) ProtoMessage() {} + +// Deprecated: Use MsgBurnResponse.ProtoReflect.Descriptor instead. +func (*MsgBurnResponse) Descriptor() ([]byte, []int) { + return file_cheqd_did_v2_tx_proto_rawDescGZIP(), []int{11} +} + var File_cheqd_did_v2_tx_proto protoreflect.FileDescriptor var file_cheqd_did_v2_tx_proto_rawDesc = []byte{ @@ -8193,154 +9182,180 @@ var file_cheqd_did_v2_tx_proto_rawDesc = []byte{ 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x1a, 0x19, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2f, 0x64, 0x69, 0x64, 0x2f, 0x76, 0x32, 0x2f, 0x64, 0x69, 0x64, 0x64, 0x6f, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x89, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x69, - 0x64, 0x44, 0x6f, 0x63, 0x12, 0x3e, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, - 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x69, - 0x64, 0x44, 0x6f, 0x63, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x07, 0x70, 0x61, 0x79, - 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x36, 0x0a, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, - 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x66, 0x6f, - 0x52, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x22, 0x89, 0x01, 0x0a, - 0x0f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, - 0x12, 0x3e, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, - 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, - 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, - 0x12, 0x36, 0x0a, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, - 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x73, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x22, 0x91, 0x01, 0x0a, 0x13, 0x4d, 0x73, 0x67, - 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, - 0x12, 0x42, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x28, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, - 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x44, 0x69, - 0x64, 0x44, 0x6f, 0x63, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x07, 0x70, 0x61, 0x79, - 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x36, 0x0a, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, - 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x66, 0x6f, - 0x52, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x22, 0x5e, 0x0a, 0x08, - 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x34, 0x0a, 0x16, 0x76, 0x65, 0x72, 0x69, - 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x49, 0x64, 0x12, 0x1c, - 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x8b, 0x04, 0x0a, - 0x16, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, - 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x78, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, - 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, - 0x72, 0x12, 0x51, 0x0a, 0x13, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, - 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x56, 0x65, - 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, - 0x52, 0x12, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, - 0x74, 0x68, 0x6f, 0x64, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x75, - 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x10, - 0x61, 0x73, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, - 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x73, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, - 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x33, 0x0a, 0x15, 0x63, 0x61, 0x70, 0x61, 0x62, - 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x6e, 0x76, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x14, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, - 0x74, 0x79, 0x49, 0x6e, 0x76, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x0a, 0x15, - 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, 0x14, 0x63, 0x61, 0x70, - 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x6b, 0x65, 0x79, 0x5f, 0x61, 0x67, 0x72, 0x65, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x6b, 0x65, 0x79, 0x41, 0x67, 0x72, - 0x65, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x2f, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, - 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x07, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x61, 0x6c, 0x73, 0x6f, 0x5f, - 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x61, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, - 0x61, 0x6c, 0x73, 0x6f, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x41, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x51, 0x0a, 0x17, 0x4d, 0x73, - 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, - 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x57, 0x69, 0x74, 0x68, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8b, 0x04, - 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, - 0x63, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, - 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x78, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, - 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x65, 0x72, 0x12, 0x51, 0x0a, 0x13, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x20, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x56, + 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, + 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, + 0x2f, 0x61, 0x6d, 0x69, 0x6e, 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, 0x19, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x89, 0x01, + 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, + 0x63, 0x12, 0x3e, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, + 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, + 0x63, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x12, 0x36, 0x0a, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, + 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x22, 0x89, 0x01, 0x0a, 0x0f, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x12, 0x3e, 0x0a, + 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, + 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x50, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x36, 0x0a, + 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, + 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x73, 0x22, 0x91, 0x01, 0x0a, 0x13, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x61, + 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x12, 0x42, 0x0a, + 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, + 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, + 0x67, 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, + 0x63, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x12, 0x36, 0x0a, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, + 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x22, 0x5e, 0x0a, 0x08, 0x53, 0x69, 0x67, + 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x34, 0x0a, 0x16, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x8b, 0x04, 0x0a, 0x16, 0x4d, 0x73, + 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x50, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1e, + 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x51, + 0x0a, 0x13, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, + 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x68, + 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x12, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x52, 0x12, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x61, - 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, - 0x10, 0x61, 0x73, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x73, 0x73, 0x65, 0x72, 0x74, 0x69, - 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x33, 0x0a, 0x15, 0x63, 0x61, 0x70, 0x61, - 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x6e, 0x76, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x14, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, - 0x69, 0x74, 0x79, 0x49, 0x6e, 0x76, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x0a, - 0x15, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x64, 0x65, 0x6c, 0x65, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, 0x14, 0x63, 0x61, - 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x6b, 0x65, 0x79, 0x5f, 0x61, 0x67, 0x72, 0x65, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x6b, 0x65, 0x79, 0x41, 0x67, - 0x72, 0x65, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x2f, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, - 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, - 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x61, 0x6c, 0x73, 0x6f, - 0x5f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x61, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x0b, 0x61, 0x6c, 0x73, 0x6f, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x41, 0x73, 0x12, 0x1d, 0x0a, 0x0a, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x51, 0x0a, 0x17, 0x4d, - 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, - 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x57, 0x69, 0x74, 0x68, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4b, - 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x44, - 0x69, 0x64, 0x44, 0x6f, 0x63, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x0a, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x55, 0x0a, 0x1b, 0x4d, + 0x64, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x65, + 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x61, 0x73, 0x73, + 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x06, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x73, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x12, 0x33, 0x0a, 0x15, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, + 0x74, 0x79, 0x5f, 0x69, 0x6e, 0x76, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x14, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x49, + 0x6e, 0x76, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x0a, 0x15, 0x63, 0x61, 0x70, + 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, 0x14, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, + 0x6c, 0x69, 0x74, 0x79, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x23, + 0x0a, 0x0d, 0x6b, 0x65, 0x79, 0x5f, 0x61, 0x67, 0x72, 0x65, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x6b, 0x65, 0x79, 0x41, 0x67, 0x72, 0x65, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x2f, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x0a, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, + 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x07, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x61, 0x6c, 0x73, 0x6f, 0x5f, 0x6b, 0x6e, 0x6f, + 0x77, 0x6e, 0x5f, 0x61, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x6c, 0x73, + 0x6f, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x41, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x51, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x36, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, + 0x2e, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x57, 0x69, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8b, 0x04, 0x0a, 0x16, 0x4d, + 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x50, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, + 0x51, 0x0a, 0x13, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, + 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x56, 0x65, 0x72, 0x69, + 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x12, + 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x75, 0x74, 0x68, + 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x61, 0x73, + 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x06, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x73, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x4d, + 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x33, 0x0a, 0x15, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, + 0x69, 0x74, 0x79, 0x5f, 0x69, 0x6e, 0x76, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x07, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x14, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, + 0x49, 0x6e, 0x76, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x0a, 0x15, 0x63, 0x61, + 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, 0x14, 0x63, 0x61, 0x70, 0x61, 0x62, + 0x69, 0x6c, 0x69, 0x74, 0x79, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x23, 0x0a, 0x0d, 0x6b, 0x65, 0x79, 0x5f, 0x61, 0x67, 0x72, 0x65, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x6b, 0x65, 0x79, 0x41, 0x67, 0x72, 0x65, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x2f, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, + 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, + 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x07, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x61, 0x6c, 0x73, 0x6f, 0x5f, 0x6b, 0x6e, + 0x6f, 0x77, 0x6e, 0x5f, 0x61, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x6c, + 0x73, 0x6f, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x41, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x51, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, + 0x32, 0x2e, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x57, 0x69, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4b, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, - 0x6f, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x68, 0x65, 0x71, - 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x57, - 0x69, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x32, 0x93, 0x02, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x54, 0x0a, 0x0c, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x12, 0x1d, 0x2e, 0x63, 0x68, 0x65, - 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x1a, 0x25, 0x2e, 0x63, 0x68, 0x65, 0x71, - 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x54, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, - 0x12, 0x1d, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, - 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x1a, - 0x25, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, - 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x60, 0x0a, 0x10, 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, - 0x76, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x12, 0x21, 0x2e, 0x63, 0x68, 0x65, - 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x61, - 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x1a, 0x29, 0x2e, + 0x6f, 0x63, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x55, 0x0a, 0x1b, 0x4d, 0x73, 0x67, 0x44, + 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, + 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x57, 0x69, 0x74, 0x68, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0xcb, 0x01, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x42, 0x75, 0x72, 0x6e, 0x12, 0x3b, 0x0a, 0x0c, 0x66, + 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0b, 0x66, 0x72, 0x6f, + 0x6d, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x68, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x02, 0x20, 0x03, 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, 0x35, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 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, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x43, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, + 0x6e, 0x74, 0x3a, 0x19, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, + 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x11, 0x0a, + 0x0f, 0x4d, 0x73, 0x67, 0x42, 0x75, 0x72, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x32, 0xd1, 0x02, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x54, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x12, 0x1d, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, + 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x1a, 0x25, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, + 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, + 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x12, 0x1d, + 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x1a, 0x25, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, - 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xa4, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, - 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x42, 0x07, 0x54, - 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2f, 0x63, 0x68, 0x65, 0x71, 0x64, - 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x63, 0x68, 0x65, - 0x71, 0x64, 0x2f, 0x64, 0x69, 0x64, 0x2f, 0x76, 0x32, 0x3b, 0x64, 0x69, 0x64, 0x76, 0x32, 0xa2, - 0x02, 0x03, 0x43, 0x44, 0x58, 0xaa, 0x02, 0x0c, 0x43, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x44, 0x69, - 0x64, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x0c, 0x43, 0x68, 0x65, 0x71, 0x64, 0x5c, 0x44, 0x69, 0x64, - 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x18, 0x43, 0x68, 0x65, 0x71, 0x64, 0x5c, 0x44, 0x69, 0x64, 0x5c, - 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x0e, 0x43, 0x68, 0x65, 0x71, 0x64, 0x3a, 0x3a, 0x44, 0x69, 0x64, 0x3a, 0x3a, 0x56, 0x32, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x60, 0x0a, 0x10, 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, + 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x12, 0x21, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, + 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x61, 0x63, 0x74, + 0x69, 0x76, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x1a, 0x29, 0x2e, 0x63, 0x68, + 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, + 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x04, 0x42, 0x75, 0x72, 0x6e, 0x12, 0x15, + 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, + 0x67, 0x42, 0x75, 0x72, 0x6e, 0x1a, 0x1d, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, + 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x75, 0x72, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xa4, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x68, 0x65, + 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2f, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2d, 0x6e, 0x6f, 0x64, + 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2f, 0x64, + 0x69, 0x64, 0x2f, 0x76, 0x32, 0x3b, 0x64, 0x69, 0x64, 0x76, 0x32, 0xa2, 0x02, 0x03, 0x43, 0x44, + 0x58, 0xaa, 0x02, 0x0c, 0x43, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x44, 0x69, 0x64, 0x2e, 0x56, 0x32, + 0xca, 0x02, 0x0c, 0x43, 0x68, 0x65, 0x71, 0x64, 0x5c, 0x44, 0x69, 0x64, 0x5c, 0x56, 0x32, 0xe2, + 0x02, 0x18, 0x43, 0x68, 0x65, 0x71, 0x64, 0x5c, 0x44, 0x69, 0x64, 0x5c, 0x56, 0x32, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x43, 0x68, 0x65, + 0x71, 0x64, 0x3a, 0x3a, 0x44, 0x69, 0x64, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -8355,7 +9370,7 @@ func file_cheqd_did_v2_tx_proto_rawDescGZIP() []byte { return file_cheqd_did_v2_tx_proto_rawDescData } -var file_cheqd_did_v2_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_cheqd_did_v2_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_cheqd_did_v2_tx_proto_goTypes = []interface{}{ (*MsgCreateDidDoc)(nil), // 0: cheqd.did.v2.MsgCreateDidDoc (*MsgUpdateDidDoc)(nil), // 1: cheqd.did.v2.MsgUpdateDidDoc @@ -8367,9 +9382,12 @@ var file_cheqd_did_v2_tx_proto_goTypes = []interface{}{ (*MsgUpdateDidDocResponse)(nil), // 7: cheqd.did.v2.MsgUpdateDidDocResponse (*MsgDeactivateDidDocPayload)(nil), // 8: cheqd.did.v2.MsgDeactivateDidDocPayload (*MsgDeactivateDidDocResponse)(nil), // 9: cheqd.did.v2.MsgDeactivateDidDocResponse - (*VerificationMethod)(nil), // 10: cheqd.did.v2.VerificationMethod - (*Service)(nil), // 11: cheqd.did.v2.Service - (*DidDocWithMetadata)(nil), // 12: cheqd.did.v2.DidDocWithMetadata + (*MsgBurn)(nil), // 10: cheqd.did.v2.MsgBurn + (*MsgBurnResponse)(nil), // 11: cheqd.did.v2.MsgBurnResponse + (*VerificationMethod)(nil), // 12: cheqd.did.v2.VerificationMethod + (*Service)(nil), // 13: cheqd.did.v2.Service + (*DidDocWithMetadata)(nil), // 14: cheqd.did.v2.DidDocWithMetadata + (*v1beta1.Coin)(nil), // 15: cosmos.base.v1beta1.Coin } var file_cheqd_did_v2_tx_proto_depIdxs = []int32{ 4, // 0: cheqd.did.v2.MsgCreateDidDoc.payload:type_name -> cheqd.did.v2.MsgCreateDidDocPayload @@ -8378,24 +9396,27 @@ var file_cheqd_did_v2_tx_proto_depIdxs = []int32{ 3, // 3: cheqd.did.v2.MsgUpdateDidDoc.signatures:type_name -> cheqd.did.v2.SignInfo 8, // 4: cheqd.did.v2.MsgDeactivateDidDoc.payload:type_name -> cheqd.did.v2.MsgDeactivateDidDocPayload 3, // 5: cheqd.did.v2.MsgDeactivateDidDoc.signatures:type_name -> cheqd.did.v2.SignInfo - 10, // 6: cheqd.did.v2.MsgCreateDidDocPayload.verification_method:type_name -> cheqd.did.v2.VerificationMethod - 11, // 7: cheqd.did.v2.MsgCreateDidDocPayload.service:type_name -> cheqd.did.v2.Service - 12, // 8: cheqd.did.v2.MsgCreateDidDocResponse.value:type_name -> cheqd.did.v2.DidDocWithMetadata - 10, // 9: cheqd.did.v2.MsgUpdateDidDocPayload.verification_method:type_name -> cheqd.did.v2.VerificationMethod - 11, // 10: cheqd.did.v2.MsgUpdateDidDocPayload.service:type_name -> cheqd.did.v2.Service - 12, // 11: cheqd.did.v2.MsgUpdateDidDocResponse.value:type_name -> cheqd.did.v2.DidDocWithMetadata - 12, // 12: cheqd.did.v2.MsgDeactivateDidDocResponse.value:type_name -> cheqd.did.v2.DidDocWithMetadata - 0, // 13: cheqd.did.v2.Msg.CreateDidDoc:input_type -> cheqd.did.v2.MsgCreateDidDoc - 1, // 14: cheqd.did.v2.Msg.UpdateDidDoc:input_type -> cheqd.did.v2.MsgUpdateDidDoc - 2, // 15: cheqd.did.v2.Msg.DeactivateDidDoc:input_type -> cheqd.did.v2.MsgDeactivateDidDoc - 5, // 16: cheqd.did.v2.Msg.CreateDidDoc:output_type -> cheqd.did.v2.MsgCreateDidDocResponse - 7, // 17: cheqd.did.v2.Msg.UpdateDidDoc:output_type -> cheqd.did.v2.MsgUpdateDidDocResponse - 9, // 18: cheqd.did.v2.Msg.DeactivateDidDoc:output_type -> cheqd.did.v2.MsgDeactivateDidDocResponse - 16, // [16:19] is the sub-list for method output_type - 13, // [13:16] is the sub-list for method input_type - 13, // [13:13] is the sub-list for extension type_name - 13, // [13:13] is the sub-list for extension extendee - 0, // [0:13] is the sub-list for field type_name + 12, // 6: cheqd.did.v2.MsgCreateDidDocPayload.verification_method:type_name -> cheqd.did.v2.VerificationMethod + 13, // 7: cheqd.did.v2.MsgCreateDidDocPayload.service:type_name -> cheqd.did.v2.Service + 14, // 8: cheqd.did.v2.MsgCreateDidDocResponse.value:type_name -> cheqd.did.v2.DidDocWithMetadata + 12, // 9: cheqd.did.v2.MsgUpdateDidDocPayload.verification_method:type_name -> cheqd.did.v2.VerificationMethod + 13, // 10: cheqd.did.v2.MsgUpdateDidDocPayload.service:type_name -> cheqd.did.v2.Service + 14, // 11: cheqd.did.v2.MsgUpdateDidDocResponse.value:type_name -> cheqd.did.v2.DidDocWithMetadata + 14, // 12: cheqd.did.v2.MsgDeactivateDidDocResponse.value:type_name -> cheqd.did.v2.DidDocWithMetadata + 15, // 13: cheqd.did.v2.MsgBurn.amount:type_name -> cosmos.base.v1beta1.Coin + 0, // 14: cheqd.did.v2.Msg.CreateDidDoc:input_type -> cheqd.did.v2.MsgCreateDidDoc + 1, // 15: cheqd.did.v2.Msg.UpdateDidDoc:input_type -> cheqd.did.v2.MsgUpdateDidDoc + 2, // 16: cheqd.did.v2.Msg.DeactivateDidDoc:input_type -> cheqd.did.v2.MsgDeactivateDidDoc + 10, // 17: cheqd.did.v2.Msg.Burn:input_type -> cheqd.did.v2.MsgBurn + 5, // 18: cheqd.did.v2.Msg.CreateDidDoc:output_type -> cheqd.did.v2.MsgCreateDidDocResponse + 7, // 19: cheqd.did.v2.Msg.UpdateDidDoc:output_type -> cheqd.did.v2.MsgUpdateDidDocResponse + 9, // 20: cheqd.did.v2.Msg.DeactivateDidDoc:output_type -> cheqd.did.v2.MsgDeactivateDidDocResponse + 11, // 21: cheqd.did.v2.Msg.Burn:output_type -> cheqd.did.v2.MsgBurnResponse + 18, // [18:22] is the sub-list for method output_type + 14, // [14:18] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name } func init() { file_cheqd_did_v2_tx_proto_init() } @@ -8525,6 +9546,30 @@ func file_cheqd_did_v2_tx_proto_init() { return nil } } + file_cheqd_did_v2_tx_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgBurn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cheqd_did_v2_tx_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgBurnResponse); 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{ @@ -8532,7 +9577,7 @@ func file_cheqd_did_v2_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cheqd_did_v2_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 10, + NumMessages: 12, NumExtensions: 0, NumServices: 1, }, diff --git a/api/cheqd/did/v2/tx_grpc.pb.go b/api/cheqd/did/v2/tx_grpc.pb.go index 11320b86e..bad1490e0 100644 --- a/api/cheqd/did/v2/tx_grpc.pb.go +++ b/api/cheqd/did/v2/tx_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: cheqd/did/v2/tx.proto @@ -15,18 +15,21 @@ import ( // 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 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Msg_CreateDidDoc_FullMethodName = "/cheqd.did.v2.Msg/CreateDidDoc" Msg_UpdateDidDoc_FullMethodName = "/cheqd.did.v2.Msg/UpdateDidDoc" Msg_DeactivateDidDoc_FullMethodName = "/cheqd.did.v2.Msg/DeactivateDidDoc" + Msg_Burn_FullMethodName = "/cheqd.did.v2.Msg/Burn" ) // 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. +// +// Msg defines the Cosmos SDK Msg service for the cheqd.did.v2 module. type MsgClient interface { // CreateDidDoc defines a method for creating a new DID document CreateDidDoc(ctx context.Context, in *MsgCreateDidDoc, opts ...grpc.CallOption) (*MsgCreateDidDocResponse, error) @@ -34,6 +37,7 @@ type MsgClient interface { UpdateDidDoc(ctx context.Context, in *MsgUpdateDidDoc, opts ...grpc.CallOption) (*MsgUpdateDidDocResponse, error) // DeactivateDidDoc defines a method for deactivating an existing DID document DeactivateDidDoc(ctx context.Context, in *MsgDeactivateDidDoc, opts ...grpc.CallOption) (*MsgDeactivateDidDocResponse, error) + Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOption) (*MsgBurnResponse, error) } type msgClient struct { @@ -45,8 +49,9 @@ func NewMsgClient(cc grpc.ClientConnInterface) MsgClient { } func (c *msgClient) CreateDidDoc(ctx context.Context, in *MsgCreateDidDoc, opts ...grpc.CallOption) (*MsgCreateDidDocResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(MsgCreateDidDocResponse) - err := c.cc.Invoke(ctx, Msg_CreateDidDoc_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Msg_CreateDidDoc_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -54,8 +59,9 @@ func (c *msgClient) CreateDidDoc(ctx context.Context, in *MsgCreateDidDoc, opts } func (c *msgClient) UpdateDidDoc(ctx context.Context, in *MsgUpdateDidDoc, opts ...grpc.CallOption) (*MsgUpdateDidDocResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(MsgUpdateDidDocResponse) - err := c.cc.Invoke(ctx, Msg_UpdateDidDoc_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Msg_UpdateDidDoc_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -63,8 +69,19 @@ func (c *msgClient) UpdateDidDoc(ctx context.Context, in *MsgUpdateDidDoc, opts } func (c *msgClient) DeactivateDidDoc(ctx context.Context, in *MsgDeactivateDidDoc, opts ...grpc.CallOption) (*MsgDeactivateDidDocResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(MsgDeactivateDidDocResponse) - err := c.cc.Invoke(ctx, Msg_DeactivateDidDoc_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Msg_DeactivateDidDoc_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOption) (*MsgBurnResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MsgBurnResponse) + err := c.cc.Invoke(ctx, Msg_Burn_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -73,7 +90,9 @@ func (c *msgClient) DeactivateDidDoc(ctx context.Context, in *MsgDeactivateDidDo // MsgServer is the server API for Msg service. // All implementations must embed UnimplementedMsgServer -// for forward compatibility +// for forward compatibility. +// +// Msg defines the Cosmos SDK Msg service for the cheqd.did.v2 module. type MsgServer interface { // CreateDidDoc defines a method for creating a new DID document CreateDidDoc(context.Context, *MsgCreateDidDoc) (*MsgCreateDidDocResponse, error) @@ -81,12 +100,16 @@ type MsgServer interface { UpdateDidDoc(context.Context, *MsgUpdateDidDoc) (*MsgUpdateDidDocResponse, error) // DeactivateDidDoc defines a method for deactivating an existing DID document DeactivateDidDoc(context.Context, *MsgDeactivateDidDoc) (*MsgDeactivateDidDocResponse, error) + Burn(context.Context, *MsgBurn) (*MsgBurnResponse, error) mustEmbedUnimplementedMsgServer() } -// UnimplementedMsgServer must be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} +// UnimplementedMsgServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedMsgServer struct{} func (UnimplementedMsgServer) CreateDidDoc(context.Context, *MsgCreateDidDoc) (*MsgCreateDidDocResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateDidDoc not implemented") @@ -97,7 +120,11 @@ func (UnimplementedMsgServer) UpdateDidDoc(context.Context, *MsgUpdateDidDoc) (* func (UnimplementedMsgServer) DeactivateDidDoc(context.Context, *MsgDeactivateDidDoc) (*MsgDeactivateDidDocResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DeactivateDidDoc not implemented") } +func (UnimplementedMsgServer) Burn(context.Context, *MsgBurn) (*MsgBurnResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Burn not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} +func (UnimplementedMsgServer) testEmbeddedByValue() {} // 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 @@ -107,6 +134,13 @@ type UnsafeMsgServer interface { } func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) { + // If the following call pancis, it indicates UnimplementedMsgServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Msg_ServiceDesc, srv) } @@ -164,6 +198,24 @@ func _Msg_DeactivateDidDoc_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +func _Msg_Burn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgBurn) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Burn(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_Burn_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Burn(ctx, req.(*MsgBurn)) + } + 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) @@ -183,6 +235,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "DeactivateDidDoc", Handler: _Msg_DeactivateDidDoc_Handler, }, + { + MethodName: "Burn", + Handler: _Msg_Burn_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cheqd/did/v2/tx.proto", diff --git a/api/cheqd/resource/v2/query_grpc.pb.go b/api/cheqd/resource/v2/query_grpc.pb.go index 0baa20b35..96492eae1 100644 --- a/api/cheqd/resource/v2/query_grpc.pb.go +++ b/api/cheqd/resource/v2/query_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: cheqd/resource/v2/query.proto @@ -15,8 +15,8 @@ import ( // 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 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Query_Resource_FullMethodName = "/cheqd.resource.v2.Query/Resource" @@ -27,6 +27,8 @@ const ( // QueryClient is the client API for Query 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. +// +// Query defines the gRPC querier service for the resource module type QueryClient interface { // Fetch data/payload for a specific resource (without metadata) Resource(ctx context.Context, in *QueryResourceRequest, opts ...grpc.CallOption) (*QueryResourceResponse, error) @@ -45,8 +47,9 @@ func NewQueryClient(cc grpc.ClientConnInterface) QueryClient { } func (c *queryClient) Resource(ctx context.Context, in *QueryResourceRequest, opts ...grpc.CallOption) (*QueryResourceResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(QueryResourceResponse) - err := c.cc.Invoke(ctx, Query_Resource_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Query_Resource_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -54,8 +57,9 @@ func (c *queryClient) Resource(ctx context.Context, in *QueryResourceRequest, op } func (c *queryClient) ResourceMetadata(ctx context.Context, in *QueryResourceMetadataRequest, opts ...grpc.CallOption) (*QueryResourceMetadataResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(QueryResourceMetadataResponse) - err := c.cc.Invoke(ctx, Query_ResourceMetadata_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Query_ResourceMetadata_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -63,8 +67,9 @@ func (c *queryClient) ResourceMetadata(ctx context.Context, in *QueryResourceMet } func (c *queryClient) CollectionResources(ctx context.Context, in *QueryCollectionResourcesRequest, opts ...grpc.CallOption) (*QueryCollectionResourcesResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(QueryCollectionResourcesResponse) - err := c.cc.Invoke(ctx, Query_CollectionResources_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Query_CollectionResources_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -73,7 +78,9 @@ func (c *queryClient) CollectionResources(ctx context.Context, in *QueryCollecti // QueryServer is the server API for Query service. // All implementations must embed UnimplementedQueryServer -// for forward compatibility +// for forward compatibility. +// +// Query defines the gRPC querier service for the resource module type QueryServer interface { // Fetch data/payload for a specific resource (without metadata) Resource(context.Context, *QueryResourceRequest) (*QueryResourceResponse, error) @@ -84,9 +91,12 @@ type QueryServer interface { mustEmbedUnimplementedQueryServer() } -// UnimplementedQueryServer must be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} +// UnimplementedQueryServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedQueryServer struct{} func (UnimplementedQueryServer) Resource(context.Context, *QueryResourceRequest) (*QueryResourceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Resource not implemented") @@ -98,6 +108,7 @@ func (UnimplementedQueryServer) CollectionResources(context.Context, *QueryColle return nil, status.Errorf(codes.Unimplemented, "method CollectionResources not implemented") } func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} +func (UnimplementedQueryServer) testEmbeddedByValue() {} // UnsafeQueryServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to QueryServer will @@ -107,6 +118,13 @@ type UnsafeQueryServer interface { } func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) { + // If the following call pancis, it indicates UnimplementedQueryServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Query_ServiceDesc, srv) } diff --git a/api/cheqd/resource/v2/tx_grpc.pb.go b/api/cheqd/resource/v2/tx_grpc.pb.go index fec133649..8da38c1de 100644 --- a/api/cheqd/resource/v2/tx_grpc.pb.go +++ b/api/cheqd/resource/v2/tx_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: cheqd/resource/v2/tx.proto @@ -15,8 +15,8 @@ import ( // 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 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Msg_CreateResource_FullMethodName = "/cheqd.resource.v2.Msg/CreateResource" @@ -25,6 +25,8 @@ const ( // 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. +// +// Msg defines the Cosmos SDK Msg service for the cheqd.resource.v2 module. type MsgClient interface { // CreateResource defines a method for creating a resource. CreateResource(ctx context.Context, in *MsgCreateResource, opts ...grpc.CallOption) (*MsgCreateResourceResponse, error) @@ -39,8 +41,9 @@ func NewMsgClient(cc grpc.ClientConnInterface) MsgClient { } func (c *msgClient) CreateResource(ctx context.Context, in *MsgCreateResource, opts ...grpc.CallOption) (*MsgCreateResourceResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(MsgCreateResourceResponse) - err := c.cc.Invoke(ctx, Msg_CreateResource_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Msg_CreateResource_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -49,21 +52,27 @@ func (c *msgClient) CreateResource(ctx context.Context, in *MsgCreateResource, o // MsgServer is the server API for Msg service. // All implementations must embed UnimplementedMsgServer -// for forward compatibility +// for forward compatibility. +// +// Msg defines the Cosmos SDK Msg service for the cheqd.resource.v2 module. type MsgServer interface { // CreateResource defines a method for creating a resource. CreateResource(context.Context, *MsgCreateResource) (*MsgCreateResourceResponse, error) mustEmbedUnimplementedMsgServer() } -// UnimplementedMsgServer must be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} +// UnimplementedMsgServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedMsgServer struct{} func (UnimplementedMsgServer) CreateResource(context.Context, *MsgCreateResource) (*MsgCreateResourceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateResource not implemented") } func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} +func (UnimplementedMsgServer) testEmbeddedByValue() {} // 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 @@ -73,6 +82,13 @@ type UnsafeMsgServer interface { } func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) { + // If the following call pancis, it indicates UnimplementedMsgServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Msg_ServiceDesc, srv) } diff --git a/app/app.go b/app/app.go index ba50f98be..9953d10c7 100644 --- a/app/app.go +++ b/app/app.go @@ -645,6 +645,8 @@ func New( app.DidKeeper = *didkeeper.NewKeeper( appCodec, keys[didtypes.StoreKey], app.GetSubspace(didtypes.ModuleName), + app.AccountKeeper, app.BankKeeper, + app.StakingKeeper, ) // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment diff --git a/proto/cheqd/did/v2/tx.proto b/proto/cheqd/did/v2/tx.proto index bd68b7042..007c3f184 100644 --- a/proto/cheqd/did/v2/tx.proto +++ b/proto/cheqd/did/v2/tx.proto @@ -3,6 +3,12 @@ syntax = "proto3"; package cheqd.did.v2; import "cheqd/did/v2/diddoc.proto"; +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; + option go_package = "github.com/cheqd/cheqd-node/x/did/types"; @@ -16,6 +22,9 @@ service Msg { // DeactivateDidDoc defines a method for deactivating an existing DID document rpc DeactivateDidDoc(MsgDeactivateDidDoc) returns (MsgDeactivateDidDocResponse); + + rpc Burn(MsgBurn) returns (MsgBurnResponse); + } // MsgCreateDidDoc defines the Msg/CreateDidDoc request type. @@ -208,3 +217,18 @@ message MsgDeactivateDidDocResponse { // Return the deactivated DID Document with metadata DidDocWithMetadata value = 1; } + +// MsgBurn represents a message to burn coins from the message signer account +message MsgBurn { + option (cosmos.msg.v1.signer) = "from_address"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + repeated cosmos.base.v1beta1.Coin amount = 2 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} +message MsgBurnResponse {} diff --git a/tests/integration/cli/tx.go b/tests/integration/cli/tx.go index c538f9b20..e53dfe9ed 100644 --- a/tests/integration/cli/tx.go +++ b/tests/integration/cli/tx.go @@ -164,3 +164,7 @@ func CreateResource(tmpDir string, payload resourcetypes.MsgCreateResourcePayloa return Tx("resource", "create", from, feeParams, payloadFile, dataFile) } + +func BurnMsg(from string, coins string, feeParams []string) (sdk.TxResponse, error) { + return Tx("cheqd", "burn", from, feeParams, coins) +} diff --git a/tests/integration/cli_defi_test.go b/tests/integration/cli_defi_test.go new file mode 100644 index 000000000..8db1b3712 --- /dev/null +++ b/tests/integration/cli_defi_test.go @@ -0,0 +1,85 @@ +//go:build upgrade_integration + +package integration + +import ( + cli "github.com/cheqd/cheqd-node/tests/integration/cli" + helpers "github.com/cheqd/cheqd-node/tests/integration/helpers" + + "github.com/cheqd/cheqd-node/tests/integration/testdata" + sdk "github.com/cosmos/cosmos-sdk/types" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +var _ = Describe("Upgrade - Burn coins from relevant message signer", func() { + It("should burn the coins from the given address", func() { + // define the coins to burn, in which case 1,000,000 ncheq or 0.01 cheq + burnCoins := sdk.NewCoin("ncheq", sdk.NewInt(1_000_000)) + + // get the balance of the account before burning the coins + balanceBefore, err := cli.QueryBalance(testdata.BASE_ACCOUNT_1_ADDR, "ncheq") + + // assert no error + Expect(err).To(BeNil()) + + // generate fixed fees, in which case 1,000,000 ncheq or 0.01 cheq + fees := helpers.GenerateFees("1000000ncheq") + + // burn the coins + res, err := cli.BurnMsg(testdata.BASE_ACCOUNT_1, burnCoins.String(), fees) + + // assert no error + Expect(err).To(BeNil()) + + // assert the response code is 0 + Expect(res.Code).To(BeEquivalentTo(0)) + + // get the balance of the account after burning the coins + balanceAfter, err := cli.QueryBalance(testdata.BASE_ACCOUNT_1_ADDR, "ncheq") + + // assert no error + Expect(err).To(BeNil()) + + // calculate the difference between the balance before and after burning the coins + diff := balanceBefore.Sub(balanceAfter) + + // assert the difference is equal to the coins burnt + total := burnCoins.Add(sdk.NewCoin("ncheq", sdk.NewInt(1_000_000))) + + // assert the difference is equal to the coins burnt + Expect(diff).To(Equal(total)) + }) + + It("shouldn't burn as their are insufficient funds in the sender", func() { + // define the coins to burn, in which case 1,000,000 ncheq or 0.01 cheq + coins := sdk.NewCoin("ncheq", sdk.NewInt(1_000_000)) + + // get the balance of the account before burning the coins + balanceBefore, err := cli.QueryBalance(testdata.BASE_ACCOUNT_3_ADDR, "ncheq") + + // assert no error + Expect(err).To(BeNil()) + + // generate fixed fees, in which case 1,000,000 ncheq or 0.01 cheq + fees := helpers.GenerateFees("1000000ncheq") + + // burn the coins + res, err := cli.BurnMsg(testdata.BASE_ACCOUNT_3, coins.String(), fees) + + // assert no error + Expect(err).NotTo(BeNil()) + + // assert the response code is 0 + Expect(res.Code).To(BeEquivalentTo(0)) + + // get the balance of the account after burning the coins + balanceAfter, err := cli.QueryBalance(testdata.BASE_ACCOUNT_3_ADDR, "ncheq") + + // assert no error + Expect(err).To(BeNil()) + + // assert the balance before and after burning the coins are equal + Expect(balanceBefore).To(Equal(balanceAfter)) + }) +}) diff --git a/tests/integration/helpers/fee.go b/tests/integration/helpers/fee.go index 2757de269..7da618fbb 100644 --- a/tests/integration/helpers/fee.go +++ b/tests/integration/helpers/fee.go @@ -8,7 +8,7 @@ func GenerateFees(amount string) []string { return []string{ "--fees", amount, "--gas", "auto", - "--gas-adjustment", "2.5", + "--gas-adjustment", "3.5", } } diff --git a/tests/upgrade/integration/v3/burn_test.go b/tests/upgrade/integration/v3/burn_test.go new file mode 100644 index 000000000..d9994cbc5 --- /dev/null +++ b/tests/upgrade/integration/v3/burn_test.go @@ -0,0 +1,25 @@ +//go:build upgrade_integration + +package integration + +import ( + cli "github.com/cheqd/cheqd-node/tests/upgrade/integration/v3/cli" + + sdk "github.com/cosmos/cosmos-sdk/types" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +var _ = Describe("Upgrade - Burn coins from relevant message signer", func() { + It("should wait for node catching up", func() { + By("pinging the node status until catching up is flagged as false") + err := cli.WaitForCaughtUp(cli.Validator0, cli.CliBinaryName, cli.VotingPeriod*6) + Expect(err).To(BeNil()) + }) + It("should burn the coins from the given address (here container/validator)", func() { + coins := sdk.NewCoins(sdk.Coin{Denom: "ncheq", Amount: sdk.NewInt(1000)}) + res, err := cli.BurnMsg(cli.Validator0, coins.String()) + Expect(err).To(BeNil()) + Expect(res.Code).To(BeEquivalentTo(0)) + }) +}) diff --git a/tests/upgrade/integration/v3/cli/config.go b/tests/upgrade/integration/v3/cli/config.go new file mode 100644 index 000000000..516206525 --- /dev/null +++ b/tests/upgrade/integration/v3/cli/config.go @@ -0,0 +1,48 @@ +package cli + +import ( + upgradeV3 "github.com/cheqd/cheqd-node/app/upgrades/v3" + integrationcli "github.com/cheqd/cheqd-node/tests/integration/cli" + integrationnetwork "github.com/cheqd/cheqd-node/tests/integration/network" +) + +const ( + CliBinaryName = integrationcli.CliBinaryName + Green = integrationcli.Green + Purple = integrationcli.Purple +) + +const ( + KeyringBackend = integrationcli.KeyringBackend + OutputFormat = integrationcli.OutputFormat + Gas = integrationcli.Gas + GasAdjustment = integrationcli.GasAdjustment + GasPrices = integrationcli.GasPrices + + BootstrapPeriod = 20 + BootstrapHeight = 1 + VotingPeriod int64 = 10 + ExpectedBlockSeconds int64 = 1 + ExtraBlocks int64 = 10 + UpgradeName = upgradeV3.UpgradeName + DepositAmount = "10000000ncheq" + NetworkConfigDir = "network-config" + KeyringDir = "keyring-test" +) + +var ( + TXParams = []string{ + "--keyring-backend", KeyringBackend, + "--chain-id", integrationnetwork.ChainID, + "-y", + } + GasParams = []string{ + "--gas", Gas, + "--gas-adjustment", GasAdjustment, + "--gas-prices", GasPrices, + } + QueryParamsConst = []string{ + "--chain-id", integrationnetwork.ChainID, + "--output", OutputFormat, + } +) diff --git a/tests/upgrade/integration/v3/cli/docker.go b/tests/upgrade/integration/v3/cli/docker.go new file mode 100644 index 000000000..947b18456 --- /dev/null +++ b/tests/upgrade/integration/v3/cli/docker.go @@ -0,0 +1,88 @@ +package cli + +import ( + "fmt" + "os/exec" + "path/filepath" + + errorsmod "cosmossdk.io/errors" +) + +const ( + DockerLocalnetPath = "../../../../docker/localnet" + DockerComposeFile = "docker-compose.yml" + DockerComposeEnvML = "mainnet-latest.env" + DockerComposeEnvBL = "build-latest.env" + Docker = "docker" + DockerCompose = "compose" + DockerHome = "/home/cheqd" + DockerUser = "cheqd" + DockerUserGroup = "cheqd" + Operator0 = "operator-0" + Operator1 = "operator-1" + Operator2 = "operator-2" + Operator3 = "operator-3" + Validator0 = "validator-0" + Validator1 = "validator-1" + Validator2 = "validator-2" + Validator3 = "validator-3" + ValidatorsCount = 4 +) + +type OperatorAccountType map[string]string + +var OperatorAccounts = OperatorAccountType{ + Validator0: Operator0, + Validator1: Operator1, + Validator2: Operator2, + Validator3: Operator3, +} + +var ValidatorNodes = []string{Validator0, Validator1, Validator2, Validator3} + +var ( + DockerComposeLatestArgs = []string{ + "-f", filepath.Join(DockerLocalnetPath, DockerComposeFile), + "--env-file", filepath.Join(DockerLocalnetPath, DockerComposeEnvML), + } + DockerComposeBuildArgs = []string{ + "-f", filepath.Join(DockerLocalnetPath, DockerComposeFile), + "--env-file", filepath.Join(DockerLocalnetPath, DockerComposeEnvBL), + } +) + +func LocalnetExec(envArgs []string, args ...string) (string, error) { + args = append(append([]string{DockerCompose}, envArgs...), args...) + cmd := exec.Command(Docker, args...) + out, err := cmd.CombinedOutput() + if err != nil { + return string(out), errorsmod.Wrap(err, string(out)) + } + return string(out), err +} + +func LocalnetExecExec(container string, args ...string) (string, error) { + args = append([]string{"exec", container}, args...) + return LocalnetExec(DockerComposeLatestArgs, args...) +} + +func LocalnetExecUp() (string, error) { + return LocalnetExec(DockerComposeLatestArgs, "up", "--detach", "--no-build") +} + +func LocalnetExecDown() (string, error) { + return LocalnetExec(DockerComposeLatestArgs, "down") +} + +func LocalnetExecCopyAbsoluteWithPermissions(path string, destination string, container string) (string, error) { + _, err := LocalnetExec(DockerComposeLatestArgs, "cp", path, container+":"+destination) + if err != nil { + fmt.Println("Error copying file to container: ", err) + return "", err + } + return LocalnetExecRestorePermissions(destination, container) +} + +func LocalnetExecRestorePermissions(path string, container string) (string, error) { + return LocalnetExec(DockerComposeLatestArgs, "exec", "-it", "--user", "root", container, "chown", "-R", DockerUser+":"+DockerUserGroup, path) +} diff --git a/tests/upgrade/integration/v3/cli/exec.go b/tests/upgrade/integration/v3/cli/exec.go new file mode 100644 index 000000000..4d1e815dd --- /dev/null +++ b/tests/upgrade/integration/v3/cli/exec.go @@ -0,0 +1,34 @@ +package cli + +import ( + "os" + "os/exec" + + errorsmod "cosmossdk.io/errors" + integrationcli "github.com/cheqd/cheqd-node/tests/integration/cli" +) + +func Exec(args ...string) (string, error) { + return integrationcli.Exec(args...) +} + +func ExecDirect(args ...string) (string, error) { + cmd := exec.Command(args[0], args[1:]...) + out, err := cmd.CombinedOutput() + if err != nil { + return "", errorsmod.Wrap(err, string(out)) + } + + return string(out), err +} + +func ExecWithEnv(env []string, args ...string) (string, error) { + cmd := exec.Command(args[0], args[1:]...) + cmd.Env = append(os.Environ(), env...) + out, err := cmd.CombinedOutput() + if err != nil { + return "", errorsmod.Wrap(err, string(out)) + } + + return string(out), err +} diff --git a/tests/upgrade/integration/v3/cli/helpers.go b/tests/upgrade/integration/v3/cli/helpers.go new file mode 100644 index 000000000..3df422678 --- /dev/null +++ b/tests/upgrade/integration/v3/cli/helpers.go @@ -0,0 +1,224 @@ +package cli + +import ( + "encoding/json" + "fmt" + "strings" + "sync" + "time" + + cheqdtypes "github.com/cheqd/cheqd-node/x/did/types" + tmbytes "github.com/cometbft/cometbft/libs/bytes" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + govtypesv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" +) + +// The following structs are overridden from the tendermint codebase. +// They are used to parse the output of the `status` command. +// We need to override them because the tendermint codebase types are overridden +// by the cosmos-sdk codebase types. +// Also, ValidatorInfo.PubKey is replaced with cosmos-sdk crypto.PubKey, hence it needs +// to be parsed accordingly. +type NodeStatus struct { + NodeInfo DefaultNodeInfo `json:"NodeInfo"` + SyncInfo SyncInfo `json:"SyncInfo"` + ValidatorInfo ValidatorInfo `json:"ValidatorInfo"` +} + +type DefaultNodeInfo struct { + ProtocolVersion ProtocolVersion `json:"protocol_version"` + ID string `json:"id"` + ListenAddr string `json:"listen_addr"` + Network string `json:"network"` + Version string `json:"version"` + Channels tmbytes.HexBytes `json:"channels"` + Moniker string `json:"moniker"` + Other DefaultNodeInfoOther `json:"other"` +} + +type ProtocolVersion struct { + P2P uint64 `json:"p2p,string"` + Block uint64 `json:"block,string"` + App uint64 `json:"app,string"` +} + +type DefaultNodeInfoOther struct { + TxIndex string `json:"tx_index"` + RPCAddress string `json:"rpc_address"` +} + +type SyncInfo struct { + LatestBlockHash tmbytes.HexBytes `json:"latest_block_hash"` + LatestAppHash tmbytes.HexBytes `json:"latest_app_hash"` + LatestBlockHeight int64 `json:"latest_block_height,string"` + LatestBlockTime time.Time `json:"latest_block_time"` + + EarliestBlockHash tmbytes.HexBytes `json:"earliest_block_hash"` + EarliestAppHash tmbytes.HexBytes `json:"earliest_app_hash"` + EarliestBlockHeight int64 `json:"earliest_block_height,string"` + EarliestBlockTime time.Time `json:"earliest_block_time"` + + CatchingUp bool `json:"catching_up"` +} + +type ValidatorInfo struct { + Address tmbytes.HexBytes `json:"Address"` + PubKey interface{} `json:"PubKey"` + VotingPower int64 `json:"VotingPower,string"` +} + +func GetNodeStatus(container string, binary string) (NodeStatus, error) { + out, err := LocalnetExecExec(container, binary, "status") + if err != nil { + return NodeStatus{}, err + } + var result NodeStatus + err = json.Unmarshal([]byte(out), &result) + if err != nil { + return NodeStatus{}, err + } + return result, nil +} + +func GetCurrentBlockHeight(container string, binary string) (int64, error) { + status, err := GetNodeStatus(container, binary) + if err != nil { + return 0, err + } + return status.SyncInfo.LatestBlockHeight, nil +} + +func GetVotingEndHeight(currentHeight int64) (int64, error) { + return currentHeight + VotingPeriod/ExpectedBlockSeconds + ExtraBlocks, nil +} + +func CalculateUpgradeHeight(container string, binary string) (int64, int64, error) { + currentHeight, err := GetCurrentBlockHeight(container, binary) + if err != nil { + return 0, 0, err + } + votingEndHeight, err := GetVotingEndHeight(currentHeight) + if err != nil { + return 0, 0, err + } + return currentHeight + VotingPeriod/ExpectedBlockSeconds + ExtraBlocks*2, votingEndHeight, nil +} + +// Added to wait for the upgrade to be applied. +// NOTE: This can be extended to run concurrent waits for multiple containers. +func WaitForChainHeight(container string, binary string, height int64, period int64) error { + var waited int64 + var waitInterval int64 = 1 + var wg sync.WaitGroup + + for waited < period { + wg.Add(1) + go waitHeightCallback(container, binary, height, period, &waited, &waitInterval, &wg) + wg.Wait() + } + + if waited == period { + return fmt.Errorf("timeout waiting for chain height") + } + + return nil +} + +func WaitForCaughtUp(container string, binary string, period int64) error { + var waited int64 + var waitInterval int64 = 1 + var wg sync.WaitGroup + + for waited < period { + wg.Add(1) + go waitCaughtUpCallback(container, binary, period, &waited, &waitInterval, &wg) + wg.Wait() + } + + if waited == period { + return fmt.Errorf("timeout waiting for chain height") + } + + return nil +} + +func waitHeightCallback(container string, binary string, height int64, period int64, waited *int64, waitInterval *int64, wg *sync.WaitGroup) { + defer wg.Done() + + time.Sleep(time.Duration(*waitInterval) * time.Second) + *waited += *waitInterval + + status, err := GetNodeStatus(container, binary) + if err != nil { + panic(err) + } + + if status.SyncInfo.LatestBlockHeight >= height { + fmt.Printf("Container %s reached height %d after %d seconds of waiting.\n", container, height, *waited) + *waited = period + 1 + return + } + + if *waited == period { + fmt.Printf("Container %s did not reach height %d after %d seconds of waiting.\n", container, height, *waited) + return + } + + fmt.Printf("Container %s is at height %d after %d seconds of waiting, with a max waiting period of %d.\n", container, status.SyncInfo.LatestBlockHeight, *waited, period) +} + +func waitCaughtUpCallback(container string, binary string, period int64, waited *int64, waitInterval *int64, wg *sync.WaitGroup) { + defer wg.Done() + + time.Sleep(time.Duration(*waitInterval) * time.Second) + *waited += *waitInterval + + status, err := GetNodeStatus(container, binary) + if err != nil { + panic(err) + } + + if !status.SyncInfo.CatchingUp { + fmt.Printf("Container %s is caught up after %d seconds of waiting.\n", container, *waited) + *waited = period + 1 + return + } + + if *waited == period { + fmt.Printf("Container %s is not caught up after %d seconds of waiting.\n", container, *waited) + return + } + + fmt.Printf("Container %s is still catching up after %d seconds of waiting, with a max waiting period of %d.\n", container, *waited, period) +} + +func TrimExtraLineOffset(input string, offset int) string { + return strings.Join(strings.Split(input, "\n")[offset:], "") +} + +func MakeCodecWithExtendedRegistry() codec.Codec { + interfaceRegistry := types.NewInterfaceRegistry() + + // TODO: Remove nolint after cheqd-node release v1.x is successful + // Register the interfaces from the cosmos-sdk codebase. + interfaceRegistry.RegisterImplementations( + (*govtypesv1beta1.Content)(nil), + //nolint: staticcheck + &upgradetypes.SoftwareUpgradeProposal{}, + ¶mproposal.ParameterChangeProposal{}, + ) + + interfaceRegistry.RegisterImplementations( + (*sdk.Msg)(nil), + &upgradetypes.MsgSoftwareUpgrade{}, + &govtypesv1.MsgExecLegacyContent{}, + &cheqdtypes.MsgBurn{}, + ) + + return codec.NewProtoCodec(interfaceRegistry) +} diff --git a/tests/upgrade/integration/v3/cli/query.go b/tests/upgrade/integration/v3/cli/query.go new file mode 100644 index 000000000..e4d1b02d1 --- /dev/null +++ b/tests/upgrade/integration/v3/cli/query.go @@ -0,0 +1,128 @@ +package cli + +import ( + "fmt" + + didtypes "github.com/cheqd/cheqd-node/x/did/types" + resourcetypes "github.com/cheqd/cheqd-node/x/resource/types" + govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" +) + +func Query(container string, binary string, module, query string, queryArgs ...string) (string, error) { + args := []string{ + binary, + "query", + module, + query, + } + + args = append(args, queryArgs...) + args = append(args, QueryParamsConst...) + + return LocalnetExecExec(container, args...) +} + +func QueryModuleVersionMap(container string) (upgradetypes.QueryModuleVersionsResponse, error) { + fmt.Println("Querying module version map from", container) + args := append([]string{ + CliBinaryName, + "query", "upgrade", "module_versions", + }, QueryParamsConst...) + + out, err := LocalnetExecExec(container, args...) + if err != nil { + return upgradetypes.QueryModuleVersionsResponse{}, err + } + + fmt.Println("Module version map", out) + + var resp upgradetypes.QueryModuleVersionsResponse + + err = MakeCodecWithExtendedRegistry().UnmarshalJSON([]byte(out), &resp) + if err != nil { + return upgradetypes.QueryModuleVersionsResponse{}, err + } + + return resp, nil +} + +func QueryParams(container, subspace, key string) (paramproposal.ParamChange, error) { + fmt.Println("Querying params from", container) + args := append([]string{ + CliBinaryName, + "query", "params", "subspace", subspace, key, + }, QueryParamsConst...) + + out, err := LocalnetExecExec(container, args...) + if err != nil { + return paramproposal.ParamChange{}, err + } + + fmt.Println("Params", out) + + var resp paramproposal.ParamChange + + err = MakeCodecWithExtendedRegistry().UnmarshalJSON([]byte(out), &resp) + if err != nil { + return paramproposal.ParamChange{}, err + } + + return resp, nil +} + +func QueryDidFeeParams(container, subspace, key string) (didtypes.FeeParams, error) { + params, err := QueryParams(container, subspace, key) + if err != nil { + return didtypes.FeeParams{}, err + } + + var feeParams didtypes.FeeParams + + err = MakeCodecWithExtendedRegistry().UnmarshalJSON([]byte(params.Value), &feeParams) + if err != nil { + return didtypes.FeeParams{}, err + } + + return feeParams, nil +} + +func QueryResourceFeeParams(container, subspace, key string) (resourcetypes.FeeParams, error) { + params, err := QueryParams(container, subspace, key) + if err != nil { + return resourcetypes.FeeParams{}, err + } + + var feeParams resourcetypes.FeeParams + + err = MakeCodecWithExtendedRegistry().UnmarshalJSON([]byte(params.Value), &feeParams) + if err != nil { + return resourcetypes.FeeParams{}, err + } + + return feeParams, nil +} + +func QueryProposal(container, id string) (govtypesv1.Proposal, error) { + fmt.Println("Querying proposal from", container) + args := append([]string{ + CliBinaryName, + "query", "gov", "proposal", id, + }, QueryParamsConst...) + + out, err := LocalnetExecExec(container, args...) + if err != nil { + return govtypesv1.Proposal{}, err + } + + fmt.Println("Proposal", out) + + var resp govtypesv1.Proposal + + err = MakeCodecWithExtendedRegistry().UnmarshalJSON([]byte(out), &resp) + if err != nil { + return govtypesv1.Proposal{}, err + } + return resp, nil +} diff --git a/tests/upgrade/integration/v3/cli/tx.go b/tests/upgrade/integration/v3/cli/tx.go new file mode 100644 index 000000000..f42599a15 --- /dev/null +++ b/tests/upgrade/integration/v3/cli/tx.go @@ -0,0 +1,185 @@ +package cli + +import ( + "fmt" + "path/filepath" + "strconv" + + integrationhelpers "github.com/cheqd/cheqd-node/tests/integration/helpers" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func Tx(container string, binary string, module, tx, from string, txArgs ...string) (sdk.TxResponse, error) { + args := []string{ + binary, + "tx", + module, + tx, + } + + // Common params + args = append(args, TXParams...) + + // Cosmos account + args = append(args, "--from", from) + + // Other args + args = append(args, txArgs...) + + output, err := LocalnetExecExec(container, args...) + if err != nil { + return sdk.TxResponse{}, err + } + + // Skip 'gas estimate: xxx' string, trim 'Successfully migrated key' string + output = integrationhelpers.TrimImportedStdout(output) + + var resp sdk.TxResponse + + err = integrationhelpers.Codec.UnmarshalJSON([]byte(output), &resp) + if err != nil { + return sdk.TxResponse{}, err + } + + return resp, nil +} + +func SubmitParamChangeProposal(container string, pathToDir ...string) (sdk.TxResponse, error) { + fmt.Println("Submitting param change proposal from", container) + args := append([]string{ + CliBinaryName, + "tx", "gov", "submit-legacy-proposal", "param-change", filepath.Join(pathToDir...), + "--from", OperatorAccounts[container], + }, TXParams...) + + args = append(args, GasParams...) + + out, err := LocalnetExecExec(container, args...) + if err != nil { + fmt.Println("Error on submitting ParamChangeProposal", err) + fmt.Println("Output:", out) + return sdk.TxResponse{}, err + } + + // Skip 'gas estimate: xxx' string, trim 'Successfully migrated key' string + out = integrationhelpers.TrimImportedStdout(out) + + fmt.Println("Output:", out) + + var resp sdk.TxResponse + + err = integrationhelpers.Codec.UnmarshalJSON([]byte(out), &resp) + if err != nil { + return sdk.TxResponse{}, err + } + return resp, nil +} + +func SubmitUpgradeProposalLegacy(upgradeHeight int64, container string) (sdk.TxResponse, error) { + fmt.Println("Submitting upgrade proposal from", container) + args := append([]string{ + CliBinaryName, + "tx", "gov", "submit-legacy-proposal", "software-upgrade", + UpgradeName, + "--title", "Upgrade Title", + "--description", "Upgrade Description", + "--upgrade-height", strconv.FormatInt(upgradeHeight, 10), + "--upgrade-info", "https://raw.githubusercontent.com/cheqd/cheqd-node/main/networks/mainnet/upgrades/upgrade-v1.json?checksum=sha256:7b257ca5fc535916a017c15f1afe4a495a801f133d490c4d59bca0d15dc283e6", + "--from", OperatorAccounts[container], + }, TXParams...) + + args = append(args, GasParams...) + + out, err := LocalnetExecExec(container, args...) + if err != nil { + return sdk.TxResponse{}, err + } + + // Skip 'gas estimate: xxx' string, trim 'Successfully migrated key' string + out = integrationhelpers.TrimImportedStdout(out) + + var resp sdk.TxResponse + + err = integrationhelpers.Codec.UnmarshalJSON([]byte(out), &resp) + if err != nil { + fmt.Println("JSON unmarshal error: output:", out) + return sdk.TxResponse{}, err + } + return resp, nil +} + +func DepositGov(container string) (sdk.TxResponse, error) { + fmt.Println("Depositing from", container) + args := append([]string{ + CliBinaryName, + "tx", "gov", "deposit", "1", DepositAmount, + "--from", OperatorAccounts[container], + }, TXParams...) + + args = append(args, GasParams...) + + out, err := LocalnetExecExec(container, args...) + if err != nil { + return sdk.TxResponse{}, err + } + + // Skip 'gas estimate: xxx' string, trim 'Successfully migrated key' string + out = integrationhelpers.TrimImportedStdout(out) + + var resp sdk.TxResponse + + err = integrationhelpers.Codec.UnmarshalJSON([]byte(out), &resp) + if err != nil { + return sdk.TxResponse{}, err + } + return resp, nil +} + +func VoteProposal(container, id, option string) (sdk.TxResponse, error) { + fmt.Println("Voting from", container) + args := append([]string{ + CliBinaryName, + "tx", "gov", "vote", id, option, + "--from", OperatorAccounts[container], + }, TXParams...) + + args = append(args, GasParams...) + + out, err := LocalnetExecExec(container, args...) + if err != nil { + return sdk.TxResponse{}, err + } + + // Skip 'gas estimate: xxx' string, trim 'Successfully migrated key' string + out = integrationhelpers.TrimImportedStdout(out) + + var resp sdk.TxResponse + + err = integrationhelpers.Codec.UnmarshalJSON([]byte(out), &resp) + if err != nil { + return sdk.TxResponse{}, err + } + return resp, nil +} + +func BurnMsg(container string, coins string) (sdk.TxResponse, error) { + fmt.Println("Burning from ", container) + + args := append([]string{ + CliBinaryName, "tx", "cheqd", "burn", coins, + "--from", OperatorAccounts[container], + }, TXParams...) + args = append(args, GasParams...) + out, err := LocalnetExecExec(container, args...) + if err != nil { + return sdk.TxResponse{}, err + } + out = integrationhelpers.TrimImportedStdout(out) + var resp sdk.TxResponse + + err = integrationhelpers.Codec.UnmarshalJSON([]byte(out), &resp) + if err != nil { + return sdk.TxResponse{}, err + } + return resp, nil +} diff --git a/tests/upgrade/integration/v3/helpers.go b/tests/upgrade/integration/v3/helpers.go new file mode 100644 index 000000000..799f245ca --- /dev/null +++ b/tests/upgrade/integration/v3/helpers.go @@ -0,0 +1,26 @@ +package integration + +import ( + "fmt" + "path/filepath" + "strings" + + helpers "github.com/cheqd/cheqd-node/tests/integration/helpers" +) + +func GetCaseName(path string) string { + split := strings.Split(path, string(filepath.Separator)) + l := len(split) + file := split[l-1] + idiom := strings.Replace(file, ".json", "", 1) + return fmt.Sprintf("%s %s %s", split[l-3], split[l-2], idiom) +} + +func GetFile(path string) string { + split := strings.Split(path, string(filepath.Separator)) + return split[len(split)-1] +} + +func CreateTestJSON(dir string, content []byte) (string, error) { + return helpers.WriteTmpFile(dir, content) +} diff --git a/tests/upgrade/integration/v3/loader.go b/tests/upgrade/integration/v3/loader.go new file mode 100644 index 000000000..baf584016 --- /dev/null +++ b/tests/upgrade/integration/v3/loader.go @@ -0,0 +1,60 @@ +package integration + +import ( + "encoding/json" + "os" + + integrationhelpers "github.com/cheqd/cheqd-node/tests/integration/helpers" + "github.com/cheqd/cheqd-node/x/did/client/cli" + didtypesv2 "github.com/cheqd/cheqd-node/x/did/types" + + resourcetypesv2 "github.com/cheqd/cheqd-node/x/resource/types" +) + +func Loader(path string, ptrPayload interface{}) ([]cli.SignInput, error) { + var tc cli.PayloadWithSignInputs + + file, err := os.ReadFile(path) + if err != nil { + return []cli.SignInput{}, err + } + + switch ptrPayload := ptrPayload.(type) { + case *didtypesv2.FeeParams: + if err := integrationhelpers.Codec.UnmarshalJSON(file, ptrPayload); err != nil { + return []cli.SignInput{}, err + } + return []cli.SignInput{}, nil + case *resourcetypesv2.FeeParams: + if err := integrationhelpers.Codec.UnmarshalJSON(file, ptrPayload); err != nil { + return []cli.SignInput{}, err + } + return []cli.SignInput{}, nil + } + + err = json.Unmarshal(file, &tc) + if err != nil { + return []cli.SignInput{}, err + } + + switch ptrPayload := ptrPayload.(type) { + case *didtypesv2.MsgCreateDidDocPayload: + err = integrationhelpers.Codec.UnmarshalJSON(tc.Payload, ptrPayload) + case *didtypesv2.MsgUpdateDidDocPayload: + err = integrationhelpers.Codec.UnmarshalJSON(tc.Payload, ptrPayload) + case *didtypesv2.DidDoc: + err = integrationhelpers.Codec.UnmarshalJSON(tc.Payload, ptrPayload) + case *resourcetypesv2.MsgCreateResourcePayload: + err = integrationhelpers.Codec.UnmarshalJSON(tc.Payload, ptrPayload) + case *resourcetypesv2.Metadata: + err = integrationhelpers.Codec.UnmarshalJSON(tc.Payload, ptrPayload) + case *resourcetypesv2.ResourceWithMetadata: + err = integrationhelpers.Codec.UnmarshalJSON(tc.Payload, ptrPayload) + default: + err = json.Unmarshal(tc.Payload, ptrPayload) + } + if err != nil { + return []cli.SignInput{}, err + } + return tc.SignInputs, err +} diff --git a/tests/upgrade/integration/v3/upgrade_suite_test.go b/tests/upgrade/integration/v3/upgrade_suite_test.go new file mode 100644 index 000000000..49d51c2b8 --- /dev/null +++ b/tests/upgrade/integration/v3/upgrade_suite_test.go @@ -0,0 +1,15 @@ +//go:build upgrade_integration + +package integration + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func TestUpgrade(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Upgrade v2 Integration Suite") +} diff --git a/x/did/client/cli/burn_cli.go b/x/did/client/cli/burn_cli.go new file mode 100644 index 000000000..1f45dcbe9 --- /dev/null +++ b/x/did/client/cli/burn_cli.go @@ -0,0 +1,46 @@ +package cli + +import ( + "strings" + + didtypes "github.com/cheqd/cheqd-node/x/did/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/spf13/cobra" +) + +func NewBurnCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "burn [amount] [flags]", + Short: "Burn tokens from an address", + Args: cobra.MinimumNArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) + if err != nil { + return err + } + + coins, err := sdk.ParseCoinsNormalized(strings.Join(args, ",")) + if err != nil { + return err + } + + msg := didtypes.NewMsgBurn( + clientCtx.GetFromAddress().String(), + coins, + ) + + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} diff --git a/x/did/client/cli/tx.go b/x/did/client/cli/tx.go index e863145f3..820fd2d57 100644 --- a/x/did/client/cli/tx.go +++ b/x/did/client/cli/tx.go @@ -97,6 +97,7 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand(CmdCreateDidDoc()) cmd.AddCommand(CmdUpdateDidDoc()) cmd.AddCommand(CmdDeactivateDidDoc()) + cmd.AddCommand(NewBurnCmd()) return cmd } diff --git a/x/did/keeper/burn.go b/x/did/keeper/burn.go new file mode 100644 index 000000000..3d6f43c9d --- /dev/null +++ b/x/did/keeper/burn.go @@ -0,0 +1,22 @@ +package keeper + +import ( + "github.com/cheqd/cheqd-node/x/did/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (k Keeper) burnFrom(ctx sdk.Context, amount sdk.Coins, burnFrom string) error { + addr, err := sdk.AccAddressFromBech32(burnFrom) + if err != nil { + return err + } + err = k.bankkeeper.SendCoinsFromAccountToModule(ctx, + addr, + types.ModuleName, + amount) + if err != nil { + return err + } + + return k.bankkeeper.BurnCoins(ctx, types.ModuleName, amount) +} diff --git a/x/did/keeper/keeper.go b/x/did/keeper/keeper.go index bb24aef22..c34bd44cf 100644 --- a/x/did/keeper/keeper.go +++ b/x/did/keeper/keeper.go @@ -12,17 +12,23 @@ import ( type ( Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - paramSpace types.ParamSubspace + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + paramSpace types.ParamSubspace + accountKeeper types.AccountKeeper + bankkeeper types.BankKeeper + stakingKeeper types.StakingKeeper } ) -func NewKeeper(cdc codec.BinaryCodec, storeKey storetypes.StoreKey, paramSpace types.ParamSubspace) *Keeper { +func NewKeeper(cdc codec.BinaryCodec, storeKey storetypes.StoreKey, paramSpace types.ParamSubspace, ak types.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper) *Keeper { return &Keeper{ - cdc: cdc, - storeKey: storeKey, - paramSpace: paramSpace, + cdc: cdc, + storeKey: storeKey, + paramSpace: paramSpace, + accountKeeper: ak, + bankkeeper: bk, + stakingKeeper: sk, } } diff --git a/x/did/keeper/msg_server.go b/x/did/keeper/msg_server.go index b2fa1f0b3..e63108548 100644 --- a/x/did/keeper/msg_server.go +++ b/x/did/keeper/msg_server.go @@ -1,9 +1,13 @@ package keeper import ( + "context" + + errorsmod "cosmossdk.io/errors" "github.com/cheqd/cheqd-node/x/did/types" "github.com/cheqd/cheqd-node/x/did/utils" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) type MsgServer struct { @@ -149,3 +153,47 @@ func VerifyAllSignersHaveAtLeastOneValidSignature(k *Keeper, ctx *sdk.Context, i return nil } + +func (k MsgServer) Burn(goCtx context.Context, msg *types.MsgBurn) (*types.MsgBurnResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(goCtx) + accountI := k.Keeper.accountKeeper.GetAccount(sdkCtx, sdk.AccAddress(msg.FromAddress)) + _, ok := accountI.(authtypes.ModuleAccountI) + if ok { + return nil, types.ErrBurnFromModuleAccount + } + + bondDenom := k.stakingKeeper.BondDenom(sdkCtx) + denoms := msg.Amount.Denoms() + if len(denoms) != 0 { + err := ValidateDenom(denoms, bondDenom) + if err != nil { + return nil, err + } + } + err := msg.ValidateBasic() + if err != nil { + return nil, err + } + err = k.Keeper.burnFrom(sdkCtx, msg.Amount, msg.FromAddress) + if err != nil { + return nil, err + } + + sdkCtx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + "burn", + sdk.NewAttribute("burn_from_address", msg.FromAddress), + sdk.NewAttribute("amount", msg.Amount.String()), + ), + }) + return &types.MsgBurnResponse{}, nil +} + +func ValidateDenom(denom []string, bondDenom string) error { + for _, denom := range denom { + if denom != bondDenom { + return errorsmod.Wrap(types.ErrInvalidDenom, denom) + } + } + return nil +} diff --git a/x/did/tests/burn_test.go b/x/did/tests/burn_test.go new file mode 100644 index 000000000..e80350e06 --- /dev/null +++ b/x/did/tests/burn_test.go @@ -0,0 +1,127 @@ +package tests + +import ( + testsetup "github.com/cheqd/cheqd-node/x/did/tests/setup" + "github.com/cheqd/cheqd-node/x/did/types" + "github.com/cometbft/cometbft/crypto/ed25519" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/bank/testutil" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +var _ = Describe("MsgBurn tests", func() { + var setup testsetup.TestSetup + + BeforeEach(func() { + setup = testsetup.Setup() + }) + It("proper msg", func() { + pk1 := ed25519.GenPrivKey().PubKey() + addr1 := sdk.AccAddress(pk1.Address()) + someCoins := sdk.Coins{ + sdk.NewInt64Coin("ncheq", 1000000*1e9), // 1mn CHEQ + } + + // mint coins to the moduleAccount + err := setup.BankKeeper.MintCoins(setup.SdkCtx, minttypes.ModuleName, someCoins) + Expect(err).To(BeNil()) + + // FundAccount to the account address + err = testutil.FundAccount(setup.BankKeeper, setup.SdkCtx, addr1, someCoins) + Expect(err).To(BeNil()) + + balanceBefore := setup.BankKeeper.GetAllBalances(setup.SdkCtx, addr1) + // make a proper burn message + burnAmount := sdk.NewCoins(sdk.NewCoin("ncheq", sdk.NewInt(100000))) + baseMsg := types.NewMsgBurn( + addr1.String(), + burnAmount, + ) + + // burn the coins + _, err = setup.MsgServer.Burn(setup.SdkCtx, baseMsg) + Expect(err).To(BeNil()) + + balanceAfter := setup.BankKeeper.GetAllBalances(setup.SdkCtx, addr1) + differnce := balanceBefore.Sub(balanceAfter...) + Expect(burnAmount).To(Equal(differnce)) + }) + It("empty sender", func() { + pk1 := ed25519.GenPrivKey().PubKey() + addr1 := sdk.AccAddress(pk1.Address()) + someCoins := sdk.Coins{ + sdk.NewInt64Coin("ncheq", 1000000*1e9), // 1mn CHEQ + } + + // mint coins to the moduleAccount + err := setup.BankKeeper.MintCoins(setup.SdkCtx, minttypes.ModuleName, someCoins) + Expect(err).To(BeNil()) + + // FundAccount to the account address + err = testutil.FundAccount(setup.BankKeeper, setup.SdkCtx, addr1, someCoins) + Expect(err).To(BeNil()) + + // make a proper burn message + baseMsg := types.NewMsgBurn( + "", + sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100000))), + ) + + // burn the coins + _, err = setup.MsgServer.Burn(setup.SdkCtx, baseMsg) + Expect(err).NotTo(BeNil()) + }) + It("zero amount", func() { + pk1 := ed25519.GenPrivKey().PubKey() + addr1 := sdk.AccAddress(pk1.Address()) + someCoins := sdk.Coins{ + sdk.NewInt64Coin("ncheq", 1000000*1e9), // 1mn CHEQ + } + + // mint coins to the moduleAccount + err := setup.BankKeeper.MintCoins(setup.SdkCtx, minttypes.ModuleName, someCoins) + Expect(err).To(BeNil()) + + // FundAccount to the account address + err = testutil.FundAccount(setup.BankKeeper, setup.SdkCtx, addr1, someCoins) + Expect(err).To(BeNil()) + + // make a proper burn message + baseMsg := types.NewMsgBurn( + addr1.String(), + sdk.NewCoins(sdk.NewCoin("ncheq", sdk.ZeroInt())), + ) + + // burn the coins + _, err = setup.MsgServer.Burn(setup.SdkCtx, baseMsg) + Expect(err).NotTo(BeNil()) + }) + It("invalid denom", func() { + pk1 := ed25519.GenPrivKey().PubKey() + addr1 := sdk.AccAddress(pk1.Address()) + someCoins := sdk.Coins{ + sdk.NewInt64Coin("ncheq", 1000000*1e9), // 1mn CHEQ + } + + // mint coins to the moduleAccount + err := setup.BankKeeper.MintCoins(setup.SdkCtx, minttypes.ModuleName, someCoins) + Expect(err).To(BeNil()) + + // FundAccount to the account address + err = testutil.FundAccount(setup.BankKeeper, setup.SdkCtx, addr1, someCoins) + Expect(err).To(BeNil()) + + // make a proper burn message + burnAmount := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100000))) + baseMsg := types.NewMsgBurn( + addr1.String(), + burnAmount, + ) + + // burn the coins + _, err = setup.MsgServer.Burn(setup.SdkCtx, baseMsg) + Expect(err).NotTo(BeNil()) + }) +}) diff --git a/x/did/tests/setup/setup.go b/x/did/tests/setup/setup.go index 865ef650b..21d28d2ec 100644 --- a/x/did/tests/setup/setup.go +++ b/x/did/tests/setup/setup.go @@ -17,8 +17,16 @@ import ( "github.com/cheqd/cheqd-node/x/did/keeper" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) type TestSetup struct { @@ -27,34 +35,63 @@ type TestSetup struct { SdkCtx sdk.Context StdCtx context.Context - Keeper keeper.Keeper - MsgServer types.MsgServer - QueryServer types.QueryServer + Keeper keeper.Keeper + MsgServer types.MsgServer + QueryServer types.QueryServer + BankKeeper bankkeeper.Keeper + AccountKeeper authkeeper.AccountKeeper } func Setup() TestSetup { // Init Codec ir := codectypes.NewInterfaceRegistry() types.RegisterInterfaces(ir) + authtypes.RegisterInterfaces(ir) + banktypes.RegisterInterfaces(ir) + stakingtypes.RegisterInterfaces(ir) + Cdc := codec.NewProtoCodec(ir) aminoCdc := codec.NewLegacyAmino() - // Init KVStore db := dbm.NewMemDB() + keys := sdk.NewKVStoreKeys( + authtypes.StoreKey, + banktypes.StoreKey, + types.StoreKey, + stakingtypes.StoreKey, + ) dbStore := store.NewCommitMultiStore(db) - storeKey := sdk.NewKVStoreKey(types.StoreKey) - dbStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, nil) + dbStore.MountStoreWithDB(keys[types.StoreKey], storetypes.StoreTypeIAVL, nil) + dbStore.MountStoreWithDB(keys[authtypes.StoreKey], storetypes.StoreTypeIAVL, nil) + dbStore.MountStoreWithDB(keys[banktypes.StoreKey], storetypes.StoreTypeIAVL, nil) + dbStore.MountStoreWithDB(keys[stakingtypes.StoreKey], storetypes.StoreTypeIAVL, nil) _ = dbStore.LoadLatestVersion() + maccPerms := map[string][]string{ + minttypes.ModuleName: {authtypes.Minter}, + types.ModuleName: {authtypes.Burner}, + stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, + stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, + } + // Init ParamsKeeper KVStore paramsStoreKey := sdk.NewKVStoreKey(paramstypes.StoreKey) paramsTStoreKey := sdk.NewTransientStoreKey(paramstypes.TStoreKey) // Init Keepers paramsKeeper := initParamsKeeper(Cdc, aminoCdc, paramsStoreKey, paramsTStoreKey) - newKeeper := keeper.NewKeeper(Cdc, storeKey, getSubspace(types.ModuleName, paramsKeeper)) + accountKeeper := authkeeper.NewAccountKeeper(Cdc, keys[authtypes.StoreKey], authtypes.ProtoBaseAccount, maccPerms, "cheqd", authtypes.NewModuleAddress(govtypes.ModuleName).String()) + bankKeeper := bankkeeper.NewBaseKeeper( + Cdc, + keys[banktypes.StoreKey], + accountKeeper, + nil, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + stakingKeeper := stakingkeeper.NewKeeper(Cdc, keys[stakingtypes.StoreKey], accountKeeper, bankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + newKeeper := keeper.NewKeeper(Cdc, keys[types.StoreKey], getSubspace(types.ModuleName, paramsKeeper), accountKeeper, bankKeeper, stakingKeeper) // Create Tx txBytes := make([]byte, 28) @@ -69,15 +106,23 @@ func Setup() TestSetup { msgServer := keeper.NewMsgServer(*newKeeper) queryServer := keeper.NewQueryServer(*newKeeper) + params := stakingtypes.DefaultParams() + params.BondDenom = "ncheq" + err := stakingKeeper.SetParams(ctx, params) + if err != nil { + panic("error while setting up the params") + } setup := TestSetup{ Cdc: Cdc, SdkCtx: ctx, StdCtx: sdk.WrapSDKContext(ctx), - Keeper: *newKeeper, - MsgServer: msgServer, - QueryServer: queryServer, + Keeper: *newKeeper, + MsgServer: msgServer, + QueryServer: queryServer, + BankKeeper: bankKeeper, + AccountKeeper: accountKeeper, } setup.Keeper.SetDidNamespace(&ctx, DidNamespace) @@ -90,6 +135,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino // set params subspaces paramsKeeper.Subspace(types.ModuleName) + paramsKeeper.Subspace(stakingtypes.ModuleName) return paramsKeeper } diff --git a/x/did/types/codec.go b/x/did/types/codec.go index 5b53598d0..ff0a0b090 100644 --- a/x/did/types/codec.go +++ b/x/did/types/codec.go @@ -12,6 +12,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgCreateDidDoc{}, "did/CreateDidDoc", nil) cdc.RegisterConcrete(&MsgUpdateDidDoc{}, "did/UpdateDidDoc", nil) cdc.RegisterConcrete(&MsgDeactivateDidDoc{}, "did/DeleteDidDoc", nil) + cdc.RegisterConcrete(&MsgBurn{}, "did/MsgBurn", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { @@ -20,6 +21,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgCreateDidDoc{}, &MsgUpdateDidDoc{}, &MsgDeactivateDidDoc{}, + &MsgBurn{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/did/types/error.go b/x/did/types/error.go index e14ec0b23..0a9d6ab9a 100644 --- a/x/did/types/error.go +++ b/x/did/types/error.go @@ -20,4 +20,7 @@ var ( ErrDIDDocDeactivated = errorsmod.Register(ModuleName, 1207, "DID Doc already deactivated") ErrUnpackStateValue = errorsmod.Register(ModuleName, 1300, "invalid did state value") ErrInternal = errorsmod.Register(ModuleName, 1500, "internal error") + ErrUnauthorized = errorsmod.Register(ModuleName, 1, "unauthorized account") + ErrBurnFromModuleAccount = errorsmod.Register(ModuleName, 2, "burning from Module Account is not allowed") + ErrInvalidDenom = errorsmod.Register(ModuleName, 3, "Invalid Denom") ) diff --git a/x/did/types/expected_keepers.go b/x/did/types/expected_keepers.go index 1c2b2d531..ead4da078 100644 --- a/x/did/types/expected_keepers.go +++ b/x/did/types/expected_keepers.go @@ -2,6 +2,8 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" ) // ParamSubspace defines the expected Subspace interface for parameters (noalias) @@ -9,3 +11,28 @@ type ParamSubspace interface { Get(ctx sdk.Context, key []byte, ptr interface{}) Set(ctx sdk.Context, key []byte, param interface{}) } + +type AccountKeeper interface { + GetAccount(sdk.Context, sdk.AccAddress) authtypes.AccountI + GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI +} + +type BankKeeper interface { + // Methods imported from bank should be defined here + GetDenomMetaData(ctx sdk.Context, denom string) (banktypes.Metadata, bool) + SetDenomMetaData(ctx sdk.Context, denomMetaData banktypes.Metadata) + + HasSupply(ctx sdk.Context, denom string) bool + + SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + + SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + HasBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin) bool +} + +type StakingKeeper interface { + BondDenom(ctx sdk.Context) string +} diff --git a/x/did/types/tx.pb.go b/x/did/types/tx.pb.go index ef2767836..2de175694 100644 --- a/x/did/types/tx.pb.go +++ b/x/did/types/tx.pb.go @@ -6,6 +6,12 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" @@ -780,6 +786,81 @@ func (m *MsgDeactivateDidDocResponse) GetValue() *DidDocWithMetadata { return nil } +// MsgBurn represents a message to burn coins from the message signer account +type MsgBurn struct { + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` +} + +func (m *MsgBurn) Reset() { *m = MsgBurn{} } +func (m *MsgBurn) String() string { return proto.CompactTextString(m) } +func (*MsgBurn) ProtoMessage() {} +func (*MsgBurn) Descriptor() ([]byte, []int) { + return fileDescriptor_0e353aae8dd04717, []int{10} +} +func (m *MsgBurn) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBurn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBurn.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 *MsgBurn) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBurn.Merge(m, src) +} +func (m *MsgBurn) XXX_Size() int { + return m.Size() +} +func (m *MsgBurn) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBurn.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBurn proto.InternalMessageInfo + +type MsgBurnResponse struct { +} + +func (m *MsgBurnResponse) Reset() { *m = MsgBurnResponse{} } +func (m *MsgBurnResponse) String() string { return proto.CompactTextString(m) } +func (*MsgBurnResponse) ProtoMessage() {} +func (*MsgBurnResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0e353aae8dd04717, []int{11} +} +func (m *MsgBurnResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBurnResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBurnResponse.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 *MsgBurnResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBurnResponse.Merge(m, src) +} +func (m *MsgBurnResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgBurnResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBurnResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBurnResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgCreateDidDoc)(nil), "cheqd.did.v2.MsgCreateDidDoc") proto.RegisterType((*MsgUpdateDidDoc)(nil), "cheqd.did.v2.MsgUpdateDidDoc") @@ -791,55 +872,71 @@ func init() { proto.RegisterType((*MsgUpdateDidDocResponse)(nil), "cheqd.did.v2.MsgUpdateDidDocResponse") proto.RegisterType((*MsgDeactivateDidDocPayload)(nil), "cheqd.did.v2.MsgDeactivateDidDocPayload") proto.RegisterType((*MsgDeactivateDidDocResponse)(nil), "cheqd.did.v2.MsgDeactivateDidDocResponse") + proto.RegisterType((*MsgBurn)(nil), "cheqd.did.v2.MsgBurn") + proto.RegisterType((*MsgBurnResponse)(nil), "cheqd.did.v2.MsgBurnResponse") } func init() { proto.RegisterFile("cheqd/did/v2/tx.proto", fileDescriptor_0e353aae8dd04717) } var fileDescriptor_0e353aae8dd04717 = []byte{ - // 679 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x56, 0x4d, 0x6f, 0x12, 0x41, - 0x18, 0xee, 0x42, 0x5b, 0xca, 0x0b, 0xfd, 0xc8, 0xf4, 0xc3, 0x15, 0x2d, 0x41, 0xfc, 0xa2, 0x07, - 0x21, 0xa1, 0xa6, 0x47, 0x93, 0x56, 0x2e, 0xa4, 0x21, 0xb1, 0x6b, 0xab, 0x89, 0x07, 0x71, 0xba, - 0xf3, 0x76, 0x99, 0x94, 0xee, 0xe0, 0xce, 0xb0, 0x96, 0x9f, 0x60, 0xbc, 0x68, 0xfc, 0x53, 0x1e, - 0x7b, 0xf4, 0x68, 0xda, 0x3f, 0x62, 0x98, 0x65, 0xe9, 0xb2, 0x60, 0x1b, 0xd3, 0xde, 0xf4, 0x42, - 0xc2, 0xf3, 0x3e, 0xef, 0x33, 0xcf, 0xce, 0x3c, 0xbb, 0xef, 0xc0, 0xaa, 0xdd, 0xc2, 0x8f, 0xac, - 0xc2, 0x38, 0xab, 0xf8, 0xd5, 0x8a, 0x3a, 0x2d, 0x77, 0x3c, 0xa1, 0x04, 0xc9, 0x6a, 0xb8, 0xcc, - 0x38, 0x2b, 0xfb, 0xd5, 0xdc, 0xdd, 0x11, 0x12, 0xe3, 0x8c, 0x09, 0x3b, 0x20, 0x16, 0x3f, 0x1b, - 0xb0, 0xd8, 0x90, 0xce, 0x4b, 0x0f, 0xa9, 0xc2, 0x1a, 0x67, 0x35, 0x61, 0x93, 0x17, 0x90, 0xea, - 0xd0, 0x5e, 0x5b, 0x50, 0x66, 0x1a, 0x05, 0xa3, 0x94, 0xa9, 0x3e, 0x2a, 0x47, 0xe5, 0xca, 0x31, - 0xfe, 0xab, 0x80, 0x6b, 0x85, 0x4d, 0x64, 0x0b, 0x40, 0x72, 0xc7, 0xa5, 0xaa, 0xeb, 0xa1, 0x34, - 0x13, 0x85, 0x64, 0x29, 0x53, 0x5d, 0x1b, 0x95, 0x78, 0xcd, 0x1d, 0xb7, 0xee, 0x1e, 0x09, 0x2b, - 0xc2, 0x0c, 0xbd, 0x1c, 0x74, 0xd8, 0x5f, 0x79, 0x89, 0xf2, 0x6f, 0xcd, 0xcb, 0x37, 0x03, 0x96, - 0x1b, 0xd2, 0xa9, 0x21, 0xb5, 0x15, 0xf7, 0x2f, 0xfd, 0xec, 0xc4, 0xfd, 0x94, 0xc6, 0xfc, 0xc4, - 0x7b, 0x6e, 0xcd, 0xd3, 0x7b, 0x98, 0x0b, 0x71, 0xf2, 0x1c, 0xd6, 0x7c, 0xf4, 0xf8, 0x11, 0xb7, - 0xa9, 0xe2, 0xc2, 0x6d, 0x9e, 0xa0, 0x6a, 0x09, 0xd6, 0xe4, 0x81, 0xad, 0xb4, 0xb5, 0x12, 0xad, - 0x36, 0x74, 0xb1, 0xce, 0xc8, 0x7d, 0x48, 0x0f, 0xf5, 0xcc, 0x44, 0xc1, 0x28, 0x65, 0xad, 0x4b, - 0xa0, 0xf8, 0x65, 0x1a, 0xd6, 0x26, 0x9f, 0x2d, 0x31, 0x21, 0x65, 0x0b, 0x57, 0xe1, 0xa9, 0x32, - 0x8d, 0x42, 0xb2, 0x94, 0xb6, 0xc2, 0xbf, 0x64, 0x01, 0x12, 0x9c, 0x69, 0xad, 0xb4, 0x95, 0xe0, - 0x8c, 0xe4, 0x01, 0xfa, 0x25, 0x4f, 0xb4, 0xdb, 0xe8, 0x99, 0x49, 0x4d, 0x8e, 0x20, 0x64, 0x0f, - 0x96, 0x27, 0x18, 0x37, 0xa7, 0xf5, 0x2e, 0x14, 0x46, 0x77, 0xe1, 0xcd, 0xd8, 0x33, 0x58, 0x64, - 0xfc, 0xb9, 0xc8, 0x13, 0x58, 0xa0, 0x5d, 0xd5, 0x42, 0x57, 0x0d, 0x70, 0x73, 0x46, 0x2f, 0x1b, - 0x43, 0xc9, 0x06, 0x2c, 0x51, 0x29, 0xd1, 0x8b, 0xae, 0x3b, 0xab, 0x99, 0x8b, 0x43, 0x7c, 0x20, - 0xb9, 0x09, 0xab, 0x36, 0xed, 0xd0, 0x43, 0xde, 0xe6, 0xaa, 0xd7, 0xe4, 0xae, 0x2f, 0x06, 0xca, - 0x29, 0xcd, 0x5f, 0xb9, 0x2c, 0xd6, 0x87, 0xb5, 0x58, 0x13, 0xc3, 0x36, 0x3a, 0x41, 0xd3, 0x5c, - 0xbc, 0xa9, 0x36, 0xac, 0x91, 0x87, 0x30, 0x7f, 0x8c, 0xbd, 0x26, 0x75, 0x3c, 0xc4, 0x13, 0x74, - 0x95, 0x99, 0xd6, 0xe4, 0xec, 0x31, 0xf6, 0xb6, 0x43, 0x8c, 0x54, 0x20, 0x25, 0xd1, 0xf3, 0xb9, - 0x8d, 0x26, 0xe8, 0x8d, 0x5a, 0x8d, 0xc5, 0x25, 0x28, 0x5a, 0x21, 0x8b, 0x14, 0x61, 0x9e, 0xb6, - 0xa5, 0x68, 0x1e, 0xbb, 0xe2, 0x93, 0xdb, 0xa4, 0xd2, 0xcc, 0x68, 0xd5, 0x4c, 0x1f, 0xdc, 0xed, - 0x63, 0xdb, 0x92, 0xac, 0x03, 0xf8, 0xe8, 0xc9, 0xfe, 0x66, 0x70, 0x66, 0x66, 0xf5, 0x09, 0xa6, - 0x07, 0x48, 0x9d, 0x15, 0xf7, 0xe0, 0x4e, 0x2c, 0x0c, 0x16, 0xca, 0x8e, 0x70, 0x25, 0x92, 0x2d, - 0x98, 0xf1, 0x69, 0xbb, 0x8b, 0x83, 0x57, 0x20, 0x76, 0x6a, 0x01, 0xf9, 0x2d, 0x57, 0xad, 0x06, - 0x2a, 0xca, 0xa8, 0xa2, 0x56, 0x40, 0x0f, 0x03, 0x36, 0xe1, 0x85, 0xfd, 0x1f, 0xb0, 0x7f, 0x35, - 0x60, 0xd1, 0x30, 0xdc, 0x38, 0x60, 0xbb, 0x90, 0xfb, 0xf3, 0x07, 0x78, 0x90, 0x24, 0x63, 0x98, - 0xa4, 0x51, 0x7f, 0x89, 0xb8, 0xbf, 0x03, 0xb8, 0x37, 0x41, 0xec, 0xa6, 0x1e, 0xab, 0xdf, 0x13, - 0x90, 0x6c, 0x48, 0x87, 0xec, 0x43, 0x76, 0x64, 0xea, 0xae, 0x5f, 0x39, 0x64, 0x73, 0x8f, 0xaf, - 0x2c, 0x0f, 0x5d, 0xed, 0x43, 0x76, 0x64, 0x7e, 0xae, 0x5f, 0x39, 0x2e, 0x27, 0xa8, 0x4e, 0x3c, - 0x8f, 0x0f, 0xb0, 0x34, 0x36, 0x09, 0x1f, 0x5c, 0x3b, 0xf8, 0x72, 0x1b, 0xd7, 0x52, 0xc2, 0x15, - 0x76, 0xb6, 0x7f, 0x9c, 0xe7, 0x8d, 0xb3, 0xf3, 0xbc, 0xf1, 0xeb, 0x3c, 0x6f, 0x7c, 0xbd, 0xc8, - 0x4f, 0x9d, 0x5d, 0xe4, 0xa7, 0x7e, 0x5e, 0xe4, 0xa7, 0xde, 0x3d, 0x75, 0xb8, 0x6a, 0x75, 0x0f, - 0xcb, 0xb6, 0x38, 0xa9, 0x04, 0xf7, 0x18, 0xfd, 0xfb, 0xcc, 0x15, 0x0c, 0x2b, 0xa7, 0xfa, 0x52, - 0xa3, 0x7a, 0x1d, 0x94, 0x87, 0xb3, 0xfa, 0x46, 0xb3, 0xf9, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x41, - 0xe4, 0x38, 0xd8, 0x13, 0x09, 0x00, 0x00, + // 899 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x56, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xf6, 0x3a, 0x69, 0x5c, 0x3f, 0xbb, 0xbf, 0xa6, 0x49, 0xba, 0x31, 0xc4, 0x31, 0xe6, 0x97, + 0x5b, 0x29, 0xbb, 0x8a, 0x0b, 0x3d, 0x00, 0x42, 0x8a, 0x9b, 0x4b, 0x54, 0x59, 0xa2, 0xdb, 0x16, + 0x24, 0x0e, 0x98, 0xf1, 0xce, 0x64, 0x3d, 0x8a, 0x3d, 0x63, 0x76, 0xc6, 0x4b, 0x7c, 0xe5, 0x04, + 0xe2, 0x02, 0xff, 0x41, 0x8f, 0x88, 0x53, 0x0f, 0xfc, 0x11, 0x95, 0xb8, 0x14, 0x4e, 0x9c, 0x00, + 0x25, 0x87, 0xf2, 0x67, 0xa0, 0x9d, 0x9d, 0x75, 0xec, 0xb5, 0x49, 0x85, 0x9a, 0x1b, 0x5c, 0x76, + 0xbd, 0xdf, 0xf7, 0xbd, 0xb7, 0xdf, 0xcc, 0x7b, 0xeb, 0x79, 0xb0, 0xe6, 0xf7, 0xe8, 0x17, 0xc4, + 0x25, 0x8c, 0xb8, 0x51, 0xd3, 0x55, 0x47, 0xce, 0x30, 0x14, 0x4a, 0xa0, 0xb2, 0x86, 0x1d, 0xc2, + 0x88, 0x13, 0x35, 0x2b, 0x1b, 0x33, 0x22, 0xc2, 0x08, 0x11, 0x7e, 0x22, 0xac, 0xdc, 0xf0, 0x85, + 0x1c, 0x08, 0xe9, 0x0e, 0x64, 0xe0, 0x46, 0x3b, 0xf1, 0xcd, 0x10, 0xd7, 0xf0, 0x80, 0x71, 0xe1, + 0xea, 0xab, 0x81, 0xaa, 0x46, 0xdb, 0xc5, 0x92, 0xba, 0xd1, 0x4e, 0x97, 0x2a, 0xbc, 0xe3, 0xfa, + 0x82, 0x71, 0xc3, 0x6f, 0x24, 0x7c, 0x47, 0x3f, 0xb9, 0xc9, 0x83, 0xa1, 0x56, 0x03, 0x11, 0x88, + 0x04, 0x8f, 0x7f, 0x25, 0x68, 0xfd, 0x1b, 0x0b, 0xae, 0xb4, 0x65, 0x70, 0x37, 0xa4, 0x58, 0xd1, + 0x3d, 0x46, 0xf6, 0x84, 0x8f, 0x3e, 0x84, 0xc2, 0x10, 0x8f, 0xfb, 0x02, 0x13, 0xdb, 0xaa, 0x59, + 0x8d, 0x52, 0xf3, 0x0d, 0x67, 0x7a, 0x2d, 0x4e, 0x46, 0xff, 0x51, 0xa2, 0xf5, 0xd2, 0x20, 0x74, + 0x07, 0x40, 0xb2, 0x80, 0x63, 0x35, 0x0a, 0xa9, 0xb4, 0xf3, 0xb5, 0xa5, 0x46, 0xa9, 0xb9, 0x3e, + 0x9b, 0xe2, 0x01, 0x0b, 0xf8, 0x3e, 0x3f, 0x10, 0xde, 0x94, 0x32, 0xf5, 0xf2, 0x68, 0x48, 0xfe, + 0x95, 0x97, 0x69, 0xfd, 0xb9, 0x79, 0xf9, 0xde, 0x82, 0xeb, 0x6d, 0x19, 0xec, 0x51, 0xec, 0x2b, + 0x16, 0x9d, 0xfa, 0x69, 0x65, 0xfd, 0x34, 0xe6, 0xfc, 0x64, 0x63, 0xce, 0xcd, 0xd3, 0x67, 0x70, + 0x31, 0xc5, 0xd1, 0x3b, 0xb0, 0x1e, 0xd1, 0x90, 0x1d, 0x30, 0x1f, 0x2b, 0x26, 0x78, 0x67, 0x40, + 0x55, 0x4f, 0x90, 0x0e, 0x4b, 0x6c, 0x15, 0xbd, 0xd5, 0x69, 0xb6, 0xad, 0xc9, 0x7d, 0x82, 0x5e, + 0x85, 0xe2, 0x24, 0x9f, 0x9d, 0xaf, 0x59, 0x8d, 0xb2, 0x77, 0x0a, 0xd4, 0xbf, 0x5d, 0x86, 0xf5, + 0xc5, 0xb5, 0x45, 0x36, 0x14, 0x7c, 0xc1, 0x15, 0x3d, 0x52, 0xb6, 0x55, 0x5b, 0x6a, 0x14, 0xbd, + 0xf4, 0x11, 0x5d, 0x86, 0x3c, 0x23, 0x3a, 0x57, 0xd1, 0xcb, 0x33, 0x82, 0xaa, 0x00, 0x31, 0x15, + 0x8a, 0x7e, 0x9f, 0x86, 0xf6, 0x92, 0x16, 0x4f, 0x21, 0xe8, 0x3e, 0x5c, 0x5f, 0x60, 0xdc, 0x5e, + 0xd6, 0xbb, 0x50, 0x9b, 0xdd, 0x85, 0x8f, 0xe7, 0xd6, 0xe0, 0xa1, 0xf9, 0x75, 0xa1, 0xb7, 0xe0, + 0x32, 0x1e, 0xa9, 0x1e, 0xe5, 0xca, 0xe0, 0xf6, 0x05, 0xfd, 0xda, 0x0c, 0x8a, 0x6e, 0xc2, 0x55, + 0x2c, 0x25, 0x0d, 0xa7, 0xdf, 0xbb, 0xa2, 0x95, 0x57, 0x26, 0xb8, 0x49, 0x79, 0x1b, 0xd6, 0x7c, + 0x3c, 0xc4, 0x5d, 0xd6, 0x67, 0x6a, 0xdc, 0x61, 0x3c, 0x12, 0x26, 0x73, 0x41, 0xeb, 0x57, 0x4f, + 0xc9, 0xfd, 0x09, 0x97, 0x09, 0x22, 0xb4, 0x4f, 0x83, 0x24, 0xe8, 0x62, 0x36, 0x68, 0x6f, 0xc2, + 0xa1, 0xd7, 0xe1, 0xd2, 0x21, 0x1d, 0x77, 0x70, 0x10, 0x52, 0x3a, 0xa0, 0x5c, 0xd9, 0x45, 0x2d, + 0x2e, 0x1f, 0xd2, 0xf1, 0x6e, 0x8a, 0x21, 0x17, 0x0a, 0x92, 0x86, 0x11, 0xf3, 0xa9, 0x0d, 0x7a, + 0xa3, 0xd6, 0x32, 0xed, 0x92, 0x90, 0x5e, 0xaa, 0x42, 0x75, 0xb8, 0x84, 0xfb, 0x52, 0x74, 0x0e, + 0xb9, 0xf8, 0x92, 0x77, 0xb0, 0xb4, 0x4b, 0x3a, 0x6b, 0x29, 0x06, 0xef, 0xc5, 0xd8, 0xae, 0x44, + 0x9b, 0x00, 0x11, 0x0d, 0x65, 0xbc, 0x19, 0x8c, 0xd8, 0x65, 0x5d, 0xc1, 0xa2, 0x41, 0xf6, 0x49, + 0xfd, 0x3e, 0xdc, 0xc8, 0x34, 0x83, 0x47, 0xe5, 0x50, 0x70, 0x49, 0xd1, 0x1d, 0xb8, 0x10, 0xe1, + 0xfe, 0x88, 0x9a, 0x4f, 0x20, 0x53, 0xb5, 0x44, 0xfc, 0x09, 0x53, 0xbd, 0x36, 0x55, 0x98, 0x60, + 0x85, 0xbd, 0x44, 0x9e, 0x36, 0xd8, 0x82, 0x0f, 0xf6, 0xff, 0x06, 0xfb, 0xaf, 0x36, 0xd8, 0x74, + 0x33, 0xbc, 0x74, 0x83, 0xdd, 0x83, 0xca, 0x3f, 0xff, 0x01, 0x9b, 0x4e, 0xb2, 0x26, 0x9d, 0x34, + 0xeb, 0x2f, 0x9f, 0xf5, 0xf7, 0x08, 0x5e, 0x59, 0x90, 0xec, 0xa5, 0x3d, 0xfe, 0x6c, 0x41, 0xa1, + 0x2d, 0x83, 0xd6, 0x28, 0xe4, 0xe8, 0x7d, 0x28, 0x1f, 0x84, 0x62, 0xd0, 0xc1, 0x84, 0x84, 0x54, + 0xca, 0xc4, 0x5b, 0xcb, 0xfe, 0xf5, 0xa7, 0xed, 0x55, 0x73, 0x76, 0xef, 0x26, 0xcc, 0x03, 0x15, + 0x32, 0x1e, 0x78, 0xa5, 0x58, 0x6d, 0x20, 0xd4, 0x83, 0x15, 0x3c, 0x10, 0x23, 0xae, 0xcc, 0x11, + 0xb2, 0xe1, 0x98, 0x98, 0x78, 0x38, 0x70, 0xcc, 0x70, 0xe0, 0xdc, 0x15, 0x8c, 0xb7, 0xde, 0x7d, + 0xfa, 0xfb, 0x56, 0xee, 0xc7, 0x3f, 0xb6, 0x1a, 0x01, 0x53, 0xbd, 0x51, 0xd7, 0xf1, 0xc5, 0xc0, + 0x0c, 0x07, 0xe6, 0xb6, 0x2d, 0xc9, 0xa1, 0xab, 0xc6, 0x43, 0x2a, 0x75, 0x80, 0xfc, 0xe1, 0xf9, + 0x93, 0x5b, 0x96, 0x67, 0xf2, 0xbf, 0xb7, 0xf1, 0xf5, 0xe3, 0xad, 0xdc, 0x5f, 0x8f, 0xb7, 0x72, + 0x5f, 0x3d, 0x7f, 0x72, 0x6b, 0xc6, 0x71, 0xfd, 0x9a, 0x3e, 0xb2, 0xe3, 0xc5, 0xa4, 0x1b, 0xd3, + 0xfc, 0x25, 0x0f, 0x4b, 0x6d, 0x19, 0xa0, 0x87, 0x50, 0x9e, 0x19, 0x2b, 0x36, 0xcf, 0x9c, 0x22, + 0x2a, 0x6f, 0x9e, 0x49, 0x4f, 0xb6, 0xfd, 0x21, 0x94, 0x67, 0x06, 0x84, 0xcd, 0x33, 0xe7, 0x81, + 0x05, 0x59, 0x17, 0x36, 0xdc, 0xe7, 0x70, 0x75, 0xee, 0xa8, 0x7f, 0xed, 0x85, 0x27, 0x7b, 0xe5, + 0xe6, 0x0b, 0x25, 0x93, 0x37, 0x7c, 0x00, 0xcb, 0xba, 0xe4, 0x6b, 0x73, 0x21, 0x31, 0x5c, 0xd9, + 0x5c, 0x08, 0xa7, 0xd1, 0xad, 0xdd, 0xa7, 0xc7, 0x55, 0xeb, 0xd9, 0x71, 0xd5, 0xfa, 0xf3, 0xb8, + 0x6a, 0x7d, 0x77, 0x52, 0xcd, 0x3d, 0x3b, 0xa9, 0xe6, 0x7e, 0x3b, 0xa9, 0xe6, 0x3e, 0x7d, 0x7b, + 0xba, 0xa4, 0x7a, 0xc6, 0xd4, 0xd7, 0x6d, 0x2e, 0x08, 0x75, 0x8f, 0xf4, 0xc0, 0xa9, 0xeb, 0xda, + 0x5d, 0xd1, 0x03, 0xdf, 0xed, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x46, 0x4a, 0xdf, 0xf3, 0xaf, + 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -860,6 +957,7 @@ type MsgClient interface { UpdateDidDoc(ctx context.Context, in *MsgUpdateDidDoc, opts ...grpc.CallOption) (*MsgUpdateDidDocResponse, error) // DeactivateDidDoc defines a method for deactivating an existing DID document DeactivateDidDoc(ctx context.Context, in *MsgDeactivateDidDoc, opts ...grpc.CallOption) (*MsgDeactivateDidDocResponse, error) + Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOption) (*MsgBurnResponse, error) } type msgClient struct { @@ -897,6 +995,15 @@ func (c *msgClient) DeactivateDidDoc(ctx context.Context, in *MsgDeactivateDidDo return out, nil } +func (c *msgClient) Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOption) (*MsgBurnResponse, error) { + out := new(MsgBurnResponse) + err := c.cc.Invoke(ctx, "/cheqd.did.v2.Msg/Burn", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // CreateDidDoc defines a method for creating a new DID document @@ -905,6 +1012,7 @@ type MsgServer interface { UpdateDidDoc(context.Context, *MsgUpdateDidDoc) (*MsgUpdateDidDocResponse, error) // DeactivateDidDoc defines a method for deactivating an existing DID document DeactivateDidDoc(context.Context, *MsgDeactivateDidDoc) (*MsgDeactivateDidDocResponse, error) + Burn(context.Context, *MsgBurn) (*MsgBurnResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -920,6 +1028,9 @@ func (*UnimplementedMsgServer) UpdateDidDoc(ctx context.Context, req *MsgUpdateD func (*UnimplementedMsgServer) DeactivateDidDoc(ctx context.Context, req *MsgDeactivateDidDoc) (*MsgDeactivateDidDocResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DeactivateDidDoc not implemented") } +func (*UnimplementedMsgServer) Burn(ctx context.Context, req *MsgBurn) (*MsgBurnResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Burn not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -979,6 +1090,24 @@ func _Msg_DeactivateDidDoc_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +func _Msg_Burn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgBurn) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Burn(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cheqd.did.v2.Msg/Burn", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Burn(ctx, req.(*MsgBurn)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "cheqd.did.v2.Msg", HandlerType: (*MsgServer)(nil), @@ -995,6 +1124,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "DeactivateDidDoc", Handler: _Msg_DeactivateDidDoc_Handler, }, + { + MethodName: "Burn", + Handler: _Msg_Burn_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cheqd/did/v2/tx.proto", @@ -1600,6 +1733,73 @@ func (m *MsgDeactivateDidDocResponse) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } +func (m *MsgBurn) 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 *MsgBurn) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBurn) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.FromAddress) > 0 { + i -= len(m.FromAddress) + copy(dAtA[i:], m.FromAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.FromAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgBurnResponse) 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 *MsgBurnResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBurnResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -1895,6 +2095,34 @@ func (m *MsgDeactivateDidDocResponse) Size() (n int) { return n } +func (m *MsgBurn) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FromAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgBurnResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -3625,6 +3853,172 @@ func (m *MsgDeactivateDidDocResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgBurn) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgBurn: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBurn: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FromAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = append(m.Amount, types.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgBurnResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgBurnResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBurnResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/did/types/tx_msg_burn.go b/x/did/types/tx_msg_burn.go new file mode 100644 index 000000000..fbb8682e3 --- /dev/null +++ b/x/did/types/tx_msg_burn.go @@ -0,0 +1,40 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +var _ sdk.Msg = &MsgBurn{} + +// NewMsgBurn creates a message to burn tokens +func NewMsgBurn(sender string, amount sdk.Coins) *MsgBurn { + return &MsgBurn{ + FromAddress: sender, + Amount: amount, + } +} +func (m MsgBurn) Route() string { return RouterKey } + +func (m MsgBurn) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(m.FromAddress) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) + } + + if !m.Amount.IsValid() || m.Amount.IsZero() { + return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, m.Amount.String()) + } + + return nil +} + +func (m MsgBurn) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +func (m MsgBurn) GetSigners() []sdk.AccAddress { + sender, _ := sdk.AccAddressFromBech32(m.FromAddress) + return []sdk.AccAddress{sender} +} diff --git a/x/resource/tests/setup/setup.go b/x/resource/tests/setup/setup.go index 4521ebc85..07175a3c0 100644 --- a/x/resource/tests/setup/setup.go +++ b/x/resource/tests/setup/setup.go @@ -20,10 +20,18 @@ import ( "github.com/cheqd/cheqd-node/x/resource/keeper" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" portkeeper "github.com/cosmos/ibc-go/v7/modules/core/05-port/keeper" ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" ) @@ -41,6 +49,8 @@ func Setup() TestSetup { // Init Codec ir := codectypes.NewInterfaceRegistry() types.RegisterInterfaces(ir) + authtypes.RegisterInterfaces(ir) + banktypes.RegisterInterfaces(ir) didtypes.RegisterInterfaces(ir) cdc := codec.NewProtoCodec(ir) aminoCdc := codec.NewLegacyAmino() @@ -50,10 +60,27 @@ func Setup() TestSetup { dbStore := store.NewCommitMultiStore(db) + keys := sdk.NewKVStoreKeys( + capabilitytypes.StoreKey, + authtypes.StoreKey, + banktypes.StoreKey, + stakingtypes.StoreKey, + ) + + maccPerms := map[string][]string{ + minttypes.ModuleName: {authtypes.Minter}, + types.ModuleName: {authtypes.Burner}, + stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, + stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, + } // Mount did store didStoreKey := sdk.NewKVStoreKey(didtypes.StoreKey) dbStore.MountStoreWithDB(didStoreKey, storetypes.StoreTypeIAVL, nil) + dbStore.MountStoreWithDB(keys[authtypes.StoreKey], storetypes.StoreTypeIAVL, nil) + dbStore.MountStoreWithDB(keys[banktypes.StoreKey], storetypes.StoreTypeIAVL, nil) + dbStore.MountStoreWithDB(keys[stakingtypes.StoreKey], storetypes.StoreTypeIAVL, nil) + // Mount resource store resourceStoreKey := sdk.NewKVStoreKey(types.StoreKey) dbStore.MountStoreWithDB(resourceStoreKey, storetypes.StoreTypeIAVL, nil) @@ -73,8 +100,18 @@ func Setup() TestSetup { _ = dbStore.LoadLatestVersion() // Init Keepers + accountKeeper := authkeeper.NewAccountKeeper(cdc, keys[authtypes.StoreKey], authtypes.ProtoBaseAccount, maccPerms, "cheqd", string(authtypes.NewModuleAddress(govtypes.ModuleName))) + bankKeeper := bankkeeper.NewBaseKeeper( + cdc, + keys[banktypes.StoreKey], + accountKeeper, + nil, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + stakingKeeper := stakingkeeper.NewKeeper(cdc, keys[stakingtypes.StoreKey], accountKeeper, bankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + paramsKeeper := initParamsKeeper(cdc, aminoCdc, paramsStoreKey, paramsTStoreKey) - didKeeper := didkeeper.NewKeeper(cdc, didStoreKey, getSubspace(didtypes.ModuleName, paramsKeeper)) + didKeeper := didkeeper.NewKeeper(cdc, didStoreKey, getSubspace(didtypes.ModuleName, paramsKeeper), accountKeeper, bankKeeper, stakingKeeper) capabilityKeeper := capabilitykeeper.NewKeeper(cdc, capabilityStoreKey, memStoreKeys[capabilitytypes.MemStoreKey]) scopedIBCKeeper := capabilityKeeper.ScopeToModule(ibcexported.ModuleName) @@ -102,6 +139,12 @@ func Setup() TestSetup { msgServer := keeper.NewMsgServer(*resourceKeeper, *didKeeper) queryServer := keeper.NewQueryServer(*resourceKeeper, *didKeeper) + params := stakingtypes.DefaultParams() + params.BondDenom = "ncheq" + err := stakingKeeper.SetParams(ctx, params) + if err != nil { + panic("error while setting up the params") + } setup := TestSetup{ TestSetup: didsetup.TestSetup{ Cdc: cdc,