Skip to content

Commit 7cd3b23

Browse files
committed
gui: add reset_slot, storage_slot
1 parent e03ae6b commit 7cd3b23

File tree

8 files changed

+60
-1
lines changed

8 files changed

+60
-1
lines changed

book/api/websocket.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,28 @@ producing) their slot. For example, if the last completed slot was
748748
`1001` and it has been 800 milliseconds since that slot, the estimated
749749
slot is likely to be `1003`.
750750

751+
#### `summary.reset_slot`
752+
| frequency | type | example |
753+
|-----------------|----------|-------------|
754+
| *Once* + *Live* | `number` | `275138349` |
755+
756+
The slot corresponding to the head of the fork we've most recently
757+
chosen to vote for. A fork choice is triggered by the completion of a
758+
replay slot, so the publish interval for this message is approximately
759+
one slot duration.
760+
761+
#### `summary.storage_slot`
762+
| frequency | type | example |
763+
|-----------------|----------|-------------|
764+
| *Once* + *Live* | `number` | `275138349` |
765+
766+
The oldest active rooted slot across all banks in the bank pool.
767+
Active here means that the bank has a positive reference count, which
768+
means there is some consumer which is still using it. This slot is less
769+
than or equal to the current consensus root and is always on the
770+
canonical consensus fork. Banks for slots before this slot or slots on a
771+
non-canonical fork will have a reference count of zero.
772+
751773
#### `summary.estimated_slot_duration_nanos`
752774
| frequency | type | example |
753775
|-----------------|----------|-------------|

src/disco/gui/fd_gui.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ fd_gui_new( void * shmem,
206206
gui->summary.slot_caught_up = ULONG_MAX;
207207
gui->summary.slot_repair = ULONG_MAX;
208208
gui->summary.slot_turbine = ULONG_MAX;
209+
gui->summary.slot_reset = ULONG_MAX;
210+
gui->summary.slot_storage = ULONG_MAX;
209211

210212
for( ulong i=0UL; i < (FD_GUI_REPAIR_SLOT_HISTORY_SZ+1UL); i++ ) gui->summary.slots_max_repair[ i ].slot = ULONG_MAX;
211213
for( ulong i=0UL; i < (FD_GUI_TURBINE_SLOT_HISTORY_SZ+1UL); i++ ) gui->summary.slots_max_turbine[ i ].slot = ULONG_MAX;
@@ -2679,15 +2681,27 @@ fd_gui_handle_tower_update( fd_gui_t * gui,
26792681
slot->reset_slot = tower->reset_slot;
26802682

26812683
try_publish_vote_status( gui, tower->replay_slot );
2684+
2685+
if( FD_LIKELY( gui->summary.slot_reset!=tower->reset_slot ) ) {
2686+
gui->summary.slot_reset = tower->reset_slot;
2687+
fd_gui_printf_reset_slot( gui );
2688+
fd_http_server_ws_broadcast( gui->http );
2689+
}
26822690
}
26832691

26842692
void
26852693
fd_gui_handle_replay_update( fd_gui_t * gui,
26862694
fd_gui_slot_completed_t * slot_completed,
26872695
fd_hash_t const * block_hash,
26882696
ulong vote_slot,
2697+
ulong storage_slot,
26892698
long now ) {
26902699
(void)now;
2700+
if( FD_LIKELY( gui->summary.slot_storage!=storage_slot ) ) {
2701+
gui->summary.slot_storage = storage_slot;
2702+
fd_gui_printf_storage_slot( gui );
2703+
fd_http_server_ws_broadcast( gui->http );
2704+
}
26912705

26922706
if( FD_UNLIKELY( gui->summary.boot_progress.catching_up_first_replay_slot==ULONG_MAX ) ) {
26932707
gui->summary.boot_progress.catching_up_first_replay_slot = slot_completed->slot;

src/disco/gui/fd_gui.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,8 @@ struct fd_gui {
630630
ulong slot_caught_up;
631631
ulong slot_repair;
632632
ulong slot_turbine;
633+
ulong slot_reset;
634+
ulong slot_storage;
633635

634636
fd_gui_ephemeral_slot_t slots_max_turbine[ FD_GUI_TURBINE_SLOT_HISTORY_SZ+1UL ];
635637
fd_gui_ephemeral_slot_t slots_max_repair [ FD_GUI_REPAIR_SLOT_HISTORY_SZ +1UL ];
@@ -872,6 +874,7 @@ fd_gui_handle_replay_update( fd_gui_t * gui,
872874
fd_gui_slot_completed_t * slot_completed,
873875
fd_hash_t const * block_hash,
874876
ulong vote_slot,
877+
ulong storage_slot,
875878
long now );
876879

877880
void

src/disco/gui/fd_gui_printf.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,22 @@ fd_gui_printf_turbine_slot( fd_gui_t * gui ) {
259259
jsonp_close_envelope( gui->http );
260260
}
261261

262+
void
263+
fd_gui_printf_reset_slot( fd_gui_t * gui ) {
264+
jsonp_open_envelope( gui->http, "summary", "reset_slot" );
265+
if( FD_LIKELY( gui->summary.slot_reset!=ULONG_MAX ) ) jsonp_ulong( gui->http, "value", gui->summary.slot_reset );
266+
else jsonp_null ( gui->http, "value" );
267+
jsonp_close_envelope( gui->http );
268+
}
269+
270+
void
271+
fd_gui_printf_storage_slot( fd_gui_t * gui ) {
272+
jsonp_open_envelope( gui->http, "summary", "storage_slot" );
273+
if( FD_LIKELY( gui->summary.slot_storage!=ULONG_MAX ) ) jsonp_ulong( gui->http, "value", gui->summary.slot_storage );
274+
else jsonp_null ( gui->http, "value" );
275+
jsonp_close_envelope( gui->http );
276+
}
277+
262278
void
263279
fd_gui_printf_slot_caught_up( fd_gui_t * gui ) {
264280
jsonp_open_envelope( gui->http, "summary", "slot_caught_up" );

src/disco/gui/fd_gui_printf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ void fd_gui_printf_estimated_tps( fd_gui_t * gui );
3737
void fd_gui_printf_shred_updates( fd_gui_t * gui );
3838
void fd_gui_printf_catch_up_history( fd_gui_t * gui );
3939
void fd_gui_peers_printf_vote_slot( fd_gui_peers_ctx_t * peers );
40+
void fd_gui_printf_reset_slot( fd_gui_t * gui );
41+
void fd_gui_printf_storage_slot( fd_gui_t * gui );
4042

4143
void
4244
fd_gui_printf_null_query_response( fd_http_server_t * http,

src/disco/gui/fd_gui_tile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ after_frag( fd_gui_ctx_t * ctx,
425425
fd_gui_peers_handle_vote_update( ctx->peers, ctx->peers->votes, vote_count, fd_clock_now( ctx->clock ), ctx->gui->summary.identity_key, ctx->gui->ipinfo.country_code );
426426

427427
/* update slot data */
428-
fd_gui_handle_replay_update( ctx->gui, &slot_completed, &replay->block_hash, ctx->peers->slot_voted, fd_clock_now( ctx->clock ) );
428+
fd_gui_handle_replay_update( ctx->gui, &slot_completed, &replay->block_hash, ctx->peers->slot_voted, replay->storage_slot, fd_clock_now( ctx->clock ) );
429429

430430
} else if( FD_UNLIKELY( sig==REPLAY_SIG_BECAME_LEADER ) ) {
431431
fd_became_leader_t * became_leader = (fd_became_leader_t *)src;

src/discof/replay/fd_replay_tile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,7 @@ publish_slot_completed( fd_replay_tile_t * ctx,
680680
fd_replay_slot_completed_t * slot_info = fd_chunk_to_laddr( ctx->replay_out->mem, ctx->replay_out->chunk );
681681
slot_info->slot = slot;
682682
slot_info->root_slot = ctx->consensus_root_slot;
683+
slot_info->storage_slot = ctx->published_root_slot;
683684
slot_info->epoch = epoch;
684685
slot_info->slot_in_epoch = slot_idx;
685686
slot_info->block_height = fd_bank_block_height_get( bank );

src/discof/replay/fd_replay_tile.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
struct fd_replay_slot_completed {
1414
ulong slot;
1515
ulong root_slot;
16+
ulong storage_slot;
1617
ulong epoch;
1718
ulong slot_in_epoch;
1819
ulong block_height;

0 commit comments

Comments
 (0)