From 431fffef2b5a4ffe9a6ea5e9fb60cbfd33f4546c Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Wed, 22 Sep 2021 11:10:18 +0200 Subject: [PATCH 1/2] removing ICAPrefix const in favour of VersionPrefix --- modules/apps/27-interchain-accounts/types/account.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/modules/apps/27-interchain-accounts/types/account.go b/modules/apps/27-interchain-accounts/types/account.go index 7948e2e6afa..94f653bb718 100644 --- a/modules/apps/27-interchain-accounts/types/account.go +++ b/modules/apps/27-interchain-accounts/types/account.go @@ -15,10 +15,6 @@ import ( connectiontypes "github.com/cosmos/ibc-go/modules/core/03-connection/types" ) -const ( - ICAPrefix string = "ics-27" -) - // GenerateAddress returns an sdk.AccAddress using the provided port identifier func GenerateAddress(portID string) sdk.AccAddress { return sdk.AccAddress(tmhash.SumTruncated([]byte(portID))) @@ -50,7 +46,7 @@ func GeneratePortID(owner, connectionID, counterpartyConnectionID string) (strin return "", sdkerrors.Wrap(err, "invalid counterparty connection identifier") } - return fmt.Sprintf("%s-%d-%d-%s", ICAPrefix, connectionSeq, counterpartyConnectionSeq, owner), nil + return fmt.Sprintf("%s-%d-%d-%s", VersionPrefix, connectionSeq, counterpartyConnectionSeq, owner), nil } type InterchainAccountI interface { From 323cf891de85dd56c9d60c53bdccc24fa7bbb987 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Wed, 22 Sep 2021 11:10:44 +0200 Subject: [PATCH 2/2] updating tests --- modules/apps/27-interchain-accounts/keeper/keeper_test.go | 2 +- modules/apps/27-interchain-accounts/module_test.go | 2 +- modules/apps/27-interchain-accounts/types/account_test.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/apps/27-interchain-accounts/keeper/keeper_test.go b/modules/apps/27-interchain-accounts/keeper/keeper_test.go index 0f7c12d8189..09665e8f417 100644 --- a/modules/apps/27-interchain-accounts/keeper/keeper_test.go +++ b/modules/apps/27-interchain-accounts/keeper/keeper_test.go @@ -16,7 +16,7 @@ var ( // TestOwnerAddress defines a reusable bech32 address for testing purposes TestOwnerAddress = "cosmos17dtl0mjt3t77kpuhg2edqzjpszulwhgzuj9ljs" // TestPortID defines a resuable port identifier for testing purposes - TestPortID = fmt.Sprintf("ics-27-0-0-%s", TestOwnerAddress) + TestPortID = fmt.Sprintf("%s-0-0-%s", types.VersionPrefix, TestOwnerAddress) // TestVersion defines a resuable interchainaccounts version string for testing purposes TestVersion = types.NewAppVersion(types.VersionPrefix, types.GenerateAddress(TestPortID).String()) ) diff --git a/modules/apps/27-interchain-accounts/module_test.go b/modules/apps/27-interchain-accounts/module_test.go index fbfea84a189..c23661b2d56 100644 --- a/modules/apps/27-interchain-accounts/module_test.go +++ b/modules/apps/27-interchain-accounts/module_test.go @@ -15,7 +15,7 @@ var ( // TestOwnerAddress defines a reusable bech32 address for testing purposes TestOwnerAddress = "cosmos17dtl0mjt3t77kpuhg2edqzjpszulwhgzuj9ljs" // TestPortID defines a resuable port identifier for testing purposes - TestPortID = fmt.Sprintf("ics-27-0-0-%s", TestOwnerAddress) + TestPortID = fmt.Sprintf("%s-0-0-%s", types.VersionPrefix, TestOwnerAddress) // TestVersion defines a resuable interchainaccounts version string for testing purposes TestVersion = types.NewAppVersion(types.VersionPrefix, types.GenerateAddress(TestPortID).String()) ) diff --git a/modules/apps/27-interchain-accounts/types/account_test.go b/modules/apps/27-interchain-accounts/types/account_test.go index 8f3bbc1126b..05f3f24cb3a 100644 --- a/modules/apps/27-interchain-accounts/types/account_test.go +++ b/modules/apps/27-interchain-accounts/types/account_test.go @@ -59,7 +59,7 @@ func (suite *TypesTestSuite) TestGeneratePortID() { { "success", func() {}, - fmt.Sprintf("ics-27-0-0-%s", TestOwnerAddress), + fmt.Sprintf("%s-0-0-%s", types.VersionPrefix, TestOwnerAddress), true, }, { @@ -67,7 +67,7 @@ func (suite *TypesTestSuite) TestGeneratePortID() { func() { path.EndpointA.ConnectionID = "connection-1" }, - fmt.Sprintf("ics-27-1-0-%s", TestOwnerAddress), + fmt.Sprintf("%s-1-0-%s", types.VersionPrefix, TestOwnerAddress), true, }, {