@@ -291,6 +291,7 @@ struct fd_replay_tile_ctx {
291
291
ulong * poh ; /* proof-of-history slot */
292
292
uint poh_init_done ;
293
293
int snapshot_init_done ;
294
+ int startup_init_done ;
294
295
295
296
int tower_checkpt_fileno ;
296
297
@@ -1285,6 +1286,7 @@ publish_slot_notifications( fd_replay_tile_ctx_t * ctx,
1285
1286
FD_LOG_DEBUG (("TIMING: notify_slot_time - slot: %lu, elapsed: %6.6f ms" , curr_slot , (double )notify_time_ns * 1e-6 ));
1286
1287
1287
1288
if ( ctx -> replay_plugin_out_mem ) {
1289
+ /*
1288
1290
fd_replay_complete_msg_t msg2 = {
1289
1291
.slot = curr_slot,
1290
1292
.total_txn_count = fork->slot_ctx->txn_count,
@@ -1296,7 +1298,19 @@ publish_slot_notifications( fd_replay_tile_ctx_t * ctx,
1296
1298
.priority_fee = fork->slot_ctx->slot_bank.collected_priority_fees,
1297
1299
.parent_slot = ctx->parent_slot,
1298
1300
};
1299
- replay_plugin_publish ( ctx , stem , FD_PLUGIN_MSG_SLOT_COMPLETED , (uchar const * )& msg2 , sizeof (msg2 ) );
1301
+ */
1302
+ ulong msg [10 ];
1303
+ msg [ 0 ] = ctx -> curr_slot ;
1304
+ msg [ 1 ] = fork -> slot_ctx -> txn_count ;
1305
+ msg [ 2 ] = fork -> slot_ctx -> nonvote_txn_count ;
1306
+ msg [ 3 ] = fork -> slot_ctx -> failed_txn_count ;
1307
+ msg [ 4 ] = fork -> slot_ctx -> nonvote_failed_txn_count ;
1308
+ msg [ 5 ] = fork -> slot_ctx -> total_compute_units_used ;
1309
+ msg [ 6 ] = fork -> slot_ctx -> slot_bank .collected_execution_fees ;
1310
+ msg [ 7 ] = fork -> slot_ctx -> slot_bank .collected_priority_fees ;
1311
+ msg [ 8 ] = 0UL ; /* todo ... track tips */
1312
+ msg [ 9 ] = ctx -> parent_slot ;
1313
+ replay_plugin_publish ( ctx , stem , FD_PLUGIN_MSG_SLOT_COMPLETED , (uchar const * )msg , sizeof (msg ) );
1300
1314
}
1301
1315
}
1302
1316
@@ -1761,6 +1775,7 @@ exec_slice( fd_replay_tile_ctx_t * ctx,
1761
1775
1762
1776
ctx -> slice_exec_ctx .txns_rem -- ;
1763
1777
num_free_exec_tiles -- ;
1778
+ fork -> slot_ctx -> txn_count ++ ;
1764
1779
continue ;
1765
1780
}
1766
1781
@@ -2033,15 +2048,6 @@ read_snapshot( void * _ctx,
2033
2048
.para_arg_2 = stem ,
2034
2049
};
2035
2050
2036
- if ( ctx -> replay_plugin_out_mem ) {
2037
- // ValidatorStartProgress::DownloadingSnapshot
2038
- uchar msg [56 ];
2039
- fd_memset ( msg , 0 , sizeof (msg ) );
2040
- msg [0 ] = 2 ;
2041
- msg [1 ] = 1 ;
2042
- replay_plugin_publish ( ctx , stem , FD_PLUGIN_MSG_START_PROGRESS , msg , sizeof (msg ) );
2043
- }
2044
-
2045
2051
/* Pass the slot_ctx to snapshot_load or recover_banks */
2046
2052
/* Base slot is the slot we will compare against the base slot of the incremental snapshot, to ensure that the
2047
2053
base slot of the incremental snapshot is the slot of the full snapshot.
@@ -2130,17 +2136,6 @@ read_snapshot( void * _ctx,
2130
2136
fd_snapshot_load_fini ( snap_ctx );
2131
2137
}
2132
2138
2133
- /* Load incremental */
2134
-
2135
- if ( ctx -> replay_plugin_out_mem ) {
2136
- // ValidatorStartProgress::DownloadingSnapshot
2137
- uchar msg [56 ];
2138
- fd_memset ( msg , 0 , sizeof (msg ) );
2139
- msg [0 ] = 2 ;
2140
- msg [1 ] = 0 ;
2141
- replay_plugin_publish ( ctx , stem , FD_PLUGIN_MSG_START_PROGRESS , msg , sizeof (msg ) );
2142
- }
2143
-
2144
2139
if ( strlen ( incremental ) > 0 && strcmp ( snapshot , "funk" ) != 0 ) {
2145
2140
2146
2141
/* The slot of the full snapshot should be used as the base slot to verify the incremental snapshot,
@@ -2158,14 +2153,6 @@ read_snapshot( void * _ctx,
2158
2153
ctx -> runtime_spad );
2159
2154
}
2160
2155
2161
- if ( ctx -> replay_plugin_out_mem ) {
2162
- // ValidatorStartProgress::DownloadedFullSnapshot
2163
- uchar msg [56 ];
2164
- fd_memset ( msg , 0 , sizeof (msg ) );
2165
- msg [0 ] = 3 ;
2166
- replay_plugin_publish ( ctx , stem , FD_PLUGIN_MSG_START_PROGRESS , msg , sizeof (msg ) );
2167
- }
2168
-
2169
2156
fd_runtime_update_leaders ( ctx -> slot_ctx ,
2170
2157
ctx -> slot_ctx -> slot_bank .slot ,
2171
2158
ctx -> runtime_spad );
@@ -2325,6 +2312,13 @@ init_snapshot( fd_replay_tile_ctx_t * ctx,
2325
2312
read_snapshot ( ctx , stem , ctx -> snapshot , ctx -> incremental );
2326
2313
}
2327
2314
2315
+ if ( ctx -> replay_plugin_out_mem ) {
2316
+ uchar msg [56 ];
2317
+ fd_memset ( msg , 0 , sizeof (msg ) );
2318
+ msg [ 0 ] = 6 ;
2319
+ replay_plugin_publish ( ctx , stem , FD_PLUGIN_MSG_START_PROGRESS , msg , sizeof (msg ) );
2320
+ }
2321
+
2328
2322
fd_runtime_read_genesis ( ctx -> slot_ctx ,
2329
2323
ctx -> genesis ,
2330
2324
is_snapshot ,
@@ -2335,6 +2329,10 @@ init_snapshot( fd_replay_tile_ctx_t * ctx,
2335
2329
ctx -> epoch_ctx -> runtime_public = ctx -> runtime_public ;
2336
2330
init_after_snapshot ( ctx , stem );
2337
2331
2332
+ if ( ctx -> replay_plugin_out_mem && strlen ( ctx -> genesis ) > 0 ) {
2333
+ replay_plugin_publish ( ctx , stem , FD_PLUGIN_MSG_GENESIS_HASH_KNOWN , ctx -> epoch_ctx -> epoch_bank .genesis_hash .uc , sizeof (fd_hash_t ) );
2334
+ }
2335
+
2338
2336
/* Redirect ctx->slot_ctx to point to the memory inside forks. */
2339
2337
2340
2338
fd_fork_t * fork = fd_forks_query ( ctx -> forks , ctx -> curr_slot );
@@ -2387,31 +2385,51 @@ publish_votes_to_plugin( fd_replay_tile_ctx_t * ctx,
2387
2385
fd_vote_state_versioned_t * vsv = fd_vote_state_versioned_decode ( mem , & dec_ctx );
2388
2386
2389
2387
fd_pubkey_t node_pubkey ;
2390
- ulong last_ts_slot ;
2388
+ ulong commission ;
2389
+ ulong epoch_credits ;
2390
+ fd_vote_epoch_credits_t const * _epoch_credits ;
2391
+ ulong root_slot ;
2392
+
2391
2393
switch ( vsv -> discriminant ) {
2392
2394
case fd_vote_state_versioned_enum_v0_23_5 :
2393
- node_pubkey = vsv -> inner .v0_23_5 .node_pubkey ;
2394
- last_ts_slot = vsv -> inner .v0_23_5 .last_timestamp .slot ;
2395
+ node_pubkey = vsv -> inner .v0_23_5 .node_pubkey ;
2396
+ commission = vsv -> inner .v0_23_5 .commission ;
2397
+ _epoch_credits = deq_fd_vote_epoch_credits_t_peek_tail_const ( vsv -> inner .v0_23_5 .epoch_credits );
2398
+ epoch_credits = _epoch_credits -> credits - _epoch_credits -> prev_credits ;
2399
+ root_slot = vsv -> inner .v0_23_5 .root_slot ;
2395
2400
break ;
2396
2401
case fd_vote_state_versioned_enum_v1_14_11 :
2397
- node_pubkey = vsv -> inner .v1_14_11 .node_pubkey ;
2398
- last_ts_slot = vsv -> inner .v1_14_11 .last_timestamp .slot ;
2402
+ node_pubkey = vsv -> inner .v1_14_11 .node_pubkey ;
2403
+ commission = vsv -> inner .v1_14_11 .commission ;
2404
+ _epoch_credits = deq_fd_vote_epoch_credits_t_peek_tail_const ( vsv -> inner .v1_14_11 .epoch_credits );
2405
+ epoch_credits = _epoch_credits -> credits - _epoch_credits -> prev_credits ;
2406
+ root_slot = vsv -> inner .v1_14_11 .root_slot ;
2399
2407
break ;
2400
2408
case fd_vote_state_versioned_enum_current :
2401
- node_pubkey = vsv -> inner .current .node_pubkey ;
2402
- last_ts_slot = vsv -> inner .current .last_timestamp .slot ;
2409
+ node_pubkey = vsv -> inner .current .node_pubkey ;
2410
+ commission = vsv -> inner .current .commission ;
2411
+ _epoch_credits = deq_fd_vote_epoch_credits_t_peek_tail_const ( vsv -> inner .current .epoch_credits );
2412
+ epoch_credits = _epoch_credits -> credits - _epoch_credits -> prev_credits ;
2413
+ root_slot = vsv -> inner .v0_23_5 .root_slot ;
2403
2414
break ;
2404
2415
default :
2405
2416
__builtin_unreachable ();
2406
2417
}
2407
2418
2419
+ fd_clock_timestamp_vote_t_mapnode_t query ;
2420
+ memcpy ( query .elem .pubkey .uc , n -> elem .key .uc , 32UL );
2421
+ fd_clock_timestamp_vote_t_mapnode_t * res = fd_clock_timestamp_vote_t_map_find ( fork -> slot_ctx -> slot_bank .timestamp_votes .votes_pool , fork -> slot_ctx -> slot_bank .timestamp_votes .votes_root , & query );
2422
+
2408
2423
fd_vote_update_msg_t * msg = (fd_vote_update_msg_t * )(dst + sizeof (ulong ) + i * 112U );
2409
2424
memset ( msg , 0 , 112U );
2410
2425
memcpy ( msg -> vote_pubkey , n -> elem .key .uc , sizeof (fd_pubkey_t ) );
2411
2426
memcpy ( msg -> node_pubkey , node_pubkey .uc , sizeof (fd_pubkey_t ) );
2412
2427
msg -> activated_stake = n -> elem .stake ;
2413
- msg -> last_vote = last_ts_slot ;
2414
- msg -> is_delinquent = (uchar )(msg -> last_vote == 0 );
2428
+ msg -> last_vote = res == NULL ? 0UL : res -> elem .slot ;
2429
+ msg -> root_slot = root_slot ;
2430
+ msg -> epoch_credits = epoch_credits ;
2431
+ msg -> commission = (uchar )commission ;
2432
+ msg -> is_delinquent = (uchar )fd_int_if (ctx -> curr_slot >= 128UL , msg -> last_vote <= ctx -> curr_slot - 128UL , msg -> last_vote == 0 );
2415
2433
++ i ;
2416
2434
}
2417
2435
} FD_SPAD_FRAME_END ;
@@ -2547,7 +2565,6 @@ after_credit( fd_replay_tile_ctx_t * ctx,
2547
2565
if ( FD_UNLIKELY ( flags & EXEC_FLAG_FINISHED_SLOT ) ){
2548
2566
fd_fork_t * fork = fd_fork_frontier_ele_query ( ctx -> forks -> frontier , & ctx -> curr_slot , NULL , ctx -> forks -> pool );
2549
2567
2550
- fork -> slot_ctx -> txn_count = fork -> slot_ctx -> slot_bank .transaction_count - fork -> slot_ctx -> parent_transaction_count ;
2551
2568
FD_LOG_NOTICE (( "finished block - slot: %lu, parent_slot: %lu, txn_cnt: %lu, blockhash: %s" ,
2552
2569
curr_slot ,
2553
2570
ctx -> parent_slot ,
@@ -2619,8 +2636,21 @@ after_credit( fd_replay_tile_ctx_t * ctx,
2619
2636
FD_LOG_ERR (( "failed to insert ghost node %lu" , curr_slot ));
2620
2637
}
2621
2638
#endif
2639
+
2640
+ ulong prev_confirmed = ctx -> forks -> confirmed ;
2641
+ ulong prev_finalized = ctx -> forks -> finalized ;
2622
2642
fd_forks_update ( ctx -> forks , ctx -> epoch , ctx -> funk , ctx -> ghost , curr_slot );
2623
2643
2644
+ if (FD_UNLIKELY ( prev_confirmed != ctx -> forks -> confirmed ) ) {
2645
+ ulong msg [ 1 ] = { ctx -> forks -> confirmed };
2646
+ replay_plugin_publish ( ctx , stem , FD_PLUGIN_MSG_SLOT_OPTIMISTICALLY_CONFIRMED , (uchar const * )msg , sizeof (msg ) );
2647
+ }
2648
+
2649
+ if (FD_UNLIKELY ( prev_finalized != ctx -> forks -> finalized ) ) {
2650
+ ulong msg [ 1 ] = { ctx -> forks -> finalized };
2651
+ replay_plugin_publish ( ctx , stem , FD_PLUGIN_MSG_SLOT_ROOTED , (uchar const * )msg , sizeof (msg ) );
2652
+ }
2653
+
2624
2654
/**********************************************************************/
2625
2655
/* Consensus: decide (1) the fork for pack; (2) the fork to vote on */
2626
2656
/**********************************************************************/
@@ -2638,6 +2668,14 @@ after_credit( fd_replay_tile_ctx_t * ctx,
2638
2668
reset_fork = new_reset_fork ;
2639
2669
}
2640
2670
2671
+ if ( FD_UNLIKELY ( !ctx -> startup_init_done && ctx -> replay_plugin_out_mem ) ) {
2672
+ ctx -> startup_init_done = 1 ;
2673
+ uchar msg [ 56 ];
2674
+ fd_memset ( msg , 0 , sizeof (msg ) );
2675
+ msg [ 0 ] = 11 ; // ValidatorStartProgress::Running
2676
+ replay_plugin_publish ( ctx , stem , FD_PLUGIN_MSG_START_PROGRESS , msg , sizeof (msg ) );
2677
+ }
2678
+
2641
2679
/* Update the gui */
2642
2680
if ( ctx -> replay_plugin_out_mem ) {
2643
2681
/* FIXME. We need a more efficient way to compute the ancestor chain. */
@@ -2793,16 +2831,15 @@ after_credit( fd_replay_tile_ctx_t * ctx,
2793
2831
} // end of if( FD_UNLIKELY( ( flags & REPLAY_FLAG_FINISHED_BLOCK ) ) )
2794
2832
2795
2833
if ( FD_UNLIKELY ( ctx -> snapshot_init_done == 0 ) ) {
2796
- init_snapshot ( ctx , stem );
2797
- ctx -> snapshot_init_done = 1 ;
2798
- //*charge_busy = 0;
2799
2834
if ( ctx -> replay_plugin_out_mem ) {
2800
- // ValidatorStartProgress::Running
2801
2835
uchar msg [56 ];
2802
2836
fd_memset ( msg , 0 , sizeof (msg ) );
2803
- msg [0 ] = 11 ;
2837
+ msg [ 0 ] = 0 ; // ValidatorStartProgress::Initializing
2804
2838
replay_plugin_publish ( ctx , stem , FD_PLUGIN_MSG_START_PROGRESS , msg , sizeof (msg ) );
2805
2839
}
2840
+ init_snapshot ( ctx , stem );
2841
+ ctx -> snapshot_init_done = 1 ;
2842
+ //*charge_busy = 0;
2806
2843
}
2807
2844
2808
2845
long now = fd_log_wallclock ();
@@ -3200,8 +3237,9 @@ unprivileged_init( fd_topo_t * topo,
3200
3237
poh_out -> chunk = poh_out -> chunk0 ;
3201
3238
}
3202
3239
3203
- ctx -> poh_init_done = 0U ;
3240
+ ctx -> poh_init_done = 0U ;
3204
3241
ctx -> snapshot_init_done = 0 ;
3242
+ ctx -> startup_init_done = 0 ;
3205
3243
3206
3244
/**********************************************************************/
3207
3245
/* exec */
0 commit comments