Skip to content

Commit

Permalink
fix: ics27 check packet data length explicitly over nil check (#1882) (
Browse files Browse the repository at this point in the history
…#1898)

* using len check in favour of nil check for interchain account packet data

* adding changelog

* updating changelog

(cherry picked from commit 73fdde9)

Co-authored-by: Damian Nolan <[email protected]>
  • Loading branch information
mergify[bot] and damiannolan authored Aug 7, 2022
1 parent bc534e9 commit 424b83f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ Ref: https://keepachangelog.com/en/1.0.0/

### State Machine Breaking

* (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.

### Improvements

* (app/20-transfer) [\#1680](https://github.com/cosmos/ibc-go/pull/1680) Adds migration to correct any malformed trace path information of tokens with denoms that contains slashes. The transfer module consensus version has been bumped to 2.
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/27-interchain-accounts/types/packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func (iapd InterchainAccountPacketData) ValidateBasic() error {
return sdkerrors.Wrap(ErrInvalidOutgoingData, "packet data type cannot be unspecified")
}

if iapd.Data == nil {
if len(iapd.Data) == 0 {
return sdkerrors.Wrap(ErrInvalidOutgoingData, "packet data cannot be empty")
}

Expand Down
9 changes: 9 additions & 0 deletions modules/apps/27-interchain-accounts/types/packet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ func (suite *TypesTestSuite) TestValidateBasic() {
},
{
"empty data",
types.InterchainAccountPacketData{
Type: types.EXECUTE_TX,
Data: []byte{},
Memo: "memo",
},
false,
},
{
"nil data",
types.InterchainAccountPacketData{
Type: types.EXECUTE_TX,
Data: nil,
Expand Down

0 comments on commit 424b83f

Please sign in to comment.