@@ -44,7 +44,7 @@ func TestFinalize_Direct1Chain(t *testing.T) {
44
44
Add (1 , 2 ).
45
45
Add (2 , 3 )
46
46
blocks , err := builder .Blocks ()
47
- require .Nil (t , err )
47
+ require .NoError (t , err )
48
48
49
49
t .Run ("consensus participant mode: ingest validated blocks" , func (t * testing.T ) {
50
50
forks , _ := newForks (t )
@@ -88,7 +88,7 @@ func TestFinalize_Direct2Chain(t *testing.T) {
88
88
Add (2 , 3 ).
89
89
Add (3 , 4 ).
90
90
Blocks ()
91
- require .Nil (t , err )
91
+ require .NoError (t , err )
92
92
expectedFinalityProof := makeFinalityProof (t , blocks [0 ], blocks [1 ], blocks [2 ].QC )
93
93
94
94
t .Run ("consensus participant mode: ingest validated blocks" , func (t * testing.T ) {
@@ -117,7 +117,7 @@ func TestFinalize_DirectIndirect2Chain(t *testing.T) {
117
117
Add (2 , 3 ).
118
118
Add (3 , 5 ).
119
119
Blocks ()
120
- require .Nil (t , err )
120
+ require .NoError (t , err )
121
121
expectedFinalityProof := makeFinalityProof (t , blocks [0 ], blocks [1 ], blocks [2 ].QC )
122
122
123
123
t .Run ("consensus participant mode: ingest validated blocks" , func (t * testing.T ) {
@@ -146,7 +146,7 @@ func TestFinalize_IndirectDirect2Chain(t *testing.T) {
146
146
Add (3 , 5 ).
147
147
Add (5 , 7 ).
148
148
Blocks ()
149
- require .Nil (t , err )
149
+ require .NoError (t , err )
150
150
151
151
t .Run ("consensus participant mode: ingest validated blocks" , func (t * testing.T ) {
152
152
forks , _ := newForks (t )
@@ -178,7 +178,7 @@ func TestFinalize_Direct2ChainOnIndirect(t *testing.T) {
178
178
Add (6 , 7 ).
179
179
Add (7 , 8 ).
180
180
Blocks ()
181
- require .Nil (t , err )
181
+ require .NoError (t , err )
182
182
expectedFinalityProof := makeFinalityProof (t , blocks [2 ], blocks [3 ], blocks [4 ].QC )
183
183
184
184
t .Run ("consensus participant mode: ingest validated blocks" , func (t * testing.T ) {
@@ -209,7 +209,7 @@ func TestFinalize_Direct2ChainOnDirect(t *testing.T) {
209
209
Add (4 , 5 ).
210
210
Add (5 , 6 ).
211
211
Blocks ()
212
- require .Nil (t , err )
212
+ require .NoError (t , err )
213
213
expectedFinalityProof := makeFinalityProof (t , blocks [2 ], blocks [3 ], blocks [4 ].QC )
214
214
215
215
t .Run ("consensus participant mode: ingest validated blocks" , func (t * testing.T ) {
@@ -240,7 +240,7 @@ func TestFinalize_Multiple2Chains(t *testing.T) {
240
240
Add (3 , 6 ).
241
241
Add (3 , 7 ).
242
242
Blocks ()
243
- require .Nil (t , err )
243
+ require .NoError (t , err )
244
244
expectedFinalityProof := makeFinalityProof (t , blocks [0 ], blocks [1 ], blocks [2 ].QC )
245
245
246
246
t .Run ("consensus participant mode: ingest validated blocks" , func (t * testing.T ) {
@@ -275,7 +275,7 @@ func TestFinalize_OrphanedFork(t *testing.T) {
275
275
Add (4 , 5 ). // [◄(4) 5]
276
276
Add (5 , 6 ). // [◄(5) 6]
277
277
Blocks ()
278
- require .Nil (t , err )
278
+ require .NoError (t , err )
279
279
expectedFinalityProof := makeFinalityProof (t , blocks [2 ], blocks [3 ], blocks [4 ].QC )
280
280
281
281
t .Run ("consensus participant mode: ingest validated blocks" , func (t * testing.T ) {
@@ -311,7 +311,7 @@ func TestDuplication(t *testing.T) {
311
311
Add (4 , 5 ).
312
312
Add (4 , 5 ).
313
313
Blocks ()
314
- require .Nil (t , err )
314
+ require .NoError (t , err )
315
315
expectedFinalityProof := makeFinalityProof (t , blocks [1 ], blocks [3 ], blocks [5 ].QC )
316
316
317
317
t .Run ("consensus participant mode: ingest validated blocks" , func (t * testing.T ) {
@@ -341,7 +341,7 @@ func TestIgnoreBlocksBelowFinalizedView(t *testing.T) {
341
341
Add (3 , 4 ). // [◄(3) 4]
342
342
Add (1 , 5 ) // [◄(1) 5]
343
343
blocks , err := builder .Blocks ()
344
- require .Nil (t , err )
344
+ require .NoError (t , err )
345
345
expectedFinalityProof := makeFinalityProof (t , blocks [0 ], blocks [1 ], blocks [2 ].QC )
346
346
347
347
t .Run ("consensus participant mode: ingest validated blocks" , func (t * testing.T ) {
@@ -401,24 +401,24 @@ func TestDoubleProposal(t *testing.T) {
401
401
Add (1 , 2 ). // [◄(1) 2]
402
402
AddVersioned (1 , 2 , 0 , 1 ). // [◄(1) 2']
403
403
Blocks ()
404
- require .Nil (t , err )
404
+ require .NoError (t , err )
405
405
406
406
t .Run ("consensus participant mode: ingest validated blocks" , func (t * testing.T ) {
407
407
forks , notifier := newForks (t )
408
408
notifier .On ("OnDoubleProposeDetected" , blocks [1 ], blocks [0 ]).Once ()
409
409
410
410
err = addValidatedBlockToForks (forks , blocks )
411
- require .Nil (t , err )
411
+ require .NoError (t , err )
412
412
})
413
413
414
414
t .Run ("consensus follower mode: ingest certified blocks" , func (t * testing.T ) {
415
415
forks , notifier := newForks (t )
416
416
notifier .On ("OnDoubleProposeDetected" , blocks [1 ], blocks [0 ]).Once ()
417
417
418
418
err = forks .AddCertifiedBlock (toCertifiedBlock (t , blocks [0 ])) // add [◄(1) 2] as certified block
419
- require .Nil (t , err )
419
+ require .NoError (t , err )
420
420
err = forks .AddCertifiedBlock (toCertifiedBlock (t , blocks [1 ])) // add [◄(1) 2'] as certified block
421
- require .Nil (t , err )
421
+ require .NoError (t , err )
422
422
})
423
423
}
424
424
@@ -438,7 +438,7 @@ func TestConflictingQCs(t *testing.T) {
438
438
Add (4 , 6 ). // [◄(4) 6]
439
439
AddVersioned (3 , 5 , 1 , 0 ). // [◄(3') 5]
440
440
Blocks ()
441
- require .Nil (t , err )
441
+ require .NoError (t , err )
442
442
443
443
t .Run ("consensus participant mode: ingest validated blocks" , func (t * testing.T ) {
444
444
forks , notifier := newForks (t )
@@ -477,7 +477,7 @@ func TestConflictingFinalizedForks(t *testing.T) {
477
477
Add (6 , 7 ).
478
478
Add (7 , 8 ). // finalizes [◄(2) 6], conflicting with conflicts with [◄(2) 3]
479
479
Blocks ()
480
- require .Nil (t , err )
480
+ require .NoError (t , err )
481
481
482
482
t .Run ("consensus participant mode: ingest validated blocks" , func (t * testing.T ) {
483
483
forks , _ := newForks (t )
@@ -502,7 +502,7 @@ func TestAddDisconnectedBlock(t *testing.T) {
502
502
Add (1 , 2 ). // we will skip this block [◄(1) 2]
503
503
Add (2 , 3 ). // [◄(2) 3]
504
504
Blocks ()
505
- require .Nil (t , err )
505
+ require .NoError (t , err )
506
506
507
507
t .Run ("consensus participant mode: ingest validated blocks" , func (t * testing.T ) {
508
508
forks , _ := newForks (t )
@@ -530,7 +530,7 @@ func TestGetBlock(t *testing.T) {
530
530
Add (3 , 4 ). // [◄(3) 4]
531
531
Add (4 , 5 ). // [◄(4) 5]
532
532
Blocks ()
533
- require .Nil (t , err )
533
+ require .NoError (t , err )
534
534
535
535
t .Run ("consensus participant mode: ingest validated blocks" , func (t * testing.T ) {
536
536
blocksAddedFirst := blocks [:3 ] // [◄(1) 2] [◄(2) 3] [◄(3) 4]
@@ -543,7 +543,7 @@ func TestGetBlock(t *testing.T) {
543
543
544
544
// add first 3 blocks - should finalize [◄(1) 2]
545
545
err = addValidatedBlockToForks (forks , blocksAddedFirst )
546
- require .Nil (t , err )
546
+ require .NoError (t , err )
547
547
548
548
// should be able to retrieve all stored blocks
549
549
for _ , block := range blocksAddedFirst {
@@ -581,9 +581,9 @@ func TestGetBlock(t *testing.T) {
581
581
582
582
// add first blocks - should finalize [◄(1) 2]
583
583
err := forks .AddCertifiedBlock (blocksAddedFirst [0 ])
584
- require .Nil (t , err )
584
+ require .NoError (t , err )
585
585
err = forks .AddCertifiedBlock (blocksAddedFirst [1 ])
586
- require .Nil (t , err )
586
+ require .NoError (t , err )
587
587
588
588
// should be able to retrieve all stored blocks
589
589
for _ , block := range blocksAddedFirst {
@@ -620,14 +620,14 @@ func TestGetBlocksForView(t *testing.T) {
620
620
Add (2 , 4 ). // [◄(2) 4]
621
621
AddVersioned (2 , 4 , 0 , 1 ). // [◄(2) 4']
622
622
Blocks ()
623
- require .Nil (t , err )
623
+ require .NoError (t , err )
624
624
625
625
t .Run ("consensus participant mode: ingest validated blocks" , func (t * testing.T ) {
626
626
forks , notifier := newForks (t )
627
627
notifier .On ("OnDoubleProposeDetected" , blocks [2 ], blocks [1 ]).Once ()
628
628
629
629
err = addValidatedBlockToForks (forks , blocks )
630
- require .Nil (t , err )
630
+ require .NoError (t , err )
631
631
632
632
// expect 1 block at view 2
633
633
storedBlocks := forks .GetBlocksForView (2 )
@@ -649,11 +649,11 @@ func TestGetBlocksForView(t *testing.T) {
649
649
notifier .On ("OnDoubleProposeDetected" , blocks [2 ], blocks [1 ]).Once ()
650
650
651
651
err := forks .AddCertifiedBlock (toCertifiedBlock (t , blocks [0 ]))
652
- require .Nil (t , err )
652
+ require .NoError (t , err )
653
653
err = forks .AddCertifiedBlock (toCertifiedBlock (t , blocks [1 ]))
654
- require .Nil (t , err )
654
+ require .NoError (t , err )
655
655
err = forks .AddCertifiedBlock (toCertifiedBlock (t , blocks [2 ]))
656
- require .Nil (t , err )
656
+ require .NoError (t , err )
657
657
658
658
// expect 1 block at view 2
659
659
storedBlocks := forks .GetBlocksForView (2 )
@@ -683,7 +683,7 @@ func TestNotifications(t *testing.T) {
683
683
Add (2 , 3 ).
684
684
Add (3 , 4 )
685
685
blocks , err := builder .Blocks ()
686
- require .Nil (t , err )
686
+ require .NoError (t , err )
687
687
688
688
t .Run ("consensus participant mode: ingest validated blocks" , func (t * testing.T ) {
689
689
notifier := & mocks.Consumer {}
@@ -736,7 +736,7 @@ func TestFinalizingMultipleBlocks(t *testing.T) {
736
736
Add (11 , 12 ). // index 4: [◄(11) 12]
737
737
Add (12 , 22 ) // index 5: [◄(12) 22]
738
738
blocks , err := builder .Blocks ()
739
- require .Nil (t , err )
739
+ require .NoError (t , err )
740
740
741
741
// The Finality Proof should right away point to the _latest_ finalized block. Subsequently emitting
742
742
// Finalization events for lower blocks is fine, because notifications are guaranteed to be
@@ -791,7 +791,7 @@ func TestFinalizingMultipleBlocks(t *testing.T) {
791
791
t .Run ("consensus participant mode: ingest validated blocks" , func (t * testing.T ) {
792
792
forks , finalizationCallback , notifier := setupForksAndAssertions ()
793
793
err = addValidatedBlockToForks (forks , blocks [:5 ]) // adding [◄(1) 2] [◄(2) 4] [◄(4) 6] [◄(6) 11] [◄(11) 12]
794
- require .Nil (t , err )
794
+ require .NoError (t , err )
795
795
requireOnlyGenesisBlockFinalized (t , forks ) // finalization should still be at the genesis block
796
796
797
797
require .NoError (t , forks .AddValidatedBlock (blocks [5 ])) // adding [◄(12) 22] should trigger finalization events
@@ -807,7 +807,7 @@ func TestFinalizingMultipleBlocks(t *testing.T) {
807
807
require .NoError (t , forks .AddCertifiedBlock (toCertifiedBlock (t , blocks [1 ])))
808
808
require .NoError (t , forks .AddCertifiedBlock (toCertifiedBlock (t , blocks [2 ])))
809
809
require .NoError (t , forks .AddCertifiedBlock (toCertifiedBlock (t , blocks [3 ])))
810
- require .Nil (t , err )
810
+ require .NoError (t , err )
811
811
requireOnlyGenesisBlockFinalized (t , forks ) // finalization should still be at the genesis block
812
812
813
813
// adding certified block [◄(11) 12] ◄(12) should trigger finalization events
@@ -831,7 +831,7 @@ func newForks(t *testing.T) (*Forks, *mocks.Consumer) {
831
831
832
832
forks , err := New (genesisBQ , finalizationCallback , notifier )
833
833
834
- require .Nil (t , err )
834
+ require .NoError (t , err )
835
835
return forks , notifier
836
836
}
837
837
@@ -914,7 +914,7 @@ func toCertifiedBlock(t *testing.T, block *model.Block) *model.CertifiedBlock {
914
914
BlockID : block .BlockID ,
915
915
}
916
916
cb , err := model .NewCertifiedBlock (block , qc )
917
- require .Nil (t , err )
917
+ require .NoError (t , err )
918
918
return & cb
919
919
}
920
920
0 commit comments