From 1283d5746f592ad28dcf0cf45ed7ceae78e3aaf5 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Fri, 6 Dec 2024 19:01:12 +0800 Subject: [PATCH] Problem: unable to query historical txs whose module is removed (#1713) * Problem: unable to query historical txs from deleted icaauth module * test * poetry * deps * add unit tets * cleanup * rename * revert integration test * revert * add authz * changelog * test authz * cleanup * register in query * only patch encoding for tx service * Revert "only patch encoding for tx service" This reverts commit 4b1c1415e7ffeeeb4f4b2955c4313e3b12f9a5ad. --------- Co-authored-by: HuangYi --- CHANGELOG.md | 1 + app/legacy.go | 18 + app/legacy/icaauth/types/codec.go | 23 + app/legacy/icaauth/types/tx.pb.go | 1201 +++++++++++++++++++++++++++++ app/legacy_test.go | 36 + cmd/cronosd/cmd/root.go | 3 + 6 files changed, 1282 insertions(+) create mode 100644 app/legacy.go create mode 100644 app/legacy/icaauth/types/codec.go create mode 100644 app/legacy/icaauth/types/tx.pb.go create mode 100644 app/legacy_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index b57559fee5..8f8bef2edf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Bug Fixes * [#1714](https://github.com/crypto-org-chain/cronos/pull/1714) Avoid nil pointer error when query blocks before feemarket module gets enabled. +* [#1713](https://github.com/crypto-org-chain/cronos/pull/1713) Register legacy codec to allow query historical txs whose modules are removed (icaauth, authz). ### Improvements diff --git a/app/legacy.go b/app/legacy.go new file mode 100644 index 0000000000..6223df6352 --- /dev/null +++ b/app/legacy.go @@ -0,0 +1,18 @@ +package app + +import ( + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/x/authz" + icaauthtypes "github.com/crypto-org-chain/cronos/v2/app/legacy/icaauth/types" +) + +func RegisterLegacyCodec(cdc *codec.LegacyAmino) { + icaauthtypes.RegisterCodec(cdc) + authz.RegisterLegacyAminoCodec(cdc) +} + +func RegisterLegacyInterfaces(registry cdctypes.InterfaceRegistry) { + icaauthtypes.RegisterInterfaces(registry) + authz.RegisterInterfaces(registry) +} diff --git a/app/legacy/icaauth/types/codec.go b/app/legacy/icaauth/types/codec.go new file mode 100644 index 0000000000..9f264bc779 --- /dev/null +++ b/app/legacy/icaauth/types/codec.go @@ -0,0 +1,23 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +func RegisterCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgRegisterAccount{}, "icaauth/RegisterAccount", nil) + cdc.RegisterConcrete(&MsgSubmitTx{}, "icaauth/SubmitTx", nil) +} + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgRegisterAccount{}, + ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgSubmitTx{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} diff --git a/app/legacy/icaauth/types/tx.pb.go b/app/legacy/icaauth/types/tx.pb.go new file mode 100644 index 0000000000..2eb00b8d40 --- /dev/null +++ b/app/legacy/icaauth/types/tx.pb.go @@ -0,0 +1,1201 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: icaauth/v1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + _ "google.golang.org/protobuf/types/known/durationpb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgRegisterAccount defines the request message for MsgRegisterAccount +type MsgRegisterAccount struct { + // owner represents the owner of the interchain account + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // connection_id represents the IBC `connection_id` of the host chain + ConnectionId string `protobuf:"bytes,2,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" yaml:"connection_id"` + // version represents the version of the ICA channel + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` +} + +func (m *MsgRegisterAccount) Reset() { *m = MsgRegisterAccount{} } +func (m *MsgRegisterAccount) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterAccount) ProtoMessage() {} +func (*MsgRegisterAccount) Descriptor() ([]byte, []int) { + return fileDescriptor_09bf995a0c8f8b8c, []int{0} +} +func (m *MsgRegisterAccount) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterAccount.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 *MsgRegisterAccount) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterAccount.Merge(m, src) +} +func (m *MsgRegisterAccount) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterAccount) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterAccount.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterAccount proto.InternalMessageInfo + +func (m *MsgRegisterAccount) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *MsgRegisterAccount) GetConnectionId() string { + if m != nil { + return m.ConnectionId + } + return "" +} + +func (m *MsgRegisterAccount) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +// MsgRegisterAccountResponse defines the response message for +// MsgRegisterAccount +type MsgRegisterAccountResponse struct { +} + +func (m *MsgRegisterAccountResponse) Reset() { *m = MsgRegisterAccountResponse{} } +func (m *MsgRegisterAccountResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterAccountResponse) ProtoMessage() {} +func (*MsgRegisterAccountResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_09bf995a0c8f8b8c, []int{1} +} +func (m *MsgRegisterAccountResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterAccountResponse.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 *MsgRegisterAccountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterAccountResponse.Merge(m, src) +} +func (m *MsgRegisterAccountResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterAccountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterAccountResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterAccountResponse proto.InternalMessageInfo + +// MsgSubmitTx defines the request message for MsgSubmitTx +type MsgSubmitTx struct { + // owner represents the owner of the interchain account + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // connection_id represents the IBC `connection_id` of the host chain + ConnectionId string `protobuf:"bytes,2,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" yaml:"connection_id"` + // msgs represents the transactions to be submitted to the host chain + Msgs []*types.Any `protobuf:"bytes,3,rep,name=msgs,proto3" json:"msgs,omitempty"` + // timeout_duration represents the timeout duration for the IBC packet from + // last block + TimeoutDuration *time.Duration `protobuf:"bytes,4,opt,name=timeout_duration,json=timeoutDuration,proto3,stdduration" json:"timeout_duration,omitempty"` +} + +func (m *MsgSubmitTx) Reset() { *m = MsgSubmitTx{} } +func (m *MsgSubmitTx) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitTx) ProtoMessage() {} +func (*MsgSubmitTx) Descriptor() ([]byte, []int) { + return fileDescriptor_09bf995a0c8f8b8c, []int{2} +} +func (m *MsgSubmitTx) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitTx.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 *MsgSubmitTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitTx.Merge(m, src) +} +func (m *MsgSubmitTx) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitTx) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitTx.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitTx proto.InternalMessageInfo + +func (m *MsgSubmitTx) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *MsgSubmitTx) GetConnectionId() string { + if m != nil { + return m.ConnectionId + } + return "" +} + +func (m *MsgSubmitTx) GetMsgs() []*types.Any { + if m != nil { + return m.Msgs + } + return nil +} + +func (m *MsgSubmitTx) GetTimeoutDuration() *time.Duration { + if m != nil { + return m.TimeoutDuration + } + return nil +} + +// MsgSubmitTxResponse defines the response message for MsgSubmitTx +type MsgSubmitTxResponse struct { + Sequence uint64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"` +} + +func (m *MsgSubmitTxResponse) Reset() { *m = MsgSubmitTxResponse{} } +func (m *MsgSubmitTxResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitTxResponse) ProtoMessage() {} +func (*MsgSubmitTxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_09bf995a0c8f8b8c, []int{3} +} +func (m *MsgSubmitTxResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitTxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitTxResponse.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 *MsgSubmitTxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitTxResponse.Merge(m, src) +} +func (m *MsgSubmitTxResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitTxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitTxResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitTxResponse proto.InternalMessageInfo + +func (m *MsgSubmitTxResponse) GetSequence() uint64 { + if m != nil { + return m.Sequence + } + return 0 +} + +func init() { + proto.RegisterType((*MsgRegisterAccount)(nil), "icaauth.v1.MsgRegisterAccount") + proto.RegisterType((*MsgRegisterAccountResponse)(nil), "icaauth.v1.MsgRegisterAccountResponse") + proto.RegisterType((*MsgSubmitTx)(nil), "icaauth.v1.MsgSubmitTx") + proto.RegisterType((*MsgSubmitTxResponse)(nil), "icaauth.v1.MsgSubmitTxResponse") +} + +func init() { proto.RegisterFile("icaauth/v1/tx.proto", fileDescriptor_09bf995a0c8f8b8c) } + +var fileDescriptor_09bf995a0c8f8b8c = []byte{ + // 494 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x93, 0xbf, 0x6e, 0x13, 0x4d, + 0x14, 0xc5, 0x3d, 0x9f, 0x9d, 0x2f, 0x61, 0x0c, 0x0a, 0xda, 0x58, 0xca, 0x66, 0x85, 0xd6, 0xd6, + 0x16, 0xc8, 0x8a, 0xe4, 0x1d, 0xd9, 0x28, 0x4d, 0x24, 0x8a, 0x58, 0x69, 0x40, 0xb2, 0x90, 0x16, + 0x1a, 0x68, 0xac, 0xf5, 0x78, 0x18, 0x8f, 0xc8, 0xce, 0x35, 0x3b, 0xb3, 0xc6, 0xdb, 0x21, 0x5e, + 0x00, 0x4a, 0x5e, 0x02, 0x29, 0x05, 0x0f, 0x81, 0xa8, 0x52, 0x52, 0x01, 0xb2, 0x8b, 0xd4, 0xf0, + 0x04, 0x68, 0xff, 0x8c, 0x43, 0x6c, 0x41, 0x47, 0xe7, 0x73, 0x7f, 0x77, 0xce, 0xdc, 0x39, 0xd7, + 0x8b, 0xf7, 0x04, 0x0d, 0xc3, 0x44, 0x4f, 0xc8, 0xac, 0x4b, 0xf4, 0xdc, 0x9f, 0xc6, 0xa0, 0xc1, + 0xc2, 0x65, 0xd1, 0x9f, 0x75, 0x9d, 0x7d, 0x0a, 0x2a, 0x02, 0x45, 0x22, 0xc5, 0xb3, 0x9e, 0x48, + 0xf1, 0xa2, 0xc9, 0x39, 0x28, 0xc0, 0x30, 0x57, 0xa4, 0x10, 0x25, 0x6a, 0x70, 0xe0, 0x50, 0xd4, + 0xb3, 0x5f, 0x65, 0xd5, 0xe5, 0x00, 0xfc, 0x8c, 0x91, 0x5c, 0x8d, 0x92, 0xe7, 0x64, 0x9c, 0xc4, + 0xa1, 0x16, 0x20, 0x8d, 0xe1, 0x3a, 0x0f, 0x65, 0x5a, 0x20, 0xef, 0x2d, 0xc2, 0xd6, 0x40, 0xf1, + 0x80, 0x71, 0xa1, 0x34, 0x8b, 0x4f, 0x28, 0x85, 0x44, 0x6a, 0xab, 0x81, 0xb7, 0xe0, 0x95, 0x64, + 0xb1, 0x8d, 0x5a, 0xa8, 0x7d, 0x23, 0x28, 0x84, 0x75, 0x1f, 0xdf, 0xa2, 0x20, 0x25, 0xa3, 0x99, + 0xf7, 0x50, 0x8c, 0xed, 0xff, 0x32, 0xda, 0xb7, 0x7f, 0x7e, 0x6d, 0x36, 0xd2, 0x30, 0x3a, 0x3b, + 0xf6, 0xae, 0x61, 0x2f, 0xb8, 0x79, 0xa5, 0x1f, 0x8c, 0x2d, 0x1b, 0x6f, 0xcf, 0x58, 0xac, 0x04, + 0x48, 0xbb, 0x9a, 0xdb, 0x1a, 0x79, 0x8c, 0xdf, 0x5c, 0x9e, 0x1f, 0x16, 0x97, 0x78, 0x77, 0xb0, + 0xb3, 0x39, 0x50, 0xc0, 0xd4, 0x14, 0xa4, 0x62, 0xde, 0x0f, 0x84, 0xeb, 0x03, 0xc5, 0x1f, 0x27, + 0xa3, 0x48, 0xe8, 0x27, 0xf3, 0x7f, 0x33, 0xe8, 0x11, 0xae, 0x45, 0x8a, 0x2b, 0xbb, 0xda, 0xaa, + 0xb6, 0xeb, 0xbd, 0x86, 0x5f, 0xc4, 0xe7, 0x9b, 0xf8, 0xfc, 0x13, 0x99, 0xf6, 0xeb, 0x9f, 0x3f, + 0x76, 0xb6, 0xd5, 0xf8, 0x85, 0x9f, 0x0d, 0x9b, 0xb7, 0x5b, 0x0f, 0xf1, 0x6d, 0x2d, 0x22, 0x06, + 0x89, 0x1e, 0x9a, 0x05, 0xd8, 0xb5, 0x16, 0x6a, 0xd7, 0x7b, 0x07, 0x1b, 0x16, 0xa7, 0x65, 0x43, + 0xbf, 0xf6, 0xfe, 0x5b, 0x13, 0x05, 0xbb, 0xe5, 0x41, 0x53, 0xbe, 0x96, 0x48, 0x17, 0xef, 0xfd, + 0xf6, 0x64, 0x13, 0x85, 0xe5, 0xe0, 0x1d, 0xc5, 0x5e, 0x26, 0x4c, 0x52, 0x96, 0xbf, 0xbe, 0x16, + 0xac, 0x74, 0xef, 0x03, 0xc2, 0xd5, 0x81, 0xe2, 0xd6, 0x53, 0xbc, 0xbb, 0xbe, 0x5a, 0xd7, 0xbf, + 0xfa, 0x0f, 0xfa, 0x9b, 0x49, 0x3b, 0x77, 0xff, 0xce, 0x57, 0xd7, 0x9f, 0xe2, 0x9d, 0xd5, 0x16, + 0xf6, 0xd7, 0xce, 0x18, 0xe0, 0x34, 0xff, 0x00, 0x8c, 0x8b, 0xb3, 0xf5, 0xfa, 0xf2, 0xfc, 0x10, + 0xf5, 0x1f, 0x7d, 0x5a, 0xb8, 0xe8, 0x62, 0xe1, 0xa2, 0xef, 0x0b, 0x17, 0xbd, 0x5b, 0xba, 0x95, + 0x8b, 0xa5, 0x5b, 0xf9, 0xb2, 0x74, 0x2b, 0xcf, 0x8e, 0xb8, 0xd0, 0x93, 0x64, 0xe4, 0x53, 0x88, + 0x08, 0x8d, 0xd3, 0xa9, 0x86, 0x0e, 0xc4, 0xbc, 0x43, 0x27, 0xa1, 0x90, 0x84, 0xc6, 0x20, 0x41, + 0x91, 0x59, 0x8f, 0xcc, 0x89, 0xf9, 0xdc, 0x74, 0x3a, 0x65, 0x6a, 0xf4, 0x7f, 0x9e, 0xf4, 0xbd, + 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8d, 0xc4, 0xb1, 0xcc, 0x86, 0x03, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // RegisterAccount registers an interchain account on host chain with given + // `connection_id` + RegisterAccount(ctx context.Context, in *MsgRegisterAccount, opts ...grpc.CallOption) (*MsgRegisterAccountResponse, error) + // SubmitTx submits a transaction to the host chain on behalf of interchain + // account + SubmitTx(ctx context.Context, in *MsgSubmitTx, opts ...grpc.CallOption) (*MsgSubmitTxResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) RegisterAccount(ctx context.Context, in *MsgRegisterAccount, opts ...grpc.CallOption) (*MsgRegisterAccountResponse, error) { + out := new(MsgRegisterAccountResponse) + err := c.cc.Invoke(ctx, "/icaauth.v1.Msg/RegisterAccount", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SubmitTx(ctx context.Context, in *MsgSubmitTx, opts ...grpc.CallOption) (*MsgSubmitTxResponse, error) { + out := new(MsgSubmitTxResponse) + err := c.cc.Invoke(ctx, "/icaauth.v1.Msg/SubmitTx", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // RegisterAccount registers an interchain account on host chain with given + // `connection_id` + RegisterAccount(context.Context, *MsgRegisterAccount) (*MsgRegisterAccountResponse, error) + // SubmitTx submits a transaction to the host chain on behalf of interchain + // account + SubmitTx(context.Context, *MsgSubmitTx) (*MsgSubmitTxResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) RegisterAccount(ctx context.Context, req *MsgRegisterAccount) (*MsgRegisterAccountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RegisterAccount not implemented") +} +func (*UnimplementedMsgServer) SubmitTx(ctx context.Context, req *MsgSubmitTx) (*MsgSubmitTxResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubmitTx not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_RegisterAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRegisterAccount) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RegisterAccount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/icaauth.v1.Msg/RegisterAccount", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RegisterAccount(ctx, req.(*MsgRegisterAccount)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_SubmitTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSubmitTx) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SubmitTx(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/icaauth.v1.Msg/SubmitTx", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SubmitTx(ctx, req.(*MsgSubmitTx)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "icaauth.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RegisterAccount", + Handler: _Msg_RegisterAccount_Handler, + }, + { + MethodName: "SubmitTx", + Handler: _Msg_SubmitTx_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "icaauth/v1/tx.proto", +} + +func (m *MsgRegisterAccount) 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 *MsgRegisterAccount) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintTx(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0x1a + } + if len(m.ConnectionId) > 0 { + i -= len(m.ConnectionId) + copy(dAtA[i:], m.ConnectionId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ConnectionId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRegisterAccountResponse) 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 *MsgRegisterAccountResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgSubmitTx) 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 *MsgSubmitTx) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.TimeoutDuration != nil { + n1, err1 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.TimeoutDuration, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.TimeoutDuration):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintTx(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x22 + } + if len(m.Msgs) > 0 { + for iNdEx := len(m.Msgs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Msgs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.ConnectionId) > 0 { + i -= len(m.ConnectionId) + copy(dAtA[i:], m.ConnectionId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ConnectionId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSubmitTxResponse) 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 *MsgSubmitTxResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitTxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Sequence != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Sequence)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgRegisterAccount) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ConnectionId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Version) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRegisterAccountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgSubmitTx) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ConnectionId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Msgs) > 0 { + for _, e := range m.Msgs { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + if m.TimeoutDuration != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.TimeoutDuration) + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSubmitTxResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sequence != 0 { + n += 1 + sovTx(uint64(m.Sequence)) + } + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgRegisterAccount) 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: MsgRegisterAccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterAccount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", 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.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConnectionId", 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.ConnectionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", 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.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRegisterAccountResponse) 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: MsgRegisterAccountResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterAccountResponse: 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 (m *MsgSubmitTx) 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: MsgSubmitTx: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitTx: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", 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.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConnectionId", 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.ConnectionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Msgs", 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.Msgs = append(m.Msgs, &types.Any{}) + if err := m.Msgs[len(m.Msgs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeoutDuration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TimeoutDuration == nil { + m.TimeoutDuration = new(time.Duration) + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.TimeoutDuration, 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 *MsgSubmitTxResponse) 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: MsgSubmitTxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitTxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) + } + m.Sequence = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Sequence |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/app/legacy_test.go b/app/legacy_test.go new file mode 100644 index 0000000000..1e72442470 --- /dev/null +++ b/app/legacy_test.go @@ -0,0 +1,36 @@ +package app + +import ( + "encoding/base64" + "testing" + + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + evmenc "github.com/evmos/ethermint/encoding" + "github.com/stretchr/testify/require" +) + +func TestDecodeLegacyTx(t *testing.T) { + txs := map[string]string{ + "/icaauth.v1.MsgRegisterAccount": "Cl8KXQoeL2ljYWF1dGgudjEuTXNnUmVnaXN0ZXJBY2NvdW50EjsKK3RjcmMxcndsNW54bHJ4ZXd5eGVqZDA4OTh1cWFqNDc5NnY0Mm1hNTB5cDQSDGNvbm5lY3Rpb24tMBKAAQpXCk8KKC9ldGhlcm1pbnQuY3J5cHRvLnYxLmV0aHNlY3AyNTZrMS5QdWJLZXkSIwohA1Q2Pphmzen/aIkuFd/3k+8YQATsARLhmWV9RxF+FGS/EgQKAggBEiUKHwoIYmFzZXRjcm8SEzQ4NDgwMDAwMDAwMDAwMDAwMDAQgLUYGkHOZPyLl81RsTbNHTv4o4XjWtYwO1fm4NzYyuju4boHpmALIytbPm+saXwhxtUG6hPT+sAsu9Bk224A9xd/8isZAQ==", + "/cosmos.authz.v1beta1.MsgGrant": "Cr0BCroBCh4vY29zbW9zLmF1dGh6LnYxYmV0YTEuTXNnR3JhbnQSlwEKKmNyYzF4N3g5cGtmeGYzM2w4N2Z0c3BrNWFldHdua3IwbHZsdjMzNDZjZBIqY3JjMTZ6MGhlcno5OTg5NDZ3cjY1OWxyODRjOGM1NTZkYTU1ZGMzNGhoGj0KOwomL2Nvc21vcy5iYW5rLnYxYmV0YTEuU2VuZEF1dGhvcml6YXRpb24SEQoPCghiYXNldGNybxIDMjAwEl8KVwpPCigvZXRoZXJtaW50LmNyeXB0by52MS5ldGhzZWNwMjU2azEuUHViS2V5EiMKIQNg/r8Tea2PYFq2XE07fpnN97ASePg32cuO4HmUkEGpFBIECgIIARIEEMCaDBpBekTx2LtLIFDODLVr1OqMUR9UYjZBv0KAr8eCacs7jTw/szr3jCvtvHGNraifkLfBEDatH3Rp/wqaNvxXgGjH4gA=", + } + + for typeUrl, tx := range txs { + bz, err := base64.StdEncoding.DecodeString(tx) + require.NoError(t, err) + + encodingConfig := evmenc.MakeConfig() + + _, err = encodingConfig.TxConfig.TxDecoder()(bz) + require.Error(t, err, "") + require.Contains(t, err.Error(), "unable to resolve type URL "+typeUrl) + + RegisterLegacyCodec(encodingConfig.Amino) + RegisterLegacyInterfaces(encodingConfig.InterfaceRegistry) + banktypes.RegisterLegacyAminoCodec(encodingConfig.Amino) + banktypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) + + _, err = encodingConfig.TxConfig.TxDecoder()(bz) + require.NoError(t, err) + } +} diff --git a/cmd/cronosd/cmd/root.go b/cmd/cronosd/cmd/root.go index 77cab2795f..ec2f5f07e2 100644 --- a/cmd/cronosd/cmd/root.go +++ b/cmd/cronosd/cmd/root.go @@ -67,6 +67,9 @@ func NewRootCmd() *cobra.Command { simtestutil.NewAppOptionsWithFlagHome(app.DefaultNodeHome), ) encodingConfig := tempApp.EncodingConfig() + // for decoding legacy transactions whose messages are removed + app.RegisterLegacyCodec(encodingConfig.Amino) + app.RegisterLegacyInterfaces(encodingConfig.InterfaceRegistry) initClientCtx := client.Context{}. WithCodec(encodingConfig.Codec). WithInterfaceRegistry(encodingConfig.InterfaceRegistry).