Skip to content

Commit 73fdde9

Browse files
authored
fix: ics27 check packet data length explicitly over nil check (cosmos#1882)
* using len check in favour of nil check for interchain account packet data * adding changelog * updating changelog
1 parent 45da8ac commit 73fdde9

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
6464

6565
### State Machine Breaking
6666

67+
* (apps/27-interchain-accounts) [\#1882](https://github.com/cosmos/ibc-go/pull/1882) Explicitly check length of interchain account packet data in favour of nil check.
68+
6769
### Improvements
6870

6971
* (linting) [\#1418](https://github.com/cosmos/ibc-go/pull/1418) Fix linting errors, resulting compatiblity with go1.18 linting style, golangci-lint 1.46.2 and the revivie linter. This caused breaking changes in core/04-channel, core/ante, and the testing library.

modules/apps/27-interchain-accounts/types/packet.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func (iapd InterchainAccountPacketData) ValidateBasic() error {
1616
return sdkerrors.Wrap(ErrInvalidOutgoingData, "packet data type cannot be unspecified")
1717
}
1818

19-
if iapd.Data == nil {
19+
if len(iapd.Data) == 0 {
2020
return sdkerrors.Wrap(ErrInvalidOutgoingData, "packet data cannot be empty")
2121
}
2222

modules/apps/27-interchain-accounts/types/packet_test.go

+9
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ func (suite *TypesTestSuite) TestValidateBasic() {
4040
},
4141
{
4242
"empty data",
43+
types.InterchainAccountPacketData{
44+
Type: types.EXECUTE_TX,
45+
Data: []byte{},
46+
Memo: "memo",
47+
},
48+
false,
49+
},
50+
{
51+
"nil data",
4352
types.InterchainAccountPacketData{
4453
Type: types.EXECUTE_TX,
4554
Data: nil,

0 commit comments

Comments
 (0)