Skip to content

Commit

Permalink
fix(forks): update sync b/w ghost and blockstore
Browse files Browse the repository at this point in the history
  • Loading branch information
lidatong committed Jan 8, 2025
1 parent 6fe5c25 commit f4c8fc5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/app/fdctl/run/tiles/fd_replay.c
Original file line number Diff line number Diff line change
Expand Up @@ -1856,7 +1856,7 @@ during_housekeeping( void * _ctx ) {
ulong wmk = fd_ulong_min( ctx->tower->root , ctx->blockstore->smr );
fd_blockstore_end_read( ctx->blockstore );

if ( FD_LIKELY( wmk <= fd_fseq_query( ctx->wmk ) ) ) return;
if( FD_LIKELY( wmk <= fd_fseq_query( ctx->wmk ) ) ) return;
FD_LOG_NOTICE(( "wmk %lu => %lu", fd_fseq_query( ctx->wmk ), wmk ));

fd_blockstore_start_read( ctx->blockstore );
Expand Down
15 changes: 11 additions & 4 deletions src/choreo/forks/fd_forks.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,16 @@ fd_forks_update( fd_forks_t * forks,

ulong root = fd_voter_state_root( state );

/* Check if this voter's root >= ghost root. We can't process
other voters' roots that precede the ghost root. */
/* Only process if voter's root > blockstore->smr because if the
root <= blockstore->smr it is by definition already finalized
(finalizing a slot also finalizes its entire ancestry).
if( FD_UNLIKELY( root >= fd_ghost_root( ghost )->slot ) ) {
Also it is possible the ghost root is lagging the supermajority
root because our tower has fallen behind the rest of the cluster.
So this prevents any issues with differences in slot retention
between ghost and blockstore. */

if( FD_UNLIKELY( root > fd_ghost_root( ghost )->slot && root > blockstore->smr ) ) {
fd_ghost_node_t const * node = fd_ghost_query( ghost, root );
if( FD_UNLIKELY( !node ) ) {

Expand All @@ -404,7 +410,8 @@ fd_forks_update( fd_forks_t * forks,

fd_ghost_rooted_vote( ghost, voter, root );

/* Check if it has crossed finalized threshold. */
/* Check if it has crossed the supermajority threshold (and can be
marked finalized in the blockstore). */

fd_blockstore_start_write( blockstore );
fd_block_map_t * block_map_entry = fd_blockstore_block_map_query( blockstore, root );
Expand Down

0 comments on commit f4c8fc5

Please sign in to comment.