Skip to content

Commit

Permalink
Add coordinator Setup functions to the Path type (#5397)
Browse files Browse the repository at this point in the history
* 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 <carlos@interchain.io>
Co-authored-by: Cian Hatton <cian@interchain.io>
Co-authored-by: Colin Axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com>
  • Loading branch information
5 people authored Jan 24, 2024
1 parent b8c5f58 commit 01e6c7c
Show file tree
Hide file tree
Showing 73 changed files with 625 additions and 561 deletions.
5 changes: 5 additions & 0 deletions docs/docs/05-migrations/13-v8-to-v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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())
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading

0 comments on commit 01e6c7c

Please sign in to comment.