From 01e6c7c25eaac7e43cb1fd03caf6aaed2e5fd289 Mon Sep 17 00:00:00 2001 From: chandiniv1 <117723967+chandiniv1@users.noreply.github.com> Date: Thu, 25 Jan 2024 02:13:39 +0530 Subject: [PATCH] Add coordinator Setup functions to the Path type (#5397) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add coordinator Setup functions to the Path type * fix * fixed lint errors * fix lint errors * modify docstring * refactor: add back coordinator functions, add deprecation notice * docs: add migrationd doc entry * Update testing/coordinator.go * lint: fix linting issues. * Update docs/docs/05-migrations/13-v8-to-v9.md * Replace occurences brought in by main being merged. * Update testing/path.go remove docstring about being connected to ibc-transfer, that is done via CreateTransferChannels --------- Co-authored-by: Carlos Rodriguez Co-authored-by: Cian Hatton Co-authored-by: Colin Axnér <25233464+colin-axner@users.noreply.github.com> Co-authored-by: DimitrisJim --- docs/docs/05-migrations/13-v8-to-v9.md | 5 + .../controller/ibc_middleware_test.go | 40 ++--- .../controller/keeper/account_test.go | 6 +- .../controller/keeper/genesis_test.go | 2 +- .../controller/keeper/grpc_query_test.go | 2 +- .../controller/keeper/handshake_test.go | 10 +- .../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 | 28 ++-- .../host/keeper/genesis_test.go | 2 +- .../host/keeper/handshake_test.go | 8 +- .../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 | 37 +++-- 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/migrations_test.go | 2 +- 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 | 4 +- modules/apps/callbacks/callbacks_test.go | 6 +- modules/apps/transfer/ibc_module_test.go | 18 +-- .../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 +- .../core/03-connection/keeper/events_test.go | 8 +- .../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 | 20 +-- .../core/04-channel/keeper/grpc_query_test.go | 72 ++++----- .../core/04-channel/keeper/handshake_test.go | 86 +++++------ modules/core/04-channel/keeper/keeper_test.go | 22 +-- modules/core/04-channel/keeper/packet_test.go | 144 +++++++++--------- .../core/04-channel/keeper/timeout_test.go | 64 ++++---- .../core/04-channel/keeper/upgrade_test.go | 52 +++---- modules/core/ante/ante_test.go | 2 +- modules/core/genesis_test.go | 6 +- modules/core/integration_test.go | 2 +- modules/core/keeper/msg_server_test.go | 93 ++++++----- 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 | 65 ++------ testing/path.go | 94 ++++++++++++ 73 files changed, 625 insertions(+), 561 deletions(-) diff --git a/docs/docs/05-migrations/13-v8-to-v9.md b/docs/docs/05-migrations/13-v8-to-v9.md index 5df1267c5df..1cc0983f31e 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 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 - Renaming of event attribute keys in [#5603](https://github.com/cosmos/ibc-go/pull/5603). 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 93610b452ff..fd39dee3d8f 100644 --- a/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go +++ b/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go @@ -197,7 +197,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) @@ -262,7 +262,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) @@ -363,7 +363,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) @@ -402,7 +402,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) @@ -447,7 +447,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) @@ -494,7 +494,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) @@ -540,7 +540,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) @@ -626,7 +626,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) @@ -721,7 +721,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) @@ -823,7 +823,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) @@ -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) @@ -950,7 +950,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) @@ -1031,7 +1031,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) @@ -1092,14 +1092,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 @@ -1137,7 +1137,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) @@ -1156,7 +1156,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()) @@ -1173,7 +1173,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) @@ -1190,7 +1190,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) @@ -1233,7 +1233,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 341df9b6295..e715b314aec 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go @@ -263,7 +263,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) @@ -423,7 +423,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) @@ -485,7 +485,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) @@ -648,7 +648,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) @@ -816,7 +816,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/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 f9040f231a0..625c0441859 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, "", channeltypes.ORDERED) @@ -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 5652805fe16..72fd2376344 100644 --- a/modules/apps/27-interchain-accounts/host/ibc_module_test.go +++ b/modules/apps/27-interchain-accounts/host/ibc_module_test.go @@ -119,7 +119,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) @@ -184,7 +184,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) @@ -237,7 +237,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) @@ -299,7 +299,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) @@ -332,7 +332,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) @@ -370,7 +370,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) @@ -432,7 +432,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) @@ -516,7 +516,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) @@ -569,7 +569,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) @@ -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) @@ -654,7 +654,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) @@ -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) @@ -755,7 +755,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) @@ -841,7 +841,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 60b9e50a38d..da485a2eafd 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go @@ -295,7 +295,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) @@ -375,7 +375,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) @@ -418,7 +418,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) @@ -570,7 +570,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/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 372245f2779..feeca415be5 100644 --- a/modules/apps/27-interchain-accounts/types/port_test.go +++ b/modules/apps/27-interchain-accounts/types/port_test.go @@ -39,7 +39,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 1515b1e3327..22513266275 100644 --- a/modules/apps/29-fee/ibc_middleware_test.go +++ b/modules/apps/29-fee/ibc_middleware_test.go @@ -79,7 +79,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, @@ -175,7 +175,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) @@ -275,7 +275,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( @@ -364,7 +364,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{ @@ -454,7 +454,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{ @@ -541,9 +541,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) @@ -807,7 +807,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() @@ -1021,7 +1021,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() @@ -1088,7 +1088,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, }, @@ -1138,7 +1138,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})) @@ -1189,7 +1189,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) }, @@ -1248,7 +1248,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})) @@ -1345,8 +1345,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 @@ -1423,7 +1422,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) { @@ -1451,7 +1450,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})) @@ -1519,7 +1518,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 @@ -1540,7 +1539,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 ad218113a92..f0d6233d23f 100644 --- a/modules/apps/29-fee/keeper/escrow_test.go +++ b/modules/apps/29-fee/keeper/escrow_test.go @@ -217,8 +217,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() @@ -362,8 +362,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()) @@ -537,8 +537,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 c33315c790b..f4f49abcf0d 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/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/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 d5163f68657..79a0405fc0d 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 @@ -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})) diff --git a/modules/apps/callbacks/callbacks_test.go b/modules/apps/callbacks/callbacks_test.go index c1329417de9..65eb1764658 100644 --- a/modules/apps/callbacks/callbacks_test.go +++ b/modules/apps/callbacks/callbacks_test.go @@ -82,7 +82,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 @@ -95,7 +95,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() { @@ -112,7 +112,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 diff --git a/modules/apps/transfer/ibc_module_test.go b/modules/apps/transfer/ibc_module_test.go index d383533004f..82a94c1d1c8 100644 --- a/modules/apps/transfer/ibc_module_test.go +++ b/modules/apps/transfer/ibc_module_test.go @@ -78,7 +78,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) @@ -164,7 +164,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) @@ -228,7 +228,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 @@ -296,11 +296,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} @@ -360,11 +360,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} @@ -430,11 +430,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/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 08f5bc80026..a2d9a3c73ff 100644 --- a/modules/apps/transfer/transfer_test.go +++ b/modules/apps/transfer/transfer_test.go @@ -52,7 +52,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) @@ -89,7 +89,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 f7c2d011208..384e513ea66 100644 --- a/modules/apps/transfer/types/transfer_authorization_test.go +++ b/modules/apps/transfer/types/transfer_authorization_test.go @@ -234,7 +234,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 38f4d3337f7..0e666144af6 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 40c6dcf3178..1dfa5b8e96b 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() @@ -231,7 +231,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 @@ -249,7 +249,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) @@ -333,7 +333,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( @@ -438,7 +438,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)) @@ -527,7 +527,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, } @@ -538,7 +538,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 @@ -555,7 +555,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/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/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 c60361aaccc..6109e6c40f1 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 16f901f3d93..8cd9b157839 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.LatestCommittedHeader.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.LatestCommittedHeader.GetHeight().Increment() }, false}, diff --git a/modules/core/03-connection/keeper/verify_test.go b/modules/core/03-connection/keeper/verify_test.go index 8a8dd958b65..0d49dd5de0d 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) @@ -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.WriteErrorReceipt(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, upgradeError) @@ -814,7 +814,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 6461e07b4c3..ba2f3126b30 100644 --- a/modules/core/04-channel/keeper/grpc_query_test.go +++ b/modules/core/04-channel/keeper/grpc_query_test.go @@ -68,7 +68,7 @@ func (suite *KeeperTestSuite) TestQueryChannel() { "success", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() // init channel @@ -137,7 +137,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, @@ -238,7 +238,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, @@ -288,7 +288,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", @@ -377,7 +377,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 @@ -396,7 +396,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{}) @@ -411,7 +411,7 @@ func (suite *KeeperTestSuite) TestQueryChannelClientState() { "success", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() // init channel @@ -515,7 +515,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 @@ -536,7 +536,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, @@ -550,7 +550,7 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() { "success", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() // init channel @@ -668,7 +668,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) @@ -753,7 +753,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) @@ -854,7 +854,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{ @@ -870,7 +870,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{ @@ -972,7 +972,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) @@ -1057,7 +1057,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 @@ -1084,7 +1084,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) @@ -1172,7 +1172,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, @@ -1187,7 +1187,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, @@ -1211,7 +1211,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{ @@ -1226,7 +1226,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 @@ -1243,7 +1243,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) @@ -1260,7 +1260,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{} @@ -1288,7 +1288,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{ @@ -1304,7 +1304,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} @@ -1321,7 +1321,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. @@ -1403,7 +1403,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, @@ -1417,7 +1417,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")) @@ -1434,7 +1434,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{ @@ -1449,7 +1449,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{} @@ -1547,7 +1547,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{ @@ -1562,7 +1562,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) @@ -1651,7 +1651,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) @@ -1668,7 +1668,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) @@ -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.WriteErrorReceipt(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, upgradeErr) @@ -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 7051e11abb9..8b1366b0539 100644 --- a/modules/core/04-channel/keeper/handshake_test.go +++ b/modules/core/04-channel/keeper/handshake_test.go @@ -33,13 +33,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 @@ -47,12 +47,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() @@ -69,7 +69,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() @@ -91,7 +91,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()) @@ -169,7 +169,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) @@ -186,7 +186,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) @@ -195,7 +195,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) @@ -207,11 +207,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) @@ -219,7 +219,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) @@ -238,7 +238,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) @@ -314,7 +314,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) @@ -325,7 +325,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() @@ -348,11 +348,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) @@ -368,7 +368,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) @@ -383,7 +383,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() @@ -397,7 +397,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() @@ -412,7 +412,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() @@ -424,7 +424,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) @@ -484,7 +484,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() { ) testCases := []testCase{ {"success", func() { - suite.coordinator.SetupConnections(path) + path.SetupConnections() path.SetChannelOrdered() err := path.EndpointA.ChanOpenInit() @@ -501,11 +501,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() @@ -525,7 +525,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) @@ -534,7 +534,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() @@ -552,7 +552,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() @@ -564,7 +564,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() @@ -624,7 +624,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() { @@ -640,7 +640,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 @@ -648,7 +648,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 @@ -657,7 +657,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) @@ -672,14 +672,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 @@ -727,7 +727,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) @@ -743,14 +743,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 @@ -759,7 +759,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) @@ -774,7 +774,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) @@ -784,11 +784,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) @@ -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 3674ae2c457..39443cb9f8b 100644 --- a/modules/core/04-channel/keeper/keeper_test.go +++ b/modules/core/04-channel/keeper/keeper_test.go @@ -47,7 +47,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) @@ -72,7 +72,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) @@ -171,7 +171,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, @@ -193,7 +193,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() @@ -235,7 +235,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() @@ -277,7 +277,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 @@ -351,7 +351,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) @@ -395,7 +395,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) @@ -452,7 +452,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) @@ -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) @@ -838,7 +838,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 1af25835f24..12308037356 100644 --- a/modules/core/04-channel/keeper/packet_test.go +++ b/modules/core/04-channel/keeper/packet_test.go @@ -43,20 +43,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 @@ -71,7 +71,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 @@ -85,7 +85,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) @@ -93,26 +93,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) @@ -120,7 +120,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() @@ -130,7 +130,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 @@ -141,7 +141,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() @@ -157,7 +157,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 @@ -166,7 +166,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 @@ -180,7 +180,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) @@ -203,7 +203,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(), @@ -214,7 +214,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) @@ -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 @@ -302,7 +302,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) @@ -315,7 +315,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) @@ -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) @@ -359,7 +359,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) @@ -374,7 +374,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) @@ -393,7 +393,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) @@ -408,7 +408,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) @@ -431,7 +431,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) @@ -447,7 +447,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) @@ -462,7 +462,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 @@ -480,7 +480,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) }, @@ -489,7 +489,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) @@ -502,7 +502,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) @@ -514,7 +514,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) @@ -525,7 +525,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) @@ -536,7 +536,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { { "connection not found", func() { - suite.coordinator.Setup(path) + path.Setup() // pass channel check suite.chainB.App.GetIBCKeeper().ChannelKeeper.SetChannel( @@ -553,7 +553,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() @@ -574,7 +574,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) @@ -584,7 +584,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) @@ -594,7 +594,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 @@ -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) @@ -639,7 +639,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) @@ -653,7 +653,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) }, @@ -712,7 +712,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) @@ -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 @@ -747,13 +747,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 @@ -764,7 +764,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) @@ -774,7 +774,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()) @@ -785,7 +785,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) @@ -795,7 +795,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) @@ -868,7 +868,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) @@ -887,7 +887,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) @@ -906,7 +906,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) @@ -939,7 +939,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) @@ -993,7 +993,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) @@ -1044,7 +1044,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) @@ -1066,7 +1066,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) @@ -1088,7 +1088,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) @@ -1101,7 +1101,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) @@ -1118,7 +1118,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) @@ -1137,7 +1137,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) @@ -1155,7 +1155,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) @@ -1170,7 +1170,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) @@ -1185,7 +1185,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) @@ -1208,7 +1208,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) @@ -1235,7 +1235,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) }, @@ -1247,7 +1247,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) @@ -1261,7 +1261,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) @@ -1282,7 +1282,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) @@ -1306,7 +1306,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 4427992ff44..d6154d7aec1 100644 --- a/modules/core/04-channel/keeper/timeout_test.go +++ b/modules/core/04-channel/keeper/timeout_test.go @@ -34,7 +34,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()) @@ -48,7 +48,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { }, true}, {"success: UNORDERED", func() { ordered = false - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) @@ -63,7 +63,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()) @@ -81,7 +81,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()) @@ -98,18 +98,18 @@ 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}, {"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}, @@ -125,7 +125,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { }, false}, {"timeout", func() { expError = types.ErrTimeoutNotReached - 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) @@ -136,7 +136,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()) @@ -152,7 +152,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) @@ -164,7 +164,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { ordered = false path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) @@ -180,7 +180,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()) @@ -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()) @@ -555,7 +555,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()) @@ -573,7 +573,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { }, true}, {"success: UNORDERED", func() { ordered = false - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) @@ -590,17 +590,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) @@ -620,7 +620,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) @@ -629,7 +629,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()) @@ -648,7 +648,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()) @@ -662,7 +662,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()) @@ -680,7 +680,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()) @@ -697,7 +697,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()) @@ -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 a4260a6f381..e39566fbbc8 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 @@ -294,7 +294,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() @@ -357,7 +357,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 @@ -453,7 +453,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 @@ -586,7 +586,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 @@ -753,7 +753,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 @@ -833,7 +833,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 @@ -903,7 +903,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 @@ -1030,7 +1030,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 @@ -1103,7 +1103,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 @@ -1154,7 +1154,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 @@ -1260,7 +1260,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 { @@ -1269,7 +1269,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 @@ -1343,7 +1343,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) @@ -1534,7 +1534,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) @@ -1752,7 +1752,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 @@ -1807,7 +1807,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 @@ -1904,7 +1904,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 @@ -2149,7 +2149,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 @@ -2237,7 +2237,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 @@ -2299,7 +2299,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, @@ -2360,7 +2360,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{ @@ -2442,7 +2442,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 @@ -2578,7 +2578,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 @@ -2630,7 +2630,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 @@ -2722,7 +2722,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/ante/ante_test.go b/modules/core/ante/ante_test.go index 7cdc5396b7f..89564683ce3 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 84200e3c969..1349c592714 100644 --- a/modules/core/genesis_test.go +++ b/modules/core/genesis_test.go @@ -327,10 +327,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/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 6d612346b94..b7f9a315b24 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -52,7 +52,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) @@ -60,7 +60,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, false, false}, {"success: UNORDERED", func() { - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(timeoutHeight, 0, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -69,7 +69,7 @@ func (suite *KeeperTestSuite) TestHandleRecvPacket() { }, true, false, false, 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++ { @@ -80,7 +80,7 @@ func (suite *KeeperTestSuite) TestHandleRecvPacket() { } }, true, false, false, 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) @@ -89,7 +89,7 @@ func (suite *KeeperTestSuite) TestHandleRecvPacket() { }, true, true, false, false}, {"success: ORDERED - async acknowledgement", func() { path.SetChannelOrdered() - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(timeoutHeight, 0, ibcmock.MockAsyncPacketData) suite.Require().NoError(err) @@ -97,7 +97,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, true, false}, {"success: UNORDERED - async acknowledgement", func() { - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(timeoutHeight, 0, ibcmock.MockAsyncPacketData) suite.Require().NoError(err) @@ -106,7 +106,7 @@ func (suite *KeeperTestSuite) TestHandleRecvPacket() { }, true, false, 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++ { @@ -121,13 +121,13 @@ func (suite *KeeperTestSuite) TestHandleRecvPacket() { suite.Require().NotNil(packet) }, false, false, 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, 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) @@ -138,7 +138,7 @@ func (suite *KeeperTestSuite) TestHandleRecvPacket() { }, true, false, false, true}, {"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) @@ -257,12 +257,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 @@ -317,7 +317,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) @@ -327,7 +327,7 @@ func (suite *KeeperTestSuite) TestHandleAcknowledgePacket() { suite.Require().NoError(err) }, true, false}, {"success: UNORDERED", func() { - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(timeoutHeight, 0, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -338,7 +338,7 @@ func (suite *KeeperTestSuite) TestHandleAcknowledgePacket() { }, true, false}, {"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++ { @@ -352,7 +352,7 @@ func (suite *KeeperTestSuite) TestHandleAcknowledgePacket() { }, true, false}, {"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++ { @@ -369,7 +369,7 @@ func (suite *KeeperTestSuite) TestHandleAcknowledgePacket() { suite.Require().NotNil(packet) }, false, false}, {"packet not received", func() { - suite.coordinator.Setup(path) + path.Setup() sequence, err := path.EndpointA.SendPacket(timeoutHeight, 0, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -377,7 +377,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, 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) @@ -390,7 +390,7 @@ func (suite *KeeperTestSuite) TestHandleAcknowledgePacket() { suite.Require().NoError(err) }, true, 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) @@ -474,7 +474,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()) @@ -491,7 +491,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutPacket() { packetKey = host.NextSequenceRecvKey(packet.GetDestPort(), packet.GetDestChannel()) }, true, false}, {"success: UNORDERED", func() { - suite.coordinator.Setup(path) + path.Setup() timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().UnixNano()) @@ -509,7 +509,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutPacket() { }, true, false}, {"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 @@ -530,7 +530,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutPacket() { }, true, false}, {"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 @@ -556,8 +556,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutPacket() { packetKey = host.NextSequenceRecvKey(packet.GetDestPort(), packet.GetDestChannel()) }, false, 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, true}, @@ -633,7 +632,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) @@ -651,7 +650,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) @@ -670,7 +669,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 @@ -693,7 +692,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 @@ -721,7 +720,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()) @@ -731,7 +730,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) @@ -875,7 +874,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) @@ -974,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, @@ -1033,7 +1032,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 @@ -1151,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 @@ -1199,7 +1198,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 @@ -1445,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 @@ -1503,7 +1502,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 @@ -1598,7 +1597,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 @@ -1784,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 @@ -1804,7 +1803,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 @@ -1971,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 @@ -1991,7 +1990,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 @@ -2340,7 +2339,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 @@ -2506,7 +2505,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 @@ -2578,7 +2577,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", @@ -2805,7 +2804,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 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 8677541bf5d..7c436531297 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 5231cc24e78..405c1bd03f7 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 4771bd47cd7..195a13cc9fb 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 3663a04938b..4cdca645e2a 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 f19faa28254..3c8744c8f54 100644 --- a/testing/coordinator.go +++ b/testing/coordinator.go @@ -72,54 +72,34 @@ 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. 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) +// fail if any error occurs. +// 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. -func (coord *Coordinator) SetupClients(path *Path) { - err := path.EndpointA.CreateClient() - require.NoError(coord.T, err) - - err = path.EndpointB.CreateClient() - require.NoError(coord.T, err) +// 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. -func (coord *Coordinator) SetupConnections(path *Path) { - coord.SetupClients(path) - - coord.CreateConnections(path) +// Deprecated: please use path.SetupConnections(), this function will be removed in v10 +func (*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. -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) +// Deprecated: please use path.CreateConnections(), this function will be removed in v10 +func (*Coordinator) CreateConnections(path *Path) { + path.CreateConnections() } // CreateMockChannels constructs and executes channel handshake messages to create OPEN @@ -146,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. -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) +// Deprecated: please use path.CreateChannels(), this function will be removed in v10 +func (*Coordinator) CreateChannels(path *Path) { + 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 64738b1c163..36bd21bbf0b 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. +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) + } +} + +// 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() { + path.SetupClients() + + path.CreateConnections() +} + +// 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() + 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) + } +}