@@ -176,11 +176,15 @@ func (suite *SoloMachineTestSuite) TestVerifyMembership() {
176
176
suite .Require ().NoError (err )
177
177
178
178
path = suite .solomachine .GetClientStatePath (counterpartyClientIdentifier )
179
+ merklePath , ok := path .(commitmenttypes.MerklePath )
180
+ suite .Require ().True (ok )
181
+ key , err := merklePath .GetKey (1 ) // in a multistore context: index 0 is the key for the IBC store in the multistore, index 1 is the key in the IBC store
182
+ suite .Require ().NoError (err )
179
183
signBytes = solomachine.SignBytes {
180
184
Sequence : sm .GetHeight ().GetRevisionHeight (),
181
185
Timestamp : sm .Time ,
182
186
Diversifier : sm .Diversifier ,
183
- Path : [] byte ( path . String ()) ,
187
+ Path : key ,
184
188
Data : clientStateBz ,
185
189
}
186
190
@@ -208,11 +212,15 @@ func (suite *SoloMachineTestSuite) TestVerifyMembership() {
208
212
suite .Require ().NoError (err )
209
213
210
214
path = sm .GetConsensusStatePath (counterpartyClientIdentifier , clienttypes .NewHeight (0 , 1 ))
215
+ merklePath , ok := path .(commitmenttypes.MerklePath )
216
+ suite .Require ().True (ok )
217
+ key , err := merklePath .GetKey (1 ) // in a multistore context: index 0 is the key for the IBC store in the multistore, index 1 is the key in the IBC store
218
+ suite .Require ().NoError (err )
211
219
signBytes = solomachine.SignBytes {
212
220
Sequence : sm .Sequence ,
213
221
Timestamp : sm .Time ,
214
222
Diversifier : sm .Diversifier ,
215
- Path : [] byte ( path . String ()) ,
223
+ Path : key ,
216
224
Data : consensusStateBz ,
217
225
}
218
226
@@ -243,11 +251,15 @@ func (suite *SoloMachineTestSuite) TestVerifyMembership() {
243
251
suite .Require ().NoError (err )
244
252
245
253
path = sm .GetConnectionStatePath (ibctesting .FirstConnectionID )
254
+ merklePath , ok := path .(commitmenttypes.MerklePath )
255
+ suite .Require ().True (ok )
256
+ key , err := merklePath .GetKey (1 ) // in a multistore context: index 0 is the key for the IBC store in the multistore, index 1 is the key in the IBC store
257
+ suite .Require ().NoError (err )
246
258
signBytes = solomachine.SignBytes {
247
259
Sequence : sm .Sequence ,
248
260
Timestamp : sm .Time ,
249
261
Diversifier : sm .Diversifier ,
250
- Path : [] byte ( path . String ()) ,
262
+ Path : key ,
251
263
Data : connectionEndBz ,
252
264
}
253
265
@@ -279,11 +291,15 @@ func (suite *SoloMachineTestSuite) TestVerifyMembership() {
279
291
suite .Require ().NoError (err )
280
292
281
293
path = sm .GetChannelStatePath (ibctesting .MockPort , ibctesting .FirstChannelID )
294
+ merklePath , ok := path .(commitmenttypes.MerklePath )
295
+ suite .Require ().True (ok )
296
+ key , err := merklePath .GetKey (1 ) // in a multistore context: index 0 is the key for the IBC store in the multistore, index 1 is the key in the IBC store
297
+ suite .Require ().NoError (err )
282
298
signBytes = solomachine.SignBytes {
283
299
Sequence : sm .Sequence ,
284
300
Timestamp : sm .Time ,
285
301
Diversifier : sm .Diversifier ,
286
- Path : [] byte ( path . String ()) ,
302
+ Path : key ,
287
303
Data : channelEndBz ,
288
304
}
289
305
@@ -312,11 +328,15 @@ func (suite *SoloMachineTestSuite) TestVerifyMembership() {
312
328
suite .Require ().True (found )
313
329
314
330
path = sm .GetNextSequenceRecvPath (ibctesting .MockPort , ibctesting .FirstChannelID )
331
+ merklePath , ok := path .(commitmenttypes.MerklePath )
332
+ suite .Require ().True (ok )
333
+ key , err := merklePath .GetKey (1 ) // in a multistore context: index 0 is the key for the IBC store in the multistore, index 1 is the key in the IBC store
334
+ suite .Require ().NoError (err )
315
335
signBytes = solomachine.SignBytes {
316
336
Sequence : sm .Sequence ,
317
337
Timestamp : sm .Time ,
318
338
Diversifier : sm .Diversifier ,
319
- Path : [] byte ( path . String ()) ,
339
+ Path : key ,
320
340
Data : sdk .Uint64ToBigEndian (nextSeqRecv ),
321
341
}
322
342
@@ -351,11 +371,15 @@ func (suite *SoloMachineTestSuite) TestVerifyMembership() {
351
371
352
372
commitmentBz := channeltypes .CommitPacket (suite .chainA .Codec , packet )
353
373
path = sm .GetPacketCommitmentPath (packet .GetSourcePort (), packet .GetSourceChannel (), packet .GetSequence ())
374
+ merklePath , ok := path .(commitmenttypes.MerklePath )
375
+ suite .Require ().True (ok )
376
+ key , err := merklePath .GetKey (1 ) // in a multistore context: index 0 is the key for the IBC store in the multistore, index 1 is the key in the IBC store
377
+ suite .Require ().NoError (err )
354
378
signBytes = solomachine.SignBytes {
355
379
Sequence : sm .Sequence ,
356
380
Timestamp : sm .Time ,
357
381
Diversifier : sm .Diversifier ,
358
- Path : [] byte ( path . String ()) ,
382
+ Path : key ,
359
383
Data : commitmentBz ,
360
384
}
361
385
@@ -378,11 +402,15 @@ func (suite *SoloMachineTestSuite) TestVerifyMembership() {
378
402
"success: packet acknowledgement verification" ,
379
403
func () {
380
404
path = sm .GetPacketAcknowledgementPath (ibctesting .MockPort , ibctesting .FirstChannelID , 1 )
405
+ merklePath , ok := path .(commitmenttypes.MerklePath )
406
+ suite .Require ().True (ok )
407
+ key , err := merklePath .GetKey (1 ) // index 0 is the key for the IBC store in the multistore, index 1 is the key in the IBC store
408
+ suite .Require ().NoError (err )
381
409
signBytes = solomachine.SignBytes {
382
410
Sequence : sm .Sequence ,
383
411
Timestamp : sm .Time ,
384
412
Diversifier : sm .Diversifier ,
385
- Path : [] byte ( path . String ()) ,
413
+ Path : key ,
386
414
Data : ibctesting .MockAcknowledgement ,
387
415
}
388
416
@@ -405,11 +433,15 @@ func (suite *SoloMachineTestSuite) TestVerifyMembership() {
405
433
"success: packet receipt verification" ,
406
434
func () {
407
435
path = sm .GetPacketReceiptPath (ibctesting .MockPort , ibctesting .FirstChannelID , 1 )
436
+ merklePath , ok := path .(commitmenttypes.MerklePath )
437
+ suite .Require ().True (ok )
438
+ key , err := merklePath .GetKey (1 ) // in a multistore context: index 0 is the key for the IBC store in the multistore, index 1 is the key in the IBC store
439
+ suite .Require ().NoError (err )
408
440
signBytes = solomachine.SignBytes {
409
441
Sequence : sm .Sequence ,
410
442
Timestamp : sm .Time ,
411
443
Diversifier : sm .Diversifier ,
412
- Path : [] byte ( path . String ()) ,
444
+ Path : key ,
413
445
Data : []byte {byte (1 )}, // packet receipt is stored as a single byte
414
446
}
415
447
@@ -429,7 +461,7 @@ func (suite *SoloMachineTestSuite) TestVerifyMembership() {
429
461
true ,
430
462
},
431
463
{
432
- "invalid path type" ,
464
+ "invalid path type - empty " ,
433
465
func () {
434
466
path = ibcmock.KeyPath {}
435
467
},
@@ -521,11 +553,15 @@ func (suite *SoloMachineTestSuite) TestVerifyMembership() {
521
553
clientState = sm .ClientState ()
522
554
523
555
path = commitmenttypes .NewMerklePath ("ibc" , "solomachine" )
556
+ merklePath , ok := path .(commitmenttypes.MerklePath )
557
+ suite .Require ().True (ok )
558
+ key , err := merklePath .GetKey (1 ) // in a multistore context: index 0 is the key for the IBC store in the multistore, index 1 is the key in the IBC store
559
+ suite .Require ().NoError (err )
524
560
signBytes = solomachine.SignBytes {
525
561
Sequence : sm .GetHeight ().GetRevisionHeight (),
526
562
Timestamp : sm .Time ,
527
563
Diversifier : sm .Diversifier ,
528
- Path : [] byte ( path . String ()) ,
564
+ Path : key ,
529
565
Data : []byte ("solomachine" ),
530
566
}
531
567
@@ -570,19 +606,21 @@ func (suite *SoloMachineTestSuite) TestVerifyMembership() {
570
606
func (suite * SoloMachineTestSuite ) TestSignBytesMarshalling () {
571
607
sm := suite .solomachine
572
608
merklePath := commitmenttypes .NewMerklePath ("ibc" , "solomachine" )
609
+ key , err := merklePath .GetKey (1 ) // in a multistore context: index 0 is the key for the IBC store in the multistore, index 1 is the key in the IBC store
610
+ suite .Require ().NoError (err )
573
611
signBytesNilData := solomachine.SignBytes {
574
612
Sequence : sm .GetHeight ().GetRevisionHeight (),
575
613
Timestamp : sm .Time ,
576
614
Diversifier : sm .Diversifier ,
577
- Path : [] byte ( merklePath . String ()) ,
615
+ Path : key ,
578
616
Data : nil ,
579
617
}
580
618
581
619
signBytesEmptyArray := solomachine.SignBytes {
582
620
Sequence : sm .GetHeight ().GetRevisionHeight (),
583
621
Timestamp : sm .Time ,
584
622
Diversifier : sm .Diversifier ,
585
- Path : [] byte ( merklePath . String ()) ,
623
+ Path : key ,
586
624
Data : []byte {},
587
625
}
588
626
@@ -621,11 +659,15 @@ func (suite *SoloMachineTestSuite) TestVerifyNonMembership() {
621
659
"success: packet receipt absence verification" ,
622
660
func () {
623
661
path = suite .solomachine .GetPacketReceiptPath (ibctesting .MockPort , ibctesting .FirstChannelID , 1 )
662
+ merklePath , ok := path .(commitmenttypes.MerklePath )
663
+ suite .Require ().True (ok )
664
+ key , err := merklePath .GetKey (1 ) // in a multistore context: index 0 is the key for the IBC store in the multistore, index 1 is the key in the IBC store
665
+ suite .Require ().NoError (err )
624
666
signBytes = solomachine.SignBytes {
625
667
Sequence : sm .GetHeight ().GetRevisionHeight (),
626
668
Timestamp : sm .Time ,
627
669
Diversifier : sm .Diversifier ,
628
- Path : [] byte ( path . String ()) ,
670
+ Path : key ,
629
671
Data : nil ,
630
672
}
631
673
@@ -740,11 +782,15 @@ func (suite *SoloMachineTestSuite) TestVerifyNonMembership() {
740
782
clientState = sm .ClientState ()
741
783
742
784
path = commitmenttypes .NewMerklePath ("ibc" , "solomachine" )
785
+ merklePath , ok := path .(commitmenttypes.MerklePath )
786
+ suite .Require ().True (ok )
787
+ key , err := merklePath .GetKey (1 ) // in a multistore context: index 0 is the key for the IBC store in the multistore, index 1 is the key in the IBC store
788
+ suite .Require ().NoError (err )
743
789
signBytes = solomachine.SignBytes {
744
790
Sequence : sm .GetHeight ().GetRevisionHeight (),
745
791
Timestamp : sm .Time ,
746
792
Diversifier : sm .Diversifier ,
747
- Path : [] byte ( path . String ()) ,
793
+ Path : key ,
748
794
Data : nil ,
749
795
}
750
796
0 commit comments