From 22815aa7a8c8e883433a91250db76774daa6afae Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Sun, 15 Oct 2023 23:56:53 +0200 Subject: [PATCH 01/10] change value of long string constant (might need to change it still) --- testing/values.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/values.go b/testing/values.go index 2741b1a5fed..519b337704e 100644 --- a/testing/values.go +++ b/testing/values.go @@ -43,7 +43,7 @@ const ( Title = "title" Description = "description" - LongString = "LoremipsumdolorsitameconsecteturadipiscingeliseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequDuisauteiruredolorinreprehenderitinvoluptateelitsseillumoloreufugiatnullaariaturEcepteurintoccaectupidatatonroidentuntnulpauifficiaeseruntmollitanimidestlaborum" + LongString = "LoremipsumdolorsitameconsecteturadipiscingeliseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequDuisauteiruredolorinreprehenderitinvoluptateelitsseillumoloreufugiatnullaariaturEcepteurintoccaectupidatatonroidentuntnulpauifficiaeseruntmollitanimidestlaborumLoremipsumdolorsitameconsecteturadipiscingeliseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequDuisauteiruredolorinreprehenderitinvoluptateelitsseillumoloreufugiatnullaariaturEcepteurintoccaectupidatatonroidentuntnulpauifficiaeseruntmollitanimidestlaborumLoremipsumdolorsitameconsecteturadipiscingeliseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequDuisauteiruredolorinreprehenderitinvoluptateelitsseillumoloreufugiatnullaariaturEcepteurintoccaectupidatatonroidentuntnulpauifficiaeseruntmollitanimidestlaborumLoremipsumdolorsitameconsecteturadipiscingeliseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequDuisauteiruredolorinreprehenderitinvoluptateelitsseillumoloreufugiatnullaariaturEcepteurintoccaectupidatatonroidentuntnulpauifficiaeseruntmollitanimidestlaborumLoremipsumdolorsitameconsecteturadipiscingeliseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequDuisauteiruredolorinreprehenderitinvoluptateelitsseillumoloreufugiatnullaariaturEcepteurintoccaectupidatatonroidentuntnulpauifficiaeseruntmollitanimidestlaborumLoremipsumdolorsitameconsecteturadipiscingeliseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequDuisauteiruredolorinreprehenderitinvoluptateelitsseillumoloreufugiatnullaariaturEcepteurintoccaectupidatatonroidentuntnulpauifficiaes" ) var ( From cc41f7d80a7860d40686fa94a97276af278141a7 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Mon, 16 Oct 2023 13:00:18 +0200 Subject: [PATCH 02/10] add function to generate random string of a given length --- .../apps/27-interchain-accounts/types/account_test.go | 2 +- testing/utils.go | 10 ++++++++++ testing/values.go | 3 ++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/apps/27-interchain-accounts/types/account_test.go b/modules/apps/27-interchain-accounts/types/account_test.go index 2130a46edf4..9ff7dc19841 100644 --- a/modules/apps/27-interchain-accounts/types/account_test.go +++ b/modules/apps/27-interchain-accounts/types/account_test.go @@ -79,7 +79,7 @@ func (suite *TypesTestSuite) TestValidateAccountAddress() { }, { "address is too long", - ibctesting.LongString, + ibctesting.GenerateString(uint(types.DefaultMaxAddrLength) + 1), false, }, } diff --git a/testing/utils.go b/testing/utils.go index 302d0e70822..332940608e1 100644 --- a/testing/utils.go +++ b/testing/utils.go @@ -1,6 +1,7 @@ package ibctesting import ( + "rand" "testing" "github.com/stretchr/testify/require" @@ -23,3 +24,12 @@ func ApplyValSetChanges(tb testing.TB, valSet *tmtypes.ValidatorSet, valUpdates return newVals } + +// GenerateString generates a random string of the given length in bytes +func GenerateString(length uint) string { + bytes := make([]byte, length) + for i := range bytes { + bytes[i] = charset[rand.Intn(len(charset))] + } + return string(bytes) +} diff --git a/testing/values.go b/testing/values.go index 519b337704e..115f3b39281 100644 --- a/testing/values.go +++ b/testing/values.go @@ -43,7 +43,8 @@ const ( Title = "title" Description = "description" - LongString = "LoremipsumdolorsitameconsecteturadipiscingeliseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequDuisauteiruredolorinreprehenderitinvoluptateelitsseillumoloreufugiatnullaariaturEcepteurintoccaectupidatatonroidentuntnulpauifficiaeseruntmollitanimidestlaborumLoremipsumdolorsitameconsecteturadipiscingeliseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequDuisauteiruredolorinreprehenderitinvoluptateelitsseillumoloreufugiatnullaariaturEcepteurintoccaectupidatatonroidentuntnulpauifficiaeseruntmollitanimidestlaborumLoremipsumdolorsitameconsecteturadipiscingeliseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequDuisauteiruredolorinreprehenderitinvoluptateelitsseillumoloreufugiatnullaariaturEcepteurintoccaectupidatatonroidentuntnulpauifficiaeseruntmollitanimidestlaborumLoremipsumdolorsitameconsecteturadipiscingeliseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequDuisauteiruredolorinreprehenderitinvoluptateelitsseillumoloreufugiatnullaariaturEcepteurintoccaectupidatatonroidentuntnulpauifficiaeseruntmollitanimidestlaborumLoremipsumdolorsitameconsecteturadipiscingeliseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequDuisauteiruredolorinreprehenderitinvoluptateelitsseillumoloreufugiatnullaariaturEcepteurintoccaectupidatatonroidentuntnulpauifficiaeseruntmollitanimidestlaborumLoremipsumdolorsitameconsecteturadipiscingeliseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequDuisauteiruredolorinreprehenderitinvoluptateelitsseillumoloreufugiatnullaariaturEcepteurintoccaectupidatatonroidentuntnulpauifficiaes" + // character set used for generating a random string in GenerateString + charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ) var ( From b989064820452a3626f9faf49deb9991da00bdef Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Mon, 16 Oct 2023 13:15:07 +0200 Subject: [PATCH 03/10] fix package --- testing/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/utils.go b/testing/utils.go index 332940608e1..a1178929e3f 100644 --- a/testing/utils.go +++ b/testing/utils.go @@ -1,7 +1,7 @@ package ibctesting import ( - "rand" + "math/rand" "testing" "github.com/stretchr/testify/require" From cd8b722a5e7898b56eb11310550e31d83a6bfda4 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Wed, 18 Oct 2023 16:22:44 +0200 Subject: [PATCH 04/10] fix(statemachine)!: add check for length of counterparty payee in `MsgRegisterCounterpartyPayee` (#4870) * add check for length of counterparty payee in MsgRegisterCounterpartyPayee * change test value --- modules/apps/29-fee/types/msgs.go | 6 ++++++ modules/apps/29-fee/types/msgs_test.go | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/modules/apps/29-fee/types/msgs.go b/modules/apps/29-fee/types/msgs.go index 095d36a604d..6d5b34b7007 100644 --- a/modules/apps/29-fee/types/msgs.go +++ b/modules/apps/29-fee/types/msgs.go @@ -12,6 +12,8 @@ import ( ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors" ) +const MaximumCounterpartyPayeeLength = 2048 // maximum length of the counterparty payee in bytes + var ( _ sdk.Msg = (*MsgRegisterPayee)(nil) _ sdk.Msg = (*MsgRegisterCounterpartyPayee)(nil) @@ -100,6 +102,10 @@ func (msg MsgRegisterCounterpartyPayee) ValidateBasic() error { return ErrCounterpartyPayeeEmpty } + if len(msg.CounterpartyPayee) > MaximumCounterpartyPayeeLength { + return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "counterparty payee addresss must not exceed %d bytes", MaximumCounterpartyPayeeLength) + } + return nil } diff --git a/modules/apps/29-fee/types/msgs_test.go b/modules/apps/29-fee/types/msgs_test.go index 4c59160cb1e..6f1d2bce4eb 100644 --- a/modules/apps/29-fee/types/msgs_test.go +++ b/modules/apps/29-fee/types/msgs_test.go @@ -139,6 +139,13 @@ func TestMsgRegisterCountepartyPayeeValidation(t *testing.T) { }, false, }, + { + "invalid counterparty payee address: too long", + func() { + msg.CounterpartyPayee = ibctesting.GenerateString(types.MaximumCounterpartyPayeeLength + 1) + }, + false, + }, } for i, tc := range testCases { From cdf3cb778ef987dcf5bc7c4404f733c329e4db77 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Wed, 18 Oct 2023 16:25:28 +0200 Subject: [PATCH 05/10] add check for length of owner address (#4874) --- .../apps/27-interchain-accounts/controller/types/msgs.go | 6 ++++++ .../27-interchain-accounts/controller/types/msgs_test.go | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/modules/apps/27-interchain-accounts/controller/types/msgs.go b/modules/apps/27-interchain-accounts/controller/types/msgs.go index b600942bf01..1187b579ff3 100644 --- a/modules/apps/27-interchain-accounts/controller/types/msgs.go +++ b/modules/apps/27-interchain-accounts/controller/types/msgs.go @@ -12,6 +12,8 @@ import ( ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors" ) +const MaximumOwnerLength = 2048 // maximum length of the owner in bytes + var ( _ sdk.Msg = (*MsgRegisterInterchainAccount)(nil) _ sdk.Msg = (*MsgSendTx)(nil) @@ -41,6 +43,10 @@ func (msg MsgRegisterInterchainAccount) ValidateBasic() error { return errorsmod.Wrap(ibcerrors.ErrInvalidAddress, "owner address cannot be empty") } + if len(msg.Owner) > MaximumOwnerLength { + return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "owner addresss must not exceed %d bytes", MaximumOwnerLength) + } + return nil } diff --git a/modules/apps/27-interchain-accounts/controller/types/msgs_test.go b/modules/apps/27-interchain-accounts/controller/types/msgs_test.go index 13ef2c9ae1a..33a02068464 100644 --- a/modules/apps/27-interchain-accounts/controller/types/msgs_test.go +++ b/modules/apps/27-interchain-accounts/controller/types/msgs_test.go @@ -64,6 +64,13 @@ func TestMsgRegisterInterchainAccountValidateBasic(t *testing.T) { }, false, }, + { + "owner address is too long", + func() { + msg.Owner = ibctesting.GenerateString(types.MaximumOwnerLength + 1) + }, + false, + }, } for i, tc := range testCases { From bb45adac19a5a316b283a03d86dbfdc67bd5e540 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Mon, 30 Oct 2023 13:23:03 +0100 Subject: [PATCH 06/10] add check for length of owner in MsgSendTx (#4875) --- .../apps/27-interchain-accounts/controller/types/msgs.go | 4 ++++ .../27-interchain-accounts/controller/types/msgs_test.go | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/modules/apps/27-interchain-accounts/controller/types/msgs.go b/modules/apps/27-interchain-accounts/controller/types/msgs.go index 1187b579ff3..dc28489066b 100644 --- a/modules/apps/27-interchain-accounts/controller/types/msgs.go +++ b/modules/apps/27-interchain-accounts/controller/types/msgs.go @@ -80,6 +80,10 @@ func (msg MsgSendTx) ValidateBasic() error { return errorsmod.Wrap(ibcerrors.ErrInvalidAddress, "owner address cannot be empty") } + if len(msg.Owner) > MaximumOwnerLength { + return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "owner addresss must not exceed %d bytes", MaximumOwnerLength) + } + if err := msg.PacketData.ValidateBasic(); err != nil { return errorsmod.Wrap(err, "invalid interchain account packet data") } diff --git a/modules/apps/27-interchain-accounts/controller/types/msgs_test.go b/modules/apps/27-interchain-accounts/controller/types/msgs_test.go index 33a02068464..541f3830fb6 100644 --- a/modules/apps/27-interchain-accounts/controller/types/msgs_test.go +++ b/modules/apps/27-interchain-accounts/controller/types/msgs_test.go @@ -128,6 +128,13 @@ func TestMsgSendTxValidateBasic(t *testing.T) { }, false, }, + { + "owner address is too long", + func() { + msg.Owner = ibctesting.GenerateString(types.MaximumOwnerLength + 1) + }, + false, + }, { "relative timeout is not set", func() { From 1a924ecf7389541f63d1348015668105fe1353c2 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Mon, 30 Oct 2023 13:23:32 +0100 Subject: [PATCH 07/10] add length check of memo field (#4915) --- modules/apps/transfer/types/errors.go | 1 + modules/apps/transfer/types/msgs.go | 5 +++++ modules/apps/transfer/types/msgs_test.go | 1 + 3 files changed, 7 insertions(+) diff --git a/modules/apps/transfer/types/errors.go b/modules/apps/transfer/types/errors.go index d62134b27cd..b3e45aa2ae2 100644 --- a/modules/apps/transfer/types/errors.go +++ b/modules/apps/transfer/types/errors.go @@ -15,4 +15,5 @@ var ( ErrReceiveDisabled = errorsmod.Register(ModuleName, 8, "fungible token transfers to this chain are disabled") ErrMaxTransferChannels = errorsmod.Register(ModuleName, 9, "max transfer channels") ErrInvalidAuthorization = errorsmod.Register(ModuleName, 10, "invalid transfer authorization") + ErrInvalidMemo = errorsmod.Register(ModuleName, 11, "invalid memo") ) diff --git a/modules/apps/transfer/types/msgs.go b/modules/apps/transfer/types/msgs.go index 33915637017..93558d313d6 100644 --- a/modules/apps/transfer/types/msgs.go +++ b/modules/apps/transfer/types/msgs.go @@ -12,6 +12,8 @@ import ( ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors" ) +const MaximumMemoLength = 32768 // maximum length of the memo in bytes + var ( _ sdk.Msg = (*MsgUpdateParams)(nil) _ sdk.Msg = (*MsgTransfer)(nil) @@ -91,6 +93,9 @@ func (msg MsgTransfer) ValidateBasic() error { if strings.TrimSpace(msg.Receiver) == "" { return errorsmod.Wrap(ibcerrors.ErrInvalidAddress, "missing recipient address") } + if len(msg.Memo) > MaximumMemoLength { + return errorsmod.Wrapf(ErrInvalidMemo, "memo must not exceed %d bytes", MaximumMemoLength) + } return ValidateIBCDenom(msg.Token.Denom) } diff --git a/modules/apps/transfer/types/msgs_test.go b/modules/apps/transfer/types/msgs_test.go index 3afae766edb..2e769659fba 100644 --- a/modules/apps/transfer/types/msgs_test.go +++ b/modules/apps/transfer/types/msgs_test.go @@ -60,6 +60,7 @@ func TestMsgTransferValidation(t *testing.T) { {"port id contains non-alpha", types.NewMsgTransfer(invalidPort, validChannel, coin, sender, receiver, timeoutHeight, 0, ""), false}, {"too short channel id", types.NewMsgTransfer(validPort, invalidShortChannel, coin, sender, receiver, timeoutHeight, 0, ""), false}, {"too long channel id", types.NewMsgTransfer(validPort, invalidLongChannel, coin, sender, receiver, timeoutHeight, 0, ""), false}, + {"too long memo", types.NewMsgTransfer(validPort, validChannel, coin, sender, receiver, timeoutHeight, 0, ibctesting.GenerateString(types.MaximumMemoLength+1)), false}, {"channel id contains non-alpha", types.NewMsgTransfer(validPort, invalidChannel, coin, sender, receiver, timeoutHeight, 0, ""), false}, {"invalid denom", types.NewMsgTransfer(validPort, validChannel, invalidDenomCoin, sender, receiver, timeoutHeight, 0, ""), false}, {"zero coin", types.NewMsgTransfer(validPort, validChannel, zeroCoin, sender, receiver, timeoutHeight, 0, ""), false}, From 075f65fbaca5ddfa173223da534b5da257a9f772 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Mon, 30 Oct 2023 21:24:54 +0700 Subject: [PATCH 08/10] fix: limit receive addresses to 2kb (#2983) * add length validation of receiver address in msg transfer * fix test. Next will add a test case that ensures that >2kb is rejected. * correct length of receiver address * lint * tidy * remove unused const / add test for recipient address length check * go mod tidy * Update msgs.go * rename variable * use testing value * fix package * lint --------- Co-authored-by: Du Nguyen Co-authored-by: Carlos Rodriguez --- modules/apps/transfer/types/msgs.go | 8 +++++++- modules/apps/transfer/types/msgs_test.go | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/apps/transfer/types/msgs.go b/modules/apps/transfer/types/msgs.go index 93558d313d6..eaa56048c4b 100644 --- a/modules/apps/transfer/types/msgs.go +++ b/modules/apps/transfer/types/msgs.go @@ -12,7 +12,10 @@ import ( ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors" ) -const MaximumMemoLength = 32768 // maximum length of the memo in bytes +const ( + MaximumReceiverLength = 2048 // maximum length of the receiver address in bytes + MaximumMemoLength = 32768 // maximum length of the memo in bytes +) var ( _ sdk.Msg = (*MsgUpdateParams)(nil) @@ -93,6 +96,9 @@ func (msg MsgTransfer) ValidateBasic() error { if strings.TrimSpace(msg.Receiver) == "" { return errorsmod.Wrap(ibcerrors.ErrInvalidAddress, "missing recipient address") } + if len(msg.Receiver) > MaximumReceiverLength { + return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "recipient addresss must not exceed %d bytes", MaximumReceiverLength) + } if len(msg.Memo) > MaximumMemoLength { return errorsmod.Wrapf(ErrInvalidMemo, "memo must not exceed %d bytes", MaximumMemoLength) } diff --git a/modules/apps/transfer/types/msgs_test.go b/modules/apps/transfer/types/msgs_test.go index 2e769659fba..6dc2dedc31a 100644 --- a/modules/apps/transfer/types/msgs_test.go +++ b/modules/apps/transfer/types/msgs_test.go @@ -66,6 +66,7 @@ func TestMsgTransferValidation(t *testing.T) { {"zero coin", types.NewMsgTransfer(validPort, validChannel, zeroCoin, sender, receiver, timeoutHeight, 0, ""), false}, {"missing sender address", types.NewMsgTransfer(validPort, validChannel, coin, emptyAddr, receiver, timeoutHeight, 0, ""), false}, {"missing recipient address", types.NewMsgTransfer(validPort, validChannel, coin, sender, "", timeoutHeight, 0, ""), false}, + {"too long recipient address", types.NewMsgTransfer(validPort, validChannel, coin, sender, ibctesting.GenerateString(types.MaximumReceiverLength+1), timeoutHeight, 0, ""), false}, {"empty coin", types.NewMsgTransfer(validPort, validChannel, sdk.Coin{}, sender, receiver, timeoutHeight, 0, ""), false}, } From 0632cc61e1837a1572bac7fb931616d729233545 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Mon, 30 Oct 2023 17:24:48 +0100 Subject: [PATCH 09/10] add comment --- modules/apps/27-interchain-accounts/controller/types/msgs.go | 2 +- modules/apps/29-fee/types/msgs.go | 2 +- modules/apps/transfer/types/msgs.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/types/msgs.go b/modules/apps/27-interchain-accounts/controller/types/msgs.go index dc28489066b..01b04cc05a3 100644 --- a/modules/apps/27-interchain-accounts/controller/types/msgs.go +++ b/modules/apps/27-interchain-accounts/controller/types/msgs.go @@ -12,7 +12,7 @@ import ( ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors" ) -const MaximumOwnerLength = 2048 // maximum length of the owner in bytes +const MaximumOwnerLength = 2048 // maximum length of the owner in bytes (value chosen arbitrarily) var ( _ sdk.Msg = (*MsgRegisterInterchainAccount)(nil) diff --git a/modules/apps/29-fee/types/msgs.go b/modules/apps/29-fee/types/msgs.go index 6d5b34b7007..3010b9d80a7 100644 --- a/modules/apps/29-fee/types/msgs.go +++ b/modules/apps/29-fee/types/msgs.go @@ -12,7 +12,7 @@ import ( ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors" ) -const MaximumCounterpartyPayeeLength = 2048 // maximum length of the counterparty payee in bytes +const MaximumCounterpartyPayeeLength = 2048 // maximum length of the counterparty payee in bytes (value chosen arbitrarily) var ( _ sdk.Msg = (*MsgRegisterPayee)(nil) diff --git a/modules/apps/transfer/types/msgs.go b/modules/apps/transfer/types/msgs.go index eaa56048c4b..af13a240e82 100644 --- a/modules/apps/transfer/types/msgs.go +++ b/modules/apps/transfer/types/msgs.go @@ -13,8 +13,8 @@ import ( ) const ( - MaximumReceiverLength = 2048 // maximum length of the receiver address in bytes - MaximumMemoLength = 32768 // maximum length of the memo in bytes + MaximumReceiverLength = 2048 // maximum length of the receiver address in bytes (value chosen arbitrarily) + MaximumMemoLength = 32768 // maximum length of the memo in bytes (value chosen arbitrarily) ) var ( From 6a0eda4eefd543e968498b75390a9e068153d3ec Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Tue, 31 Oct 2023 09:13:22 +0100 Subject: [PATCH 10/10] Apply suggestions from code review Co-authored-by: Charly --- modules/apps/27-interchain-accounts/controller/types/msgs.go | 4 ++-- modules/apps/29-fee/types/msgs.go | 2 +- modules/apps/transfer/types/msgs.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/types/msgs.go b/modules/apps/27-interchain-accounts/controller/types/msgs.go index 01b04cc05a3..213fcbfbc04 100644 --- a/modules/apps/27-interchain-accounts/controller/types/msgs.go +++ b/modules/apps/27-interchain-accounts/controller/types/msgs.go @@ -44,7 +44,7 @@ func (msg MsgRegisterInterchainAccount) ValidateBasic() error { } if len(msg.Owner) > MaximumOwnerLength { - return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "owner addresss must not exceed %d bytes", MaximumOwnerLength) + return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "owner address must not exceed %d bytes", MaximumOwnerLength) } return nil @@ -81,7 +81,7 @@ func (msg MsgSendTx) ValidateBasic() error { } if len(msg.Owner) > MaximumOwnerLength { - return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "owner addresss must not exceed %d bytes", MaximumOwnerLength) + return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "owner address must not exceed %d bytes", MaximumOwnerLength) } if err := msg.PacketData.ValidateBasic(); err != nil { diff --git a/modules/apps/29-fee/types/msgs.go b/modules/apps/29-fee/types/msgs.go index 3010b9d80a7..af2a9287a65 100644 --- a/modules/apps/29-fee/types/msgs.go +++ b/modules/apps/29-fee/types/msgs.go @@ -103,7 +103,7 @@ func (msg MsgRegisterCounterpartyPayee) ValidateBasic() error { } if len(msg.CounterpartyPayee) > MaximumCounterpartyPayeeLength { - return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "counterparty payee addresss must not exceed %d bytes", MaximumCounterpartyPayeeLength) + return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "counterparty payee address must not exceed %d bytes", MaximumCounterpartyPayeeLength) } return nil diff --git a/modules/apps/transfer/types/msgs.go b/modules/apps/transfer/types/msgs.go index af13a240e82..ad126d149c7 100644 --- a/modules/apps/transfer/types/msgs.go +++ b/modules/apps/transfer/types/msgs.go @@ -97,7 +97,7 @@ func (msg MsgTransfer) ValidateBasic() error { return errorsmod.Wrap(ibcerrors.ErrInvalidAddress, "missing recipient address") } if len(msg.Receiver) > MaximumReceiverLength { - return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "recipient addresss must not exceed %d bytes", MaximumReceiverLength) + return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "recipient address must not exceed %d bytes", MaximumReceiverLength) } if len(msg.Memo) > MaximumMemoLength { return errorsmod.Wrapf(ErrInvalidMemo, "memo must not exceed %d bytes", MaximumMemoLength)