@@ -114,7 +114,7 @@ pub enum PruningError {
114
114
UnexpectedUnequalStateRoots ,
115
115
MissingSummaryForFinalizedCheckpoint ( Hash256 ) ,
116
116
MissingBlindedBlock ( Hash256 ) ,
117
- SummariesDagError ( SummariesDagError ) ,
117
+ SummariesDagError ( & ' static str , SummariesDagError ) ,
118
118
EmptyFinalizedStates ,
119
119
EmptyFinalizedBlocks ,
120
120
}
@@ -494,6 +494,7 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> BackgroundMigrator<E, Ho
494
494
. into_iter ( )
495
495
. map ( |( state_root, summary) | {
496
496
let block_root = summary. latest_block_root ;
497
+ // This error should never happen unless we break a DB invariant
497
498
let block = store
498
499
. get_blinded_block ( & block_root) ?
499
500
. ok_or ( PruningError :: MissingBlindedBlock ( block_root) ) ?;
@@ -541,7 +542,7 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> BackgroundMigrator<E, Ho
541
542
542
543
(
543
544
StateSummariesDAG :: new_from_v22 ( state_summaries)
544
- . map_err ( PruningError :: SummariesDagError ) ?,
545
+ . map_err ( |e| PruningError :: SummariesDagError ( "creating StateSumariesDAG" , e ) ) ?,
545
546
BlockSummariesDAG :: new ( & blocks) ,
546
547
)
547
548
} ;
@@ -565,7 +566,9 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> BackgroundMigrator<E, Ho
565
566
std:: iter:: once ( new_finalized_state_hash) . chain (
566
567
state_summaries_dag
567
568
. descendants_of ( & new_finalized_state_hash)
568
- . map_err ( PruningError :: SummariesDagError ) ?,
569
+ . map_err ( |e| {
570
+ PruningError :: SummariesDagError ( "state summaries descendants_of" , e)
571
+ } ) ?,
569
572
) ,
570
573
) ;
571
574
@@ -582,6 +585,7 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> BackgroundMigrator<E, Ho
582
585
// state_summaries_dag
583
586
let summary = state_summaries_dag. get ( state_root) . ok_or (
584
587
PruningError :: SummariesDagError (
588
+ "state summaries get summary" ,
585
589
SummariesDagError :: MissingStateSummary ( * state_root) ,
586
590
) ,
587
591
) ?;
@@ -593,7 +597,7 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> BackgroundMigrator<E, Ho
593
597
// Note: ancestors_of includes the finalized state root
594
598
let newly_finalized_state_summaries = state_summaries_dag
595
599
. ancestors_of ( new_finalized_state_hash)
596
- . map_err ( PruningError :: SummariesDagError ) ?;
600
+ . map_err ( |e| PruningError :: SummariesDagError ( "state summaries ancestors_of" , e ) ) ?;
597
601
let newly_finalized_state_roots = newly_finalized_state_summaries
598
602
. iter ( )
599
603
. map ( |( root, _) | * root)
@@ -607,7 +611,7 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> BackgroundMigrator<E, Ho
607
611
// Note: ancestors_of includes the finalized block
608
612
let newly_finalized_blocks = block_summaries_dag
609
613
. ancestors_of ( new_finalized_checkpoint. root )
610
- . map_err ( PruningError :: SummariesDagError ) ?;
614
+ . map_err ( |e| PruningError :: SummariesDagError ( "block summaries ancestors_of" , e ) ) ?;
611
615
let newly_finalized_block_roots = newly_finalized_blocks
612
616
. iter ( )
613
617
. map ( |( root, _) | * root)
0 commit comments