@@ -454,6 +454,13 @@ func TestStore_HistoricalDataBeforeSlot(t *testing.T) {
454
454
// Verify block does not exist
455
455
assert .Equal (t , false , db .HasBlock (ctx , root ))
456
456
457
+ // Verify block parent root does not exist
458
+ err = db .db .View (func (tx * bolt.Tx ) error {
459
+ require .Equal (t , 0 , len (tx .Bucket (blockParentRootIndicesBucket ).Get (root [:])))
460
+ return nil
461
+ })
462
+ require .NoError (t , err )
463
+
457
464
// Verify state is deleted
458
465
hasState := db .HasState (ctx , root )
459
466
assert .Equal (t , false , hasState )
@@ -491,6 +498,15 @@ func TestStore_HistoricalDataBeforeSlot(t *testing.T) {
491
498
// Verify block exists
492
499
assert .Equal (t , true , db .HasBlock (ctx , root ))
493
500
501
+ // Verify remaining block parent root exists, except last slot since we store parent roots of each block.
502
+ if i < slotsPerEpoch * 4 - 1 {
503
+ err = db .db .View (func (tx * bolt.Tx ) error {
504
+ require .NotNil (t , tx .Bucket (blockParentRootIndicesBucket ).Get (root [:]), fmt .Sprintf ("Expected block parent index to be deleted, slot: %d" , i ))
505
+ return nil
506
+ })
507
+ require .NoError (t , err )
508
+ }
509
+
494
510
// Verify state exists
495
511
hasState := db .HasState (ctx , root )
496
512
assert .Equal (t , true , hasState )
@@ -515,6 +531,12 @@ func TestStore_HistoricalDataBeforeSlot(t *testing.T) {
515
531
valsActual , err := db .validatorEntries (ctx , root )
516
532
require .NoError (t , err )
517
533
assert .NotNil (t , valsActual )
534
+
535
+ // Verify remaining validator hashes for block roots exists
536
+ err = db .db .View (func (tx * bolt.Tx ) error {
537
+ assert .NotNil (t , tx .Bucket (blockRootValidatorHashesBucket ).Get (root [:]))
538
+ return nil
539
+ })
518
540
}
519
541
}
520
542
0 commit comments