diff --git a/CHANGELOG.md b/CHANGELOG.md index 41c31d738fa..f7661c7f493 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -81,6 +81,11 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes +<<<<<<< HEAD +======= +* (apps/29-fee) [\#1774](https://github.com/cosmos/ibc-go/pull/1774) Change non nil relayer assertion to non empty to avoid import/export issues for genesis upgrades. +* (makefile) [\#1785](https://github.com/cosmos/ibc-go/pull/1785) Fetch the correct versions of protocol buffers dependencies from tendermint, cosmos-sdk, and ics23. +>>>>>>> 126ab2d (fix: change non nil relayer check to non empty (#1774)) * (apps/29-fee) [\#1278](https://github.com/cosmos/ibc-go/pull/1278) The URI path for the query to get all incentivized packets for a specific channel did not follow the same format as the rest of queries. ## [v3.1.0](https://github.com/cosmos/ibc-go/releases/tag/v3.1.0) - 2022-04-16 diff --git a/modules/apps/29-fee/types/errors.go b/modules/apps/29-fee/types/errors.go index 0ac40e5f824..700864b9a33 100644 --- a/modules/apps/29-fee/types/errors.go +++ b/modules/apps/29-fee/types/errors.go @@ -10,7 +10,7 @@ var ( ErrRefundAccNotFound = sdkerrors.Register(ModuleName, 3, "no account found for given refund address") ErrBalanceNotFound = sdkerrors.Register(ModuleName, 4, "balance not found for given account address") ErrFeeNotFound = sdkerrors.Register(ModuleName, 5, "there is no fee escrowed for the given packetID") - ErrRelayersNotNil = sdkerrors.Register(ModuleName, 6, "relayers must be nil. This feature is not supported") + ErrRelayersNotEmpty = sdkerrors.Register(ModuleName, 6, "relayers must not be set. This feature is not supported") ErrCounterpartyPayeeEmpty = sdkerrors.Register(ModuleName, 7, "counterparty payee must not be empty") ErrForwardRelayerAddressNotFound = sdkerrors.Register(ModuleName, 8, "forward relayer address not found") ErrFeeNotEnabled = sdkerrors.Register(ModuleName, 9, "fee module is not enabled for this channel. If this error occurs after channel setup, fee module may not be enabled") diff --git a/modules/apps/29-fee/types/fee.go b/modules/apps/29-fee/types/fee.go index 774d8857e56..e22e2d1b419 100644 --- a/modules/apps/29-fee/types/fee.go +++ b/modules/apps/29-fee/types/fee.go @@ -25,9 +25,9 @@ func (p PacketFee) Validate() error { return sdkerrors.Wrap(err, "failed to convert RefundAddress into sdk.AccAddress") } - // enforce relayer is nil - if p.Relayers != nil { - return ErrRelayersNotNil + // enforce relayers are not set + if len(p.Relayers) != 0 { + return ErrRelayersNotEmpty } if err := p.Fee.Validate(); err != nil { diff --git a/modules/apps/29-fee/types/fee_test.go b/modules/apps/29-fee/types/fee_test.go index 3abe0e382b3..a132ec5335b 100644 --- a/modules/apps/29-fee/types/fee_test.go +++ b/modules/apps/29-fee/types/fee_test.go @@ -47,6 +47,13 @@ func TestPacketFeeValidation(t *testing.T) { func() {}, true, }, + { + "success with empty slice for Relayers", + func() { + packetFee.Relayers = []string{} + }, + true, + }, { "should fail when refund address is invalid", func() { @@ -102,6 +109,13 @@ func TestPacketFeeValidation(t *testing.T) { }, false, }, + { + "should fail with non empty Relayers", + func() { + packetFee.Relayers = []string{"relayer"} + }, + false, + }, } for _, tc := range testCases { @@ -113,9 +127,9 @@ func TestPacketFeeValidation(t *testing.T) { err := packetFee.Validate() if tc.expPass { - require.NoError(t, err) + require.NoError(t, err, tc.name) } else { - require.Error(t, err) + require.Error(t, err, tc.name) } } } diff --git a/modules/apps/29-fee/types/msgs.go b/modules/apps/29-fee/types/msgs.go index 4b0fd331c9d..e008bddfed5 100644 --- a/modules/apps/29-fee/types/msgs.go +++ b/modules/apps/29-fee/types/msgs.go @@ -133,9 +133,9 @@ func (msg MsgPayPacketFee) ValidateBasic() error { return sdkerrors.Wrap(err, "failed to convert msg.Signer into sdk.AccAddress") } - // enforce relayer is nil - if msg.Relayers != nil { - return ErrRelayersNotNil + // enforce relayer is not set + if len(msg.Relayers) != 0 { + return ErrRelayersNotEmpty } if err := msg.Fee.Validate(); err != nil { diff --git a/modules/apps/29-fee/types/msgs_test.go b/modules/apps/29-fee/types/msgs_test.go index bf12f95784b..a32f91f24d9 100644 --- a/modules/apps/29-fee/types/msgs_test.go +++ b/modules/apps/29-fee/types/msgs_test.go @@ -171,6 +171,13 @@ func TestMsgPayPacketFeeValidation(t *testing.T) { func() {}, true, }, + { + "success with empty relayers", + func() { + msg.Relayers = []string{} + }, + true, + }, { "invalid channelID", func() { @@ -210,9 +217,9 @@ func TestMsgPayPacketFeeValidation(t *testing.T) { err := msg.ValidateBasic() if tc.expPass { - require.NoError(t, err) + require.NoError(t, err, tc.name) } else { - require.Error(t, err) + require.Error(t, err, tc.name) } } } @@ -257,6 +264,13 @@ func TestMsgPayPacketFeeAsyncValidation(t *testing.T) { func() {}, true, }, + { + "success with empty relayers", + func() { + msg.PacketFee.Relayers = []string{} + }, + true, + }, { "invalid channelID", func() { @@ -354,9 +368,9 @@ func TestMsgPayPacketFeeAsyncValidation(t *testing.T) { err := msg.ValidateBasic() if tc.expPass { - require.NoError(t, err) + require.NoError(t, err, tc.name) } else { - require.Error(t, err) + require.Error(t, err, tc.name) } } }