-
Notifications
You must be signed in to change notification settings - Fork 580
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
[FEAT] ICS20-V2 #6352
[FEAT] ICS20-V2 #6352
Changes from 30 commits
c07bca9
e66bd89
034f472
4cc6a85
71f830c
28ff9b6
4e55137
ca056cf
147cf17
9bbfa1a
4f57916
4c333c5
0478cb9
f39d173
9b39944
06ca9a5
7897ef3
786a4f1
5747756
7e2e6df
a84b0e7
43877df
8eae033
dbcff45
bb69698
f19a145
8f86dda
d4b06c8
a9391a4
575403e
50ccd94
87eb32e
e8b9d5a
6d40bc6
c171059
9890f53
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1276,13 +1276,15 @@ func (suite *InterchainAccountsTestSuite) TestPacketDataUnmarshalerInterface() { | |
Memo: "", | ||
} | ||
|
||
packetData, err := controller.IBCMiddleware{}.UnmarshalPacketData(expPacketData.GetBytes()) | ||
// Context, port identifier and channel identifier are unused for controller. | ||
packetData, err := controller.IBCMiddleware{}.UnmarshalPacketData(suite.chainA.GetContext(), "", "", expPacketData.GetBytes()) | ||
suite.Require().NoError(err) | ||
suite.Require().Equal(expPacketData, packetData) | ||
|
||
// test invalid packet data | ||
invalidPacketData := []byte("invalid packet data") | ||
packetData, err = controller.IBCMiddleware{}.UnmarshalPacketData(invalidPacketData) | ||
// Context, port identifier and channel identifier are not used for controller. | ||
packetData, err = controller.IBCMiddleware{}.UnmarshalPacketData(suite.chainA.GetContext(), "", "", invalidPacketData) | ||
Comment on lines
+1279
to
+1287
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure proper error handling for invalid packet data. The test for invalid packet data correctly checks for an error, which is good practice. However, it would be beneficial to assert the type of error to ensure that it is specifically related to packet data unmarshalling. This can help identify if the correct error handling paths are being triggered. // Suggested addition to the test to check for specific error type
suite.Require().IsType(icatypes.ErrInvalidPacketData, err, "Expected error type icatypes.ErrInvalidPacketData") |
||
suite.Require().Error(err) | ||
suite.Require().Nil(packetData) | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -472,11 +472,11 @@ func (im IBCMiddleware) GetAppVersion(ctx sdk.Context, portID, channelID string) | |||||||||||||||||||||||||||||||
// UnmarshalPacketData attempts to use the underlying app to unmarshal the packet data. | ||||||||||||||||||||||||||||||||
// If the underlying app does not support the PacketDataUnmarshaler interface, an error is returned. | ||||||||||||||||||||||||||||||||
// This function implements the optional PacketDataUnmarshaler interface required for ADR 008 support. | ||||||||||||||||||||||||||||||||
func (im IBCMiddleware) UnmarshalPacketData(bz []byte) (interface{}, error) { | ||||||||||||||||||||||||||||||||
func (im IBCMiddleware) UnmarshalPacketData(ctx sdk.Context, portID, channelID string, bz []byte) (interface{}, error) { | ||||||||||||||||||||||||||||||||
unmarshaler, ok := im.app.(porttypes.PacketDataUnmarshaler) | ||||||||||||||||||||||||||||||||
if !ok { | ||||||||||||||||||||||||||||||||
return nil, errorsmod.Wrapf(types.ErrUnsupportedAction, "underlying app does not implement %T", (*porttypes.PacketDataUnmarshaler)(nil)) | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
return unmarshaler.UnmarshalPacketData(bz) | ||||||||||||||||||||||||||||||||
return unmarshaler.UnmarshalPacketData(ctx, portID, channelID, bz) | ||||||||||||||||||||||||||||||||
Comment on lines
+475
to
+481
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure proper error handling when the underlying app does not support packet data unmarshaling. The error message in - return nil, errorsmod.Wrapf(types.ErrUnsupportedAction, "underlying app does not implement %T", (*porttypes.PacketDataUnmarshaler)(nil))
+ return nil, errorsmod.Wrapf(types.ErrUnsupportedAction, "underlying app for port %s and channel %s does not implement PacketDataUnmarshaler", portID, channelID) Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove trailing spaces.
Committable suggestion