Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add coordinator Setup functions to the Path type #5397

Merged
merged 21 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,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 @@ -267,7 +267,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 @@ -368,7 +368,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 @@ -407,7 +407,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 @@ -452,7 +452,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 @@ -499,7 +499,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 @@ -545,7 +545,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 @@ -631,7 +631,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 @@ -726,7 +726,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 @@ -822,7 +822,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeInit() {
isNilApp = false

path = NewICAPath(suite.chainA, suite.chainB)
suite.coordinator.SetupConnections(path)
path.SetupConnections()

err := RegisterInterchainAccount(path.EndpointA, TestOwnerAddress)
suite.Require().NoError(err)
Expand Down Expand Up @@ -920,7 +920,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeAck() {
isNilApp = false

path = NewICAPath(suite.chainA, suite.chainB)
suite.coordinator.SetupConnections(path)
path.SetupConnections()

err := SetupICAPath(path, TestOwnerAddress)
suite.Require().NoError(err)
Expand Down Expand Up @@ -996,7 +996,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeOpen() {
isNilApp = false

path = NewICAPath(suite.chainA, suite.chainB)
suite.coordinator.SetupConnections(path)
path.SetupConnections()

err := SetupICAPath(path, TestOwnerAddress)
suite.Require().NoError(err)
Expand Down Expand Up @@ -1066,7 +1066,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeRestore() {
isNilApp = false

path = NewICAPath(suite.chainA, suite.chainB)
suite.coordinator.SetupConnections(path)
path.SetupConnections()

err := SetupICAPath(path, TestOwnerAddress)
suite.Require().NoError(err)
Expand Down Expand Up @@ -1116,14 +1116,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 @@ -1161,7 +1161,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 @@ -1180,7 +1180,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 @@ -1197,7 +1197,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 @@ -1214,7 +1214,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 @@ -1257,7 +1257,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 @@ -234,7 +234,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 @@ -392,7 +392,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 @@ -454,7 +454,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 @@ -547,7 +547,7 @@ func (suite *KeeperTestSuite) TestOnChanUpgradeInit() {
suite.SetupTest() // reset

path = NewICAPath(suite.chainA, suite.chainB)
suite.coordinator.SetupConnections(path)
path.SetupConnections()

err := SetupICAPath(path, TestOwnerAddress)
suite.Require().NoError(err)
Expand Down Expand Up @@ -686,7 +686,7 @@ func (suite *KeeperTestSuite) TestOnChanUpgradeAck() {
suite.SetupTest() // reset

path = NewICAPath(suite.chainA, suite.chainB)
suite.coordinator.SetupConnections(path)
path.SetupConnections()

err := SetupICAPath(path, TestOwnerAddress)
suite.Require().NoError(err)
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, "")

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
Loading