7
7
"github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"
8
8
host "github.com/cosmos/ibc-go/v7/modules/core/24-host"
9
9
"github.com/cosmos/ibc-go/v7/modules/core/exported"
10
- ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
11
10
ibctesting "github.com/cosmos/ibc-go/v7/testing"
12
11
)
13
12
@@ -132,38 +131,6 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
132
131
// retrieve client state of chainA to pass as counterpartyClient
133
132
counterpartyClient = suite .chainA .GetClientState (path .EndpointA .ClientID )
134
133
}, true },
135
- {"invalid counterparty client" , func () {
136
- err := path .EndpointA .ConnOpenInit ()
137
- suite .Require ().NoError (err )
138
-
139
- // retrieve client state of chainB to pass as counterpartyClient
140
- counterpartyClient = suite .chainA .GetClientState (path .EndpointA .ClientID )
141
-
142
- // Set an invalid client of chainA on chainB
143
- tmClient , ok := counterpartyClient .(* ibctm.ClientState )
144
- suite .Require ().True (ok )
145
- tmClient .ChainId = "wrongchainid"
146
-
147
- suite .chainA .App .GetIBCKeeper ().ClientKeeper .SetClientState (suite .chainA .GetContext (), path .EndpointA .ClientID , tmClient )
148
- }, false },
149
- {"consensus height >= latest height" , func () {
150
- err := path .EndpointA .ConnOpenInit ()
151
- suite .Require ().NoError (err )
152
-
153
- // retrieve client state of chainA to pass as counterpartyClient
154
- counterpartyClient = suite .chainA .GetClientState (path .EndpointA .ClientID )
155
-
156
- consensusHeight = clienttypes .GetSelfHeight (suite .chainB .GetContext ())
157
- }, false },
158
- {"self consensus state not found" , func () {
159
- err := path .EndpointA .ConnOpenInit ()
160
- suite .Require ().NoError (err )
161
-
162
- // retrieve client state of chainA to pass as counterpartyClient
163
- counterpartyClient = suite .chainA .GetClientState (path .EndpointA .ClientID )
164
-
165
- consensusHeight = clienttypes .NewHeight (0 , 1 )
166
- }, false },
167
134
{"counterparty versions is empty" , func () {
168
135
err := path .EndpointA .ConnOpenInit ()
169
136
suite .Require ().NoError (err )
@@ -189,35 +156,6 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
189
156
// retrieve client state of chainA to pass as counterpartyClient
190
157
counterpartyClient = suite .chainA .GetClientState (path .EndpointA .ClientID )
191
158
}, false },
192
- {"client state verification failed" , func () {
193
- err := path .EndpointA .ConnOpenInit ()
194
- suite .Require ().NoError (err )
195
-
196
- // retrieve client state of chainA to pass as counterpartyClient
197
- counterpartyClient = suite .chainA .GetClientState (path .EndpointA .ClientID )
198
-
199
- // modify counterparty client without setting in store so it still passes validate but fails proof verification
200
- tmClient , ok := counterpartyClient .(* ibctm.ClientState )
201
- suite .Require ().True (ok )
202
- tmClient .LatestHeight = tmClient .LatestHeight .Increment ().(clienttypes.Height )
203
- }, false },
204
- {"consensus state verification failed" , func () {
205
- // retrieve client state of chainA to pass as counterpartyClient
206
- counterpartyClient = suite .chainA .GetClientState (path .EndpointA .ClientID )
207
-
208
- // give chainA wrong consensus state for chainB
209
- consState , found := suite .chainA .App .GetIBCKeeper ().ClientKeeper .GetLatestClientConsensusState (suite .chainA .GetContext (), path .EndpointA .ClientID )
210
- suite .Require ().True (found )
211
-
212
- tmConsState , ok := consState .(* ibctm.ConsensusState )
213
- suite .Require ().True (ok )
214
-
215
- tmConsState .Timestamp = time .Now ()
216
- suite .chainA .App .GetIBCKeeper ().ClientKeeper .SetClientConsensusState (suite .chainA .GetContext (), path .EndpointA .ClientID , counterpartyClient .GetLatestHeight (), tmConsState )
217
-
218
- err := path .EndpointA .ConnOpenInit ()
219
- suite .Require ().NoError (err )
220
- }, false },
221
159
}
222
160
223
161
for _ , tc := range testCases {
@@ -295,35 +233,6 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
295
233
// retrieve client state of chainB to pass as counterpartyClient
296
234
counterpartyClient = suite .chainB .GetClientState (path .EndpointB .ClientID )
297
235
}, true },
298
- {"invalid counterparty client" , func () {
299
- err := path .EndpointA .ConnOpenInit ()
300
- suite .Require ().NoError (err )
301
-
302
- err = path .EndpointB .ConnOpenTry ()
303
- suite .Require ().NoError (err )
304
-
305
- // retrieve client state of chainB to pass as counterpartyClient
306
- counterpartyClient = suite .chainB .GetClientState (path .EndpointB .ClientID )
307
-
308
- // Set an invalid client of chainA on chainB
309
- tmClient , ok := counterpartyClient .(* ibctm.ClientState )
310
- suite .Require ().True (ok )
311
- tmClient .ChainId = "wrongchainid"
312
-
313
- suite .chainB .App .GetIBCKeeper ().ClientKeeper .SetClientState (suite .chainB .GetContext (), path .EndpointB .ClientID , tmClient )
314
- }, false },
315
- {"consensus height >= latest height" , func () {
316
- err := path .EndpointA .ConnOpenInit ()
317
- suite .Require ().NoError (err )
318
-
319
- // retrieve client state of chainB to pass as counterpartyClient
320
- counterpartyClient = suite .chainB .GetClientState (path .EndpointB .ClientID )
321
-
322
- err = path .EndpointB .ConnOpenTry ()
323
- suite .Require ().NoError (err )
324
-
325
- consensusHeight = clienttypes .GetSelfHeight (suite .chainA .GetContext ())
326
- }, false },
327
236
{"connection not found" , func () {
328
237
// connections are never created
329
238
@@ -334,9 +243,6 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
334
243
err := path .EndpointA .ConnOpenInit ()
335
244
suite .Require ().NoError (err )
336
245
337
- // retrieve client state of chainB to pass as counterpartyClient
338
- counterpartyClient = suite .chainB .GetClientState (path .EndpointB .ClientID )
339
-
340
246
err = path .EndpointB .ConnOpenTry ()
341
247
suite .Require ().NoError (err )
342
248
@@ -345,6 +251,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
345
251
suite .Require ().True (found )
346
252
347
253
connection .Counterparty .ConnectionId = "badconnectionid"
254
+ path .EndpointB .ConnectionID = "badconnectionid"
348
255
349
256
suite .chainA .App .GetIBCKeeper ().ConnectionKeeper .SetConnection (suite .chainA .GetContext (), path .EndpointA .ConnectionID , connection )
350
257
@@ -418,18 +325,6 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
418
325
419
326
version = types .NewVersion (types .DefaultIBCVersionIdentifier , []string {"ORDER_ORDERED" , "ORDER_UNORDERED" , "ORDER_DAG" })
420
327
}, false },
421
- {"self consensus state not found" , func () {
422
- err := path .EndpointA .ConnOpenInit ()
423
- suite .Require ().NoError (err )
424
-
425
- // retrieve client state of chainB to pass as counterpartyClient
426
- counterpartyClient = suite .chainB .GetClientState (path .EndpointB .ClientID )
427
-
428
- err = path .EndpointB .ConnOpenTry ()
429
- suite .Require ().NoError (err )
430
-
431
- consensusHeight = clienttypes .NewHeight (0 , 1 )
432
- }, false },
433
328
{"connection state verification failed" , func () {
434
329
// chainB connection is not in INIT
435
330
err := path .EndpointA .ConnOpenInit ()
@@ -438,41 +333,6 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
438
333
// retrieve client state of chainB to pass as counterpartyClient
439
334
counterpartyClient = suite .chainB .GetClientState (path .EndpointB .ClientID )
440
335
}, false },
441
- {"client state verification failed" , func () {
442
- err := path .EndpointA .ConnOpenInit ()
443
- suite .Require ().NoError (err )
444
-
445
- // retrieve client state of chainB to pass as counterpartyClient
446
- counterpartyClient = suite .chainB .GetClientState (path .EndpointB .ClientID )
447
-
448
- // modify counterparty client without setting in store so it still passes validate but fails proof verification
449
- tmClient , ok := counterpartyClient .(* ibctm.ClientState )
450
- suite .Require ().True (ok )
451
- tmClient .LatestHeight = tmClient .LatestHeight .Increment ().(clienttypes.Height )
452
-
453
- err = path .EndpointB .ConnOpenTry ()
454
- suite .Require ().NoError (err )
455
- }, false },
456
- {"consensus state verification failed" , func () {
457
- err := path .EndpointA .ConnOpenInit ()
458
- suite .Require ().NoError (err )
459
-
460
- // retrieve client state of chainB to pass as counterpartyClient
461
- counterpartyClient = suite .chainB .GetClientState (path .EndpointB .ClientID )
462
-
463
- // give chainB wrong consensus state for chainA
464
- consState , found := suite .chainB .App .GetIBCKeeper ().ClientKeeper .GetLatestClientConsensusState (suite .chainB .GetContext (), path .EndpointB .ClientID )
465
- suite .Require ().True (found )
466
-
467
- tmConsState , ok := consState .(* ibctm.ConsensusState )
468
- suite .Require ().True (ok )
469
-
470
- tmConsState .Timestamp = tmConsState .Timestamp .Add (time .Second )
471
- suite .chainB .App .GetIBCKeeper ().ClientKeeper .SetClientConsensusState (suite .chainB .GetContext (), path .EndpointB .ClientID , counterpartyClient .GetLatestHeight (), tmConsState )
472
-
473
- err = path .EndpointB .ConnOpenTry ()
474
- suite .Require ().NoError (err )
475
- }, false },
476
336
}
477
337
478
338
for _ , tc := range testCases {
0 commit comments