Skip to content

Commit d8a9974

Browse files
committed
replay: adding block_id to bank
1 parent d869963 commit d8a9974

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

src/app/firedancer/topology.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ fd_topo_initialize( config_t * config ) {
458458
fd_topob_tile_uses( topo, replay_tile, banks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
459459
FOR(exec_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "exec", i ) ], banks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
460460
FOR(writer_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "writer", i ) ], banks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
461+
fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "tower", 0 ) ], banks_obj, FD_SHMEM_JOIN_MODE_READ_ONLY );
461462
FD_TEST( fd_pod_insertf_ulong( topo->props, banks_obj->id, "banks" ) );
462463

463464
/* Setup a shared wksp object for bank hash cmp. */

src/discof/replay/fd_replay_tile.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,17 @@
7373
be replayed. The new Dispatcher will change this by taking a FEC
7474
set as input instead. */
7575

76+
typedef struct {
77+
ulong slot;
78+
fd_hash_t block_id; /* we in fact need to store multiple block ids, but can mempool later i guess */
79+
} bid_t;
80+
81+
#define MAP_NAME fd_bid_map
82+
#define MAP_T bid_t
83+
#define MAP_KEY slot
84+
#define MAP_MEMOIZE 0
85+
#include "../../util/tmpl/fd_map_dynamic.c"
86+
7687
/* An estimate of the max number of transactions in a block. If there are more
7788
transactions, they must be split into multiple sets. */
7889
#define MAX_TXNS_PER_REPLAY ( ( FD_SHRED_BLK_MAX * FD_SHRED_MAX_SZ) / FD_TXN_MIN_SERIALIZED_SZ )
@@ -1820,10 +1831,10 @@ unprivileged_init( fd_topo_t * topo,
18201831
for( ulong i = 0UL; i<FD_PACK_MAX_BANK_TILES; i++ ) {
18211832
ctx->bmtree[i] = FD_SCRATCH_ALLOC_APPEND( l, FD_BMTREE_COMMIT_ALIGN, FD_BMTREE_COMMIT_FOOTPRINT(0) );
18221833
}
1823-
void * slice_buf = FD_SCRATCH_ALLOC_APPEND( l, 128UL, FD_SLICE_MAX );
1824-
void * block_id_map_mem = FD_SCRATCH_ALLOC_APPEND( l, block_id_map_align(), block_id_map_footprint( fd_ulong_find_msb( fd_ulong_pow2_up( FD_BLOCK_MAX ) ) ) );
1825-
void * exec_slice_map_mem = FD_SCRATCH_ALLOC_APPEND( l, fd_exec_slice_map_align(), fd_exec_slice_map_footprint( 20 ) );
1826-
ulong scratch_alloc_mem = FD_SCRATCH_ALLOC_FINI ( l, scratch_align() );
1834+
void * slice_buf = FD_SCRATCH_ALLOC_APPEND( l, 128UL, FD_SLICE_MAX );
1835+
void * block_id_map_mem = FD_SCRATCH_ALLOC_APPEND( l, block_id_map_align(), block_id_map_footprint( fd_ulong_find_msb( fd_ulong_pow2_up( FD_BLOCK_MAX ) ) ) );
1836+
void * exec_slice_map_mem = FD_SCRATCH_ALLOC_APPEND( l, fd_exec_slice_map_align(), fd_exec_slice_map_footprint( 20 ) );
1837+
ulong scratch_alloc_mem = FD_SCRATCH_ALLOC_FINI ( l, scratch_align() );
18271838

18281839
if( FD_UNLIKELY( scratch_alloc_mem != ( (ulong)scratch + scratch_footprint( tile ) ) ) ) {
18291840
FD_LOG_ERR( ( "scratch_alloc_mem did not match scratch_footprint diff: %lu alloc: %lu footprint: %lu",
@@ -1999,6 +2010,8 @@ unprivileged_init( fd_topo_t * topo,
19992010

20002011
ctx->forks = fd_forks_join( fd_forks_new( forks_mem, FD_BLOCK_MAX, 42UL ) );
20012012

2013+
ctx->bid_map = fd_bid_map_join( fd_bid_map_new( bid_map_mem, 16 ) );
2014+
20022015
/**********************************************************************/
20032016
/* bank_hash_cmp */
20042017
/**********************************************************************/

src/flamenco/runtime/fd_bank.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ FD_PROTOTYPES_BEGIN
178178
X(ulong, parent_slot, sizeof(ulong), alignof(ulong), 0, 0, 0 ) /* Previous slot */ \
179179
X(fd_hash_t, bank_hash, sizeof(fd_hash_t), alignof(fd_hash_t), 0, 0, 0 ) /* Bank hash */ \
180180
X(fd_hash_t, prev_bank_hash, sizeof(fd_hash_t), alignof(fd_hash_t), 0, 0, 0 ) /* Previous bank hash */ \
181+
X(fd_hash_t, block_id, sizeof(fd_hash_t), alignof(fd_hash_t), 0, 0, 0 ) /* Block id, merkle root of the last FEC set */ \
181182
X(fd_hash_t, genesis_hash, sizeof(fd_hash_t), alignof(fd_hash_t), 0, 0, 0 ) /* Genesis hash */ \
182183
X(fd_epoch_schedule_t, epoch_schedule, sizeof(fd_epoch_schedule_t), alignof(fd_epoch_schedule_t), 0, 0, 0 ) /* Epoch schedule */ \
183184
X(fd_rent_t, rent, sizeof(fd_rent_t), alignof(fd_rent_t), 0, 0, 0 ) /* Rent */ \

0 commit comments

Comments
 (0)