diff --git a/CHANGELOG.md b/CHANGELOG.md index f608884ba25..e0dac6413e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (core/05-port) [\#6341](https://github.com/cosmos/ibc-go/pull/6341) Modify `UnmarshalPacketData` interface to take in the context, portID, and channelID. This allows for packet data's to be unmarshaled based on the channel version. * (apps/27-interchain-accounts) [\#6433](https://github.com/cosmos/ibc-go/pull/6433) Use UNORDERED as the default ordering for new ICA channels. * (apps/transfer) [\#6440](https://github.com/cosmos/ibc-go/pull/6440) Remove `GetPrefixedDenom`. +* (apps/transfer) [\#6508](https://github.com/cosmos/ibc-go/pull/6508) Remove the `DenomTrace` type. ### State Machine Breaking diff --git a/modules/apps/transfer/internal/types/denomtrace.pb.go b/modules/apps/transfer/internal/types/denomtrace.pb.go new file mode 100644 index 00000000000..6d7ee29ad75 --- /dev/null +++ b/modules/apps/transfer/internal/types/denomtrace.pb.go @@ -0,0 +1,378 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ibc/applications/transfer/v1/denomtrace.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// DenomTrace contains the base denomination for ICS20 fungible tokens and the +// source tracing information path. +// +// Deprecated: Do not use. +type DenomTrace struct { + // path defines the chain of port/channel identifiers used for tracing the + // source of the fungible token. + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + // base denomination of the relayed fungible token. + BaseDenom string `protobuf:"bytes,2,opt,name=base_denom,json=baseDenom,proto3" json:"base_denom,omitempty"` +} + +func (m *DenomTrace) Reset() { *m = DenomTrace{} } +func (m *DenomTrace) String() string { return proto.CompactTextString(m) } +func (*DenomTrace) ProtoMessage() {} +func (*DenomTrace) Descriptor() ([]byte, []int) { + return fileDescriptor_c400148599bf8bc8, []int{0} +} +func (m *DenomTrace) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DenomTrace) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DenomTrace.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 *DenomTrace) XXX_Merge(src proto.Message) { + xxx_messageInfo_DenomTrace.Merge(m, src) +} +func (m *DenomTrace) XXX_Size() int { + return m.Size() +} +func (m *DenomTrace) XXX_DiscardUnknown() { + xxx_messageInfo_DenomTrace.DiscardUnknown(m) +} + +var xxx_messageInfo_DenomTrace proto.InternalMessageInfo + +func (m *DenomTrace) GetPath() string { + if m != nil { + return m.Path + } + return "" +} + +func (m *DenomTrace) GetBaseDenom() string { + if m != nil { + return m.BaseDenom + } + return "" +} + +func init() { + proto.RegisterType((*DenomTrace)(nil), "ibc.applications.transfer.v1.DenomTrace") +} + +func init() { + proto.RegisterFile("ibc/applications/transfer/v1/denomtrace.proto", fileDescriptor_c400148599bf8bc8) +} + +var fileDescriptor_c400148599bf8bc8 = []byte{ + // 215 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xcd, 0x4c, 0x4a, 0xd6, + 0x4f, 0x2c, 0x28, 0xc8, 0xc9, 0x4c, 0x4e, 0x2c, 0xc9, 0xcc, 0xcf, 0x2b, 0xd6, 0x2f, 0x29, 0x4a, + 0xcc, 0x2b, 0x4e, 0x4b, 0x2d, 0xd2, 0x2f, 0x33, 0xd4, 0x4f, 0x49, 0xcd, 0xcb, 0xcf, 0x2d, 0x29, + 0x4a, 0x4c, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0xc9, 0x4c, 0x4a, 0xd6, 0x43, + 0x56, 0xae, 0x07, 0x53, 0xae, 0x57, 0x66, 0xa8, 0xe4, 0xcc, 0xc5, 0xe5, 0x02, 0xd2, 0x11, 0x02, + 0xd2, 0x21, 0x24, 0xc4, 0xc5, 0x52, 0x90, 0x58, 0x92, 0x21, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19, + 0x04, 0x66, 0x0b, 0xc9, 0x72, 0x71, 0x25, 0x25, 0x16, 0xa7, 0xc6, 0x83, 0x0d, 0x96, 0x60, 0x02, + 0xcb, 0x70, 0x82, 0x44, 0xc0, 0xfa, 0xac, 0x98, 0x24, 0x18, 0x9d, 0x02, 0x4f, 0x3c, 0x92, 0x63, + 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, + 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x3c, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, + 0x3f, 0x57, 0x3f, 0x39, 0xbf, 0x38, 0x37, 0xbf, 0x58, 0x3f, 0x33, 0x29, 0x59, 0x37, 0x3d, 0x5f, + 0xbf, 0xcc, 0x42, 0x3f, 0x37, 0x3f, 0xa5, 0x34, 0x27, 0xb5, 0x18, 0xe4, 0x17, 0x24, 0x3f, 0x94, + 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x1d, 0x6f, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x40, + 0x87, 0xd3, 0x61, 0xed, 0x00, 0x00, 0x00, +} + +func (m *DenomTrace) 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 *DenomTrace) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DenomTrace) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BaseDenom) > 0 { + i -= len(m.BaseDenom) + copy(dAtA[i:], m.BaseDenom) + i = encodeVarintDenomtrace(dAtA, i, uint64(len(m.BaseDenom))) + i-- + dAtA[i] = 0x12 + } + if len(m.Path) > 0 { + i -= len(m.Path) + copy(dAtA[i:], m.Path) + i = encodeVarintDenomtrace(dAtA, i, uint64(len(m.Path))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintDenomtrace(dAtA []byte, offset int, v uint64) int { + offset -= sovDenomtrace(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *DenomTrace) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Path) + if l > 0 { + n += 1 + l + sovDenomtrace(uint64(l)) + } + l = len(m.BaseDenom) + if l > 0 { + n += 1 + l + sovDenomtrace(uint64(l)) + } + return n +} + +func sovDenomtrace(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozDenomtrace(x uint64) (n int) { + return sovDenomtrace(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *DenomTrace) 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 ErrIntOverflowDenomtrace + } + 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: DenomTrace: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DenomTrace: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDenomtrace + } + 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 ErrInvalidLengthDenomtrace + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDenomtrace + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Path = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDenomtrace + } + 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 ErrInvalidLengthDenomtrace + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDenomtrace + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BaseDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDenomtrace(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDenomtrace + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipDenomtrace(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, ErrIntOverflowDenomtrace + } + 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, ErrIntOverflowDenomtrace + } + 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, ErrIntOverflowDenomtrace + } + 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, ErrInvalidLengthDenomtrace + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupDenomtrace + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthDenomtrace + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthDenomtrace = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowDenomtrace = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupDenomtrace = fmt.Errorf("proto: unexpected end of group") +) diff --git a/modules/apps/transfer/types/legacy_denomtrace.go b/modules/apps/transfer/internal/types/legacy_denomtrace.go similarity index 79% rename from modules/apps/transfer/types/legacy_denomtrace.go rename to modules/apps/transfer/internal/types/legacy_denomtrace.go index 3d3adc487ea..ca11d708d74 100644 --- a/modules/apps/transfer/types/legacy_denomtrace.go +++ b/modules/apps/transfer/internal/types/legacy_denomtrace.go @@ -5,13 +5,8 @@ import ( "fmt" cmtbytes "github.com/cometbft/cometbft/libs/bytes" -) -// TODO: https://github.com/cosmos/ibc-go/issues/6421#issuecomment-2137516426 -// Kept around due to dependency. Empty and useless and ideally dropped before v9. -type ( - QueryDenomTracesResponse struct{} - QueryDenomTraceResponse struct{} + "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" ) // Hash returns the hex bytes of the SHA256 hash of the DenomTrace fields using the following formula: @@ -31,7 +26,7 @@ func (dt DenomTrace) GetPrefix() string { // 'ibc/{hash(tracePath + baseDenom)}'. If the trace is empty, it will return the base denomination. func (dt DenomTrace) IBCDenom() string { if dt.Path != "" { - return fmt.Sprintf("%s/%s", DenomPrefix, dt.Hash()) + return fmt.Sprintf("%s/%s", types.DenomPrefix, dt.Hash()) } return dt.BaseDenom } diff --git a/modules/apps/transfer/internal/types/legacy_denomtrace_test.go b/modules/apps/transfer/internal/types/legacy_denomtrace_test.go new file mode 100644 index 00000000000..9889fa07730 --- /dev/null +++ b/modules/apps/transfer/internal/types/legacy_denomtrace_test.go @@ -0,0 +1,27 @@ +package types_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + internaltypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/internal/types" +) + +func TestDenomTrace_IBCDenom(t *testing.T) { + testCases := []struct { + name string + trace internaltypes.DenomTrace + expDenom string + }{ + {"base denom", internaltypes.DenomTrace{BaseDenom: "uatom"}, "uatom"}, + {"trace info", internaltypes.DenomTrace{BaseDenom: "uatom", Path: "transfer/channel-1"}, "ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9"}, + } + + for _, tc := range testCases { + tc := tc + + denom := tc.trace.IBCDenom() + require.Equal(t, tc.expDenom, denom, tc.name) + } +} diff --git a/modules/apps/transfer/keeper/export_test.go b/modules/apps/transfer/keeper/export_test.go index 8c6f3961c79..f3f66b3c33e 100644 --- a/modules/apps/transfer/keeper/export_test.go +++ b/modules/apps/transfer/keeper/export_test.go @@ -3,23 +3,24 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + internaltypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/internal/types" "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" ) // SetDenomTraces is a wrapper around iterateDenomTraces for testing purposes. -func (k Keeper) SetDenomTrace(ctx sdk.Context, denomTrace types.DenomTrace) { +func (k Keeper) SetDenomTrace(ctx sdk.Context, denomTrace internaltypes.DenomTrace) { k.setDenomTrace(ctx, denomTrace) } // IterateDenomTraces is a wrapper around iterateDenomTraces for testing purposes. -func (k Keeper) IterateDenomTraces(ctx sdk.Context, cb func(denomTrace types.DenomTrace) bool) { +func (k Keeper) IterateDenomTraces(ctx sdk.Context, cb func(denomTrace internaltypes.DenomTrace) bool) { k.iterateDenomTraces(ctx, cb) } // GetAllDenomTraces returns the trace information for all the denominations. -func (k Keeper) GetAllDenomTraces(ctx sdk.Context) []types.DenomTrace { - var traces []types.DenomTrace - k.iterateDenomTraces(ctx, func(denomTrace types.DenomTrace) bool { +func (k Keeper) GetAllDenomTraces(ctx sdk.Context) []internaltypes.DenomTrace { + var traces []internaltypes.DenomTrace + k.iterateDenomTraces(ctx, func(denomTrace internaltypes.DenomTrace) bool { traces = append(traces, denomTrace) return false }) diff --git a/modules/apps/transfer/keeper/migrations.go b/modules/apps/transfer/keeper/migrations.go index 81306a4d986..8376c904644 100644 --- a/modules/apps/transfer/keeper/migrations.go +++ b/modules/apps/transfer/keeper/migrations.go @@ -10,6 +10,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + internaltypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/internal/types" "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" ) @@ -38,7 +39,7 @@ func (m Migrator) MigrateParams(ctx sdk.Context) error { // MigrateDenomMetadata sets token metadata for all the IBC denom traces func (m Migrator) MigrateDenomMetadata(ctx sdk.Context) error { m.keeper.iterateDenomTraces(ctx, - func(dt types.DenomTrace) (stop bool) { + func(dt internaltypes.DenomTrace) (stop bool) { // check if the metadata for the given denom trace does not already exist if !m.keeper.bankKeeper.HasDenomMetaData(ctx, dt.IBCDenom()) { m.keeper.setDenomMetadataWithDenomTrace(ctx, dt) @@ -75,10 +76,10 @@ func (m Migrator) MigrateTotalEscrowForDenom(ctx sdk.Context) error { func (m Migrator) MigrateDenomTraceToDenom(ctx sdk.Context) error { var ( denoms []types.Denom - denomTraces []types.DenomTrace + denomTraces []internaltypes.DenomTrace ) m.keeper.iterateDenomTraces(ctx, - func(dt types.DenomTrace) (stop bool) { + func(dt internaltypes.DenomTrace) (stop bool) { // convert denomTrace to denom denom := types.ExtractDenomFromPath(dt.GetFullDenomPath()) err := denom.Validate() @@ -112,7 +113,7 @@ func (m Migrator) MigrateDenomTraceToDenom(ctx sdk.Context) error { } // setDenomTrace sets a new {trace hash -> denom trace} pair to the store. -func (k Keeper) setDenomTrace(ctx sdk.Context, denomTrace types.DenomTrace) { +func (k Keeper) setDenomTrace(ctx sdk.Context, denomTrace internaltypes.DenomTrace) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.DenomTraceKey) bz := k.cdc.MustMarshal(&denomTrace) @@ -120,20 +121,20 @@ func (k Keeper) setDenomTrace(ctx sdk.Context, denomTrace types.DenomTrace) { } // deleteDenomTrace deletes the denom trace -func (k Keeper) deleteDenomTrace(ctx sdk.Context, denomTrace types.DenomTrace) { +func (k Keeper) deleteDenomTrace(ctx sdk.Context, denomTrace internaltypes.DenomTrace) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.DenomTraceKey) store.Delete(denomTrace.Hash()) } // iterateDenomTraces iterates over the denomination traces in the store // and performs a callback function. -func (k Keeper) iterateDenomTraces(ctx sdk.Context, cb func(denomTrace types.DenomTrace) bool) { +func (k Keeper) iterateDenomTraces(ctx sdk.Context, cb func(denomTrace internaltypes.DenomTrace) bool) { store := ctx.KVStore(k.storeKey) iterator := storetypes.KVStorePrefixIterator(store, types.DenomTraceKey) defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) for ; iterator.Valid(); iterator.Next() { - var denomTrace types.DenomTrace + var denomTrace internaltypes.DenomTrace k.cdc.MustUnmarshal(iterator.Value(), &denomTrace) if cb(denomTrace) { @@ -143,7 +144,7 @@ func (k Keeper) iterateDenomTraces(ctx sdk.Context, cb func(denomTrace types.Den } // setDenomMetadataWithDenomTrace sets an IBC token's denomination metadata -func (k Keeper) setDenomMetadataWithDenomTrace(ctx sdk.Context, denomTrace types.DenomTrace) { +func (k Keeper) setDenomMetadataWithDenomTrace(ctx sdk.Context, denomTrace internaltypes.DenomTrace) { metadata := banktypes.Metadata{ Description: fmt.Sprintf("IBC token from %s", denomTrace.GetFullDenomPath()), DenomUnits: []*banktypes.DenomUnit{ diff --git a/modules/apps/transfer/keeper/migrations_test.go b/modules/apps/transfer/keeper/migrations_test.go index 141b4121ae8..c5e922688dc 100644 --- a/modules/apps/transfer/keeper/migrations_test.go +++ b/modules/apps/transfer/keeper/migrations_test.go @@ -9,6 +9,7 @@ import ( banktestutil "github.com/cosmos/cosmos-sdk/x/bank/testutil" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + internaltransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/internal/types" transferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" ibctesting "github.com/cosmos/ibc-go/v8/testing" @@ -59,7 +60,7 @@ func (suite *KeeperTestSuite) TestMigratorMigrateDenomTraceToDenom() { func() { suite.chainA.GetSimApp().TransferKeeper.SetDenomTrace( suite.chainA.GetContext(), - transfertypes.DenomTrace{ + internaltransfertypes.DenomTrace{ BaseDenom: "uatom", }) }, @@ -72,7 +73,7 @@ func (suite *KeeperTestSuite) TestMigratorMigrateDenomTraceToDenom() { func() { suite.chainA.GetSimApp().TransferKeeper.SetDenomTrace( suite.chainA.GetContext(), - transfertypes.DenomTrace{ + internaltransfertypes.DenomTrace{ BaseDenom: "uatom", Path: "transfer/channel-49", }) }, @@ -85,7 +86,7 @@ func (suite *KeeperTestSuite) TestMigratorMigrateDenomTraceToDenom() { func() { suite.chainA.GetSimApp().TransferKeeper.SetDenomTrace( suite.chainA.GetContext(), - transfertypes.DenomTrace{ + internaltransfertypes.DenomTrace{ BaseDenom: "uatom", Path: "transfer/channel-49/transfer/channel-32/transfer/channel-2", }) }, @@ -98,22 +99,22 @@ func (suite *KeeperTestSuite) TestMigratorMigrateDenomTraceToDenom() { func() { suite.chainA.GetSimApp().TransferKeeper.SetDenomTrace( suite.chainA.GetContext(), - transfertypes.DenomTrace{ + internaltransfertypes.DenomTrace{ BaseDenom: "uatom", Path: "transfer/channel-49", }) suite.chainA.GetSimApp().TransferKeeper.SetDenomTrace( suite.chainA.GetContext(), - transfertypes.DenomTrace{ + internaltransfertypes.DenomTrace{ BaseDenom: "pineapple", Path: "transfer/channel-0", }) suite.chainA.GetSimApp().TransferKeeper.SetDenomTrace( suite.chainA.GetContext(), - transfertypes.DenomTrace{ + internaltransfertypes.DenomTrace{ BaseDenom: "apple", Path: "transfer/channel-0", }) suite.chainA.GetSimApp().TransferKeeper.SetDenomTrace( suite.chainA.GetContext(), - transfertypes.DenomTrace{ + internaltransfertypes.DenomTrace{ BaseDenom: "cucumber", Path: "transfer/channel-102/transfer/channel-0", }) }, @@ -130,7 +131,7 @@ func (suite *KeeperTestSuite) TestMigratorMigrateDenomTraceToDenom() { func() { suite.chainA.GetSimApp().TransferKeeper.SetDenomTrace( suite.chainA.GetContext(), - transfertypes.DenomTrace{ + internaltransfertypes.DenomTrace{ BaseDenom: "gamm/pool/1", Path: "transfer/channel-0", }) }, @@ -143,7 +144,7 @@ func (suite *KeeperTestSuite) TestMigratorMigrateDenomTraceToDenom() { func() { suite.chainA.GetSimApp().TransferKeeper.SetDenomTrace( suite.chainA.GetContext(), - transfertypes.DenomTrace{ + internaltransfertypes.DenomTrace{ BaseDenom: "erc/0x85bcBCd7e79Ec36f4fBBDc54F90C643d921151AA", Path: "transfer/channel-149", }) }, @@ -156,7 +157,7 @@ func (suite *KeeperTestSuite) TestMigratorMigrateDenomTraceToDenom() { func() { suite.chainA.GetSimApp().TransferKeeper.SetDenomTrace( suite.chainA.GetContext(), - transfertypes.DenomTrace{ + internaltransfertypes.DenomTrace{ BaseDenom: "uatom", Path: "transfer/channel-0/customport/channel-7", }) }, @@ -182,7 +183,7 @@ func (suite *KeeperTestSuite) TestMigratorMigrateDenomTraceToDenom() { // assert no leftover denom traces suite.chainA.GetSimApp().TransferKeeper.IterateDenomTraces(suite.chainA.GetContext(), - func(dt transfertypes.DenomTrace) (stop bool) { + func(dt internaltransfertypes.DenomTrace) (stop bool) { suite.FailNow("DenomTrace key still exists", dt) return false }, @@ -194,18 +195,18 @@ func (suite *KeeperTestSuite) TestMigratorMigrateDenomTraceToDenom() { func (suite *KeeperTestSuite) TestMigratorMigrateDenomTraceToDenomCorruptionDetection() { testCases := []struct { name string - denomTrace transfertypes.DenomTrace + denomTrace internaltransfertypes.DenomTrace }{ { "corrupted denom trace, denom.IBCHash() does not match", - transfertypes.DenomTrace{ + internaltransfertypes.DenomTrace{ BaseDenom: "customport/channel-0/uatom", Path: "", }, }, { "invalid denom trace, base denom is empty", - transfertypes.DenomTrace{ + internaltransfertypes.DenomTrace{ BaseDenom: "", Path: "transfer/channel-0", }, @@ -305,7 +306,7 @@ func (suite *KeeperTestSuite) TestMigrateTotalEscrowForDenom() { func (suite *KeeperTestSuite) TestMigratorMigrateMetadata() { var ( - denomTraces []transfertypes.DenomTrace + denomTraces []internaltransfertypes.DenomTrace expectedMetadata []banktypes.Metadata ) @@ -316,7 +317,7 @@ func (suite *KeeperTestSuite) TestMigratorMigrateMetadata() { { "success with one denom trace with one hop", func() { - denomTraces = []transfertypes.DenomTrace{ + denomTraces = []internaltransfertypes.DenomTrace{ { BaseDenom: "foo", Path: "transfer/channel-0", @@ -343,7 +344,7 @@ func (suite *KeeperTestSuite) TestMigratorMigrateMetadata() { { "success with one denom trace with two hops", func() { - denomTraces = []transfertypes.DenomTrace{ + denomTraces = []internaltransfertypes.DenomTrace{ { BaseDenom: "ubar", Path: "transfer/channel-1/transfer/channel-2", @@ -370,7 +371,7 @@ func (suite *KeeperTestSuite) TestMigratorMigrateMetadata() { { "success with two denom traces with one hop", func() { - denomTraces = []transfertypes.DenomTrace{ + denomTraces = []internaltransfertypes.DenomTrace{ { BaseDenom: "foo", Path: "transfer/channel-0", @@ -414,7 +415,7 @@ func (suite *KeeperTestSuite) TestMigratorMigrateMetadata() { { "success with two denom traces, metadata for one of them already exists", func() { - denomTraces = []transfertypes.DenomTrace{ + denomTraces = []internaltransfertypes.DenomTrace{ { BaseDenom: "foo", Path: "transfer/channel-0", diff --git a/modules/apps/transfer/simulation/decoder.go b/modules/apps/transfer/simulation/decoder.go index c224b76cfd4..a8a9ea7f7ed 100644 --- a/modules/apps/transfer/simulation/decoder.go +++ b/modules/apps/transfer/simulation/decoder.go @@ -6,6 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/kv" + internaltypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/internal/types" "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" ) @@ -18,7 +19,7 @@ func NewDecodeStore() func(kvA, kvB kv.Pair) string { return fmt.Sprintf("Port A: %s\nPort B: %s", string(kvA.Value), string(kvB.Value)) case bytes.Equal(kvA.Key[:1], types.DenomTraceKey): - var denomTraceA, denomTraceB types.DenomTrace + var denomTraceA, denomTraceB internaltypes.DenomTrace types.ModuleCdc.MustUnmarshal(kvA.Value, &denomTraceA) types.ModuleCdc.MustUnmarshal(kvB.Value, &denomTraceB) return fmt.Sprintf("DenomTrace A: %s\nDenomTrace B: %s", denomTraceA.IBCDenom(), denomTraceB.IBCDenom()) diff --git a/modules/apps/transfer/simulation/decoder_test.go b/modules/apps/transfer/simulation/decoder_test.go index 29a77ced412..95603c67dbd 100644 --- a/modules/apps/transfer/simulation/decoder_test.go +++ b/modules/apps/transfer/simulation/decoder_test.go @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/kv" + internaltypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/internal/types" "github.com/cosmos/ibc-go/v8/modules/apps/transfer/simulation" "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" ) @@ -15,7 +16,7 @@ import ( func TestDecodeStore(t *testing.T) { dec := simulation.NewDecodeStore() - trace := types.DenomTrace{ + trace := internaltypes.DenomTrace{ BaseDenom: "uatom", Path: "transfer/channelToA", } diff --git a/modules/apps/transfer/types/legacy_denomtrace_responses.go b/modules/apps/transfer/types/legacy_denomtrace_responses.go new file mode 100644 index 00000000000..b1ca1bf2093 --- /dev/null +++ b/modules/apps/transfer/types/legacy_denomtrace_responses.go @@ -0,0 +1,8 @@ +package types + +// TODO: https://github.com/cosmos/ibc-go/issues/6421#issuecomment-2137516426 +// Kept around due to dependency. Empty and useless and ideally dropped before v9. +type ( + QueryDenomTracesResponse struct{} + QueryDenomTraceResponse struct{} +) diff --git a/modules/apps/transfer/types/legacy_denomtrace_test.go b/modules/apps/transfer/types/legacy_denomtrace_test.go deleted file mode 100644 index 7339120cab6..00000000000 --- a/modules/apps/transfer/types/legacy_denomtrace_test.go +++ /dev/null @@ -1,27 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" -) - -func TestDenomTrace_IBCDenom(t *testing.T) { - testCases := []struct { - name string - trace types.DenomTrace - expDenom string - }{ - {"base denom", types.DenomTrace{BaseDenom: "uatom"}, "uatom"}, - {"trace info", types.DenomTrace{BaseDenom: "uatom", Path: "transfer/channel-1"}, "ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9"}, - } - - for _, tc := range testCases { - tc := tc - - denom := tc.trace.IBCDenom() - require.Equal(t, tc.expDenom, denom, tc.name) - } -} diff --git a/modules/apps/transfer/types/transfer.pb.go b/modules/apps/transfer/types/transfer.pb.go index 99bfa07a587..18086ea38a4 100644 --- a/modules/apps/transfer/types/transfer.pb.go +++ b/modules/apps/transfer/types/transfer.pb.go @@ -22,63 +22,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// DenomTrace contains the base denomination for ICS20 fungible tokens and the -// source tracing information path. -type DenomTrace struct { - // path defines the chain of port/channel identifiers used for tracing the - // source of the fungible token. - Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` - // base denomination of the relayed fungible token. - BaseDenom string `protobuf:"bytes,2,opt,name=base_denom,json=baseDenom,proto3" json:"base_denom,omitempty"` -} - -func (m *DenomTrace) Reset() { *m = DenomTrace{} } -func (m *DenomTrace) String() string { return proto.CompactTextString(m) } -func (*DenomTrace) ProtoMessage() {} -func (*DenomTrace) Descriptor() ([]byte, []int) { - return fileDescriptor_5041673e96e97901, []int{0} -} -func (m *DenomTrace) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DenomTrace) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DenomTrace.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 *DenomTrace) XXX_Merge(src proto.Message) { - xxx_messageInfo_DenomTrace.Merge(m, src) -} -func (m *DenomTrace) XXX_Size() int { - return m.Size() -} -func (m *DenomTrace) XXX_DiscardUnknown() { - xxx_messageInfo_DenomTrace.DiscardUnknown(m) -} - -var xxx_messageInfo_DenomTrace proto.InternalMessageInfo - -func (m *DenomTrace) GetPath() string { - if m != nil { - return m.Path - } - return "" -} - -func (m *DenomTrace) GetBaseDenom() string { - if m != nil { - return m.BaseDenom - } - return "" -} - // Params defines the set of IBC transfer parameters. // NOTE: To prevent a single token from being transferred, set the // TransfersEnabled parameter to true and then set the bank module's SendEnabled @@ -96,7 +39,7 @@ func (m *Params) Reset() { *m = Params{} } func (m *Params) String() string { return proto.CompactTextString(m) } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_5041673e96e97901, []int{1} + return fileDescriptor_5041673e96e97901, []int{0} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -140,7 +83,6 @@ func (m *Params) GetReceiveEnabled() bool { } func init() { - proto.RegisterType((*DenomTrace)(nil), "ibc.applications.transfer.v1.DenomTrace") proto.RegisterType((*Params)(nil), "ibc.applications.transfer.v1.Params") } @@ -149,60 +91,21 @@ func init() { } var fileDescriptor_5041673e96e97901 = []byte{ - // 256 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0x3f, 0x4b, 0x03, 0x31, - 0x18, 0x87, 0x9b, 0x22, 0xc5, 0x46, 0x51, 0xc8, 0xd4, 0x41, 0x83, 0x76, 0x51, 0x10, 0x2f, 0x14, - 0x07, 0xdd, 0x04, 0xd1, 0x5d, 0x4b, 0x27, 0x97, 0x92, 0xe4, 0x5e, 0xdb, 0xc0, 0xe5, 0x0f, 0x79, - 0xd3, 0x03, 0xbf, 0x85, 0x1f, 0xcb, 0xb1, 0xa3, 0xa3, 0xdc, 0x7d, 0x11, 0xb9, 0x58, 0x8e, 0x6e, - 0x3f, 0x9e, 0x3c, 0x79, 0x87, 0x87, 0xde, 0x18, 0xa5, 0x85, 0x0c, 0xa1, 0x32, 0x5a, 0x26, 0xe3, - 0x1d, 0x8a, 0x14, 0xa5, 0xc3, 0x0f, 0x88, 0xa2, 0x9e, 0xf5, 0xbb, 0x08, 0xd1, 0x27, 0xcf, 0xce, - 0x8c, 0xd2, 0xc5, 0xbe, 0x5c, 0xf4, 0x42, 0x3d, 0x9b, 0x3e, 0x52, 0xfa, 0x0c, 0xce, 0xdb, 0x45, - 0x94, 0x1a, 0x18, 0xa3, 0x07, 0x41, 0xa6, 0xf5, 0x84, 0x5c, 0x90, 0xeb, 0xf1, 0x3c, 0x6f, 0x76, - 0x4e, 0xa9, 0x92, 0x08, 0xcb, 0xb2, 0xd3, 0x26, 0xc3, 0xfc, 0x32, 0xee, 0x48, 0xfe, 0x37, 0x5d, - 0xd0, 0xd1, 0xab, 0x8c, 0xd2, 0x22, 0xbb, 0xa4, 0xc7, 0x08, 0xae, 0x5c, 0x82, 0x93, 0xaa, 0x82, - 0x32, 0x1f, 0x39, 0x9c, 0x1f, 0x75, 0xec, 0xe5, 0x1f, 0xb1, 0x2b, 0x7a, 0x1a, 0x41, 0x83, 0xa9, - 0xa1, 0xb7, 0x86, 0xd9, 0x3a, 0xd9, 0xe1, 0x9d, 0xf8, 0xf4, 0xf6, 0xdd, 0x70, 0xb2, 0x6d, 0x38, - 0xf9, 0x6d, 0x38, 0xf9, 0x6a, 0xf9, 0x60, 0xdb, 0xf2, 0xc1, 0x4f, 0xcb, 0x07, 0xef, 0xf7, 0x2b, - 0x93, 0xd6, 0x1b, 0x55, 0x68, 0x6f, 0x85, 0xf6, 0x68, 0x3d, 0x0a, 0xa3, 0xf4, 0xed, 0xca, 0x8b, - 0xfa, 0x41, 0x58, 0x5f, 0x6e, 0x2a, 0xc0, 0xae, 0xcd, 0x5e, 0x93, 0xf4, 0x19, 0x00, 0xd5, 0x28, - 0xe7, 0xb8, 0xfb, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x24, 0x39, 0xe1, 0x5f, 0x3d, 0x01, 0x00, 0x00, -} - -func (m *DenomTrace) 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 *DenomTrace) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DenomTrace) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.BaseDenom) > 0 { - i -= len(m.BaseDenom) - copy(dAtA[i:], m.BaseDenom) - i = encodeVarintTransfer(dAtA, i, uint64(len(m.BaseDenom))) - i-- - dAtA[i] = 0x12 - } - if len(m.Path) > 0 { - i -= len(m.Path) - copy(dAtA[i:], m.Path) - i = encodeVarintTransfer(dAtA, i, uint64(len(m.Path))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil + // 214 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xce, 0x4c, 0x4a, 0xd6, + 0x4f, 0x2c, 0x28, 0xc8, 0xc9, 0x4c, 0x4e, 0x2c, 0xc9, 0xcc, 0xcf, 0x2b, 0xd6, 0x2f, 0x29, 0x4a, + 0xcc, 0x2b, 0x4e, 0x4b, 0x2d, 0xd2, 0x2f, 0x33, 0x84, 0xb3, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, + 0x85, 0x64, 0x32, 0x93, 0x92, 0xf5, 0x90, 0x15, 0xeb, 0xc1, 0x15, 0x94, 0x19, 0x2a, 0x85, 0x70, + 0xb1, 0x05, 0x24, 0x16, 0x25, 0xe6, 0x16, 0x0b, 0x29, 0x72, 0xf1, 0x14, 0xa7, 0xe6, 0xa5, 0xc4, + 0xa7, 0xe6, 0x25, 0x26, 0xe5, 0xa4, 0xa6, 0x48, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x04, 0x71, 0x83, + 0xc4, 0x5c, 0x21, 0x42, 0x42, 0xea, 0x5c, 0xfc, 0x45, 0xa9, 0xc9, 0xa9, 0x99, 0x65, 0xa9, 0x70, + 0x55, 0x4c, 0x60, 0x55, 0x7c, 0x50, 0x61, 0xa8, 0x42, 0xa7, 0xc0, 0x13, 0x8f, 0xe4, 0x18, 0x2f, + 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, + 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x32, 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, + 0xd5, 0x4f, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0xcf, 0x4c, 0x4a, 0xd6, 0x4d, 0xcf, 0xd7, 0x2f, + 0xb3, 0xd0, 0xcf, 0xcd, 0x4f, 0x29, 0xcd, 0x49, 0x2d, 0x06, 0x79, 0x0d, 0xc9, 0x4b, 0x25, 0x95, + 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0xdf, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xc7, 0x93, + 0x43, 0xf8, 0xfc, 0x00, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -259,23 +162,6 @@ func encodeVarintTransfer(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *DenomTrace) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Path) - if l > 0 { - n += 1 + l + sovTransfer(uint64(l)) - } - l = len(m.BaseDenom) - if l > 0 { - n += 1 + l + sovTransfer(uint64(l)) - } - return n -} - func (m *Params) Size() (n int) { if m == nil { return 0 @@ -297,120 +183,6 @@ func sovTransfer(x uint64) (n int) { func sozTransfer(x uint64) (n int) { return sovTransfer(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *DenomTrace) 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 ErrIntOverflowTransfer - } - 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: DenomTrace: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DenomTrace: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransfer - } - 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 ErrInvalidLengthTransfer - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTransfer - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Path = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseDenom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransfer - } - 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 ErrInvalidLengthTransfer - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTransfer - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BaseDenom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTransfer(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTransfer - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/proto/ibc/applications/transfer/v1/denomtrace.proto b/proto/ibc/applications/transfer/v1/denomtrace.proto new file mode 100644 index 00000000000..9ac7e093573 --- /dev/null +++ b/proto/ibc/applications/transfer/v1/denomtrace.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +package ibc.applications.transfer.v1; + +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"; + +// DenomTrace contains the base denomination for ICS20 fungible tokens and the +// source tracing information path. +message DenomTrace { + option deprecated = true; + // path defines the chain of port/channel identifiers used for tracing the + // source of the fungible token. + string path = 1; + // base denomination of the relayed fungible token. + string base_denom = 2; +} diff --git a/proto/ibc/applications/transfer/v1/transfer.proto b/proto/ibc/applications/transfer/v1/transfer.proto index 7f77237621f..15ce7a40e59 100644 --- a/proto/ibc/applications/transfer/v1/transfer.proto +++ b/proto/ibc/applications/transfer/v1/transfer.proto @@ -4,16 +4,6 @@ package ibc.applications.transfer.v1; option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"; -// DenomTrace contains the base denomination for ICS20 fungible tokens and the -// source tracing information path. -message DenomTrace { - // path defines the chain of port/channel identifiers used for tracing the - // source of the fungible token. - string path = 1; - // base denomination of the relayed fungible token. - string base_denom = 2; -} - // Params defines the set of IBC transfer parameters. // NOTE: To prevent a single token from being transferred, set the // TransfersEnabled parameter to true and then set the bank module's SendEnabled diff --git a/scripts/protocgen.sh b/scripts/protocgen.sh index 92fcc89a936..e25c443039f 100755 --- a/scripts/protocgen.sh +++ b/scripts/protocgen.sh @@ -14,4 +14,7 @@ cp -r github.com/cosmos/ibc-go/v*/modules/* modules/ cp -r github.com/cosmos/ibc-go/modules/* modules/ rm -rf github.com +# copy legacy denom trace to internal/types +mv modules/apps/transfer/types/denomtrace.pb.go modules/apps/transfer/internal/types/ + go mod tidy