Skip to content

Commit

Permalink
Remove leftover crossing hello tests in connection handshake (#1724) (#…
Browse files Browse the repository at this point in the history
…1729)

* remove leftover crossing hello tests in connection handshake

* fix bug in tests

(cherry picked from commit c809ce3)

Co-authored-by: Aditya <adityasripal@gmail.com>
  • Loading branch information
mergify[bot] and AdityaSripal committed Jul 19, 2022
1 parent e9648d0 commit bc403c2
Showing 1 changed file with 3 additions and 41 deletions.
44 changes: 3 additions & 41 deletions modules/core/03-connection/keeper/handshake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,54 +203,16 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
err := path.EndpointA.ConnOpenInit()
suite.Require().NoError(err)
}, false},
{"invalid previous connection is in TRYOPEN", func() {
// open init chainA
err := path.EndpointA.ConnOpenInit()
suite.Require().NoError(err)

// open try chainB
err = path.EndpointB.ConnOpenTry()
suite.Require().NoError(err)

err = path.EndpointB.UpdateClient()
suite.Require().NoError(err)

// retrieve client state of chainA to pass as counterpartyClient
counterpartyClient = suite.chainA.GetClientState(path.EndpointA.ClientID)
}, false},
{"invalid previous connection has invalid versions", func() {
// open init chainA
err := path.EndpointA.ConnOpenInit()
suite.Require().NoError(err)

// open try chainB
err = path.EndpointB.ConnOpenTry()
suite.Require().NoError(err)

// modify connB to be in INIT with incorrect versions
connection, found := suite.chainB.App.GetIBCKeeper().ConnectionKeeper.GetConnection(suite.chainB.GetContext(), path.EndpointB.ConnectionID)
suite.Require().True(found)

connection.State = types.INIT
connection.Versions = []*types.Version{{}}

suite.chainB.App.GetIBCKeeper().ConnectionKeeper.SetConnection(suite.chainB.GetContext(), path.EndpointB.ConnectionID, connection)

err = path.EndpointB.UpdateClient()
suite.Require().NoError(err)

// retrieve client state of chainA to pass as counterpartyClient
counterpartyClient = suite.chainA.GetClientState(path.EndpointA.ClientID)
}, false},
}

for _, tc := range testCases {
tc := tc

suite.Run(tc.msg, func() {
suite.SetupTest() // reset
consensusHeight = clienttypes.ZeroHeight() // must be explicitly changed in malleate
versions = types.GetCompatibleVersions() // must be explicitly changed in malleate
consensusHeight = clienttypes.ZeroHeight() // may be changed in malleate
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)

Expand Down

0 comments on commit bc403c2

Please sign in to comment.