From 1c1ece81ba4ebeb10cb79191747e3665fc4c8ec8 Mon Sep 17 00:00:00 2001 From: chandiniv1 Date: Wed, 13 Dec 2023 14:20:18 +0530 Subject: [PATCH 01/12] Add coordinator Setup functions to the Path type --- .../controller/ibc_middleware_test.go | 32 ++--- .../controller/keeper/account_test.go | 6 +- .../controller/keeper/genesis_test.go | 2 +- .../controller/keeper/grpc_query_test.go | 2 +- .../controller/keeper/handshake_test.go | 6 +- .../controller/keeper/keeper_test.go | 10 +- .../controller/keeper/migrations_test.go | 2 +- .../controller/keeper/msg_server_test.go | 4 +- .../controller/keeper/relay_test.go | 4 +- .../migrations/v6/migrations_test.go | 2 +- .../host/ibc_module_test.go | 22 ++-- .../host/keeper/genesis_test.go | 2 +- .../host/keeper/handshake_test.go | 6 +- .../host/keeper/keeper_test.go | 8 +- .../host/keeper/relay_test.go | 10 +- .../types/metadata_test.go | 6 +- .../27-interchain-accounts/types/port_test.go | 2 +- modules/apps/29-fee/ibc_middleware_test.go | 22 ++-- modules/apps/29-fee/ica_test.go | 2 +- modules/apps/29-fee/keeper/escrow_test.go | 12 +- modules/apps/29-fee/keeper/events_test.go | 4 +- modules/apps/29-fee/keeper/grpc_query_test.go | 6 +- modules/apps/29-fee/keeper/keeper_test.go | 8 +- modules/apps/29-fee/keeper/msg_server_test.go | 8 +- modules/apps/29-fee/keeper/relay_test.go | 10 +- modules/apps/29-fee/transfer_test.go | 2 +- modules/apps/transfer/ibc_module_test.go | 6 +- .../apps/transfer/keeper/invariants_test.go | 2 +- .../apps/transfer/keeper/mbt_relay_test.go | 4 +- .../apps/transfer/keeper/migrations_test.go | 4 +- .../apps/transfer/keeper/msg_server_test.go | 2 +- modules/apps/transfer/keeper/relay_test.go | 24 ++-- modules/apps/transfer/transfer_test.go | 4 +- .../types/transfer_authorization_test.go | 2 +- modules/core/02-client/keeper/client_test.go | 10 +- .../core/02-client/keeper/grpc_query_test.go | 20 +-- modules/core/02-client/keeper/keeper_test.go | 8 +- .../02-client/migrations/v7/genesis_test.go | 2 +- .../02-client/migrations/v7/store_test.go | 2 +- .../core/02-client/proposal_handler_test.go | 4 +- modules/core/02-client/types/client_test.go | 2 +- modules/core/02-client/types/genesis_test.go | 2 +- .../02-client/types/legacy_proposal_test.go | 4 +- .../03-connection/keeper/grpc_query_test.go | 20 +-- .../03-connection/keeper/handshake_test.go | 10 +- .../core/03-connection/keeper/keeper_test.go | 20 +-- .../core/03-connection/keeper/verify_test.go | 16 +-- .../core/04-channel/keeper/grpc_query_test.go | 68 +++++----- .../core/04-channel/keeper/handshake_test.go | 84 ++++++------- modules/core/04-channel/keeper/keeper_test.go | 18 +-- modules/core/04-channel/keeper/packet_test.go | 116 +++++++++--------- .../core/04-channel/keeper/timeout_test.go | 54 ++++---- modules/core/ante/ante_test.go | 2 +- modules/core/genesis_test.go | 6 +- modules/core/keeper/msg_server_test.go | 64 +++++----- modules/core/migrations/v7/genesis_test.go | 2 +- .../06-solomachine/client_state_test.go | 8 +- .../07-tendermint/client_state_test.go | 8 +- .../07-tendermint/genesis_test.go | 2 +- .../migrations/migrations_test.go | 2 +- .../07-tendermint/proposal_handle_test.go | 12 +- .../light-clients/07-tendermint/store_test.go | 2 +- .../07-tendermint/update_test.go | 2 +- .../07-tendermint/upgrade_test.go | 2 +- testing/chain_test.go | 2 +- testing/coordinator.go | 51 -------- testing/path.go | 94 ++++++++++++++ 67 files changed, 505 insertions(+), 462 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go b/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go index 3394c1af332..0aaa55cb0b0 100644 --- a/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go +++ b/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go @@ -199,7 +199,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenInit() { isNilApp = false path = NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() // mock init interchain account portID, err := icatypes.NewControllerPortID(TestOwnerAddress) @@ -264,7 +264,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenInit() { func (suite *InterchainAccountsTestSuite) TestChanOpenTry() { suite.SetupTest() // reset path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := RegisterInterchainAccount(path.EndpointA, TestOwnerAddress) suite.Require().NoError(err) @@ -365,7 +365,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenAck() { isNilApp = false path = NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := RegisterInterchainAccount(path.EndpointA, TestOwnerAddress) suite.Require().NoError(err) @@ -404,7 +404,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenAck() { func (suite *InterchainAccountsTestSuite) TestChanOpenConfirm() { suite.SetupTest() // reset path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := RegisterInterchainAccount(path.EndpointA, TestOwnerAddress) suite.Require().NoError(err) @@ -449,7 +449,7 @@ func (suite *InterchainAccountsTestSuite) TestChanOpenConfirm() { // OnChanCloseInit on controller (chainA) func (suite *InterchainAccountsTestSuite) TestOnChanCloseInit() { path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -496,7 +496,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanCloseConfirm() { isNilApp = false path = NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -542,7 +542,7 @@ func (suite *InterchainAccountsTestSuite) TestOnRecvPacket() { suite.SetupTest() // reset path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -628,7 +628,7 @@ func (suite *InterchainAccountsTestSuite) TestOnAcknowledgementPacket() { isNilApp = false path = NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -723,7 +723,7 @@ func (suite *InterchainAccountsTestSuite) TestOnTimeoutPacket() { isNilApp = false path = NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -788,14 +788,14 @@ func (suite *InterchainAccountsTestSuite) TestSingleHostMultipleControllers() { // Setup a new path from A(controller) -> B(host) pathAToB = NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(pathAToB) + pathAToB.SetupConnections() err := SetupICAPath(pathAToB, TestOwnerAddress) suite.Require().NoError(err) // Setup a new path from C(controller) -> B(host) pathCToB = NewICAPath(suite.chainC, suite.chainB) - suite.coordinator.SetupConnections(pathCToB) + pathCToB.SetupConnections() // NOTE: Here the version metadata is overridden to include to the next host connection sequence (i.e. chainB's connection to chainC) // SetupICAPath() will set endpoint.ChannelConfig.Version to TestVersion @@ -833,7 +833,7 @@ func (suite *InterchainAccountsTestSuite) TestSingleHostMultipleControllers() { func (suite *InterchainAccountsTestSuite) TestGetAppVersion() { path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -852,7 +852,7 @@ func (suite *InterchainAccountsTestSuite) TestGetAppVersion() { func (suite *InterchainAccountsTestSuite) TestInFlightHandshakeRespectsGoAPICaller() { path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() // initiate a channel handshake such that channel.State == INIT err := RegisterInterchainAccount(path.EndpointA, suite.chainA.SenderAccount.GetAddress().String()) @@ -869,7 +869,7 @@ func (suite *InterchainAccountsTestSuite) TestInFlightHandshakeRespectsGoAPICall func (suite *InterchainAccountsTestSuite) TestInFlightHandshakeRespectsMsgServerCaller() { path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() // initiate a channel handshake such that channel.State == INIT msgServer := controllerkeeper.NewMsgServerImpl(&suite.chainA.GetSimApp().ICAControllerKeeper) @@ -886,7 +886,7 @@ func (suite *InterchainAccountsTestSuite) TestInFlightHandshakeRespectsMsgServer func (suite *InterchainAccountsTestSuite) TestClosedChannelReopensWithMsgServer() { path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, suite.chainA.SenderAccount.GetAddress().String()) suite.Require().NoError(err) @@ -929,7 +929,7 @@ func (suite *InterchainAccountsTestSuite) TestClosedChannelReopensWithMsgServer( func (suite *InterchainAccountsTestSuite) TestPacketDataUnmarshalerInterface() { path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/account_test.go b/modules/apps/27-interchain-accounts/controller/keeper/account_test.go index 6f529c6eea8..c462de350f6 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/account_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/account_test.go @@ -68,7 +68,7 @@ func (suite *KeeperTestSuite) TestRegisterInterchainAccount() { owner = TestOwnerAddress // must be explicitly changed path = NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() tc.malleate() // malleate mutates test data @@ -89,10 +89,10 @@ func (suite *KeeperTestSuite) TestRegisterSameOwnerMultipleConnections() { owner := TestOwnerAddress pathAToB := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(pathAToB) + pathAToB.SetupConnections() pathAToC := NewICAPath(suite.chainA, suite.chainC) - suite.coordinator.SetupConnections(pathAToC) + pathAToC.SetupConnections() // build ICS27 metadata with connection identifiers for path A->B metadata := &icatypes.Metadata{ diff --git a/modules/apps/27-interchain-accounts/controller/keeper/genesis_test.go b/modules/apps/27-interchain-accounts/controller/keeper/genesis_test.go index aab068e6cf1..b8f8acf9537 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/genesis_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/genesis_test.go @@ -98,7 +98,7 @@ func (suite *KeeperTestSuite) TestExportGenesis() { suite.SetupTest() path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/grpc_query_test.go b/modules/apps/27-interchain-accounts/controller/keeper/grpc_query_test.go index 64cac88dc08..465f103b924 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/grpc_query_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/grpc_query_test.go @@ -48,7 +48,7 @@ func (suite *KeeperTestSuite) TestQueryInterchainAccount() { suite.SetupTest() path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, ibctesting.TestAccAddress) suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go b/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go index 29ebf75dec1..c8d5201ea40 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go @@ -229,7 +229,7 @@ func (suite *KeeperTestSuite) TestOnChanOpenInit() { suite.SetupTest() // reset path = NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() // mock init interchain account portID, err := icatypes.NewControllerPortID(TestOwnerAddress) @@ -387,7 +387,7 @@ func (suite *KeeperTestSuite) TestOnChanOpenAck() { suite.SetupTest() // reset path = NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := RegisterInterchainAccount(path.EndpointA, TestOwnerAddress) suite.Require().NoError(err) @@ -449,7 +449,7 @@ func (suite *KeeperTestSuite) TestOnChanCloseConfirm() { suite.SetupTest() // reset path = NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go b/modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go index 2f06fa019f5..b8028d53354 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go @@ -164,7 +164,7 @@ func (suite *KeeperTestSuite) TestGetAllPorts() { suite.SetupTest() path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -180,7 +180,7 @@ func (suite *KeeperTestSuite) TestGetInterchainAccountAddress() { suite.SetupTest() path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -205,7 +205,7 @@ func (suite *KeeperTestSuite) TestGetAllActiveChannels() { suite.SetupTest() path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -241,7 +241,7 @@ func (suite *KeeperTestSuite) TestGetAllInterchainAccounts() { suite.SetupTest() path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -274,7 +274,7 @@ func (suite *KeeperTestSuite) TestIsActiveChannel() { path := NewICAPath(suite.chainA, suite.chainB) owner := TestOwnerAddress - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, owner) suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/migrations_test.go b/modules/apps/27-interchain-accounts/controller/keeper/migrations_test.go index dbb7dc746a5..da5be84b6f5 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/migrations_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/migrations_test.go @@ -50,7 +50,7 @@ func (suite *KeeperTestSuite) TestAssertChannelCapabilityMigrations() { suite.SetupTest() path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, ibctesting.TestAccAddress) suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go b/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go index 4518a4c3825..aeff5edc169 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go @@ -73,7 +73,7 @@ func (suite *KeeperTestSuite) TestRegisterInterchainAccount_MsgServer() { suite.SetupTest() path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() msg = types.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, ibctesting.TestAccAddress, "") @@ -157,7 +157,7 @@ func (suite *KeeperTestSuite) TestSubmitTx() { owner := TestOwnerAddress path = NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, owner) suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/relay_test.go b/modules/apps/27-interchain-accounts/controller/keeper/relay_test.go index f1fe089bb57..9c95af0cf71 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/relay_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/relay_test.go @@ -155,7 +155,7 @@ func (suite *KeeperTestSuite) TestSendTx() { timeoutTimestamp = ^uint64(0) // default path = NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -196,7 +196,7 @@ func (suite *KeeperTestSuite) TestOnTimeoutPacket() { suite.SetupTest() // reset path = NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/controller/migrations/v6/migrations_test.go b/modules/apps/27-interchain-accounts/controller/migrations/v6/migrations_test.go index 4aec10eb05a..813436cd3ed 100644 --- a/modules/apps/27-interchain-accounts/controller/migrations/v6/migrations_test.go +++ b/modules/apps/27-interchain-accounts/controller/migrations/v6/migrations_test.go @@ -86,7 +86,7 @@ func TestKeeperTestSuite(t *testing.T) { func (suite *MigrationsTestSuite) TestMigrateICS27ChannelCapability() { suite.SetupTest() - suite.coordinator.SetupConnections(suite.path) + suite.path.SetupConnections() err := suite.SetupPath() suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/host/ibc_module_test.go b/modules/apps/27-interchain-accounts/host/ibc_module_test.go index a5bb9381e66..a4925419915 100644 --- a/modules/apps/27-interchain-accounts/host/ibc_module_test.go +++ b/modules/apps/27-interchain-accounts/host/ibc_module_test.go @@ -118,7 +118,7 @@ func SetupICAPath(path *ibctesting.Path, owner string) error { func (suite *InterchainAccountsTestSuite) TestChanOpenInit() { suite.SetupTest() // reset path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() // use chainB (host) for ChanOpenInit msg := channeltypes.NewMsgChannelOpenInit(path.EndpointB.ChannelConfig.PortID, icatypes.Version, channeltypes.ORDERED, []string{path.EndpointB.ConnectionID}, path.EndpointA.ChannelConfig.PortID, icatypes.ModuleName) @@ -183,7 +183,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenTry() { suite.SetupTest() // reset path = NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := RegisterInterchainAccount(path.EndpointA, TestOwnerAddress) suite.Require().NoError(err) @@ -236,7 +236,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenTry() { func (suite *InterchainAccountsTestSuite) TestChanOpenAck() { suite.SetupTest() // reset path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := RegisterInterchainAccount(path.EndpointA, TestOwnerAddress) suite.Require().NoError(err) @@ -298,7 +298,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenConfirm() { suite.Run(tc.name, func() { suite.SetupTest() path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := RegisterInterchainAccount(path.EndpointA, TestOwnerAddress) suite.Require().NoError(err) @@ -331,7 +331,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenConfirm() { // OnChanCloseInit on host (chainB) func (suite *InterchainAccountsTestSuite) TestOnChanCloseInit() { path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -369,7 +369,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanCloseConfirm() { suite.SetupTest() // reset path = NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -431,7 +431,7 @@ func (suite *InterchainAccountsTestSuite) TestOnRecvPacket() { suite.SetupTest() // reset path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -515,7 +515,7 @@ func (suite *InterchainAccountsTestSuite) TestOnAcknowledgementPacket() { suite.SetupTest() // reset path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -568,7 +568,7 @@ func (suite *InterchainAccountsTestSuite) TestOnTimeoutPacket() { suite.SetupTest() // reset path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -634,7 +634,7 @@ func (suite *InterchainAccountsTestSuite) TestControlAccountAfterChannelClose() path.EndpointA.ChannelConfig.Version = feeICAVersion path.EndpointB.ChannelConfig.Version = feeICAVersion - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -720,7 +720,7 @@ func (suite *InterchainAccountsTestSuite) assertBalance(addr sdk.AccAddress, exp func (suite *InterchainAccountsTestSuite) TestPacketDataUnmarshalerInterface() { path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/host/keeper/genesis_test.go b/modules/apps/27-interchain-accounts/host/keeper/genesis_test.go index 72d13d9e320..642288fed3f 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/genesis_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/genesis_test.go @@ -115,7 +115,7 @@ func (suite *KeeperTestSuite) TestExportGenesis() { suite.SetupTest() path := NewICAPath(suite.chainA, suite.chainB, icatypes.EncodingProtobuf) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go b/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go index 3074faf9b8e..dd57afadf78 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go @@ -281,7 +281,7 @@ func (suite *KeeperTestSuite) TestOnChanOpenTry() { suite.SetupTest() // reset path = NewICAPath(suite.chainA, suite.chainB, icatypes.EncodingProtobuf) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := RegisterInterchainAccount(path.EndpointA, TestOwnerAddress) suite.Require().NoError(err) @@ -361,7 +361,7 @@ func (suite *KeeperTestSuite) TestOnChanOpenConfirm() { suite.SetupTest() // reset path = NewICAPath(suite.chainA, suite.chainB, icatypes.EncodingProtobuf) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := RegisterInterchainAccount(path.EndpointA, TestOwnerAddress) suite.Require().NoError(err) @@ -404,7 +404,7 @@ func (suite *KeeperTestSuite) TestOnChanCloseConfirm() { suite.SetupTest() // reset path = NewICAPath(suite.chainA, suite.chainB, icatypes.EncodingProtobuf) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go b/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go index a300832818d..6af0abb67ca 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go @@ -202,7 +202,7 @@ func (suite *KeeperTestSuite) TestGetInterchainAccountAddress() { suite.SetupTest() path := NewICAPath(suite.chainA, suite.chainB, icatypes.EncodingProtobuf) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -227,7 +227,7 @@ func (suite *KeeperTestSuite) TestGetAllActiveChannels() { suite.SetupTest() path := NewICAPath(suite.chainA, suite.chainB, icatypes.EncodingProtobuf) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -261,7 +261,7 @@ func (suite *KeeperTestSuite) TestGetAllInterchainAccounts() { suite.SetupTest() path := NewICAPath(suite.chainA, suite.chainB, icatypes.EncodingProtobuf) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -293,7 +293,7 @@ func (suite *KeeperTestSuite) TestIsActiveChannel() { suite.SetupTest() path := NewICAPath(suite.chainA, suite.chainB, icatypes.EncodingProtobuf) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/host/keeper/relay_test.go b/modules/apps/27-interchain-accounts/host/keeper/relay_test.go index 997000490b9..9ad0ef02f12 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/relay_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/relay_test.go @@ -305,7 +305,7 @@ func (suite *KeeperTestSuite) TestOnRecvPacket() { func(encoding string) { transferPath := ibctesting.NewTransferPath(suite.chainB, suite.chainC) - suite.coordinator.Setup(transferPath) + transferPath.Setup() interchainAccountAddr, found := suite.chainB.GetSimApp().ICAHostKeeper.GetInterchainAccountAddress(suite.chainB.GetContext(), ibctesting.FirstConnectionID, path.EndpointA.ChannelConfig.PortID) suite.Require().True(found) @@ -339,7 +339,7 @@ func (suite *KeeperTestSuite) TestOnRecvPacket() { "Msg fails its ValidateBasic: MsgTransfer has an empty receiver", func(encoding string) { transferPath := ibctesting.NewTransferPath(suite.chainB, suite.chainC) - suite.coordinator.Setup(transferPath) + transferPath.Setup() interchainAccountAddr, found := suite.chainB.GetSimApp().ICAHostKeeper.GetInterchainAccountAddress(suite.chainB.GetContext(), ibctesting.FirstConnectionID, path.EndpointA.ChannelConfig.PortID) suite.Require().True(found) @@ -497,7 +497,7 @@ func (suite *KeeperTestSuite) TestOnRecvPacket() { suite.SetupTest() // reset path = NewICAPath(suite.chainA, suite.chainB, encoding) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -744,7 +744,7 @@ func (suite *KeeperTestSuite) TestJSONOnRecvPacket() { func(icaAddress string) { transferPath := ibctesting.NewTransferPath(suite.chainB, suite.chainC) - suite.coordinator.Setup(transferPath) + transferPath.Setup() msgBytes := []byte(`{ "messages": [ @@ -847,7 +847,7 @@ func (suite *KeeperTestSuite) TestJSONOnRecvPacket() { suite.SetupTest() // reset path = NewICAPath(suite.chainA, suite.chainB, icatypes.EncodingProto3JSON) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/types/metadata_test.go b/modules/apps/27-interchain-accounts/types/metadata_test.go index 9dde7d78a3f..05c00b31a8b 100644 --- a/modules/apps/27-interchain-accounts/types/metadata_test.go +++ b/modules/apps/27-interchain-accounts/types/metadata_test.go @@ -118,7 +118,7 @@ func (suite *TypesTestSuite) TestIsPreviousMetadataEqual() { suite.SetupTest() // reset path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() expectedMetadata := types.NewMetadata(types.Version, ibctesting.FirstConnectionID, ibctesting.FirstConnectionID, TestOwnerAddress, types.EncodingProtobuf, types.TxTypeSDKMultiMsg) metadata = expectedMetadata // default success case @@ -269,7 +269,7 @@ func (suite *TypesTestSuite) TestValidateControllerMetadata() { suite.SetupTest() // reset path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() metadata = types.NewMetadata(types.Version, ibctesting.FirstConnectionID, ibctesting.FirstConnectionID, TestOwnerAddress, types.EncodingProtobuf, types.TxTypeSDKMultiMsg) @@ -424,7 +424,7 @@ func (suite *TypesTestSuite) TestValidateHostMetadata() { suite.SetupTest() // reset path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() metadata = types.NewMetadata(types.Version, ibctesting.FirstConnectionID, ibctesting.FirstConnectionID, TestOwnerAddress, types.EncodingProtobuf, types.TxTypeSDKMultiMsg) diff --git a/modules/apps/27-interchain-accounts/types/port_test.go b/modules/apps/27-interchain-accounts/types/port_test.go index 3b4aef8931a..57f4988fd06 100644 --- a/modules/apps/27-interchain-accounts/types/port_test.go +++ b/modules/apps/27-interchain-accounts/types/port_test.go @@ -41,7 +41,7 @@ func (suite *TypesTestSuite) TestNewControllerPortID() { suite.SetupTest() // reset path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() tc.malleate() // malleate mutates test data diff --git a/modules/apps/29-fee/ibc_middleware_test.go b/modules/apps/29-fee/ibc_middleware_test.go index 941bce02dd4..449a7a25b9c 100644 --- a/modules/apps/29-fee/ibc_middleware_test.go +++ b/modules/apps/29-fee/ibc_middleware_test.go @@ -80,7 +80,7 @@ func (suite *FeeTestSuite) TestOnChanOpenInit() { suite.Run(tc.name, func() { // reset suite suite.SetupTest() - suite.coordinator.SetupConnections(suite.path) + suite.path.SetupConnections() // setup mock callback suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanOpenInit = func(ctx sdk.Context, order channeltypes.Order, connectionHops []string, @@ -176,7 +176,7 @@ func (suite *FeeTestSuite) TestOnChanOpenTry() { suite.Run(tc.name, func() { // reset suite suite.SetupTest() - suite.coordinator.SetupConnections(suite.path) + suite.path.SetupConnections() err := suite.path.EndpointB.ChanOpenInit() suite.Require().NoError(err) @@ -276,7 +276,7 @@ func (suite *FeeTestSuite) TestOnChanOpenAck() { tc := tc suite.Run(tc.name, func() { suite.SetupTest() - suite.coordinator.SetupConnections(suite.path) + suite.path.SetupConnections() // setup mock callback suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanOpenAck = func( @@ -365,7 +365,7 @@ func (suite *FeeTestSuite) TestOnChanCloseInit() { tc := tc suite.Run(tc.name, func() { suite.SetupTest() - suite.coordinator.Setup(suite.path) // setup channel + suite.path.Setup() // setup channel packetID := channeltypes.NewPacketID(suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID, 1) fee = types.Fee{ @@ -455,7 +455,7 @@ func (suite *FeeTestSuite) TestOnChanCloseConfirm() { suite.Run(tc.name, func() { suite.SetupTest() - suite.coordinator.Setup(suite.path) // setup channel + suite.path.Setup() // setup channel packetID := channeltypes.NewPacketID(suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID, 1) fee = types.Fee{ @@ -542,9 +542,9 @@ func (suite *FeeTestSuite) TestOnRecvPacket() { suite.Run(tc.name, func() { suite.SetupTest() // setup pathAToC (chainA -> chainC) first in order to have different channel IDs for chainA & chainB - suite.coordinator.Setup(suite.pathAToC) + suite.pathAToC.Setup() // setup path for chainA -> chainB - suite.coordinator.Setup(suite.path) + suite.path.Setup() suite.chainB.GetSimApp().IBCFeeKeeper.SetFeeEnabled(suite.chainB.GetContext(), suite.path.EndpointB.ChannelConfig.PortID, suite.path.EndpointB.ChannelID) @@ -788,7 +788,7 @@ func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { tc := tc suite.Run(tc.name, func() { suite.SetupTest() - suite.coordinator.Setup(suite.path) + suite.path.Setup() relayerAddr = suite.chainA.SenderAccounts[0].SenderAccount.GetAddress() refundAddr = suite.chainA.SenderAccounts[1].SenderAccount.GetAddress() @@ -974,7 +974,7 @@ func (suite *FeeTestSuite) TestOnTimeoutPacket() { tc := tc suite.Run(tc.name, func() { suite.SetupTest() - suite.coordinator.Setup(suite.path) + suite.path.Setup() relayerAddr = suite.chainA.SenderAccounts[0].SenderAccount.GetAddress() refundAddr = suite.chainA.SenderAccounts[1].SenderAccount.GetAddress() @@ -1034,7 +1034,7 @@ func (suite *FeeTestSuite) TestGetAppVersion() { path.EndpointA.ChannelConfig.PortID = ibctesting.MockFeePort path.EndpointB.ChannelConfig.PortID = ibctesting.MockFeePort // by default a new path uses a non fee channel - suite.coordinator.Setup(path) + path.Setup() portID = path.EndpointA.ChannelConfig.PortID channelID = path.EndpointA.ChannelID @@ -1055,7 +1055,7 @@ func (suite *FeeTestSuite) TestGetAppVersion() { tc := tc suite.Run(tc.name, func() { suite.SetupTest() - suite.coordinator.Setup(suite.path) + suite.path.Setup() portID = suite.path.EndpointA.ChannelConfig.PortID channelID = suite.path.EndpointA.ChannelID diff --git a/modules/apps/29-fee/ica_test.go b/modules/apps/29-fee/ica_test.go index 530ffa2f631..a7f45fb4af6 100644 --- a/modules/apps/29-fee/ica_test.go +++ b/modules/apps/29-fee/ica_test.go @@ -92,7 +92,7 @@ func RegisterInterchainAccount(endpoint *ibctesting.Endpoint, owner string) erro // TestFeeInterchainAccounts Integration test to ensure ics29 works with ics27 func (suite *FeeTestSuite) TestFeeInterchainAccounts() { path := NewIncentivizedICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupPath(path, defaultOwnerAddress) suite.Require().NoError(err) diff --git a/modules/apps/29-fee/keeper/escrow_test.go b/modules/apps/29-fee/keeper/escrow_test.go index 928238163e0..b5caa4947af 100644 --- a/modules/apps/29-fee/keeper/escrow_test.go +++ b/modules/apps/29-fee/keeper/escrow_test.go @@ -171,8 +171,8 @@ func (suite *KeeperTestSuite) TestDistributeFee() { tc := tc suite.Run(tc.name, func() { - suite.SetupTest() // reset - suite.coordinator.Setup(suite.path) // setup channel + suite.SetupTest() // reset + suite.path.Setup() // setup channel // setup accounts forwardRelayer = sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()).String() @@ -283,8 +283,8 @@ func (suite *KeeperTestSuite) TestDistributePacketFeesOnTimeout() { tc := tc suite.Run(tc.name, func() { - suite.SetupTest() // reset - suite.coordinator.Setup(suite.path) // setup channel + suite.SetupTest() // reset + suite.path.Setup() // setup channel // setup accounts timeoutRelayer = sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()) @@ -458,8 +458,8 @@ func (suite *KeeperTestSuite) TestRefundFeesOnChannelClosure() { tc := tc suite.Run(tc.name, func() { - suite.SetupTest() // reset - suite.coordinator.Setup(suite.path) // setup channel + suite.SetupTest() // reset + suite.path.Setup() // setup channel expIdentifiedPacketFees = []types.IdentifiedPacketFees{} expEscrowBal = sdk.Coins{} locked = false diff --git a/modules/apps/29-fee/keeper/events_test.go b/modules/apps/29-fee/keeper/events_test.go index a3b5a87e414..ba17296d051 100644 --- a/modules/apps/29-fee/keeper/events_test.go +++ b/modules/apps/29-fee/keeper/events_test.go @@ -22,7 +22,7 @@ func (suite *KeeperTestSuite) TestIncentivizePacketEvent() { expTimeoutFees sdk.Coins ) - suite.coordinator.Setup(suite.path) + suite.path.Setup() fee := types.NewFee(defaultRecvFee, defaultAckFee, defaultTimeoutFee) msg := types.NewMsgPayPacketFee( @@ -99,7 +99,7 @@ func (suite *KeeperTestSuite) TestDistributeFeeEvent() { path.EndpointA.ChannelConfig.PortID = transfertypes.PortID path.EndpointB.ChannelConfig.PortID = transfertypes.PortID - suite.coordinator.Setup(path) + path.Setup() // send a new MsgPayPacketFee and MsgTransfer to chainA fee := types.NewFee(defaultRecvFee, defaultAckFee, defaultTimeoutFee) diff --git a/modules/apps/29-fee/keeper/grpc_query_test.go b/modules/apps/29-fee/keeper/grpc_query_test.go index 13c87a04135..c34af3393ff 100644 --- a/modules/apps/29-fee/keeper/grpc_query_test.go +++ b/modules/apps/29-fee/keeper/grpc_query_test.go @@ -644,7 +644,7 @@ func (suite *KeeperTestSuite) TestQueryFeeEnabledChannels() { { "success: with multiple fee enabled channels", func() { - suite.coordinator.Setup(suite.pathAToC) + suite.pathAToC.Setup() expChannel := types.FeeEnabledChannel{ PortId: suite.pathAToC.EndpointA.ChannelConfig.PortID, @@ -695,7 +695,7 @@ func (suite *KeeperTestSuite) TestQueryFeeEnabledChannels() { suite.Run(tc.name, func() { suite.SetupTest() // reset - suite.coordinator.Setup(suite.path) + suite.path.Setup() expChannel := types.FeeEnabledChannel{ PortId: suite.path.EndpointA.ChannelConfig.PortID, @@ -769,7 +769,7 @@ func (suite *KeeperTestSuite) TestQueryFeeEnabledChannel() { suite.SetupTest() // reset expEnabled = true - suite.coordinator.Setup(suite.path) + suite.path.Setup() req = &types.QueryFeeEnabledChannelRequest{ PortId: suite.path.EndpointA.ChannelConfig.PortID, diff --git a/modules/apps/29-fee/keeper/keeper_test.go b/modules/apps/29-fee/keeper/keeper_test.go index 235daf52035..36f1199fd3d 100644 --- a/modules/apps/29-fee/keeper/keeper_test.go +++ b/modules/apps/29-fee/keeper/keeper_test.go @@ -90,7 +90,7 @@ func (suite *KeeperTestSuite) TestEscrowAccountHasBalance() { } func (suite *KeeperTestSuite) TestGetSetPayeeAddress() { - suite.coordinator.Setup(suite.path) + suite.path.Setup() payeeAddr, found := suite.chainA.GetSimApp().IBCFeeKeeper.GetPayeeAddress(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.path.EndpointA.ChannelID) suite.Require().False(found) @@ -109,7 +109,7 @@ func (suite *KeeperTestSuite) TestGetSetPayeeAddress() { } func (suite *KeeperTestSuite) TestFeesInEscrow() { - suite.coordinator.Setup(suite.path) + suite.path.Setup() // escrow five fees for packet sequence 1 packetID := channeltypes.NewPacketID(suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID, 1) @@ -141,7 +141,7 @@ func (suite *KeeperTestSuite) TestIsLocked() { } func (suite *KeeperTestSuite) TestGetIdentifiedPacketFeesForChannel() { - suite.coordinator.Setup(suite.path) + suite.path.Setup() // escrow a fee refundAcc := suite.chainA.SenderAccount.GetAddress() @@ -205,7 +205,7 @@ func (suite *KeeperTestSuite) TestGetIdentifiedPacketFeesForChannel() { } func (suite *KeeperTestSuite) TestGetAllIdentifiedPacketFees() { - suite.coordinator.Setup(suite.path) + suite.path.Setup() // escrow a fee refundAcc := suite.chainA.SenderAccount.GetAddress() diff --git a/modules/apps/29-fee/keeper/msg_server_test.go b/modules/apps/29-fee/keeper/msg_server_test.go index a12de519b3e..6a249c2ecd6 100644 --- a/modules/apps/29-fee/keeper/msg_server_test.go +++ b/modules/apps/29-fee/keeper/msg_server_test.go @@ -61,7 +61,7 @@ func (suite *KeeperTestSuite) TestRegisterPayee() { tc := tc suite.SetupTest() - suite.coordinator.Setup(suite.path) + suite.path.Setup() msg = types.NewMsgRegisterPayee( suite.path.EndpointA.ChannelConfig.PortID, @@ -136,7 +136,7 @@ func (suite *KeeperTestSuite) TestRegisterCounterpartyPayee() { tc := tc suite.SetupTest() - suite.coordinator.Setup(suite.path) // setup channel + suite.path.Setup() // setup channel expCounterpartyPayee = suite.chainA.SenderAccounts[1].SenderAccount.GetAddress().String() msg = types.NewMsgRegisterCounterpartyPayee( @@ -303,7 +303,7 @@ func (suite *KeeperTestSuite) TestPayPacketFee() { suite.Run(tc.name, func() { suite.SetupTest() - suite.coordinator.Setup(suite.path) // setup channel + suite.path.Setup() // setup channel fee = types.NewFee(defaultRecvFee, defaultAckFee, defaultTimeoutFee) msg = types.NewMsgPayPacketFee( @@ -515,7 +515,7 @@ func (suite *KeeperTestSuite) TestPayPacketFeeAsync() { suite.Run(tc.name, func() { suite.SetupTest() - suite.coordinator.Setup(suite.path) // setup channel + suite.path.Setup() // setup channel timeoutHeight := clienttypes.NewHeight(clienttypes.ParseChainID(suite.chainB.ChainID), 100) diff --git a/modules/apps/29-fee/keeper/relay_test.go b/modules/apps/29-fee/keeper/relay_test.go index 14b69cd8da5..23ae6cec9b9 100644 --- a/modules/apps/29-fee/keeper/relay_test.go +++ b/modules/apps/29-fee/keeper/relay_test.go @@ -36,9 +36,9 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgementAsync() { // open incentivized channels // setup pathAToC (chainA -> chainC) first in order to have different channel IDs for chainA & chainB - suite.coordinator.Setup(suite.pathAToC) + suite.pathAToC.Setup() // setup path for chainA -> chainB - suite.coordinator.Setup(suite.path) + suite.path.Setup() // build packet timeoutTimestamp := ^uint64(0) @@ -78,7 +78,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgementAsync() { func (suite *KeeperTestSuite) TestWriteAcknowledgementAsyncFeeDisabled() { // open incentivized channel - suite.coordinator.Setup(suite.path) + suite.path.Setup() suite.chainB.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(suite.chainB.GetContext(), suite.path.EndpointB.ChannelConfig.PortID, "channel-0") // build packet @@ -129,7 +129,7 @@ func (suite *KeeperTestSuite) TestGetAppVersion() { path.EndpointA.ChannelConfig.PortID = ibctesting.MockFeePort path.EndpointB.ChannelConfig.PortID = ibctesting.MockFeePort // by default a new path uses a non fee channel - suite.coordinator.Setup(path) + path.Setup() portID = path.EndpointA.ChannelConfig.PortID channelID = path.EndpointA.ChannelID @@ -150,7 +150,7 @@ func (suite *KeeperTestSuite) TestGetAppVersion() { tc := tc suite.Run(tc.name, func() { suite.SetupTest() - suite.coordinator.Setup(suite.path) + suite.path.Setup() portID = suite.path.EndpointA.ChannelConfig.PortID channelID = suite.path.EndpointA.ChannelID diff --git a/modules/apps/29-fee/transfer_test.go b/modules/apps/29-fee/transfer_test.go index 287a5cad1b8..a3f1ca7eeb2 100644 --- a/modules/apps/29-fee/transfer_test.go +++ b/modules/apps/29-fee/transfer_test.go @@ -18,7 +18,7 @@ func (suite *FeeTestSuite) TestFeeTransfer() { path.EndpointA.ChannelConfig.PortID = transfertypes.PortID path.EndpointB.ChannelConfig.PortID = transfertypes.PortID - suite.coordinator.Setup(path) + path.Setup() // set up coin & ics20 packet coin := ibctesting.TestCoin diff --git a/modules/apps/transfer/ibc_module_test.go b/modules/apps/transfer/ibc_module_test.go index 81255a32670..37420a35978 100644 --- a/modules/apps/transfer/ibc_module_test.go +++ b/modules/apps/transfer/ibc_module_test.go @@ -69,7 +69,7 @@ func (suite *TransferTestSuite) TestOnChanOpenInit() { suite.Run(tc.name, func() { suite.SetupTest() // reset path = ibctesting.NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.EndpointA.ChannelID = ibctesting.FirstChannelID counterparty = channeltypes.NewCounterparty(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) @@ -155,7 +155,7 @@ func (suite *TransferTestSuite) TestOnChanOpenTry() { suite.SetupTest() // reset path = ibctesting.NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.EndpointA.ChannelID = ibctesting.FirstChannelID counterparty = channeltypes.NewCounterparty(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) @@ -219,7 +219,7 @@ func (suite *TransferTestSuite) TestOnChanOpenAck() { suite.SetupTest() // reset path := ibctesting.NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.EndpointA.ChannelID = ibctesting.FirstChannelID counterpartyVersion = types.Version diff --git a/modules/apps/transfer/keeper/invariants_test.go b/modules/apps/transfer/keeper/invariants_test.go index 0da8d0372d1..ef1b6ae90ca 100644 --- a/modules/apps/transfer/keeper/invariants_test.go +++ b/modules/apps/transfer/keeper/invariants_test.go @@ -38,7 +38,7 @@ func (suite *KeeperTestSuite) TestTotalEscrowPerDenomInvariant() { suite.Run(tc.name, func() { suite.SetupTest() // reset path := ibctesting.NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() amount := sdkmath.NewInt(100) diff --git a/modules/apps/transfer/keeper/mbt_relay_test.go b/modules/apps/transfer/keeper/mbt_relay_test.go index ee7d60f6f71..fcb466dd468 100644 --- a/modules/apps/transfer/keeper/mbt_relay_test.go +++ b/modules/apps/transfer/keeper/mbt_relay_test.go @@ -304,8 +304,8 @@ func (suite *KeeperTestSuite) TestModelBasedRelay() { suite.SetupTest() pathAtoB := ibctesting.NewTransferPath(suite.chainA, suite.chainB) pathBtoC := ibctesting.NewTransferPath(suite.chainB, suite.chainC) - suite.coordinator.Setup(pathAtoB) - suite.coordinator.Setup(pathBtoC) + pathAtoB.Setup() + pathBtoC.Setup() for i, tlaTc := range tlaTestCases { tc := OnRecvPacketTestCaseFromTla(tlaTc) diff --git a/modules/apps/transfer/keeper/migrations_test.go b/modules/apps/transfer/keeper/migrations_test.go index 49b978cef42..8c63d3cc9d1 100644 --- a/modules/apps/transfer/keeper/migrations_test.go +++ b/modules/apps/transfer/keeper/migrations_test.go @@ -190,7 +190,7 @@ func (suite *KeeperTestSuite) TestMigrateTotalEscrowForDenom() { func() { denom = sdk.DefaultBondDenom extraPath := ibctesting.NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(extraPath) + extraPath.Setup() escrowAddress1 := transfertypes.GetEscrowAddress(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) escrowAddress2 := transfertypes.GetEscrowAddress(extraPath.EndpointA.ChannelConfig.PortID, extraPath.EndpointA.ChannelID) @@ -227,7 +227,7 @@ func (suite *KeeperTestSuite) TestMigrateTotalEscrowForDenom() { suite.SetupTest() // reset path = ibctesting.NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() tc.malleate() // explicitly fund escrow account diff --git a/modules/apps/transfer/keeper/msg_server_test.go b/modules/apps/transfer/keeper/msg_server_test.go index 0cda061f1eb..55bc27a8a89 100644 --- a/modules/apps/transfer/keeper/msg_server_test.go +++ b/modules/apps/transfer/keeper/msg_server_test.go @@ -89,7 +89,7 @@ func (suite *KeeperTestSuite) TestMsgTransfer() { suite.SetupTest() path := ibctesting.NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() coin := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100)) msg = types.NewMsgTransfer( diff --git a/modules/apps/transfer/keeper/relay_test.go b/modules/apps/transfer/keeper/relay_test.go index a9c914d6cd9..fcb22693c33 100644 --- a/modules/apps/transfer/keeper/relay_test.go +++ b/modules/apps/transfer/keeper/relay_test.go @@ -117,7 +117,7 @@ func (suite *KeeperTestSuite) TestSendTransfer() { suite.SetupTest() // reset path = ibctesting.NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() coin = sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100)) sender = suite.chainA.SenderAccount.GetAddress() @@ -196,10 +196,10 @@ func (suite *KeeperTestSuite) TestSendTransferSetsTotalEscrowAmountForSourceIBCT // set up // 2 transfer channels between chain A and chain B path1 := ibctesting.NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path1) + path1.Setup() path2 := ibctesting.NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path2) + path2.Setup() // create IBC token on chain B with denom trace "transfer/channel-0/stake" coin := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100)) @@ -346,7 +346,7 @@ func (suite *KeeperTestSuite) TestOnRecvPacket() { suite.SetupTest() // reset path := ibctesting.NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() receiver = suite.chainB.SenderAccount.GetAddress().String() // must be explicitly changed in malleate memo = "" // can be explicitly changed in malleate @@ -464,10 +464,10 @@ func (suite *KeeperTestSuite) TestOnRecvPacketSetsTotalEscrowAmountForSourceIBCT // setup // 2 transfer channels between chain A and chain B path1 := ibctesting.NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path1) + path1.Setup() path2 := ibctesting.NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path2) + path2.Setup() // denomTrace path: {transfer/channel-1/transfer/channel-0} denomTrace := types.DenomTrace{ @@ -592,7 +592,7 @@ func (suite *KeeperTestSuite) TestOnAcknowledgementPacket() { suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { suite.SetupTest() // reset path = ibctesting.NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() amount = sdkmath.NewInt(100) // must be explicitly changed expEscrowAmount = sdkmath.ZeroInt() @@ -661,10 +661,10 @@ func (suite *KeeperTestSuite) TestOnAcknowledgementPacketSetsTotalEscrowAmountFo // set up // 2 transfer channels between chain A and chain B path1 := ibctesting.NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path1) + path1.Setup() path2 := ibctesting.NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path2) + path2.Setup() // fund escrow account for transfer and channel-1 on chain B // denomTrace path = transfer/channel-0 @@ -792,7 +792,7 @@ func (suite *KeeperTestSuite) TestOnTimeoutPacket() { suite.SetupTest() // reset path = ibctesting.NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() amount = sdkmath.NewInt(100) // must be explicitly changed sender = suite.chainA.SenderAccount.GetAddress().String() expEscrowAmount = sdkmath.ZeroInt() @@ -856,10 +856,10 @@ func (suite *KeeperTestSuite) TestOnTimeoutPacketSetsTotalEscrowAmountForSourceI // set up // 2 transfer channels between chain A and chain B path1 := ibctesting.NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path1) + path1.Setup() path2 := ibctesting.NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path2) + path2.Setup() // fund escrow account for transfer and channel-1 on chain B denomTrace := types.DenomTrace{ diff --git a/modules/apps/transfer/transfer_test.go b/modules/apps/transfer/transfer_test.go index 647a1b83665..ef8dea295c6 100644 --- a/modules/apps/transfer/transfer_test.go +++ b/modules/apps/transfer/transfer_test.go @@ -42,7 +42,7 @@ func (suite *TransferTestSuite) TestHandleMsgTransfer() { // pathAtoB.EndpointA = endpoint on chainA // pathAtoB.EndpointB = endpoint on chainB pathAtoB := ibctesting.NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(pathAtoB) + pathAtoB.Setup() originalBalance := suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress(), sdk.DefaultBondDenom) timeoutHeight := clienttypes.NewHeight(1, 110) @@ -79,7 +79,7 @@ func (suite *TransferTestSuite) TestHandleMsgTransfer() { // pathBtoC.EndpointA = endpoint on chainB // pathBtoC.EndpointB = endpoint on chainC pathBtoC := ibctesting.NewTransferPath(suite.chainB, suite.chainC) - suite.coordinator.Setup(pathBtoC) + pathBtoC.Setup() // send from chainB to chainC msg = types.NewMsgTransfer(pathBtoC.EndpointA.ChannelConfig.PortID, pathBtoC.EndpointA.ChannelID, coinSentFromAToB, suite.chainB.SenderAccount.GetAddress().String(), suite.chainC.SenderAccount.GetAddress().String(), timeoutHeight, 0, "") diff --git a/modules/apps/transfer/types/transfer_authorization_test.go b/modules/apps/transfer/types/transfer_authorization_test.go index fdc877340e8..16809bbb82b 100644 --- a/modules/apps/transfer/types/transfer_authorization_test.go +++ b/modules/apps/transfer/types/transfer_authorization_test.go @@ -165,7 +165,7 @@ func (suite *TypesTestSuite) TestTransferAuthorizationAccept() { suite.SetupTest() path := NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() transferAuthz = types.TransferAuthorization{ Allocations: []types.Allocation{ diff --git a/modules/core/02-client/keeper/client_test.go b/modules/core/02-client/keeper/client_test.go index e201f4d7bf7..6708eac6e03 100644 --- a/modules/core/02-client/keeper/client_test.go +++ b/modules/core/02-client/keeper/client_test.go @@ -258,7 +258,7 @@ func (suite *KeeperTestSuite) TestUpdateClientTendermint() { suite.Run(fmt.Sprintf("Case %s", tc.name), func() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() tc.malleate() @@ -470,7 +470,7 @@ func (suite *KeeperTestSuite) TestUpgradeClient() { for _, tc := range testCases { tc := tc path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() clientState := path.EndpointA.GetClientState().(*ibctm.ClientState) revisionNumber := clienttypes.ParseChainID(clientState.ChainId) @@ -503,7 +503,7 @@ func (suite *KeeperTestSuite) TestUpgradeClient() { func (suite *KeeperTestSuite) TestUpdateClientEventEmission() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() header, err := suite.chainA.ConstructUpdateTMClientHeader(suite.chainB, path.EndpointA.ClientID) suite.Require().NoError(err) @@ -630,12 +630,12 @@ func (suite *KeeperTestSuite) TestRecoverClient() { suite.SetupTest() // reset subjectPath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(subjectPath) + subjectPath.SetupClients() subject = subjectPath.EndpointA.ClientID subjectClientState = suite.chainA.GetClientState(subject) substitutePath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(substitutePath) + substitutePath.SetupClients() substitute = substitutePath.EndpointA.ClientID // update substitute twice diff --git a/modules/core/02-client/keeper/grpc_query_test.go b/modules/core/02-client/keeper/grpc_query_test.go index 231d000a257..cc31fbd78df 100644 --- a/modules/core/02-client/keeper/grpc_query_test.go +++ b/modules/core/02-client/keeper/grpc_query_test.go @@ -50,7 +50,7 @@ func (suite *KeeperTestSuite) TestQueryClientState() { "success", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() var err error expClientState, err = types.PackClientState(path.EndpointA.GetClientState()) @@ -134,10 +134,10 @@ func (suite *KeeperTestSuite) TestQueryClientStates() { "success", func() { path1 := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path1) + path1.SetupClients() path2 := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path2) + path2.SetupClients() clientStateA1 := path1.EndpointA.GetClientState() clientStateA2 := path2.EndpointA.GetClientState() @@ -232,7 +232,7 @@ func (suite *KeeperTestSuite) TestQueryConsensusState() { "success latest height", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() cs := path.EndpointA.GetConsensusState(path.EndpointA.GetClientState().GetLatestHeight()) var err error @@ -250,7 +250,7 @@ func (suite *KeeperTestSuite) TestQueryConsensusState() { "success with height", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() height := path.EndpointA.GetClientState().GetLatestHeight() cs := path.EndpointA.GetConsensusState(height) @@ -334,7 +334,7 @@ func (suite *KeeperTestSuite) TestQueryConsensusStates() { "success", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() height1 := path.EndpointA.GetClientState().GetLatestHeight().(types.Height) expConsensusStates = append( @@ -439,7 +439,7 @@ func (suite *KeeperTestSuite) TestQueryConsensusStateHeights() { "success: returns consensus heights", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() expConsensusStateHeights = append(expConsensusStateHeights, path.EndpointA.GetClientState().GetLatestHeight().(types.Height)) @@ -528,7 +528,7 @@ func (suite *KeeperTestSuite) TestQueryClientStatus() { "Active client status", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() req = &types.QueryClientStatusRequest{ ClientId: path.EndpointA.ClientID, } @@ -539,7 +539,7 @@ func (suite *KeeperTestSuite) TestQueryClientStatus() { "Unknown client status", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() clientState := path.EndpointA.GetClientState().(*ibctm.ClientState) // increment latest height so no consensus state is stored @@ -556,7 +556,7 @@ func (suite *KeeperTestSuite) TestQueryClientStatus() { "Frozen client status", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() clientState := path.EndpointA.GetClientState().(*ibctm.ClientState) clientState.FrozenHeight = types.NewHeight(0, 1) diff --git a/modules/core/02-client/keeper/keeper_test.go b/modules/core/02-client/keeper/keeper_test.go index cd7d197983b..e525e72c069 100644 --- a/modules/core/02-client/keeper/keeper_test.go +++ b/modules/core/02-client/keeper/keeper_test.go @@ -311,7 +311,7 @@ func (suite KeeperTestSuite) TestGetConsensusState() { //nolint:govet // this is // and a consensus state at the update height. func (suite KeeperTestSuite) TestGetAllConsensusStates() { //nolint:govet // this is a test, we are okay with copying locks path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() clientState := path.EndpointA.GetClientState() expConsensusHeight0 := clientState.GetLatestHeight() @@ -335,7 +335,7 @@ func (suite KeeperTestSuite) TestGetAllConsensusStates() { //nolint:govet // thi // create second client on chainA path2 := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path2) + path2.SetupClients() clientState = path2.EndpointA.GetClientState() expConsensusHeight2 := clientState.GetLatestHeight() @@ -377,7 +377,7 @@ func (suite KeeperTestSuite) TestIterateClientStates() { //nolint:govet // this // create tendermint clients for i, path := range paths { - suite.coordinator.SetupClients(path) + path.SetupClients() expTMClientIDs[i] = path.EndpointA.ClientID } @@ -530,7 +530,7 @@ func (suite *KeeperTestSuite) TestIBCSoftwareUpgrade() { oldPlan.Height = 0 // reset path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() upgradedClientState = suite.chainA.GetClientState(path.EndpointA.ClientID).ZeroCustomFields().(*ibctm.ClientState) // use height 1000 to distinguish from old plan diff --git a/modules/core/02-client/migrations/v7/genesis_test.go b/modules/core/02-client/migrations/v7/genesis_test.go index 8fc8b5f23f2..4abbb646f0c 100644 --- a/modules/core/02-client/migrations/v7/genesis_test.go +++ b/modules/core/02-client/migrations/v7/genesis_test.go @@ -19,7 +19,7 @@ func (suite *MigrationsV7TestSuite) TestMigrateGenesisSolomachine() { for i := 0; i < 3; i++ { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() err := path.EndpointA.UpdateClient() suite.Require().NoError(err) diff --git a/modules/core/02-client/migrations/v7/store_test.go b/modules/core/02-client/migrations/v7/store_test.go index bb4898190da..b0a2ae934e6 100644 --- a/modules/core/02-client/migrations/v7/store_test.go +++ b/modules/core/02-client/migrations/v7/store_test.go @@ -50,7 +50,7 @@ func (suite *MigrationsV7TestSuite) TestMigrateStore() { // create tendermint clients for _, path := range paths { - suite.coordinator.SetupClients(path) + path.SetupClients() } solomachines := []*ibctesting.Solomachine{ diff --git a/modules/core/02-client/proposal_handler_test.go b/modules/core/02-client/proposal_handler_test.go index 79e34ceaa85..108b886add6 100644 --- a/modules/core/02-client/proposal_handler_test.go +++ b/modules/core/02-client/proposal_handler_test.go @@ -27,11 +27,11 @@ func (suite *ClientTestSuite) TestNewClientUpdateProposalHandler() { { "valid update client proposal", func() { subjectPath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(subjectPath) + subjectPath.SetupClients() subjectClientState := suite.chainA.GetClientState(subjectPath.EndpointA.ClientID) substitutePath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(substitutePath) + substitutePath.SetupClients() // update substitute twice err = substitutePath.EndpointA.UpdateClient() diff --git a/modules/core/02-client/types/client_test.go b/modules/core/02-client/types/client_test.go index 0d05946b3d4..a983672d386 100644 --- a/modules/core/02-client/types/client_test.go +++ b/modules/core/02-client/types/client_test.go @@ -25,7 +25,7 @@ func (suite *TypesTestSuite) TestMarshalConsensusStateWithHeight() { { "tendermint client", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() clientState := suite.chainA.GetClientState(path.EndpointA.ClientID) consensusState, ok := suite.chainA.GetConsensusState(path.EndpointA.ClientID, clientState.GetLatestHeight()) suite.Require().True(ok) diff --git a/modules/core/02-client/types/genesis_test.go b/modules/core/02-client/types/genesis_test.go index 2e1714434f3..2a22df6d18c 100644 --- a/modules/core/02-client/types/genesis_test.go +++ b/modules/core/02-client/types/genesis_test.go @@ -29,7 +29,7 @@ var clientHeight = types.NewHeight(1, 10) func (suite *TypesTestSuite) TestMarshalGenesisState() { cdc := suite.chainA.App.AppCodec() path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() err := path.EndpointA.UpdateClient() suite.Require().NoError(err) diff --git a/modules/core/02-client/types/legacy_proposal_test.go b/modules/core/02-client/types/legacy_proposal_test.go index 1fab3ac9e31..a2684265a4f 100644 --- a/modules/core/02-client/types/legacy_proposal_test.go +++ b/modules/core/02-client/types/legacy_proposal_test.go @@ -11,11 +11,11 @@ import ( func (suite *TypesTestSuite) TestValidateBasic() { subjectPath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(subjectPath) + subjectPath.SetupClients() subject := subjectPath.EndpointA.ClientID substitutePath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(substitutePath) + substitutePath.SetupClients() substitute := substitutePath.EndpointA.ClientID testCases := []struct { diff --git a/modules/core/03-connection/keeper/grpc_query_test.go b/modules/core/03-connection/keeper/grpc_query_test.go index 9654f8bb8dd..f44c89b38f5 100644 --- a/modules/core/03-connection/keeper/grpc_query_test.go +++ b/modules/core/03-connection/keeper/grpc_query_test.go @@ -49,7 +49,7 @@ func (suite *KeeperTestSuite) TestQueryConnection() { "success", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() err := path.EndpointA.ConnOpenInit() suite.Require().NoError(err) @@ -124,9 +124,9 @@ func (suite *KeeperTestSuite) TestQueryConnections() { path1 := ibctesting.NewPath(suite.chainA, suite.chainB) path2 := ibctesting.NewPath(suite.chainA, suite.chainB) path3 := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path1) - suite.coordinator.SetupConnections(path2) - suite.coordinator.SetupClients(path3) + path1.SetupConnections() + path2.SetupConnections() + path3.SetupClients() err := path3.EndpointA.ConnOpenInit() suite.Require().NoError(err) @@ -217,14 +217,14 @@ func (suite *KeeperTestSuite) TestQueryClientConnections() { "success", func() { path1 := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path1) + path1.SetupConnections() // create another connection using same underlying clients path2 := ibctesting.NewPath(suite.chainA, suite.chainB) path2.EndpointA.ClientID = path1.EndpointA.ClientID path2.EndpointB.ClientID = path1.EndpointB.ClientID - suite.coordinator.CreateConnections(path2) + path2.CreateConnections() expPaths = []string{path1.EndpointA.ConnectionID, path2.EndpointA.ConnectionID} suite.chainA.App.GetIBCKeeper().ConnectionKeeper.SetClientConnectionPaths(suite.chainA.GetContext(), path1.EndpointA.ClientID, expPaths) @@ -299,7 +299,7 @@ func (suite *KeeperTestSuite) TestQueryConnectionClientState() { "client state not found", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() // set connection to empty so clientID is empty suite.chainA.App.GetIBCKeeper().ConnectionKeeper.SetConnection(suite.chainA.GetContext(), path.EndpointA.ConnectionID, types.ConnectionEnd{}) @@ -313,7 +313,7 @@ func (suite *KeeperTestSuite) TestQueryConnectionClientState() { "success", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() expClientState := suite.chainA.GetClientState(path.EndpointA.ClientID) expIdentifiedClientState = clienttypes.NewIdentifiedClientState(path.EndpointA.ClientID, expClientState) @@ -397,7 +397,7 @@ func (suite *KeeperTestSuite) TestQueryConnectionConsensusState() { "consensus state not found", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() req = &types.QueryConnectionConsensusStateRequest{ ConnectionId: path.EndpointA.ConnectionID, @@ -410,7 +410,7 @@ func (suite *KeeperTestSuite) TestQueryConnectionConsensusState() { "success", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() clientState := suite.chainA.GetClientState(path.EndpointA.ClientID) expConsensusState, _ = suite.chainA.GetConsensusState(path.EndpointA.ClientID, clientState.GetLatestHeight()) diff --git a/modules/core/03-connection/keeper/handshake_test.go b/modules/core/03-connection/keeper/handshake_test.go index eaaa0ab3125..9e5475f6a67 100644 --- a/modules/core/03-connection/keeper/handshake_test.go +++ b/modules/core/03-connection/keeper/handshake_test.go @@ -67,7 +67,7 @@ func (suite *KeeperTestSuite) TestConnOpenInit() { version = nil // must be explicitly changed expErrorMsgSubstring = "" path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() tc.malleate() @@ -229,7 +229,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() { versions = types.GetCompatibleVersions() // may be changed in malleate delayPeriod = 0 // may be changed in malleate path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() tc.malleate() @@ -482,7 +482,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() { version = types.GetCompatibleVersions()[0] // must be explicitly changed in malleate consensusHeight = clienttypes.ZeroHeight() // must be explicitly changed in malleate path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() tc.malleate() @@ -543,7 +543,7 @@ func (suite *KeeperTestSuite) TestConnOpenConfirm() { }, false}, {"chain B's connection state is not TRYOPEN", func() { // connections are OPEN - suite.coordinator.CreateConnections(path) + path.CreateConnections() }, false}, {"connection state verification failed", func() { // chainA is in INIT @@ -561,7 +561,7 @@ func (suite *KeeperTestSuite) TestConnOpenConfirm() { suite.Run(tc.msg, func() { suite.SetupTest() // reset path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() tc.malleate() diff --git a/modules/core/03-connection/keeper/keeper_test.go b/modules/core/03-connection/keeper/keeper_test.go index 090d8cf26ea..e0ea47bccc1 100644 --- a/modules/core/03-connection/keeper/keeper_test.go +++ b/modules/core/03-connection/keeper/keeper_test.go @@ -34,21 +34,21 @@ func TestKeeperTestSuite(t *testing.T) { func (suite *KeeperTestSuite) TestSetAndGetConnection() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() firstConnection := "connection-0" // check first connection does not exist _, existed := suite.chainA.App.GetIBCKeeper().ConnectionKeeper.GetConnection(suite.chainA.GetContext(), firstConnection) suite.Require().False(existed) - suite.coordinator.CreateConnections(path) + path.CreateConnections() _, existed = suite.chainA.App.GetIBCKeeper().ConnectionKeeper.GetConnection(suite.chainA.GetContext(), firstConnection) suite.Require().True(existed) } func (suite *KeeperTestSuite) TestSetAndGetClientConnectionPaths() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() _, existed := suite.chainA.App.GetIBCKeeper().ConnectionKeeper.GetClientConnectionPaths(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.False(existed) @@ -63,13 +63,13 @@ func (suite *KeeperTestSuite) TestSetAndGetClientConnectionPaths() { // create 2 connections: A0 - B0, A1 - B1 func (suite KeeperTestSuite) TestGetAllConnections() { //nolint:govet // this is a test, we are okay with copying locks path1 := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path1) + path1.SetupConnections() path2 := ibctesting.NewPath(suite.chainA, suite.chainB) path2.EndpointA.ClientID = path1.EndpointA.ClientID path2.EndpointB.ClientID = path1.EndpointB.ClientID - suite.coordinator.CreateConnections(path2) + path2.CreateConnections() counterpartyB0 := types.NewCounterparty(path1.EndpointB.ClientID, path1.EndpointB.ConnectionID, suite.chainB.GetPrefix()) // connection B0 counterpartyB1 := types.NewCounterparty(path2.EndpointB.ClientID, path2.EndpointB.ConnectionID, suite.chainB.GetPrefix()) // connection B1 @@ -96,13 +96,13 @@ func (suite KeeperTestSuite) TestGetAllConnections() { //nolint:govet // this is func (suite KeeperTestSuite) TestGetAllClientConnectionPaths() { //nolint:govet // this is a test, we are okay with copying locks path1 := ibctesting.NewPath(suite.chainA, suite.chainB) path2 := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path1) - suite.coordinator.SetupConnections(path2) + path1.SetupConnections() + path2.SetupConnections() path3 := ibctesting.NewPath(suite.chainA, suite.chainB) path3.EndpointA.ClientID = path2.EndpointA.ClientID path3.EndpointB.ClientID = path2.EndpointB.ClientID - suite.coordinator.CreateConnections(path3) + path3.CreateConnections() expPaths := []types.ConnectionPaths{ types.NewConnectionPaths(path1.EndpointA.ClientID, []string{path1.EndpointA.ConnectionID}), @@ -129,14 +129,14 @@ func (suite *KeeperTestSuite) TestGetTimestampAtHeight() { }{ {"verification success", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() connection = path.EndpointA.GetConnection() height = suite.chainB.LastHeader.GetHeight() }, true}, {"client state not found", func() {}, false}, {"consensus state not found", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() connection = path.EndpointA.GetConnection() height = suite.chainB.LastHeader.GetHeight().Increment() }, false}, diff --git a/modules/core/03-connection/keeper/verify_test.go b/modules/core/03-connection/keeper/verify_test.go index c42fb0e044b..96896796f89 100644 --- a/modules/core/03-connection/keeper/verify_test.go +++ b/modules/core/03-connection/keeper/verify_test.go @@ -57,7 +57,7 @@ func (suite *KeeperTestSuite) TestVerifyClientState() { heightDiff = 0 // must be explicitly changed path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() tc.malleate() @@ -131,7 +131,7 @@ func (suite *KeeperTestSuite) TestVerifyClientConsensusState() { suite.SetupTest() // reset heightDiff = 0 // must be explicitly changed in malleate path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() tc.malleate() @@ -195,7 +195,7 @@ func (suite *KeeperTestSuite) TestVerifyConnectionState() { suite.SetupTest() // reset path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() connectionKey := host.ConnectionKey(path.EndpointB.ConnectionID) proof, proofHeight := suite.chainB.QueryProof(connectionKey) @@ -260,7 +260,7 @@ func (suite *KeeperTestSuite) TestVerifyChannelState() { suite.SetupTest() // reset path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() channelKey := host.ChannelKey(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) proof, proofHeight := suite.chainB.QueryProof(channelKey) @@ -338,7 +338,7 @@ func (suite *KeeperTestSuite) TestVerifyPacketCommitment() { suite.SetupTest() // reset path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, 0, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -431,7 +431,7 @@ func (suite *KeeperTestSuite) TestVerifyPacketAcknowledgement() { ack = ibcmock.MockAcknowledgement // must be explicitly changed path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() // send and receive packet sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, 0, ibctesting.MockPacketData) @@ -536,7 +536,7 @@ func (suite *KeeperTestSuite) TestVerifyPacketReceiptAbsence() { suite.SetupTest() // reset path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() // send, only receive in malleate if applicable sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, 0, ibctesting.MockPacketData) @@ -637,7 +637,7 @@ func (suite *KeeperTestSuite) TestVerifyNextSequenceRecv() { suite.SetupTest() // reset path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() // send and receive packet sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, 0, ibctesting.MockPacketData) diff --git a/modules/core/04-channel/keeper/grpc_query_test.go b/modules/core/04-channel/keeper/grpc_query_test.go index 6603c972dc2..0f47fbb7267 100644 --- a/modules/core/04-channel/keeper/grpc_query_test.go +++ b/modules/core/04-channel/keeper/grpc_query_test.go @@ -66,7 +66,7 @@ func (suite *KeeperTestSuite) TestQueryChannel() { "success", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() // init channel @@ -135,7 +135,7 @@ func (suite *KeeperTestSuite) TestQueryChannels() { "success", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() // channel0 on first connection on chainA counterparty0 := types.Counterparty{ PortId: path.EndpointB.ChannelConfig.PortID, @@ -236,7 +236,7 @@ func (suite *KeeperTestSuite) TestQueryConnectionChannels() { "success", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() // channel0 on first connection on chainA counterparty0 := types.Counterparty{ PortId: path.EndpointB.ChannelConfig.PortID, @@ -286,7 +286,7 @@ func (suite *KeeperTestSuite) TestQueryConnectionChannels() { "success, empty response", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() expChannels = []*types.IdentifiedChannel(nil) req = &types.QueryConnectionChannelsRequest{ Connection: "externalConnID", @@ -375,7 +375,7 @@ func (suite *KeeperTestSuite) TestQueryChannelClientState() { "connection not found", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() channel := path.EndpointA.GetChannel() // update channel to reference a connection that does not exist @@ -394,7 +394,7 @@ func (suite *KeeperTestSuite) TestQueryChannelClientState() { "client state for channel's connection not found", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() // set connection to empty so clientID is empty suite.chainA.App.GetIBCKeeper().ConnectionKeeper.SetConnection(suite.chainA.GetContext(), path.EndpointA.ConnectionID, connectiontypes.ConnectionEnd{}) @@ -409,7 +409,7 @@ func (suite *KeeperTestSuite) TestQueryChannelClientState() { "success", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() // init channel @@ -513,7 +513,7 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() { "connection not found", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() channel := path.EndpointA.GetChannel() // update channel to reference a connection that does not exist @@ -534,7 +534,7 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() { "consensus state for channel's connection not found", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() req = &types.QueryChannelConsensusStateRequest{ PortId: path.EndpointA.ChannelConfig.PortID, @@ -548,7 +548,7 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() { "success", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() // init channel @@ -666,7 +666,7 @@ func (suite *KeeperTestSuite) TestQueryPacketCommitment() { "success", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() expCommitment = []byte("hash") suite.chainA.App.GetIBCKeeper().ChannelKeeper.SetPacketCommitment(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, 1, expCommitment) @@ -751,7 +751,7 @@ func (suite *KeeperTestSuite) TestQueryPacketCommitments() { "success", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() expCommitments = make([]*types.PacketState, 9) @@ -852,7 +852,7 @@ func (suite *KeeperTestSuite) TestQueryPacketReceipt() { "success: receipt not found", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() suite.chainA.App.GetIBCKeeper().ChannelKeeper.SetPacketReceipt(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, 1) req = &types.QueryPacketReceiptRequest{ @@ -868,7 +868,7 @@ func (suite *KeeperTestSuite) TestQueryPacketReceipt() { "success: receipt found", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() suite.chainA.App.GetIBCKeeper().ChannelKeeper.SetPacketReceipt(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, 1) req = &types.QueryPacketReceiptRequest{ @@ -970,7 +970,7 @@ func (suite *KeeperTestSuite) TestQueryPacketAcknowledgement() { "success", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() expAck = []byte("hash") suite.chainA.App.GetIBCKeeper().ChannelKeeper.SetPacketAcknowledgement(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, 1, expAck) @@ -1055,7 +1055,7 @@ func (suite *KeeperTestSuite) TestQueryPacketAcknowledgements() { "success, filtered res", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() var commitments []uint64 @@ -1082,7 +1082,7 @@ func (suite *KeeperTestSuite) TestQueryPacketAcknowledgements() { "success", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() expAcknowledgements = make([]*types.PacketState, 9) @@ -1170,7 +1170,7 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedPackets() { "invalid seq", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() req = &types.QueryUnreceivedPacketsRequest{ PortId: path.EndpointA.ChannelConfig.PortID, @@ -1185,7 +1185,7 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedPackets() { func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() req = &types.QueryUnreceivedPacketsRequest{ PortId: path.EndpointA.ChannelConfig.PortID, @@ -1209,7 +1209,7 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedPackets() { "basic success empty packet commitments", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() expSeq = []uint64(nil) req = &types.QueryUnreceivedPacketsRequest{ @@ -1224,7 +1224,7 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedPackets() { "basic success unreceived packet commitments", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() // no ack exists @@ -1241,7 +1241,7 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedPackets() { "basic success unreceived packet commitments, nothing to relay", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() suite.chainA.App.GetIBCKeeper().ChannelKeeper.SetPacketReceipt(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, 1) @@ -1258,7 +1258,7 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedPackets() { "success multiple unreceived packet commitments", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() expSeq = []uint64(nil) // reset packetCommitments := []uint64{} @@ -1286,7 +1286,7 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedPackets() { func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() expSeq = []uint64(nil) req = &types.QueryUnreceivedPacketsRequest{ @@ -1302,7 +1302,7 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedPackets() { func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() // Note: NextSequenceRecv is set to 1 on channel creation. expSeq = []uint64{1} @@ -1319,7 +1319,7 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedPackets() { func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() // Exercise scenario from issue #1532. NextSequenceRecv is 5, packet commitments provided are 2, 7, 9, 10. // Packet sequence 2 is already received so only sequences 7, 9, 10 should be considered unreceived. @@ -1401,7 +1401,7 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedAcks() { "invalid seq", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() req = &types.QueryUnreceivedAcksRequest{ PortId: path.EndpointA.ChannelConfig.PortID, @@ -1415,7 +1415,7 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedAcks() { "basic success unreceived packet acks", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() suite.chainA.App.GetIBCKeeper().ChannelKeeper.SetPacketCommitment(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, 1, []byte("commitment")) @@ -1432,7 +1432,7 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedAcks() { "basic success unreceived packet acknowledgements, nothing to relay", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() expSeq = []uint64(nil) req = &types.QueryUnreceivedAcksRequest{ @@ -1447,7 +1447,7 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedAcks() { "success multiple unreceived packet acknowledgements", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() expSeq = []uint64{} // reset packetAcks := []uint64{} @@ -1545,7 +1545,7 @@ func (suite *KeeperTestSuite) TestQueryNextSequenceReceive() { "basic success on unordered channel returns zero", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() expSeq = 0 req = &types.QueryNextSequenceReceiveRequest{ @@ -1560,7 +1560,7 @@ func (suite *KeeperTestSuite) TestQueryNextSequenceReceive() { func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() expSeq = 3 seq := uint64(3) @@ -1649,7 +1649,7 @@ func (suite *KeeperTestSuite) TestQueryNextSequenceSend() { "basic success on unordered channel returns the set send sequence", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() expSeq = 42 seq := uint64(42) @@ -1666,7 +1666,7 @@ func (suite *KeeperTestSuite) TestQueryNextSequenceSend() { func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() expSeq = 3 seq := uint64(3) diff --git a/modules/core/04-channel/keeper/handshake_test.go b/modules/core/04-channel/keeper/handshake_test.go index 988de93045d..0522200ec6c 100644 --- a/modules/core/04-channel/keeper/handshake_test.go +++ b/modules/core/04-channel/keeper/handshake_test.go @@ -32,13 +32,13 @@ func (suite *KeeperTestSuite) TestChanOpenInit() { testCases := []testCase{ {"success", func() { - suite.coordinator.SetupConnections(path) + path.SetupConnections() features = []string{"ORDER_ORDERED", "ORDER_UNORDERED"} suite.chainA.CreatePortCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort) portCap = suite.chainA.GetPortCapability(ibctesting.MockPort) }, true}, {"channel already exists", func() { - suite.coordinator.Setup(path) + path.Setup() }, false}, {"connection doesn't exist", func() { // any non-empty values @@ -46,12 +46,12 @@ func (suite *KeeperTestSuite) TestChanOpenInit() { path.EndpointB.ConnectionID = "connection-0" }, false}, {"capability is incorrect", func() { - suite.coordinator.SetupConnections(path) + path.SetupConnections() features = []string{"ORDER_ORDERED", "ORDER_UNORDERED"} portCap = capabilitytypes.NewCapability(3) }, false}, {"connection version not negotiated", func() { - suite.coordinator.SetupConnections(path) + path.SetupConnections() // modify connA versions conn := path.EndpointA.GetConnection() @@ -68,7 +68,7 @@ func (suite *KeeperTestSuite) TestChanOpenInit() { portCap = suite.chainA.GetPortCapability(ibctesting.MockPort) }, false}, {"connection does not support ORDERED channels", func() { - suite.coordinator.SetupConnections(path) + path.SetupConnections() // modify connA versions to only support UNORDERED channels conn := path.EndpointA.GetConnection() @@ -90,7 +90,7 @@ func (suite *KeeperTestSuite) TestChanOpenInit() { expPass: false, malleate: func() { expErrorMsgSubstring = "status is Unauthorized" - suite.coordinator.SetupConnections(path) + path.SetupConnections() // remove client from allowed list params := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetParams(suite.chainA.GetContext()) @@ -168,7 +168,7 @@ func (suite *KeeperTestSuite) TestChanOpenTry() { testCases := []testCase{ {"success", func() { - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() err := path.EndpointA.ChanOpenInit() suite.Require().NoError(err) @@ -185,7 +185,7 @@ func (suite *KeeperTestSuite) TestChanOpenTry() { portCap = suite.chainB.GetPortCapability(ibctesting.MockPort) }, false}, {"connection is not OPEN", func() { - suite.coordinator.SetupClients(path) + path.SetupClients() // pass capability check suite.chainB.CreatePortCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort) portCap = suite.chainB.GetPortCapability(ibctesting.MockPort) @@ -194,7 +194,7 @@ func (suite *KeeperTestSuite) TestChanOpenTry() { suite.Require().NoError(err) }, false}, {"consensus state not found", func() { - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() err := path.EndpointA.ChanOpenInit() suite.Require().NoError(err) @@ -206,11 +206,11 @@ func (suite *KeeperTestSuite) TestChanOpenTry() { }, false}, {"channel verification failed", func() { // not creating a channel on chainA will result in an invalid proof of existence - suite.coordinator.SetupConnections(path) + path.SetupConnections() portCap = suite.chainB.GetPortCapability(ibctesting.MockPort) }, false}, {"port capability not found", func() { - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() err := path.EndpointA.ChanOpenInit() suite.Require().NoError(err) @@ -218,7 +218,7 @@ func (suite *KeeperTestSuite) TestChanOpenTry() { portCap = capabilitytypes.NewCapability(3) }, false}, {"connection version not negotiated", func() { - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() err := path.EndpointA.ChanOpenInit() suite.Require().NoError(err) @@ -237,7 +237,7 @@ func (suite *KeeperTestSuite) TestChanOpenTry() { portCap = suite.chainB.GetPortCapability(ibctesting.MockPort) }, false}, {"connection does not support ORDERED channels", func() { - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() err := path.EndpointA.ChanOpenInit() suite.Require().NoError(err) @@ -313,7 +313,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() { testCases := []testCase{ {"success", func() { - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() err := path.EndpointA.ChanOpenInit() suite.Require().NoError(err) @@ -324,7 +324,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() { channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, true}, {"success with empty stored counterparty channel ID", func() { - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() err := path.EndpointA.ChanOpenInit() @@ -347,11 +347,11 @@ func (suite *KeeperTestSuite) TestChanOpenAck() { {"channel doesn't exist", func() {}, false}, {"channel state is not INIT", func() { // create fully open channels on both chains - suite.coordinator.Setup(path) + path.Setup() channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"connection not found", func() { - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() err := path.EndpointA.ChanOpenInit() suite.Require().NoError(err) @@ -367,7 +367,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() { suite.chainA.App.GetIBCKeeper().ChannelKeeper.SetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, channel) }, false}, {"connection is not OPEN", func() { - suite.coordinator.SetupClients(path) + path.SetupClients() err := path.EndpointA.ConnOpenInit() suite.Require().NoError(err) @@ -382,7 +382,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() { channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"consensus state not found", func() { - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() err := path.EndpointA.ChanOpenInit() @@ -396,7 +396,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() { heightDiff = 3 // consensus state doesn't exist at this height }, false}, {"invalid counterparty channel identifier", func() { - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() err := path.EndpointA.ChanOpenInit() @@ -411,7 +411,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() { }, false}, {"channel verification failed", func() { // chainB is INIT, chainA in TRYOPEN - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() err := path.EndpointB.ChanOpenInit() @@ -423,7 +423,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() { channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"channel capability not found", func() { - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() err := path.EndpointA.ChanOpenInit() suite.Require().NoError(err) @@ -483,7 +483,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() { ) testCases := []testCase{ {"success", func() { - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() err := path.EndpointA.ChanOpenInit() @@ -500,11 +500,11 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() { {"channel doesn't exist", func() {}, false}, {"channel state is not TRYOPEN", func() { // create fully open channels on both chains - suite.coordinator.Setup(path) + path.Setup() channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, false}, {"connection not found", func() { - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() err := path.EndpointA.ChanOpenInit() @@ -524,7 +524,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() { suite.chainB.App.GetIBCKeeper().ChannelKeeper.SetChannel(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, channel) }, false}, {"connection is not OPEN", func() { - suite.coordinator.SetupClients(path) + path.SetupClients() err := path.EndpointB.ConnOpenInit() suite.Require().NoError(err) @@ -533,7 +533,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() { channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, ibctesting.FirstChannelID) }, false}, {"consensus state not found", func() { - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() err := path.EndpointA.ChanOpenInit() @@ -551,7 +551,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() { }, false}, {"channel verification failed", func() { // chainA is INIT, chainB in TRYOPEN - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() err := path.EndpointA.ChanOpenInit() @@ -563,7 +563,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() { channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, false}, {"channel capability not found", func() { - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() err := path.EndpointA.ChanOpenInit() @@ -623,7 +623,7 @@ func (suite *KeeperTestSuite) TestChanCloseInit() { testCases := []testCase{ {"success", func() { - suite.coordinator.Setup(path) + path.Setup() channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, true}, {"channel doesn't exist", func() { @@ -639,7 +639,7 @@ func (suite *KeeperTestSuite) TestChanCloseInit() { channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"channel state is CLOSED", func() { - suite.coordinator.Setup(path) + path.Setup() channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) // close channel @@ -647,7 +647,7 @@ func (suite *KeeperTestSuite) TestChanCloseInit() { suite.Require().NoError(err) }, false}, {"connection not found", func() { - suite.coordinator.Setup(path) + path.Setup() channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) // set the channel's connection hops to wrong connection ID @@ -656,7 +656,7 @@ func (suite *KeeperTestSuite) TestChanCloseInit() { suite.chainA.App.GetIBCKeeper().ChannelKeeper.SetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, channel) }, false}, {"connection is not OPEN", func() { - suite.coordinator.SetupClients(path) + path.SetupClients() err := path.EndpointA.ConnOpenInit() suite.Require().NoError(err) @@ -671,14 +671,14 @@ func (suite *KeeperTestSuite) TestChanCloseInit() { channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"channel capability not found", func() { - suite.coordinator.Setup(path) + path.Setup() channelCap = capabilitytypes.NewCapability(3) }, false}, { msg: "unauthorized client", expPass: false, malleate: func() { - suite.coordinator.Setup(path) + path.Setup() channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) // remove client from allowed list @@ -725,7 +725,7 @@ func (suite *KeeperTestSuite) TestChanCloseConfirm() { testCases := []testCase{ {"success", func() { - suite.coordinator.Setup(path) + path.Setup() channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) err := path.EndpointA.SetChannelState(types.CLOSED) @@ -741,14 +741,14 @@ func (suite *KeeperTestSuite) TestChanCloseConfirm() { channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, ibctesting.FirstChannelID) }, false}, {"channel state is CLOSED", func() { - suite.coordinator.Setup(path) + path.Setup() channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) err := path.EndpointB.SetChannelState(types.CLOSED) suite.Require().NoError(err) }, false}, {"connection not found", func() { - suite.coordinator.Setup(path) + path.Setup() channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) // set the channel's connection hops to wrong connection ID @@ -757,7 +757,7 @@ func (suite *KeeperTestSuite) TestChanCloseConfirm() { suite.chainB.App.GetIBCKeeper().ChannelKeeper.SetChannel(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, channel) }, false}, {"connection is not OPEN", func() { - suite.coordinator.SetupClients(path) + path.SetupClients() err := path.EndpointB.ConnOpenInit() suite.Require().NoError(err) @@ -772,7 +772,7 @@ func (suite *KeeperTestSuite) TestChanCloseConfirm() { channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, false}, {"consensus state not found", func() { - suite.coordinator.Setup(path) + path.Setup() channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) err := path.EndpointA.SetChannelState(types.CLOSED) @@ -782,11 +782,11 @@ func (suite *KeeperTestSuite) TestChanCloseConfirm() { }, false}, {"channel verification failed", func() { // channel not closed - suite.coordinator.Setup(path) + path.Setup() channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, false}, {"channel capability not found", func() { - suite.coordinator.Setup(path) + path.Setup() channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) err := path.EndpointA.SetChannelState(types.CLOSED) diff --git a/modules/core/04-channel/keeper/keeper_test.go b/modules/core/04-channel/keeper/keeper_test.go index 94917b92d00..3b849c3c8ad 100644 --- a/modules/core/04-channel/keeper/keeper_test.go +++ b/modules/core/04-channel/keeper/keeper_test.go @@ -43,7 +43,7 @@ func (suite *KeeperTestSuite) SetupTest() { func (suite *KeeperTestSuite) TestSetChannel() { // create client and connections on both chains path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() // check for channel to be created on chainA found := suite.chainA.App.GetIBCKeeper().ChannelKeeper.HasChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) @@ -68,7 +68,7 @@ func (suite *KeeperTestSuite) TestSetChannel() { func (suite *KeeperTestSuite) TestGetAppVersion() { // create client and connections on both chains path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() version, found := suite.chainA.App.GetIBCKeeper().ChannelKeeper.GetAppVersion(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) suite.Require().False(found) @@ -167,7 +167,7 @@ func containsAll(expected, actual []types.IdentifiedChannel) bool { // and tests their retrieval. 2 channels are on connA0 and 1 channel is on connA1 func (suite KeeperTestSuite) TestGetAllChannels() { //nolint:govet // this is a test, we are okay with copying locks path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() // channel0 on first connection on chainA counterparty0 := types.Counterparty{ PortId: path.EndpointB.ChannelConfig.PortID, @@ -189,7 +189,7 @@ func (suite KeeperTestSuite) TestGetAllChannels() { //nolint:govet // this is a } path2 := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path2) + path2.SetupConnections() // path2 creates a second channel on chainA err := path2.EndpointA.ChanOpenInit() @@ -231,7 +231,7 @@ func (suite KeeperTestSuite) TestGetAllChannels() { //nolint:govet // this is a // tests their retrieval. func (suite KeeperTestSuite) TestGetAllSequences() { //nolint:govet // this is a test, we are okay with copying locks path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() path1 := ibctesting.NewPath(suite.chainA, suite.chainB) path1.SetChannelOrdered() @@ -273,7 +273,7 @@ func (suite KeeperTestSuite) TestGetAllSequences() { //nolint:govet // this is a // channels on chain A and tests their retrieval. func (suite KeeperTestSuite) TestGetAllPacketState() { //nolint:govet // this is a test, we are okay with copying locks path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() path1 := ibctesting.NewPath(suite.chainA, suite.chainB) path1.EndpointA.ClientID = path.EndpointA.ClientID @@ -347,7 +347,7 @@ func (suite KeeperTestSuite) TestGetAllPacketState() { //nolint:govet // this is // TestSetSequence verifies that the keeper correctly sets the sequence counters. func (suite *KeeperTestSuite) TestSetSequence() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() ctxA := suite.chainA.GetContext() one := uint64(1) @@ -391,7 +391,7 @@ func (suite *KeeperTestSuite) TestSetSequence() { // with the value maxSeq + 1 is set on a different channel. func (suite *KeeperTestSuite) TestGetAllPacketCommitmentsAtChannel() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() // create second channel path1 := ibctesting.NewPath(suite.chainA, suite.chainB) @@ -448,7 +448,7 @@ func (suite *KeeperTestSuite) TestGetAllPacketCommitmentsAtChannel() { // set in the keeper. func (suite *KeeperTestSuite) TestSetPacketAcknowledgement() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() ctxA := suite.chainA.GetContext() seq := uint64(10) diff --git a/modules/core/04-channel/keeper/packet_test.go b/modules/core/04-channel/keeper/packet_test.go index 721a41d46de..7a841cf4b2b 100644 --- a/modules/core/04-channel/keeper/packet_test.go +++ b/modules/core/04-channel/keeper/packet_test.go @@ -41,20 +41,20 @@ func (suite *KeeperTestSuite) TestSendPacket() { testCases := []testCase{ {"success: UNORDERED channel", func() { - suite.coordinator.Setup(path) + path.Setup() sourceChannel = path.EndpointA.ChannelID channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, true}, {"success: ORDERED channel", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() sourceChannel = path.EndpointA.ChannelID channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, true}, {"success with solomachine: UNORDERED channel", func() { - suite.coordinator.Setup(path) + path.Setup() sourceChannel = path.EndpointA.ChannelID // swap client with solo machine @@ -69,7 +69,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { }, true}, {"success with solomachine: ORDERED channel", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() sourceChannel = path.EndpointA.ChannelID // swap client with solomachine @@ -83,7 +83,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, true}, {"packet basic validation failed, empty packet data", func() { - suite.coordinator.Setup(path) + path.Setup() sourceChannel = path.EndpointA.ChannelID channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) @@ -91,26 +91,26 @@ func (suite *KeeperTestSuite) TestSendPacket() { }, false}, {"channel not found", func() { // use wrong channel naming - suite.coordinator.Setup(path) + path.Setup() sourceChannel = ibctesting.InvalidID channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"channel is in CLOSED state", func() { - suite.coordinator.Setup(path) + path.Setup() sourceChannel = path.EndpointA.ChannelID err := path.EndpointA.SetChannelState(types.CLOSED) suite.Require().NoError(err) }, false}, {"channel is in INIT state", func() { - suite.coordinator.Setup(path) + path.Setup() sourceChannel = path.EndpointA.ChannelID err := path.EndpointA.SetChannelState(types.INIT) suite.Require().NoError(err) }, false}, {"channel is in TRYOPEN stage", func() { - suite.coordinator.Setup(path) + path.Setup() sourceChannel = path.EndpointA.ChannelID err := path.EndpointA.SetChannelState(types.TRYOPEN) @@ -118,7 +118,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { }, false}, {"connection not found", func() { // pass channel check - suite.coordinator.Setup(path) + path.Setup() sourceChannel = path.EndpointA.ChannelID channel := path.EndpointA.GetChannel() @@ -128,7 +128,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"client state not found", func() { - suite.coordinator.Setup(path) + path.Setup() sourceChannel = path.EndpointA.ChannelID // change connection client ID @@ -139,7 +139,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"client state is frozen", func() { - suite.coordinator.Setup(path) + path.Setup() sourceChannel = path.EndpointA.ChannelID connection := path.EndpointA.GetConnection() @@ -155,7 +155,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { }, false}, {"timeout height passed", func() { - suite.coordinator.Setup(path) + path.Setup() sourceChannel = path.EndpointA.ChannelID // use client state latest height for timeout @@ -164,7 +164,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"timeout timestamp passed", func() { - suite.coordinator.Setup(path) + path.Setup() sourceChannel = path.EndpointA.ChannelID // use latest time on client state @@ -178,7 +178,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"timeout timestamp passed with solomachine", func() { - suite.coordinator.Setup(path) + path.Setup() // swap client with solomachine solomachine := ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "solomachinesingle", "testing", 1) path.EndpointA.ClientID = clienttypes.FormatClientIdentifier(exported.Solomachine, 10) @@ -201,7 +201,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { path := ibctesting.NewPath(suite.chainA, suite.chainB) sourceChannel = path.EndpointA.ChannelID - suite.coordinator.SetupConnections(path) + path.SetupConnections() // manually creating channel prevents next sequence from being set suite.chainA.App.GetIBCKeeper().ChannelKeeper.SetChannel( suite.chainA.GetContext(), @@ -212,7 +212,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"channel capability not found", func() { - suite.coordinator.Setup(path) + path.Setup() sourceChannel = path.EndpointA.ChannelID channelCap = capabilitytypes.NewCapability(5) @@ -272,7 +272,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { "success: ORDERED channel", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -285,7 +285,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { "success UNORDERED channel", func() { // setup uses an UNORDERED channel - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) @@ -297,7 +297,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { "success with out of order packet: UNORDERED channel", func() { // setup uses an UNORDERED channel - suite.coordinator.Setup(path) + path.Setup() // send 2 packets _, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -313,7 +313,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { "packet already relayed ORDERED channel (no-op)", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -329,7 +329,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { "packet already relayed UNORDERED channel (no-op)", func() { // setup uses an UNORDERED channel - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) @@ -344,7 +344,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { "out of order packet failure with ORDERED channel", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) // send 2 packets @@ -362,7 +362,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { "channel not found", func() { // use wrong channel naming - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, ibctesting.InvalidID, ibctesting.InvalidID, defaultTimeoutHeight, disabledTimeoutTimestamp) channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, @@ -371,7 +371,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { { "channel not open", func() { - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) err := path.EndpointB.SetChannelState(types.CLOSED) @@ -384,7 +384,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { "capability cannot authenticate ORDERED", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -396,7 +396,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { { "packet source port ≠ channel counterparty port", func() { - suite.coordinator.Setup(path) + path.Setup() // use wrong port for dest packet = types.NewPacket(ibctesting.MockPacketData, 1, ibctesting.InvalidID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) @@ -407,7 +407,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { { "packet source channel ID ≠ channel counterparty channel ID", func() { - suite.coordinator.Setup(path) + path.Setup() // use wrong port for dest packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, ibctesting.InvalidID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) @@ -418,7 +418,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { { "connection not found", func() { - suite.coordinator.Setup(path) + path.Setup() // pass channel check suite.chainB.App.GetIBCKeeper().ChannelKeeper.SetChannel( @@ -435,7 +435,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { { "connection not OPEN", func() { - suite.coordinator.SetupClients(path) + path.SetupClients() // connection on chainB is in INIT err := path.EndpointB.ConnOpenInit() @@ -456,7 +456,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { { "timeout height passed", func() { - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), disabledTimeoutTimestamp) channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) @@ -466,7 +466,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { { "timeout timestamp passed", func() { - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, disabledTimeoutHeight, uint64(suite.chainB.GetContext().BlockTime().UnixNano())) channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) @@ -476,7 +476,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { { "next receive sequence is not found", func() { - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.EndpointA.ChannelID = ibctesting.FirstChannelID path.EndpointB.ChannelID = ibctesting.FirstChannelID @@ -506,7 +506,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { { "receipt already stored", func() { - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -520,7 +520,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { "validation failed", func() { // packet commitment not set resulting in invalid proof - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, @@ -579,7 +579,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { { "success", func() { - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) ack = ibcmock.MockAcknowledgement channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) @@ -588,13 +588,13 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { }, {"channel not found", func() { // use wrong channel naming - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, ibctesting.InvalidID, ibctesting.InvalidID, defaultTimeoutHeight, disabledTimeoutTimestamp) ack = ibcmock.MockAcknowledgement channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, false}, {"channel not open", func() { - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) ack = ibcmock.MockAcknowledgement @@ -605,7 +605,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { { "capability authentication failed", func() { - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) ack = ibcmock.MockAcknowledgement channelCap = capabilitytypes.NewCapability(3) @@ -615,7 +615,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { { "no-op, already acked", func() { - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) ack = ibcmock.MockAcknowledgement suite.chainB.App.GetIBCKeeper().ChannelKeeper.SetPacketAcknowledgement(suite.chainB.GetContext(), packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence(), ack.Acknowledgement()) @@ -626,7 +626,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { { "empty acknowledgement", func() { - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) ack = ibcmock.NewEmptyAcknowledgement() channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) @@ -636,7 +636,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { { "acknowledgement is nil", func() { - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) ack = nil channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) @@ -708,7 +708,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { name: "success on ordered channel", malleate: func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() // create packet commitment sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) @@ -727,7 +727,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { name: "success on unordered channel", malleate: func() { // setup uses an UNORDERED channel - suite.coordinator.Setup(path) + path.Setup() // create packet commitment sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) @@ -746,7 +746,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { name: "packet already acknowledged ordered channel (no-op)", malleate: func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() // create packet commitment sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) @@ -768,7 +768,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { name: "packet already acknowledged unordered channel (no-op)", malleate: func() { // setup uses an UNORDERED channel - suite.coordinator.Setup(path) + path.Setup() // create packet commitment sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) @@ -790,7 +790,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { name: "channel not found", malleate: func() { // use wrong channel naming - suite.coordinator.Setup(path) + path.Setup() // create packet commitment sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) @@ -803,7 +803,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { { name: "channel not open", malleate: func() { - suite.coordinator.Setup(path) + path.Setup() // create packet commitment sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) @@ -821,7 +821,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { name: "capability authentication failed ORDERED", malleate: func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() // create packet commitment sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) @@ -839,7 +839,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { { name: "packet destination port ≠ channel counterparty port", malleate: func() { - suite.coordinator.Setup(path) + path.Setup() // create packet commitment sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) @@ -854,7 +854,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { { name: "packet destination channel ID ≠ channel counterparty channel ID", malleate: func() { - suite.coordinator.Setup(path) + path.Setup() // create packet commitment sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) @@ -869,7 +869,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { { name: "connection not found", malleate: func() { - suite.coordinator.Setup(path) + path.Setup() // create packet commitment sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) @@ -892,7 +892,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { { name: "connection not OPEN", malleate: func() { - suite.coordinator.Setup(path) + path.Setup() // create packet commitment sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) @@ -919,7 +919,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { name: "packet hasn't been sent", malleate: func() { // packet commitment never written - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, @@ -931,7 +931,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { // skip error code check since error occurs in light-clients // ack never written - suite.coordinator.Setup(path) + path.Setup() // create packet commitment sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) @@ -945,7 +945,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { name: "packet commitment bytes do not match", malleate: func() { // setup uses an UNORDERED channel - suite.coordinator.Setup(path) + path.Setup() // create packet commitment sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) @@ -966,7 +966,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { name: "next ack sequence not found", malleate: func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() // create packet commitment sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) @@ -990,7 +990,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { name: "next ack sequence mismatch ORDERED", malleate: func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() // create packet commitment sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) diff --git a/modules/core/04-channel/keeper/timeout_test.go b/modules/core/04-channel/keeper/timeout_test.go index adaf237cf42..969e60205be 100644 --- a/modules/core/04-channel/keeper/timeout_test.go +++ b/modules/core/04-channel/keeper/timeout_test.go @@ -31,7 +31,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { {"success: ORDERED", func() { ordered = true path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().UnixNano()) @@ -45,7 +45,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { }, true}, {"success: UNORDERED", func() { ordered = false - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) @@ -60,7 +60,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { expError = types.ErrNoOpMsg ordered = true path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().UnixNano()) @@ -78,7 +78,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { {"packet already timed out: UNORDERED", func() { expError = types.ErrNoOpMsg ordered = false - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) @@ -95,12 +95,12 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { {"channel not found", func() { expError = types.ErrChannelNotFound // use wrong channel naming - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, ibctesting.InvalidID, ibctesting.InvalidID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) }, false}, {"channel not open", func() { expError = types.ErrInvalidChannelState - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := path.EndpointA.GetClientState().GetLatestHeight().Increment().(clienttypes.Height) @@ -116,13 +116,13 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { }, false}, {"packet destination port ≠ channel counterparty port", func() { expError = types.ErrInvalidPacket - suite.coordinator.Setup(path) + path.Setup() // use wrong port for dest packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, ibctesting.InvalidID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) }, false}, {"packet destination channel ID ≠ channel counterparty channel ID", func() { expError = types.ErrInvalidPacket - suite.coordinator.Setup(path) + path.Setup() // use wrong channel for dest packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, ibctesting.InvalidID, defaultTimeoutHeight, disabledTimeoutTimestamp) }, false}, @@ -138,7 +138,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { }, false}, {"timeout", func() { expError = types.ErrPacketTimeout - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) @@ -149,7 +149,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { expError = types.ErrPacketReceived ordered = true path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() nextSeqRecv = 2 timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().UnixNano()) @@ -165,7 +165,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { ordered = true path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, uint64(suite.chainB.GetContext().BlockTime().UnixNano())) err := path.EndpointA.UpdateClient() suite.Require().NoError(err) @@ -177,7 +177,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { ordered = false path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) @@ -193,7 +193,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { // set ordered to true resulting in wrong proof provided ordered = true - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) @@ -258,7 +258,7 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { testCases := []testCase{ {"success ORDERED", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().UnixNano()) @@ -271,12 +271,12 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { }, true}, {"channel not found", func() { // use wrong channel naming - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, ibctesting.InvalidID, ibctesting.InvalidID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) }, false}, {"incorrect capability ORDERED", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().UnixNano()) @@ -325,7 +325,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { {"success: ORDERED", func() { ordered = true path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().UnixNano()) @@ -343,7 +343,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { }, true}, {"success: UNORDERED", func() { ordered = false - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) @@ -360,17 +360,17 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { }, true}, {"channel not found", func() { // use wrong channel naming - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, ibctesting.InvalidID, ibctesting.InvalidID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) }, false}, {"packet dest port ≠ channel counterparty port", func() { - suite.coordinator.Setup(path) + path.Setup() // use wrong port for dest packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, ibctesting.InvalidID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"packet dest channel ID ≠ channel counterparty channel ID", func() { - suite.coordinator.Setup(path) + path.Setup() // use wrong channel for dest packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, ibctesting.InvalidID, defaultTimeoutHeight, disabledTimeoutTimestamp) chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) @@ -390,7 +390,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { }, false}, {"packet hasn't been sent ORDERED", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), uint64(suite.chainB.GetContext().BlockTime().UnixNano())) chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) @@ -399,7 +399,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { path.SetChannelOrdered() nextSeqRecv = 2 ordered = true - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().UnixNano()) @@ -418,7 +418,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { {"channel verification failed ORDERED", func() { ordered = true path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().UnixNano()) @@ -432,7 +432,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { // set ordered to false providing the wrong proof for ORDERED case ordered = false path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().UnixNano()) @@ -450,7 +450,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { {"packet ack verification failed", func() { // set ordered to true providing the wrong proof for UNORDERED case ordered = true - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) @@ -467,7 +467,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { {"channel capability not found ORDERED", func() { ordered = true path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().UnixNano()) diff --git a/modules/core/ante/ante_test.go b/modules/core/ante/ante_test.go index 1b9a8c15c64..acf9cfc0f15 100644 --- a/modules/core/ante/ante_test.go +++ b/modules/core/ante/ante_test.go @@ -37,7 +37,7 @@ func (suite *AnteTestSuite) SetupTest() { suite.coordinator.CommitNBlocks(suite.chainA, 2) suite.coordinator.CommitNBlocks(suite.chainB, 2) suite.path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(suite.path) + suite.path.Setup() } // TestAnteTestSuite runs all the tests within this package. diff --git a/modules/core/genesis_test.go b/modules/core/genesis_test.go index 3f6515573c7..af3938ad1df 100644 --- a/modules/core/genesis_test.go +++ b/modules/core/genesis_test.go @@ -325,10 +325,10 @@ func (suite *IBCTestSuite) TestExportGenesis() { "success", func() { // creates clients - suite.coordinator.Setup(ibctesting.NewPath(suite.chainA, suite.chainB)) + ibctesting.NewPath(suite.chainA, suite.chainB).Setup() // create extra clients - suite.coordinator.SetupClients(ibctesting.NewPath(suite.chainA, suite.chainB)) - suite.coordinator.SetupClients(ibctesting.NewPath(suite.chainA, suite.chainB)) + ibctesting.NewPath(suite.chainA, suite.chainB).SetupClients() + ibctesting.NewPath(suite.chainA, suite.chainB).SetupClients() }, }, } diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index 84298ae0481..64420c18748 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -45,7 +45,7 @@ func (suite *KeeperTestSuite) TestHandleRecvPacket() { }{ {"success: ORDERED", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(timeoutHeight, 0, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -53,7 +53,7 @@ func (suite *KeeperTestSuite) TestHandleRecvPacket() { packet = channeltypes.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, timeoutHeight, 0) }, true, false}, {"success: UNORDERED", func() { - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(timeoutHeight, 0, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -62,7 +62,7 @@ func (suite *KeeperTestSuite) TestHandleRecvPacket() { }, true, false}, {"success: UNORDERED out of order packet", func() { // setup uses an UNORDERED channel - suite.coordinator.Setup(path) + path.Setup() // attempts to receive packet with sequence 10 without receiving packet with sequence 1 for i := uint64(1); i < 10; i++ { @@ -73,7 +73,7 @@ func (suite *KeeperTestSuite) TestHandleRecvPacket() { } }, true, false}, {"success: OnRecvPacket callback returns revert=true", func() { - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(timeoutHeight, 0, ibctesting.MockFailPacketData) suite.Require().NoError(err) @@ -82,7 +82,7 @@ func (suite *KeeperTestSuite) TestHandleRecvPacket() { }, true, true}, {"success: ORDERED - async acknowledgement", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() async = true sequence, err := path.EndpointA.SendPacket(timeoutHeight, 0, ibcmock.MockAsyncPacketData) @@ -91,7 +91,7 @@ func (suite *KeeperTestSuite) TestHandleRecvPacket() { packet = channeltypes.NewPacket(ibcmock.MockAsyncPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, timeoutHeight, 0) }, true, false}, {"success: UNORDERED - async acknowledgement", func() { - suite.coordinator.Setup(path) + path.Setup() async = true sequence, err := path.EndpointA.SendPacket(timeoutHeight, 0, ibcmock.MockAsyncPacketData) @@ -101,7 +101,7 @@ func (suite *KeeperTestSuite) TestHandleRecvPacket() { }, true, false}, {"failure: ORDERED out of order packet", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() // attempts to receive packet with sequence 10 without receiving packet with sequence 1 for i := uint64(1); i < 10; i++ { @@ -116,13 +116,13 @@ func (suite *KeeperTestSuite) TestHandleRecvPacket() { suite.Require().NotNil(packet) }, false, false}, {"packet not sent", func() { - suite.coordinator.Setup(path) + path.Setup() packet = channeltypes.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, timeoutHeight, 0) }, false, false}, {"successful no-op: ORDERED - packet already received (replay)", func() { // mock will panic if application callback is called twice on the same packet path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(timeoutHeight, 0, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -133,7 +133,7 @@ func (suite *KeeperTestSuite) TestHandleRecvPacket() { }, true, false}, {"successful no-op: UNORDERED - packet already received (replay)", func() { // mock will panic if application callback is called twice on the same packet - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(timeoutHeight, 0, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -220,7 +220,7 @@ func (suite *KeeperTestSuite) TestHandleAcknowledgePacket() { }{ {"success: ORDERED", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(timeoutHeight, 0, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -230,7 +230,7 @@ func (suite *KeeperTestSuite) TestHandleAcknowledgePacket() { suite.Require().NoError(err) }, true}, {"success: UNORDERED", func() { - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(timeoutHeight, 0, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -241,7 +241,7 @@ func (suite *KeeperTestSuite) TestHandleAcknowledgePacket() { }, true}, {"success: UNORDERED acknowledge out of order packet", func() { // setup uses an UNORDERED channel - suite.coordinator.Setup(path) + path.Setup() // attempts to acknowledge ack with sequence 10 without acknowledging ack with sequence 1 (removing packet commitment) for i := uint64(1); i < 10; i++ { @@ -255,7 +255,7 @@ func (suite *KeeperTestSuite) TestHandleAcknowledgePacket() { }, true}, {"failure: ORDERED acknowledge out of order packet", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() // attempts to acknowledge ack with sequence 10 without acknowledging ack with sequence 1 (removing packet commitment for i := uint64(1); i < 10; i++ { @@ -272,7 +272,7 @@ func (suite *KeeperTestSuite) TestHandleAcknowledgePacket() { suite.Require().NotNil(packet) }, false}, {"packet not received", func() { - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(timeoutHeight, 0, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -280,7 +280,7 @@ func (suite *KeeperTestSuite) TestHandleAcknowledgePacket() { packet = channeltypes.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, timeoutHeight, 0) }, false}, {"successful no-op: ORDERED - packet already acknowledged (replay)", func() { - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(timeoutHeight, 0, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -293,7 +293,7 @@ func (suite *KeeperTestSuite) TestHandleAcknowledgePacket() { suite.Require().NoError(err) }, true}, {"successful no-op: UNORDERED - packet already acknowledged (replay)", func() { - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(timeoutHeight, 0, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -365,7 +365,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutPacket() { }{ {"success: ORDERED", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().UnixNano()) @@ -382,7 +382,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutPacket() { packetKey = host.NextSequenceRecvKey(packet.GetDestPort(), packet.GetDestChannel()) }, true}, {"success: UNORDERED", func() { - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().UnixNano()) @@ -400,7 +400,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutPacket() { }, true}, {"success: UNORDERED timeout out of order packet", func() { // setup uses an UNORDERED channel - suite.coordinator.Setup(path) + path.Setup() // attempts to timeout the last packet sent without timing out the first packet // packet sequences begin at 1 @@ -421,7 +421,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutPacket() { }, true}, {"success: ORDERED timeout out of order packet", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() // attempts to timeout the last packet sent without timing out the first packet // packet sequences begin at 1 @@ -447,7 +447,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutPacket() { packetKey = host.NextSequenceRecvKey(packet.GetDestPort(), packet.GetDestChannel()) }, false}, {"successful no-op: UNORDERED - packet not sent", func() { - suite.coordinator.Setup(path) + path.Setup() packet = channeltypes.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, clienttypes.NewHeight(0, 1), 0) packetKey = host.PacketReceiptKey(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) }, true}, @@ -511,7 +511,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutOnClosePacket() { }{ {"success: ORDERED", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() // create packet commitment sequence, err := path.EndpointA.SendPacket(timeoutHeight, 0, ibctesting.MockPacketData) @@ -529,7 +529,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutOnClosePacket() { suite.Require().NoError(err) }, true}, {"success: UNORDERED", func() { - suite.coordinator.Setup(path) + path.Setup() // create packet commitment sequence, err := path.EndpointA.SendPacket(timeoutHeight, 0, ibctesting.MockPacketData) @@ -548,7 +548,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutOnClosePacket() { }, true}, {"success: UNORDERED timeout out of order packet", func() { // setup uses an UNORDERED channel - suite.coordinator.Setup(path) + path.Setup() // attempts to timeout the last packet sent without timing out the first packet // packet sequences begin at 1 @@ -571,7 +571,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutOnClosePacket() { }, true}, {"success: ORDERED timeout out of order packet", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() // attempts to timeout the last packet sent without timing out the first packet // packet sequences begin at 1 @@ -599,7 +599,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutOnClosePacket() { packetKey = host.NextSequenceRecvKey(packet.GetDestPort(), packet.GetDestChannel()) }, false}, {"successful no-op: UNORDERED - packet not sent", func() { - suite.coordinator.Setup(path) + path.Setup() packet = channeltypes.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, clienttypes.NewHeight(0, 1), 0) packetKey = host.PacketAcknowledgementKey(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) @@ -609,7 +609,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutOnClosePacket() { }, true}, {"ORDERED: channel not closed", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() // create packet commitment sequence, err := path.EndpointA.SendPacket(timeoutHeight, 0, ibctesting.MockPacketData) @@ -753,7 +753,7 @@ func (suite *KeeperTestSuite) TestUpgradeClient() { for _, tc := range cases { tc := tc path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() var err error clientState := path.EndpointA.GetClientState().(*ibctm.ClientState) @@ -815,12 +815,12 @@ func (suite *KeeperTestSuite) TestRecoverClient() { suite.SetupTest() subjectPath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(subjectPath) + subjectPath.SetupClients() subject := subjectPath.EndpointA.ClientID subjectClientState := suite.chainA.GetClientState(subject) substitutePath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(substitutePath) + substitutePath.SetupClients() substitute := substitutePath.EndpointA.ClientID // update substitute twice @@ -896,7 +896,7 @@ func (suite *KeeperTestSuite) TestIBCSoftwareUpgrade() { tc := tc suite.Run(tc.name, func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() validAuthority := suite.chainA.App.GetIBCKeeper().GetAuthority() plan := upgradetypes.Plan{ Name: "upgrade IBC clients", diff --git a/modules/core/migrations/v7/genesis_test.go b/modules/core/migrations/v7/genesis_test.go index 73d8dc8e916..de941f3a2d2 100644 --- a/modules/core/migrations/v7/genesis_test.go +++ b/modules/core/migrations/v7/genesis_test.go @@ -47,7 +47,7 @@ func (suite *MigrationsV7TestSuite) TestMigrateGenesisSolomachine() { for i := 0; i < 3; i++ { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() err := path.EndpointA.UpdateClient() suite.Require().NoError(err) diff --git a/modules/light-clients/06-solomachine/client_state_test.go b/modules/light-clients/06-solomachine/client_state_test.go index 34f3b66323d..0f94dcffa54 100644 --- a/modules/light-clients/06-solomachine/client_state_test.go +++ b/modules/light-clients/06-solomachine/client_state_test.go @@ -246,7 +246,7 @@ func (suite *SoloMachineTestSuite) TestVerifyMembership() { { "success: connection state verification", func() { - suite.coordinator.SetupConnections(testingPath) + testingPath.SetupConnections() connectionEnd, found := suite.chainA.GetSimApp().IBCKeeper.ConnectionKeeper.GetConnection(suite.chainA.GetContext(), ibctesting.FirstConnectionID) suite.Require().True(found) @@ -285,7 +285,7 @@ func (suite *SoloMachineTestSuite) TestVerifyMembership() { { "success: channel state verification", func() { - suite.coordinator.SetupConnections(testingPath) + testingPath.SetupConnections() suite.coordinator.CreateMockChannels(testingPath) channelEnd, found := suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.GetChannel(suite.chainA.GetContext(), ibctesting.MockPort, ibctesting.FirstChannelID) @@ -325,7 +325,7 @@ func (suite *SoloMachineTestSuite) TestVerifyMembership() { { "success: next sequence recv verification", func() { - suite.coordinator.SetupConnections(testingPath) + testingPath.SetupConnections() suite.coordinator.CreateMockChannels(testingPath) nextSeqRecv, found := suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.GetNextSequenceRecv(suite.chainA.GetContext(), ibctesting.MockPort, ibctesting.FirstChannelID) @@ -836,7 +836,7 @@ func (suite *SoloMachineTestSuite) TestVerifyNonMembership() { func (suite *SoloMachineTestSuite) TestGetTimestampAtHeight() { tmPath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(tmPath) + tmPath.SetupClients() // Single setup for all test cases. suite.SetupTest() diff --git a/modules/light-clients/07-tendermint/client_state_test.go b/modules/light-clients/07-tendermint/client_state_test.go index 56a7c0925ed..1fba9432107 100644 --- a/modules/light-clients/07-tendermint/client_state_test.go +++ b/modules/light-clients/07-tendermint/client_state_test.go @@ -57,7 +57,7 @@ func (suite *TendermintTestSuite) TestStatus() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), path.EndpointA.ClientID) clientState = path.EndpointA.GetClientState().(*ibctm.ClientState) @@ -104,7 +104,7 @@ func (suite *TendermintTestSuite) TestGetTimestampAtHeight() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() clientState := path.EndpointA.GetClientState() height = clientState.GetLatestHeight() @@ -512,7 +512,7 @@ func (suite *TendermintTestSuite) TestVerifyMembership() { suite.SetupTest() // reset testingpath = ibctesting.NewPath(suite.chainA, suite.chainB) testingpath.SetChannelOrdered() - suite.coordinator.Setup(testingpath) + testingpath.Setup() // reset time and block delays to 0, malleate may change to a specific non-zero value. delayTimePeriod = 0 @@ -729,7 +729,7 @@ func (suite *TendermintTestSuite) TestVerifyNonMembership() { suite.SetupTest() // reset testingpath = ibctesting.NewPath(suite.chainA, suite.chainB) testingpath.SetChannelOrdered() - suite.coordinator.Setup(testingpath) + testingpath.Setup() // reset time and block delays to 0, malleate may change to a specific non-zero value. delayTimePeriod = 0 diff --git a/modules/light-clients/07-tendermint/genesis_test.go b/modules/light-clients/07-tendermint/genesis_test.go index b3a03166663..56344c14dac 100644 --- a/modules/light-clients/07-tendermint/genesis_test.go +++ b/modules/light-clients/07-tendermint/genesis_test.go @@ -14,7 +14,7 @@ import ( func (suite *TendermintTestSuite) TestExportMetadata() { // test initializing client and exporting metadata path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), path.EndpointA.ClientID) clientState := path.EndpointA.GetClientState() height := clientState.GetLatestHeight() diff --git a/modules/light-clients/07-tendermint/migrations/migrations_test.go b/modules/light-clients/07-tendermint/migrations/migrations_test.go index f54b1551bb4..a0b6234460e 100644 --- a/modules/light-clients/07-tendermint/migrations/migrations_test.go +++ b/modules/light-clients/07-tendermint/migrations/migrations_test.go @@ -45,7 +45,7 @@ func (suite *MigrationsTestSuite) TestPruneExpiredConsensusStates() { for i := 0; i < numTMClients; i++ { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() paths[i] = path } diff --git a/modules/light-clients/07-tendermint/proposal_handle_test.go b/modules/light-clients/07-tendermint/proposal_handle_test.go index 7f7ad06d346..4bae7099708 100644 --- a/modules/light-clients/07-tendermint/proposal_handle_test.go +++ b/modules/light-clients/07-tendermint/proposal_handle_test.go @@ -27,7 +27,7 @@ func (suite *TendermintTestSuite) TestCheckSubstituteUpdateStateBasic() { }, { "non-matching substitute", func() { - suite.coordinator.SetupClients(substitutePath) + substitutePath.SetupClients() substituteClientState, ok := suite.chainA.GetClientState(substitutePath.EndpointA.ClientID).(*ibctm.ClientState) suite.Require().True(ok) // change trusting period so that test should fail @@ -47,7 +47,7 @@ func (suite *TendermintTestSuite) TestCheckSubstituteUpdateStateBasic() { subjectPath := ibctesting.NewPath(suite.chainA, suite.chainB) substitutePath = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(subjectPath) + subjectPath.SetupClients() subjectClientState := suite.chainA.GetClientState(subjectPath.EndpointA.ClientID).(*ibctm.ClientState) // expire subject client @@ -91,7 +91,7 @@ func (suite *TendermintTestSuite) TestCheckSubstituteAndUpdateState() { // construct subject using test case parameters subjectPath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(subjectPath) + subjectPath.SetupClients() subjectClientState := suite.chainA.GetClientState(subjectPath.EndpointA.ClientID).(*ibctm.ClientState) if tc.FreezeClient { @@ -101,7 +101,7 @@ func (suite *TendermintTestSuite) TestCheckSubstituteAndUpdateState() { // construct the substitute to match the subject client substitutePath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(substitutePath) + substitutePath.SetupClients() substituteClientState := suite.chainA.GetClientState(substitutePath.EndpointA.ClientID).(*ibctm.ClientState) // update trusting period of substitute client state substituteClientState.TrustingPeriod = time.Hour * 24 * 7 @@ -222,8 +222,8 @@ func (suite *TendermintTestSuite) TestIsMatchingClientState() { subjectPath = ibctesting.NewPath(suite.chainA, suite.chainB) substitutePath = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(subjectPath) - suite.coordinator.SetupClients(substitutePath) + subjectPath.SetupClients() + substitutePath.SetupClients() tc.malleate() diff --git a/modules/light-clients/07-tendermint/store_test.go b/modules/light-clients/07-tendermint/store_test.go index 2248fc15005..310b6371ad0 100644 --- a/modules/light-clients/07-tendermint/store_test.go +++ b/modules/light-clients/07-tendermint/store_test.go @@ -59,7 +59,7 @@ func (suite *TendermintTestSuite) TestGetConsensusState() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() clientState := suite.chainA.GetClientState(path.EndpointA.ClientID) height = clientState.GetLatestHeight() diff --git a/modules/light-clients/07-tendermint/update_test.go b/modules/light-clients/07-tendermint/update_test.go index 44850ef7337..0998952067f 100644 --- a/modules/light-clients/07-tendermint/update_test.go +++ b/modules/light-clients/07-tendermint/update_test.go @@ -523,7 +523,7 @@ func (suite *TendermintTestSuite) TestUpdateState() { func (suite *TendermintTestSuite) TestPruneConsensusState() { // create path and setup clients path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() // get the first height as it will be pruned first. var pruneHeight exported.Height diff --git a/modules/light-clients/07-tendermint/upgrade_test.go b/modules/light-clients/07-tendermint/upgrade_test.go index 9cedda0b206..e817b728b9d 100644 --- a/modules/light-clients/07-tendermint/upgrade_test.go +++ b/modules/light-clients/07-tendermint/upgrade_test.go @@ -433,7 +433,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() clientState := path.EndpointA.GetClientState().(*ibctm.ClientState) revisionNumber := clienttypes.ParseChainID(clientState.ChainId) diff --git a/testing/chain_test.go b/testing/chain_test.go index ea0e2cbe608..dfe754a98a5 100644 --- a/testing/chain_test.go +++ b/testing/chain_test.go @@ -18,7 +18,7 @@ func TestChangeValSet(t *testing.T) { chainB := coord.GetChain(ibctesting.GetChainID(2)) path := ibctesting.NewPath(chainA, chainB) - coord.Setup(path) + path.Setup() amount, ok := sdkmath.NewIntFromString("10000000000000000000") require.True(t, ok) diff --git a/testing/coordinator.go b/testing/coordinator.go index 95af7c610b2..458ba7fd81d 100644 --- a/testing/coordinator.go +++ b/testing/coordinator.go @@ -71,57 +71,6 @@ func (coord *Coordinator) UpdateTimeForChain(chain *TestChain) { chain.CurrentHeader.Time = coord.CurrentTime.UTC() } -// Setup constructs a TM client, connection, and channel on both chains provided. It will -// fail if any error occurs. The clientID's, TestConnections, and TestChannels are returned -// for both chains. The channels created are connected to the ibc-transfer application. -func (coord *Coordinator) Setup(path *Path) { - coord.SetupConnections(path) - - // channels can also be referenced through the returned connections - coord.CreateChannels(path) -} - -// SetupClients is a helper function to create clients on both chains. It assumes the -// caller does not anticipate any errors. -func (coord *Coordinator) SetupClients(path *Path) { - err := path.EndpointA.CreateClient() - require.NoError(coord.T, err) - - err = path.EndpointB.CreateClient() - require.NoError(coord.T, err) -} - -// SetupClientConnections is a helper function to create clients and the appropriate -// connections on both the source and counterparty chain. It assumes the caller does not -// anticipate any errors. -func (coord *Coordinator) SetupConnections(path *Path) { - coord.SetupClients(path) - - coord.CreateConnections(path) -} - -// CreateConnection constructs and executes connection handshake messages in order to create -// OPEN channels on chainA and chainB. The connection information of for chainA and chainB -// are returned within a TestConnection struct. The function expects the connections to be -// successfully opened otherwise testing will fail. -func (coord *Coordinator) CreateConnections(path *Path) { - err := path.EndpointA.ConnOpenInit() - require.NoError(coord.T, err) - - err = path.EndpointB.ConnOpenTry() - require.NoError(coord.T, err) - - err = path.EndpointA.ConnOpenAck() - require.NoError(coord.T, err) - - err = path.EndpointB.ConnOpenConfirm() - require.NoError(coord.T, err) - - // ensure counterparty is up to date - err = path.EndpointA.UpdateClient() - require.NoError(coord.T, err) -} - // CreateMockChannels constructs and executes channel handshake messages to create OPEN // channels that use a mock application module that returns nil on all callbacks. This // function is expects the channels to be successfully opened otherwise testing will diff --git a/testing/path.go b/testing/path.go index 64738b1c163..6dac8a6c856 100644 --- a/testing/path.go +++ b/testing/path.go @@ -115,3 +115,97 @@ func (path *Path) RelayPacketWithResults(packet channeltypes.Packet) (*abci.Exec return nil, nil, fmt.Errorf("packet commitment does not exist on either endpoint for provided packet") } + +// Setup constructs a TM client, connection, and channel on both chains provided. It will +// fail if any error occurs. The clientID's, TestConnections, and TestChannels are returned +// for both chains. The channels created are connected to the ibc-transfer application. +func (path *Path) Setup() { + path.SetupConnections() + + // channels can also be referenced through the returned connections + path.CreateChannels() +} + +// SetupClients is a helper function to create clients on both chains. It assumes the +// caller does not anticipate any errors. +func (path *Path) SetupClients() { + err := path.EndpointA.CreateClient() + if err != nil { + panic(err) + } + + err = path.EndpointB.CreateClient() + if err != nil { + panic(err) + } +} + +// SetupClientConnections is a helper function to create clients and the appropriate +// connections on both the source and counterparty chain. It assumes the caller does not +// anticipate any errors. +func (path *Path) SetupConnections() { + path.SetupClients() + + path.CreateConnections() +} + +// CreateConnection constructs and executes connection handshake messages in order to create +// OPEN channels on chainA and chainB. The connection information of for chainA and chainB +// are returned within a TestConnection struct. The function expects the connections to be +// successfully opened otherwise testing will fail. +func (path *Path) CreateConnections() { + err := path.EndpointA.ConnOpenInit() + if err != nil { + panic(err) + } + + err = path.EndpointB.ConnOpenTry() + if err != nil { + panic(err) + } + err = path.EndpointA.ConnOpenAck() + if err != nil { + panic(err) + } + + err = path.EndpointB.ConnOpenConfirm() + if err != nil { + panic(err) + } + + // ensure counterparty is up to date + err = path.EndpointA.UpdateClient() + if err != nil { + panic(err) + } +} + +// CreateChannel constructs and executes channel handshake messages in order to create +// OPEN channels on chainA and chainB. The function expects the channels to be successfully +// opened otherwise testing will fail. +func (path *Path) CreateChannels() { + err := path.EndpointA.ChanOpenInit() + if err != nil { + panic(err) + } + + err = path.EndpointB.ChanOpenTry() + if err != nil { + panic(err) + } + + err = path.EndpointA.ChanOpenAck() + if err != nil { + panic(err) + } + + err = path.EndpointB.ChanOpenConfirm() + if err != nil { + panic(err) + } + // ensure counterparty is up to date + err = path.EndpointA.UpdateClient() + if err != nil { + panic(err) + } +} From 5e28ca837a7a9bc8d60f8d6dc52d7aa57b16a61a Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Tue, 19 Dec 2023 23:23:32 +0100 Subject: [PATCH 02/12] fix --- modules/apps/callbacks/callbacks_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/apps/callbacks/callbacks_test.go b/modules/apps/callbacks/callbacks_test.go index 9796913cef6..8414d0737b8 100644 --- a/modules/apps/callbacks/callbacks_test.go +++ b/modules/apps/callbacks/callbacks_test.go @@ -81,7 +81,7 @@ func (s *CallbacksTestSuite) SetupTransferTest() { s.path.EndpointA.ChannelConfig.Version = transfertypes.Version s.path.EndpointB.ChannelConfig.Version = transfertypes.Version - s.coordinator.Setup(s.path) + s.path.Setup() } // SetupFeeTransferTest sets up a fee middleware enabled transfer channel between chainA and chainB @@ -94,7 +94,7 @@ func (s *CallbacksTestSuite) SetupFeeTransferTest() { s.path.EndpointA.ChannelConfig.PortID = transfertypes.PortID s.path.EndpointB.ChannelConfig.PortID = transfertypes.PortID - s.coordinator.Setup(s.path) + s.path.Setup() } func (s *CallbacksTestSuite) SetupMockFeeTest() { @@ -111,7 +111,7 @@ func (s *CallbacksTestSuite) SetupMockFeeTest() { // It funds and returns the interchain account address owned by chainA's SenderAccount. func (s *CallbacksTestSuite) SetupICATest() string { s.setupChains() - s.coordinator.SetupConnections(s.path) + s.path.SetupConnections() icaOwner := s.chainA.SenderAccount.GetAddress().String() // ICAVersion defines a interchain accounts version string From d8285f85ca536b668165b4dc853fb24a7870aec7 Mon Sep 17 00:00:00 2001 From: chandiniv1 Date: Wed, 3 Jan 2024 11:13:09 +0530 Subject: [PATCH 03/12] fixed lint errors --- .../controller/ibc_middleware_test.go | 8 +-- .../controller/keeper/handshake_test.go | 4 +- .../host/ibc_module_test.go | 2 +- .../host/keeper/handshake_test.go | 2 +- modules/apps/29-fee/ibc_middleware_test.go | 15 +++--- modules/apps/transfer/ibc_module_test.go | 12 ++--- .../core/03-connection/keeper/verify_test.go | 6 +-- .../core/04-channel/keeper/grpc_query_test.go | 4 +- .../core/04-channel/keeper/handshake_test.go | 2 +- modules/core/04-channel/keeper/keeper_test.go | 4 +- modules/core/04-channel/keeper/packet_test.go | 20 +++---- .../core/04-channel/keeper/timeout_test.go | 18 +++---- .../core/04-channel/keeper/upgrade_test.go | 52 +++++++++---------- modules/core/keeper/msg_server_test.go | 24 ++++----- 14 files changed, 86 insertions(+), 87 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go b/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go index 1b4bb82b001..bb9580427c8 100644 --- a/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go +++ b/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go @@ -822,7 +822,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeInit() { isNilApp = false path = NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := RegisterInterchainAccount(path.EndpointA, TestOwnerAddress) suite.Require().NoError(err) @@ -920,7 +920,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeAck() { isNilApp = false path = NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -996,7 +996,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeOpen() { isNilApp = false path = NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -1066,7 +1066,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeRestore() { isNilApp = false path = NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go b/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go index afb2cb6db31..49e43245852 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go @@ -547,7 +547,7 @@ func (suite *KeeperTestSuite) TestOnChanUpgradeInit() { suite.SetupTest() // reset path = NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -686,7 +686,7 @@ func (suite *KeeperTestSuite) TestOnChanUpgradeAck() { suite.SetupTest() // reset path = NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/host/ibc_module_test.go b/modules/apps/27-interchain-accounts/host/ibc_module_test.go index 12a4715686f..96a7fc8d682 100644 --- a/modules/apps/27-interchain-accounts/host/ibc_module_test.go +++ b/modules/apps/27-interchain-accounts/host/ibc_module_test.go @@ -627,7 +627,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeTry() { suite.SetupTest() // reset path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go b/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go index 7a790a9bbec..12705d4f030 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go @@ -517,7 +517,7 @@ func (suite *KeeperTestSuite) TestOnChanUpgradeTry() { suite.SetupTest() // reset path = NewICAPath(suite.chainA, suite.chainB, icatypes.EncodingProtobuf) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) diff --git a/modules/apps/29-fee/ibc_middleware_test.go b/modules/apps/29-fee/ibc_middleware_test.go index 290f82fcb12..d93aceaecd2 100644 --- a/modules/apps/29-fee/ibc_middleware_test.go +++ b/modules/apps/29-fee/ibc_middleware_test.go @@ -1038,7 +1038,7 @@ func (suite *FeeTestSuite) TestOnChanUpgradeInit() { path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = upgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = upgradeVersion - suite.coordinator.Setup(path) + path.Setup() }, nil, }, @@ -1088,7 +1088,7 @@ func (suite *FeeTestSuite) TestOnChanUpgradeInit() { path.EndpointA.ChannelConfig.Version = ibcmock.Version path.EndpointB.ChannelConfig.Version = ibcmock.Version - suite.coordinator.Setup(path) + path.Setup() // configure the channel upgrade version to enabled ics29 fee middleware upgradeVersion := string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: ibcmock.Version})) @@ -1139,7 +1139,7 @@ func (suite *FeeTestSuite) TestOnChanUpgradeTry() { path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = upgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = upgradeVersion - suite.coordinator.Setup(path) + path.Setup() err := path.EndpointA.ChanUpgradeInit() suite.Require().NoError(err) }, @@ -1198,7 +1198,7 @@ func (suite *FeeTestSuite) TestOnChanUpgradeTry() { path.EndpointA.ChannelConfig.Version = ibcmock.Version path.EndpointB.ChannelConfig.Version = ibcmock.Version - suite.coordinator.Setup(path) + path.Setup() // configure the channel upgrade version to enabled ics29 fee middleware upgradeVersion := string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: ibcmock.Version})) @@ -1295,8 +1295,7 @@ func (suite *FeeTestSuite) TestOnChanUpgradeAck() { path.EndpointA.ChannelConfig.Version = ibcmock.Version path.EndpointB.ChannelConfig.Version = ibcmock.Version - suite.coordinator.Setup(path) - + path.Setup() // configure the channel upgrade version to enabled ics29 fee middleware upgradeVersion := string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: ibcmock.Version})) path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = upgradeVersion @@ -1373,7 +1372,7 @@ func (suite *FeeTestSuite) TestOnChanUpgradeOpen() { path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = upgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = upgradeVersion - suite.coordinator.Setup(path) + path.Setup() // Assert in callback that correct version is passed suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanUpgradeOpen = func(_ sdk.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, version string) { @@ -1401,7 +1400,7 @@ func (suite *FeeTestSuite) TestOnChanUpgradeOpen() { path.EndpointA.ChannelConfig.Version = ibcmock.Version path.EndpointB.ChannelConfig.Version = ibcmock.Version - suite.coordinator.Setup(path) + path.Setup() // configure the channel upgrade version to enabled ics29 fee middleware upgradeVersion := string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: ibcmock.Version})) diff --git a/modules/apps/transfer/ibc_module_test.go b/modules/apps/transfer/ibc_module_test.go index dba72b3ae88..863b39993d3 100644 --- a/modules/apps/transfer/ibc_module_test.go +++ b/modules/apps/transfer/ibc_module_test.go @@ -289,11 +289,11 @@ func (suite *TransferTestSuite) TestOnChanUpgradeInit() { suite.SetupTest() path = NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() // configure the channel upgrade to modify the underlying connection upgradePath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(upgradePath) + upgradePath.SetupConnections() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.ConnectionHops = []string{upgradePath.EndpointA.ConnectionID} path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.ConnectionHops = []string{upgradePath.EndpointB.ConnectionID} @@ -353,11 +353,11 @@ func (suite *TransferTestSuite) TestOnChanUpgradeTry() { suite.SetupTest() path = NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() // configure the channel upgrade to modify the underlying connection upgradePath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(upgradePath) + upgradePath.SetupConnections() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.ConnectionHops = []string{upgradePath.EndpointA.ConnectionID} path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.ConnectionHops = []string{upgradePath.EndpointB.ConnectionID} @@ -423,11 +423,11 @@ func (suite *TransferTestSuite) TestOnChanUpgradeAck() { suite.SetupTest() path = NewTransferPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() // configure the channel upgrade to modify the underlying connection upgradePath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(upgradePath) + upgradePath.SetupConnections() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.ConnectionHops = []string{upgradePath.EndpointA.ConnectionID} path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.ConnectionHops = []string{upgradePath.EndpointB.ConnectionID} diff --git a/modules/core/03-connection/keeper/verify_test.go b/modules/core/03-connection/keeper/verify_test.go index 3661aadc5f3..698b8b050a0 100644 --- a/modules/core/03-connection/keeper/verify_test.go +++ b/modules/core/03-connection/keeper/verify_test.go @@ -740,7 +740,7 @@ func (suite *KeeperTestSuite) TestVerifyUpgradeErrorReceipt() { suite.SetupTest() // reset path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() upgradeError = channeltypes.NewUpgradeError(1, channeltypes.ErrInvalidChannel) suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.SetUpgradeErrorReceipt(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, upgradeError.GetErrorReceipt()) @@ -814,7 +814,7 @@ func (suite *KeeperTestSuite) TestVerifyUpgradeErrorReceiptAbsence() { suite.SetupTest() // reset path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() suite.chainA.Coordinator.CommitBlock(suite.chainA) suite.Require().NoError(path.EndpointB.UpdateClient()) @@ -885,7 +885,7 @@ func (suite *KeeperTestSuite) TestVerifyUpgrade() { suite.SetupTest() // reset path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() upgrade = channeltypes.NewUpgrade( channeltypes.NewUpgradeFields(channeltypes.UNORDERED, []string{path.EndpointA.ConnectionID}, "v1.0.0"), diff --git a/modules/core/04-channel/keeper/grpc_query_test.go b/modules/core/04-channel/keeper/grpc_query_test.go index 11009e25f2b..701e0206044 100644 --- a/modules/core/04-channel/keeper/grpc_query_test.go +++ b/modules/core/04-channel/keeper/grpc_query_test.go @@ -1756,7 +1756,7 @@ func (suite *KeeperTestSuite) TestQueryUpgradeError() { "success", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() upgradeErr = types.NewUpgradeError(uint64(1), fmt.Errorf("test error")) suite.chainA.App.GetIBCKeeper().ChannelKeeper.SetUpgradeErrorReceipt(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, upgradeErr.GetErrorReceipt()) @@ -1858,7 +1858,7 @@ func (suite *KeeperTestSuite) TestQueryUpgrade() { suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { suite.SetupTest() // reset path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() expectedUpgrade = types.NewUpgrade( types.NewUpgradeFields(types.UNORDERED, []string{ibctesting.FirstConnectionID}, mock.Version), diff --git a/modules/core/04-channel/keeper/handshake_test.go b/modules/core/04-channel/keeper/handshake_test.go index 66d7dbc6113..8b1366b0539 100644 --- a/modules/core/04-channel/keeper/handshake_test.go +++ b/modules/core/04-channel/keeper/handshake_test.go @@ -799,7 +799,7 @@ func (suite *KeeperTestSuite) TestChanCloseConfirm() { { "failure: invalid counterparty upgrade sequence", func() { - suite.coordinator.Setup(path) + path.Setup() channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) // trigger upgradeInit on B which will bump the counterparty upgrade sequence. diff --git a/modules/core/04-channel/keeper/keeper_test.go b/modules/core/04-channel/keeper/keeper_test.go index 81df3364fb6..e172638f0da 100644 --- a/modules/core/04-channel/keeper/keeper_test.go +++ b/modules/core/04-channel/keeper/keeper_test.go @@ -472,7 +472,7 @@ func (suite *KeeperTestSuite) TestSetPacketAcknowledgement() { func (suite *KeeperTestSuite) TestSetUpgradeErrorReceipt() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() suite.coordinator.CreateChannels(path) errorReceipt, found := suite.chainA.App.GetIBCKeeper().ChannelKeeper.GetUpgradeErrorReceipt(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) @@ -793,7 +793,7 @@ func (suite *KeeperTestSuite) TestPruneAcknowledgements() { suite.SetupTest() // reset path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() // Defaults will be filled in for rest. upgradeFields = types.UpgradeFields{Version: ibcmock.UpgradeVersion} diff --git a/modules/core/04-channel/keeper/packet_test.go b/modules/core/04-channel/keeper/packet_test.go index 8cc5d212be6..da2167e9f5d 100644 --- a/modules/core/04-channel/keeper/packet_test.go +++ b/modules/core/04-channel/keeper/packet_test.go @@ -222,7 +222,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { { "channel is in FLUSH_COMPLETE state", func() { - suite.coordinator.Setup(path) + path.Setup() sourceChannel = path.EndpointA.ChannelID channel := path.EndpointA.GetChannel() @@ -234,7 +234,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { { "channel is in FLUSHING state", func() { - suite.coordinator.Setup(path) + path.Setup() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = ibcmock.UpgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = ibcmock.UpgradeVersion @@ -342,7 +342,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { { "success with counterpartyNextSequenceSend higher than packet sequence", func() { - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) @@ -361,7 +361,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { { "success with counterparty upgrade not found", func() { - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) @@ -376,7 +376,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { { "failure while upgrading channel, packet sequence ≥ counterparty next send sequence", func() { - suite.coordinator.Setup(path) + path.Setup() // send 2 packets so that when NextSequenceSend is set to sequence - 1, it is not 0. _, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -398,7 +398,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { { "failure while upgrading channel, channel in flush complete state", func() { - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) @@ -848,7 +848,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { name: "success on channel in flushing state", malleate: func() { // setup uses an UNORDERED channel - suite.coordinator.Setup(path) + path.Setup() // create packet commitment sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) @@ -881,7 +881,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { name: "success on channel in flushing state with valid timeout", malleate: func() { // setup uses an UNORDERED channel - suite.coordinator.Setup(path) + path.Setup() // create packet commitment sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) @@ -935,7 +935,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { name: "success on channel in flushing state with timeout passed", malleate: func() { // setup uses an UNORDERED channel - suite.coordinator.Setup(path) + path.Setup() // create packet commitment sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) @@ -1060,7 +1060,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { { name: "channel in flush complete state", malleate: func() { - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) diff --git a/modules/core/04-channel/keeper/timeout_test.go b/modules/core/04-channel/keeper/timeout_test.go index e4798ae6a26..ee81fe0efd1 100644 --- a/modules/core/04-channel/keeper/timeout_test.go +++ b/modules/core/04-channel/keeper/timeout_test.go @@ -253,7 +253,7 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { "success ORDERED", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().UnixNano()) @@ -278,7 +278,7 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { "channel not found", func() { // use wrong channel naming - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, ibctesting.InvalidID, ibctesting.InvalidID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) }, func(packetCommitment []byte, err error) { @@ -294,7 +294,7 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { "incorrect capability ORDERED", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().UnixNano()) @@ -317,7 +317,7 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { { "set to flush complete with no inflight packets", func() { - suite.coordinator.Setup(path) + path.Setup() chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) @@ -352,7 +352,7 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { { "conterparty upgrade timeout is invalid", func() { - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().UnixNano()) @@ -378,7 +378,7 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { { "conterparty upgrade timed out (abort)", func() { - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().UnixNano()) @@ -423,7 +423,7 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { { "conterparty upgrade has not timed out with in-flight packets", func() { - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().UnixNano()) @@ -471,7 +471,7 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { "ordered channel is closed and upgrade is aborted when timeout is executed", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().UnixNano()) @@ -717,7 +717,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { "failure: invalid counterparty upgrade sequence", func() { ordered = false - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) diff --git a/modules/core/04-channel/keeper/upgrade_test.go b/modules/core/04-channel/keeper/upgrade_test.go index 5400a99e5ac..47d9f05e289 100644 --- a/modules/core/04-channel/keeper/upgrade_test.go +++ b/modules/core/04-channel/keeper/upgrade_test.go @@ -93,7 +93,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeInit() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() expSequence = 1 @@ -312,7 +312,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeTry() { expPass := tc.expError == nil path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion err := path.EndpointA.ChanUpgradeInit() @@ -375,7 +375,7 @@ func (suite *KeeperTestSuite) TestChanUpgrade_CrossingHellos_UpgradeSucceeds_Aft suite.Run("setup path", func() { path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion @@ -471,7 +471,7 @@ func (suite *KeeperTestSuite) TestChanUpgrade_CrossingHellos_UpgradeSucceeds_Aft suite.Run("setup path", func() { path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion @@ -605,7 +605,7 @@ func (suite *KeeperTestSuite) TestWriteUpgradeTry() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion @@ -789,7 +789,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeAck() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion @@ -869,7 +869,7 @@ func (suite *KeeperTestSuite) TestWriteChannelUpgradeAck() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion @@ -956,7 +956,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeConfirm() { "success with in-flight packets on init chain", func() { path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion @@ -1083,7 +1083,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeConfirm() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion @@ -1156,7 +1156,7 @@ func (suite *KeeperTestSuite) TestWriteUpgradeConfirm() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion @@ -1222,7 +1222,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeOpen() { "success: counterparty in flushcomplete", func() { path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion @@ -1305,7 +1305,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeOpen() { // next path used to run the upgrade handshake. // See issue 4062. path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() suite.Require().NoError(path.EndpointA.ChanOpenInit()) for _, tc := range testCases { @@ -1314,7 +1314,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeOpen() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion @@ -1388,7 +1388,7 @@ func (suite *KeeperTestSuite) TestWriteUpgradeOpenChannel() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() // Need to create a packet commitment on A so as to keep it from going to OPEN if no inflight packets exist. sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) @@ -1596,7 +1596,7 @@ func (suite *KeeperTestSuite) TestWriteUpgradeOpenChannel_Ordering() { tc.malleate() - suite.coordinator.Setup(path) + path.Setup() // Need to create a packet commitment on A so as to keep it from going to OPEN if no inflight packets exist. sequenceA, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) @@ -1802,7 +1802,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeCancel() { suite.Run(tc.name, func() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion @@ -1857,7 +1857,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeCancel() { // become out of sync, the upgrade can still be performed successfully after the upgrade is cancelled. func (suite *KeeperTestSuite) TestChanUpgrade_UpgradeSucceeds_AfterCancel() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion @@ -1961,7 +1961,7 @@ func (suite *KeeperTestSuite) TestWriteUpgradeCancelChannel() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion @@ -2226,7 +2226,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeTimeout() { expPass := tc.expError == nil path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion @@ -2314,7 +2314,7 @@ func (suite *KeeperTestSuite) TestStartFlush() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion @@ -2376,7 +2376,7 @@ func (suite *KeeperTestSuite) TestValidateUpgradeFields() { name: "change connection hops", malleate: func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() proposedUpgrade.ConnectionHops = []string{path.EndpointA.ConnectionID} }, expPass: true, @@ -2437,7 +2437,7 @@ func (suite *KeeperTestSuite) TestValidateUpgradeFields() { suite.Run(tc.name, func() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() existingChannel := path.EndpointA.GetChannel() proposedUpgrade = &types.UpgradeFields{ @@ -2519,7 +2519,7 @@ func (suite *KeeperTestSuite) TestAbortUpgrade() { suite.Run(tc.name, func() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() channelKeeper := suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper @@ -2667,7 +2667,7 @@ func (suite *KeeperTestSuite) TestCheckForUpgradeCompatibility() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion @@ -2719,7 +2719,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeCrossingHelloWithHistoricalProofs() suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion @@ -2811,7 +2811,7 @@ func (suite *KeeperTestSuite) TestWriteErrorReceipt() { suite.Run(tc.name, func() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() channelKeeper := suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index cf12c1ea4df..32bd4289770 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -240,12 +240,12 @@ func (suite *KeeperTestSuite) TestRecoverClient() { suite.SetupTest() subjectPath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(subjectPath) + subjectPath.SetupClients() subject := subjectPath.EndpointA.ClientID subjectClientState := suite.chainA.GetClientState(subject) substitutePath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(substitutePath) + substitutePath.SetupClients() substitute := substitutePath.EndpointA.ClientID // update substitute twice @@ -911,7 +911,7 @@ func (suite *KeeperTestSuite) TestChannelUpgradeInit() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() // configure the channel upgrade version on testing endpoints path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = ibcmock.UpgradeVersion @@ -990,7 +990,7 @@ func (suite *KeeperTestSuite) TestChannelUpgradeTry() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() // configure the channel upgrade version on testing endpoints path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = ibcmock.UpgradeVersion @@ -1158,7 +1158,7 @@ func (suite *KeeperTestSuite) TestChannelUpgradeAck() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() // configure the channel upgrade version on testing endpoints path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = ibcmock.UpgradeVersion @@ -1224,7 +1224,7 @@ func (suite *KeeperTestSuite) TestChannelUpgradeConfirm() { "success, pending in-flight packets on init chain", func() { path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = ibcmock.UpgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = ibcmock.UpgradeVersion @@ -1363,7 +1363,7 @@ func (suite *KeeperTestSuite) TestChannelUpgradeConfirm() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() // configure the channel upgrade version on testing endpoints path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = ibcmock.UpgradeVersion @@ -1463,7 +1463,7 @@ func (suite *KeeperTestSuite) TestChannelUpgradeOpen() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() // configure the channel upgrade version on testing endpoints path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = ibcmock.UpgradeVersion @@ -1659,7 +1659,7 @@ func (suite *KeeperTestSuite) TestChannelUpgradeCancel() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() // configure the channel upgrade version on testing endpoints path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = ibcmock.UpgradeVersion @@ -1801,7 +1801,7 @@ func (suite *KeeperTestSuite) TestChannelUpgradeTimeout() { suite.SetupTest() path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = ibcmock.UpgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = ibcmock.UpgradeVersion @@ -1872,7 +1872,7 @@ func (suite *KeeperTestSuite) TestIBCSoftwareUpgrade() { tc := tc suite.Run(tc.name, func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() validAuthority := suite.chainA.App.GetIBCKeeper().GetAuthority() plan := upgradetypes.Plan{ Name: "upgrade IBC clients", @@ -2045,7 +2045,7 @@ func (suite *KeeperTestSuite) TestPruneAcknowledgements() { suite.SetupTest() path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) + path.Setup() // configure the channel upgrade version on testing endpoints path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = ibcmock.UpgradeVersion From 4c4ebec8ddde229762d0a2d8bd14cfb7da2a60e7 Mon Sep 17 00:00:00 2001 From: chandiniv1 Date: Wed, 3 Jan 2024 11:19:40 +0530 Subject: [PATCH 04/12] fix lint errors --- modules/apps/29-fee/transfer_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/apps/29-fee/transfer_test.go b/modules/apps/29-fee/transfer_test.go index d6c4fe543dd..158b7914dba 100644 --- a/modules/apps/29-fee/transfer_test.go +++ b/modules/apps/29-fee/transfer_test.go @@ -97,7 +97,7 @@ func (suite *FeeTestSuite) TestTransferFeeUpgrade() { path.EndpointA.ChannelConfig.Version = transfertypes.Version path.EndpointB.ChannelConfig.Version = transfertypes.Version - suite.coordinator.Setup(path) + path.Setup() // configure the channel upgrade to upgrade to an incentivized fee enabled transfer channel upgradeVersion := string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: transfertypes.Version})) From 0aeabe5ae63e8ab020c7751688d9db32d26de7a3 Mon Sep 17 00:00:00 2001 From: chandiniv1 Date: Wed, 3 Jan 2024 17:01:57 +0530 Subject: [PATCH 05/12] modify docstring --- testing/path.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/testing/path.go b/testing/path.go index 6dac8a6c856..e22cc3a297b 100644 --- a/testing/path.go +++ b/testing/path.go @@ -117,8 +117,7 @@ func (path *Path) RelayPacketWithResults(packet channeltypes.Packet) (*abci.Exec } // Setup constructs a TM client, connection, and channel on both chains provided. It will -// fail if any error occurs. The clientID's, TestConnections, and TestChannels are returned -// for both chains. The channels created are connected to the ibc-transfer application. +// fail if any error occurs. The channels created are connected to the ibc-transfer application. func (path *Path) Setup() { path.SetupConnections() @@ -140,7 +139,7 @@ func (path *Path) SetupClients() { } } -// SetupClientConnections is a helper function to create clients and the appropriate +// SetupConnections is a helper function to create clients and the appropriate // connections on both the source and counterparty chain. It assumes the caller does not // anticipate any errors. func (path *Path) SetupConnections() { @@ -149,9 +148,8 @@ func (path *Path) SetupConnections() { path.CreateConnections() } -// CreateConnection constructs and executes connection handshake messages in order to create -// OPEN channels on chainA and chainB. The connection information of for chainA and chainB -// are returned within a TestConnection struct. The function expects the connections to be +// CreateConnections constructs and executes connection handshake messages in order to create +// OPEN connections on chainA and chainB. The function expects the connections to be // successfully opened otherwise testing will fail. func (path *Path) CreateConnections() { err := path.EndpointA.ConnOpenInit() From ba87d623ddcd7a40d708352afd50bf45352ae183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20Axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Wed, 24 Jan 2024 17:08:47 +0100 Subject: [PATCH 06/12] refactor: add back coordinator functions, add deprecation notice --- testing/coordinator.go | 48 +++++++++++++++++++++++++++++------------- testing/path.go | 2 ++ 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/testing/coordinator.go b/testing/coordinator.go index 458ba7fd81d..71bf62f8369 100644 --- a/testing/coordinator.go +++ b/testing/coordinator.go @@ -71,6 +71,37 @@ func (coord *Coordinator) UpdateTimeForChain(chain *TestChain) { chain.CurrentHeader.Time = coord.CurrentTime.UTC() } +// Setup constructs a TM client, connection, and channel on both chains provided. It will +// fail if any error occurs. +// DEPRECATED: please use path.Setup(), this function will be removed in v10 +func (coord *Coordinator) Setup(path *Path) { + path.Setup() +} + +// SetupClients is a helper function to create clients on both chains. It assumes the +// caller does not anticipate any errors. +// DEPRECATED: please use path.SetupClients(), this function will be removed in v10 +func (coord *Coordinator) SetupClients(path *Path) { + path.SetupClients() +} + +// SetupClientConnections is a helper function to create clients and the appropriate +// connections on both the source and counterparty chain. It assumes the caller does not +// anticipate any errors. +// DEPRECATED: please use path.SetupConnections(), this function will be removed in v10 +func (coord *Coordinator) SetupConnections(path *Path) { + path.SetupConnections() +} + +// CreateConnection constructs and executes connection handshake messages in order to create +// OPEN channels on chainA and chainB. The connection information of for chainA and chainB +// are returned within a TestConnection struct. The function expects the connections to be +// successfully opened otherwise testing will fail. +// DEPRECATED: please use path.CreateConnections(), this function will be removed in v10 +func (coord *Coordinator) CreateConnections(path *Path) { + path.CreateConnections() +} + // CreateMockChannels constructs and executes channel handshake messages to create OPEN // channels that use a mock application module that returns nil on all callbacks. This // function is expects the channels to be successfully opened otherwise testing will @@ -95,22 +126,9 @@ func (coord *Coordinator) CreateTransferChannels(path *Path) { // CreateChannel constructs and executes channel handshake messages in order to create // OPEN channels on chainA and chainB. The function expects the channels to be successfully // opened otherwise testing will fail. +// DEPRECATED: please use path.SetupChannels(), this function will be removed in v10 func (coord *Coordinator) CreateChannels(path *Path) { - err := path.EndpointA.ChanOpenInit() - require.NoError(coord.T, err) - - err = path.EndpointB.ChanOpenTry() - require.NoError(coord.T, err) - - err = path.EndpointA.ChanOpenAck() - require.NoError(coord.T, err) - - err = path.EndpointB.ChanOpenConfirm() - require.NoError(coord.T, err) - - // ensure counterparty is up to date - err = path.EndpointA.UpdateClient() - require.NoError(coord.T, err) + path.CreateChannels() } // GetChain returns the TestChain using the given chainID and returns an error if it does diff --git a/testing/path.go b/testing/path.go index e22cc3a297b..5187db9ad90 100644 --- a/testing/path.go +++ b/testing/path.go @@ -161,6 +161,7 @@ func (path *Path) CreateConnections() { if err != nil { panic(err) } + err = path.EndpointA.ConnOpenAck() if err != nil { panic(err) @@ -201,6 +202,7 @@ func (path *Path) CreateChannels() { if err != nil { panic(err) } + // ensure counterparty is up to date err = path.EndpointA.UpdateClient() if err != nil { From 706fbbabe368ef06856d224f35af048671b3f47d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20Axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Wed, 24 Jan 2024 17:49:50 +0100 Subject: [PATCH 07/12] docs: add migrationd doc entry --- docs/docs/05-migrations/13-v8-to-v9.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/docs/05-migrations/13-v8-to-v9.md b/docs/docs/05-migrations/13-v8-to-v9.md index 5df1267c5df..c83827a6fa7 100644 --- a/docs/docs/05-migrations/13-v8-to-v9.md +++ b/docs/docs/05-migrations/13-v8-to-v9.md @@ -28,6 +28,11 @@ There are four sections based on the four potential user groups of this document The `exported.ChannelI` interface has been removed. Please use the concrete type. +### API deprecation notice + +The testing pkg function `coordinator.Setup`, `coordinator.SetupClients`, `coordinator.SetupConnections`, `coordinator.CreateConnections`, and `coordinator.CreateChannels` have been deprecated will be removed in v10. +Please use the new functions `path.Setup`, `path.SetupClients`, `path.SetupConnections`, `path.CreateConnections`, `path.CreateChannels`. + ## Relayers - Renaming of event attribute keys in [#5603](https://github.com/cosmos/ibc-go/pull/5603). From 589bfc5fbf6c7ecf460e12614c1525a506497b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?colin=20axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Wed, 24 Jan 2024 17:51:49 +0100 Subject: [PATCH 08/12] Update testing/coordinator.go --- testing/coordinator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/coordinator.go b/testing/coordinator.go index a8f2db15ad6..df7587ef203 100644 --- a/testing/coordinator.go +++ b/testing/coordinator.go @@ -126,7 +126,7 @@ func (coord *Coordinator) CreateTransferChannels(path *Path) { // CreateChannel constructs and executes channel handshake messages in order to create // OPEN channels on chainA and chainB. The function expects the channels to be successfully // opened otherwise testing will fail. -// DEPRECATED: please use path.SetupChannels(), this function will be removed in v10 +// DEPRECATED: please use path.CreateChannels(), this function will be removed in v10 func (coord *Coordinator) CreateChannels(path *Path) { path.CreateChannels() } From 05ce62a802d2b7beadec0e7d32b280fab014348e Mon Sep 17 00:00:00 2001 From: DimitrisJim Date: Wed, 24 Jan 2024 20:28:51 +0200 Subject: [PATCH 09/12] lint: fix linting issues. --- testing/coordinator.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/testing/coordinator.go b/testing/coordinator.go index df7587ef203..3c8744c8f54 100644 --- a/testing/coordinator.go +++ b/testing/coordinator.go @@ -73,23 +73,23 @@ func (coord *Coordinator) UpdateTimeForChain(chain *TestChain) { // Setup constructs a TM client, connection, and channel on both chains provided. It will // fail if any error occurs. -// DEPRECATED: please use path.Setup(), this function will be removed in v10 -func (coord *Coordinator) Setup(path *Path) { +// Deprecated: please use path.Setup(), this function will be removed in v10 +func (*Coordinator) Setup(path *Path) { path.Setup() } // SetupClients is a helper function to create clients on both chains. It assumes the // caller does not anticipate any errors. -// DEPRECATED: please use path.SetupClients(), this function will be removed in v10 -func (coord *Coordinator) SetupClients(path *Path) { +// Deprecated: please use path.SetupClients(), this function will be removed in v10 +func (*Coordinator) SetupClients(path *Path) { path.SetupClients() } // SetupClientConnections is a helper function to create clients and the appropriate // connections on both the source and counterparty chain. It assumes the caller does not // anticipate any errors. -// DEPRECATED: please use path.SetupConnections(), this function will be removed in v10 -func (coord *Coordinator) SetupConnections(path *Path) { +// Deprecated: please use path.SetupConnections(), this function will be removed in v10 +func (*Coordinator) SetupConnections(path *Path) { path.SetupConnections() } @@ -97,8 +97,8 @@ func (coord *Coordinator) SetupConnections(path *Path) { // OPEN channels on chainA and chainB. The connection information of for chainA and chainB // are returned within a TestConnection struct. The function expects the connections to be // successfully opened otherwise testing will fail. -// DEPRECATED: please use path.CreateConnections(), this function will be removed in v10 -func (coord *Coordinator) CreateConnections(path *Path) { +// Deprecated: please use path.CreateConnections(), this function will be removed in v10 +func (*Coordinator) CreateConnections(path *Path) { path.CreateConnections() } @@ -126,8 +126,8 @@ func (coord *Coordinator) CreateTransferChannels(path *Path) { // CreateChannel constructs and executes channel handshake messages in order to create // OPEN channels on chainA and chainB. The function expects the channels to be successfully // opened otherwise testing will fail. -// DEPRECATED: please use path.CreateChannels(), this function will be removed in v10 -func (coord *Coordinator) CreateChannels(path *Path) { +// Deprecated: please use path.CreateChannels(), this function will be removed in v10 +func (*Coordinator) CreateChannels(path *Path) { path.CreateChannels() } From 46727aaf5dcefac8ed9b8be826e98c5bfd3650ca Mon Sep 17 00:00:00 2001 From: DimitrisJim Date: Wed, 24 Jan 2024 20:43:01 +0200 Subject: [PATCH 10/12] Update docs/docs/05-migrations/13-v8-to-v9.md --- docs/docs/05-migrations/13-v8-to-v9.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/05-migrations/13-v8-to-v9.md b/docs/docs/05-migrations/13-v8-to-v9.md index c83827a6fa7..1cc0983f31e 100644 --- a/docs/docs/05-migrations/13-v8-to-v9.md +++ b/docs/docs/05-migrations/13-v8-to-v9.md @@ -30,7 +30,7 @@ The `exported.ChannelI` interface has been removed. Please use the concrete type ### API deprecation notice -The testing pkg function `coordinator.Setup`, `coordinator.SetupClients`, `coordinator.SetupConnections`, `coordinator.CreateConnections`, and `coordinator.CreateChannels` have been deprecated will be removed in v10. +The testing package functions `coordinator.Setup`, `coordinator.SetupClients`, `coordinator.SetupConnections`, `coordinator.CreateConnections`, and `coordinator.CreateChannels` have been deprecated and will be removed in v10. Please use the new functions `path.Setup`, `path.SetupClients`, `path.SetupConnections`, `path.CreateConnections`, `path.CreateChannels`. ## Relayers From 327b6db1f176c7544e39108738153d25b3bf5a4c Mon Sep 17 00:00:00 2001 From: DimitrisJim Date: Wed, 24 Jan 2024 21:01:00 +0200 Subject: [PATCH 11/12] Replace occurences brought in by main being merged. --- .../controller/ibc_middleware_test.go | 2 +- .../27-interchain-accounts/host/ibc_module_test.go | 4 ++-- modules/apps/29-fee/keeper/migrations_test.go | 2 +- modules/core/03-connection/keeper/events_test.go | 8 ++++---- modules/core/04-channel/keeper/packet_test.go | 10 +++++----- modules/core/integration_test.go | 2 +- modules/core/keeper/msg_server_test.go | 10 +++++----- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go b/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go index 7b882f0333f..fd39dee3d8f 100644 --- a/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go +++ b/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go @@ -870,7 +870,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeInit() { func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeTry() { suite.SetupTest() // reset path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/host/ibc_module_test.go b/modules/apps/27-interchain-accounts/host/ibc_module_test.go index 3a3f5a931e8..72fd2376344 100644 --- a/modules/apps/27-interchain-accounts/host/ibc_module_test.go +++ b/modules/apps/27-interchain-accounts/host/ibc_module_test.go @@ -607,7 +607,7 @@ func (suite *InterchainAccountsTestSuite) TestOnTimeoutPacket() { // OnChanUpgradeInit callback returns error on host chains func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeInit() { path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) @@ -702,7 +702,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeTry() { // OnChanUpgradeAck callback returns error on host chains func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeAck() { path := NewICAPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) diff --git a/modules/apps/29-fee/keeper/migrations_test.go b/modules/apps/29-fee/keeper/migrations_test.go index ee7209c9cbc..e2d295f47bb 100644 --- a/modules/apps/29-fee/keeper/migrations_test.go +++ b/modules/apps/29-fee/keeper/migrations_test.go @@ -168,7 +168,7 @@ func (suite *KeeperTestSuite) TestMigrate1to2() { tc := tc suite.SetupTest() - suite.coordinator.Setup(suite.path) + suite.path.Setup() refundAcc = suite.chainA.SenderAccount.GetAddress() packetFee = types.NewPacketFee(fee, refundAcc.String(), []string(nil)) diff --git a/modules/core/03-connection/keeper/events_test.go b/modules/core/03-connection/keeper/events_test.go index 36ce9ef73f8..b37f7da2147 100644 --- a/modules/core/03-connection/keeper/events_test.go +++ b/modules/core/03-connection/keeper/events_test.go @@ -11,7 +11,7 @@ import ( func (suite *KeeperTestSuite) TestMsgConnectionOpenInitEvents() { suite.SetupTest() path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() msg := types.NewMsgConnectionOpenInit( path.EndpointA.ClientID, @@ -42,7 +42,7 @@ func (suite *KeeperTestSuite) TestMsgConnectionOpenInitEvents() { func (suite *KeeperTestSuite) TestMsgConnectionOpenTryEvents() { suite.SetupTest() path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() suite.Require().NoError(path.EndpointA.ConnOpenInit()) @@ -81,7 +81,7 @@ func (suite *KeeperTestSuite) TestMsgConnectionOpenTryEvents() { func (suite *KeeperTestSuite) TestMsgConnectionOpenAckEvents() { suite.SetupTest() path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() suite.Require().NoError(path.EndpointA.ConnOpenInit()) suite.Require().NoError(path.EndpointB.ConnOpenTry()) @@ -121,7 +121,7 @@ func (suite *KeeperTestSuite) TestMsgConnectionOpenAckEvents() { func (suite *KeeperTestSuite) TestMsgConnectionOpenConfirmEvents() { suite.SetupTest() path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + path.SetupClients() suite.Require().NoError(path.EndpointA.ConnOpenInit()) suite.Require().NoError(path.EndpointB.ConnOpenTry()) diff --git a/modules/core/04-channel/keeper/packet_test.go b/modules/core/04-channel/keeper/packet_test.go index 238bcfa7eae..12308037356 100644 --- a/modules/core/04-channel/keeper/packet_test.go +++ b/modules/core/04-channel/keeper/packet_test.go @@ -327,7 +327,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { "success UNORDERED channel in FLUSHING", func() { // setup uses an UNORDERED channel - suite.coordinator.Setup(path) + path.Setup() channel := path.EndpointB.GetChannel() channel.State = types.FLUSHING path.EndpointB.SetChannel(channel) @@ -343,7 +343,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { "success UNORDERED channel in FLUSHCOMPLETE", func() { // setup uses an UNORDERED channel - suite.coordinator.Setup(path) + path.Setup() channel := path.EndpointB.GetChannel() channel.State = types.FLUSHCOMPLETE path.EndpointB.SetChannel(channel) @@ -624,7 +624,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { { "packet already received", func() { - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -722,7 +722,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { { "success: channel flushing", func() { - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) ack = ibcmock.MockAcknowledgement @@ -735,7 +735,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { { "success: channel flush complete", func() { - suite.coordinator.Setup(path) + path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) ack = ibcmock.MockAcknowledgement diff --git a/modules/core/integration_test.go b/modules/core/integration_test.go index c1b165b4d01..0850af43182 100644 --- a/modules/core/integration_test.go +++ b/modules/core/integration_test.go @@ -49,7 +49,7 @@ func (suite *IBCTestSuite) TestReplayProtectionAfterReceivePruning() { tc.malleate() - suite.coordinator.Setup(path) + path.Setup() // Setup replay attack by sending a packet. We will save the receive // proof to replay relaying after the channel upgrade compeletes. diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index 576c8e10429..b7f9a315b24 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -973,7 +973,7 @@ func (suite *KeeperTestSuite) TestChannelUpgradeInit() { path.EndpointA.ChannelConfig.PortID = ibcmock.MockBlockUpgrade path.EndpointB.ChannelConfig.PortID = ibcmock.MockBlockUpgrade - suite.coordinator.Setup(path) + path.Setup() msg = channeltypes.NewMsgChannelUpgradeInit( path.EndpointA.ChannelConfig.PortID, @@ -1150,7 +1150,7 @@ func (suite *KeeperTestSuite) TestChannelUpgradeTry() { path.EndpointA.ChannelConfig.PortID = ibcmock.MockBlockUpgrade path.EndpointB.ChannelConfig.PortID = ibcmock.MockBlockUpgrade - suite.coordinator.Setup(path) + path.Setup() msg.PortId = path.EndpointB.ChannelConfig.PortID msg.ChannelId = path.EndpointB.ChannelID @@ -1444,7 +1444,7 @@ func (suite *KeeperTestSuite) TestChannelUpgradeAck() { path.EndpointA.ChannelConfig.PortID = ibcmock.MockBlockUpgrade path.EndpointB.ChannelConfig.PortID = ibcmock.MockBlockUpgrade - suite.coordinator.Setup(path) + path.Setup() msg.PortId = path.EndpointB.ChannelConfig.PortID msg.ChannelId = path.EndpointB.ChannelID @@ -1783,7 +1783,7 @@ func (suite *KeeperTestSuite) TestChannelUpgradeConfirm() { path.EndpointA.ChannelConfig.PortID = ibcmock.MockBlockUpgrade path.EndpointB.ChannelConfig.PortID = ibcmock.MockBlockUpgrade - suite.coordinator.Setup(path) + path.Setup() msg.PortId = path.EndpointB.ChannelConfig.PortID msg.ChannelId = path.EndpointB.ChannelID @@ -1970,7 +1970,7 @@ func (suite *KeeperTestSuite) TestChannelUpgradeOpen() { path.EndpointA.ChannelConfig.PortID = ibcmock.MockBlockUpgrade path.EndpointB.ChannelConfig.PortID = ibcmock.MockBlockUpgrade - suite.coordinator.Setup(path) + path.Setup() msg.PortId = path.EndpointB.ChannelConfig.PortID msg.ChannelId = path.EndpointB.ChannelID From f9ecf0b3d233735f91e42e6c081d2292acb45d2c Mon Sep 17 00:00:00 2001 From: DimitrisJim Date: Wed, 24 Jan 2024 21:04:37 +0200 Subject: [PATCH 12/12] Update testing/path.go remove docstring about being connected to ibc-transfer, that is done via CreateTransferChannels --- testing/path.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/path.go b/testing/path.go index 5187db9ad90..36bd21bbf0b 100644 --- a/testing/path.go +++ b/testing/path.go @@ -117,7 +117,7 @@ func (path *Path) RelayPacketWithResults(packet channeltypes.Packet) (*abci.Exec } // Setup constructs a TM client, connection, and channel on both chains provided. It will -// fail if any error occurs. The channels created are connected to the ibc-transfer application. +// fail if any error occurs. func (path *Path) Setup() { path.SetupConnections()