@@ -200,6 +200,8 @@ func (m *processor) aggregateFastSyncTables(ctx context.Context) error {
200200 m .logger .Info ("computing epoch boundaries for epochs scanned during fast-sync" )
201201 batch .Queue (queries .ConsensusEpochsRecompute )
202202 batch .Queue ("DELETE FROM todo_updates.epochs" )
203+ batch .Queue (queries .ConsensusBlockSignersFinalize )
204+ batch .Queue ("DELETE FROM todo_updates.block_signers" )
203205
204206 if err := m .target .SendBatch (ctx , batch ); err != nil {
205207 return err
@@ -455,11 +457,24 @@ func (m *processor) queueBlockInserts(batch *storage.QueryBatch, data *consensus
455457 }
456458 prevSigners = append (prevSigners , entity .String ())
457459 }
458- batch .Queue (
459- queries .ConsensusBlockAddSigners ,
460- cmtMeta .LastCommit .Height ,
461- prevSigners ,
462- )
460+ switch m .mode {
461+ case analyzer .FastSyncMode :
462+ // During fast-sync, blocks are processed out of order, meaning the parent block may not yet be available.
463+ // To avoid missing dependencies, signers are stored in a temporary table.
464+ // These entries will be finalized during the fast-sync completion phase.
465+ batch .Queue (
466+ queries .ConsensusBlockAddSignersFastSync ,
467+ cmtMeta .LastCommit .Height ,
468+ prevSigners ,
469+ )
470+
471+ case analyzer .SlowSyncMode :
472+ batch .Queue (
473+ queries .ConsensusBlockAddSigners ,
474+ cmtMeta .LastCommit .Height ,
475+ prevSigners ,
476+ )
477+ }
463478 }
464479
465480 return nil
0 commit comments