Skip to content

Commit

Permalink
fd_shred: Abandon microblocks from abandoned block instead of crashing
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaffet-jump committed Dec 11, 2023
1 parent 03a212b commit c97fe9e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/app/fdctl/run/tiles/fd_shred.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,19 @@ during_frag( void * _ctx,
/* It should never be possible for this to fail, but we check it
anyway. */
FD_TEST( entry_sz + ctx->pending_batch.pos <= sizeof(ctx->pending_batch.payload) );
FD_TEST( (ctx->pending_batch.microblock_cnt==0) | (ctx->pending_batch.slot==entry_meta->slot) );

if( FD_UNLIKELY( (ctx->pending_batch.microblock_cnt>0) & (ctx->pending_batch.slot!=entry_meta->slot) ) ) {
/* TODO: The Labs client sends a dummy entry batch with only 1
byte and the block-complete bit set. This helps other
validators know that the block is dead and they should not try
to continue building a fork on it. We probably want a similar
approach eventually. */
FD_LOG_WARNING(( "Abandoning %lu microblocks for slot %lu and switching to slot %lu",
ctx->pending_batch.microblock_cnt, ctx->pending_batch.slot, entry_meta->slot ));
ctx->pending_batch.slot = 0UL;
ctx->pending_batch.pos = 0UL;
ctx->pending_batch.microblock_cnt = 0UL;
}

ctx->pending_batch.slot = entry_meta->slot;
/* Ugh, yet another memcpy */
Expand Down

0 comments on commit c97fe9e

Please sign in to comment.