Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imp: self review comments for ics20-v2 #6360

Merged
merged 3 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (core) [\#6138](https://github.com/cosmos/ibc-go/pull/6138) Remove `Router` reference from IBC core keeper and use instead the router on the existing `PortKeeper` reference.
* (core/04-channel) [\#6023](https://github.com/cosmos/ibc-go/pull/6023) Remove emission of non-hexlified event attributes `packet_data` and `packet_ack`.
* (core) [\#6320](https://github.com/cosmos/ibc-go/pull/6320) Remove unnecessary `Proof` interface from `exported` package.
* (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.

### State Machine Breaking

Expand Down
1 change: 1 addition & 0 deletions docs/docs/05-migrations/13-v8-to-v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func AssertEvents(

### IBC core

- `UnmarshalPacketData` now takes in the context, portID, and channelID. This allows the packet data to be unmarshaled based on the channel version.
- `Router` reference has been removed from IBC core keeper: [#6138](https://github.com/cosmos/ibc-go/pull/6138)

### ICS27 - Interchain Accounts
Expand Down
2 changes: 1 addition & 1 deletion e2e/testsuite/testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ func (s *E2ETestSuite) ConfigureRelayer(ctx context.Context, chainA, chainB ibc.
pathName := s.generatePathName()

channelOptions := ibc.DefaultChannelOpts()
// TODO: better way to do this.
// For now, set the version to the latest transfer module version
// DefaultChannelOpts uses V1 at the moment
channelOptions.Version = transfertypes.V2

if channelOpts != nil {
Expand Down
4 changes: 2 additions & 2 deletions modules/apps/transfer/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ const (
// V1 defines first version of the IBC transfer module
V1 = "ics20-1"

// V2 defines the current version the IBC transfer
// module supports
// V2 defines the transfer version which introduces multidenom support
// through the FungibleTokenPacketDataV2. It is the latest version.
V2 = "ics20-2"

// escrowAddressVersion should remain as ics20-1 to avoid the address changing.
Expand Down
83 changes: 83 additions & 0 deletions modules/apps/transfer/types/token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,86 @@ func TestValidate(t *testing.T) {
})
}
}

func TestTokens_String(t *testing.T) {
cases := []struct {
name string
input Tokens
expected string
}{
{
"empty tokens",
Tokens{},
"",
},
{
"single token, no trace",
Tokens{
Token{
Denom: "tree",
Amount: "1",
Trace: []string{},
},
},
`denom:"tree" amount:"1" `,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh an empty space even with a single token 🥸

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea 🙃

},
{
"single token with trace",
Tokens{
Token{
Denom: "tree",
Amount: "1",
Trace: []string{"portid/channelid"},
},
},
`denom:"tree" amount:"1" trace:"portid/channelid" `,
},
{
"multiple tokens, no trace",
Tokens{
Token{
Denom: "tree",
Amount: "1",
Trace: []string{},
},
Token{
Denom: "gas",
Amount: "2",
Trace: []string{},
},
Token{
Denom: "mineral",
Amount: "3",
Trace: []string{},
},
},
`denom:"tree" amount:"1" ,denom:"gas" amount:"2" ,denom:"mineral" amount:"3" `,
},
{
"multiple tokens, trace and no trace",
Tokens{
Token{
Denom: "tree",
Amount: "1",
Trace: []string{},
},
Token{
Denom: "gas",
Amount: "2",
Trace: []string{"portid/channelid"},
},
Token{
Denom: "mineral",
Amount: "3",
Trace: []string{"portid/channelid", "transfer/channel-52"},
},
},
`denom:"tree" amount:"1" ,denom:"gas" amount:"2" trace:"portid/channelid" ,denom:"mineral" amount:"3" trace:"portid/channelid" trace:"transfer/channel-52" `,
},
}

for _, tt := range cases {
require.Equal(t, tt.expected, tt.input.String())
}

}
Loading