Conversation
ccff54b to
33e472f
Compare
There was a problem hiding this comment.
Pull request overview
Refactors tower-adjacent APIs in the choreo/discof tower components, while extending tower metrics to better distinguish ignored replay completions vs. equivocation-related replays.
Changes:
- Refactors
fd_tower_stakesinternals (slot map rename) and renames stake insertion/removal APIs. - Renames tower block lockout APIs (
*_add/clear→*_insert/remove) and updates tower tile call sites. - Adds new tower metrics for equivocation detection and updates generated metrics artifacts/docs.
Reviewed changes
Copilot reviewed 8 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/discof/tower/fd_tower_tile.c | Updates tower logic to use renamed stakes/lockouts APIs; introduces new equivocation metrics fields. |
| src/disco/metrics/metrics.xml | Adds SlotEqvoced* metrics and tweaks SlotIgnored metric descriptions. |
| src/disco/metrics/generated/fd_metrics_tower.h | Regenerates metric metadata (new offsets/total, new eqvoced metrics). |
| src/disco/metrics/generated/fd_metrics_tower.c | Adds eqvoced metrics to the tower metric registry. |
| src/choreo/tower/fd_tower_stakes.h | Renames/reshapes stakes APIs and related types (blk→slot map). |
| src/choreo/tower/fd_tower_stakes.c | Implements renamed stakes APIs and adds seed parameter to *_new. |
| src/choreo/tower/fd_tower_blocks.h | Renames lockouts APIs to *_insert/remove and adjusts prototypes/formatting. |
| src/choreo/tower/fd_tower_blocks.c | Minor formatting change; (implementation not yet aligned with renamed lockouts API). |
| src/choreo/tower/fd_tower.c | Small refactors/robustness tweaks in switch-check logic and formatting. |
| book/api/metrics-generated.md | Regenerates metrics documentation to include new eqvoced metrics. |
33e472f to
9f09e06
Compare
9f09e06 to
ae4e9b9
Compare
ae4e9b9 to
bddf2c2
Compare
bddf2c2 to
2103d44
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 20 changed files in this pull request and generated 12 comments.
Comments suppressed due to low confidence (1)
src/discof/tower/fd_tower_tile.c:1125
- New metrics slot_eqvoced_{cnt,gauge} are tracked in ctx->metrics but never exported in metrics_write(). Add the corresponding FD_MCNT_SET/FD_MGAUGE_SET calls so the new metrics show up in the TOWER metrics stream.
static inline void
metrics_write( fd_tower_tile_t * ctx ) {
FD_MCNT_SET ( TOWER, SLOT_IGNORED_CNT, ctx->metrics.slot_ignored_cnt );
FD_MGAUGE_SET( TOWER, SLOT_IGNORED_GAUGE, ctx->metrics.slot_ignored_gauge );
2103d44 to
7a26513
Compare
7a26513 to
61c668a
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 20 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (1)
src/discof/tower/fd_tower_tile.c:1128
- New metrics
slot_eqvoced_cnt/gaugeare updated inreplay_slot_completed, butmetrics_write()does not emit them viaFD_MCNT_SET/FD_MGAUGE_SET. Add the missing metric writes so the new counters/gauges actually show up in telemetry.
static inline void
metrics_write( fd_tower_tile_t * ctx ) {
FD_MCNT_SET ( TOWER, SLOT_IGNORED_CNT, ctx->metrics.slot_ignored_cnt );
FD_MGAUGE_SET( TOWER, SLOT_IGNORED_GAUGE, ctx->metrics.slot_ignored_gauge );
FD_MGAUGE_SET( TOWER, REPLAY_SLOT, ctx->metrics.replay_slot );
FD_MGAUGE_SET( TOWER, VOTE_SLOT, ctx->metrics.vote_slot );
5acb609 to
7e2936e
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 20 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
src/discof/tower/fd_tower_tile.c:1128
- New equivocation metrics (
slot_eqvoced_cnt/gauge) are updated inreplay_slot_completed, butmetrics_writenever exports them viaFD_MCNT_SET/FD_MGAUGE_SET. As a result, the newly added metrics inmetrics.xml/generated headers won't actually report meaningful values. Add the corresponding metric writes alongside the existing SLOT_IGNORED metrics writes.
static inline void
metrics_write( fd_tower_tile_t * ctx ) {
FD_MCNT_SET ( TOWER, SLOT_IGNORED_CNT, ctx->metrics.slot_ignored_cnt );
FD_MGAUGE_SET( TOWER, SLOT_IGNORED_GAUGE, ctx->metrics.slot_ignored_gauge );
7d526fe to
1e9cc5d
Compare
1e9cc5d to
b973e50
Compare
ec8eb7d to
4788828
Compare
206b430 to
283c4e9
Compare
5275a57 to
79e0f63
Compare
Performance Measurements ⏳
|
| tower_blk->replayed = 1; | ||
| tower_blk->replayed_block_id = slot_completed->block_id; | ||
| tower_blk->voted = 0; | ||
| tower_blk->confirmed = 0; |
There was a problem hiding this comment.
not sure if we should be resetting voted and confirmed here?
79e0f63 to
d1293cb
Compare
d1293cb to
c659cbc
Compare
Performance Measurements ⏳
|
c659cbc to
859994e
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 25 out of 31 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
src/discof/tower/fd_tower_tile.c:1093
- New metrics
slot_eqvoced_cnt/slot_eqvoced_gaugeare tracked inctx->metricsbut never exported inmetrics_write, so they will remain invisible to the metrics subsystem. Add the correspondingFD_MCNT_SET/FD_MGAUGE_SETcalls alongside the existing SlotIgnored metrics.
Performance Measurements ⏳
|
859994e to
69bf43b
Compare
69bf43b to
432d778
Compare
432d778 to
9bb2afc
Compare
Performance Measurements ⏳
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 23 out of 29 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/discof/tower/fd_tower_tile.c:1093
- New equivocation metrics (slot_eqvoced_cnt/gauge) are updated in ctx->metrics but never exported in metrics_write(), so they will stay at zero in published metrics despite being incremented. Add the corresponding FD_MCNT_SET / FD_MGAUGE_SET calls here to match the new generated tower metrics.
static inline void
metrics_write( fd_tower_tile_t * ctx ) {
FD_MCNT_SET ( TOWER, SLOT_IGNORED_CNT, ctx->metrics.slot_ignored_cnt );
FD_MGAUGE_SET( TOWER, SLOT_IGNORED_GAUGE, ctx->metrics.slot_ignored_gauge );
FD_MGAUGE_SET( TOWER, REPLAY_SLOT, ctx->metrics.replay_slot );
FD_MGAUGE_SET( TOWER, VOTE_SLOT, ctx->metrics.vote_slot );
| fd_tower_blk_t * eqvoc_tower_blk = NULL; | ||
| if( FD_UNLIKELY( eqvoc_tower_blk = fd_tower_blocks_query( ctx->tower_blocks, slot_completed->slot ) ) ) { | ||
|
|
||
| /* As fd_replay_slot_completed guarantees, we process at most 2 | ||
| equivocating blocks for a given slot. fd_tower_{...} only stores | ||
| one version of a block (by design, given the tower protocol's | ||
| limitations ... see notes in fd_tower_blocks.h). We also know | ||
| when seeing the same slot a second time that second block is | ||
| confirmed, also guaranteed by fd_replay_slot_completed ... see | ||
| notes in fd_replay_tile.h). | ||
|
|
||
| So we retain the existing tower_block we have (which contains the | ||
| first replayed_block_id as well as the voted_block_id if we did | ||
| indeed vote for it). We clear out the slot from the other tower | ||
| adjacent structures, and re-insert into them with the confirmed | ||
| version of the slot . */ | ||
|
|
||
| FD_TEST( eqvoc_tower_blk->confirmed ); /* check the confirmed bit is set (second replay_slot_completed version must be confirmed) */ | ||
| fd_tower_leaves_remove( ctx->tower_leaves, slot_completed->slot ); | ||
| fd_tower_lockos_remove( ctx->tower_lockos, slot_completed->slot ); | ||
| fd_tower_stakes_remove( ctx->tower_stakes, slot_completed->slot ); | ||
|
|
||
| /* If the previous equivocating version had a different parent than | ||
| the new version, then we need to ensure the original equivocating | ||
| block's parent is restored as a tower leaf. | ||
|
|
||
| TODO check agave doesn't have equivocating? */ | ||
|
|
||
| if( FD_UNLIKELY( eqvoc_tower_blk->parent_slot != slot_completed->parent_slot && | ||
| !fd_tower_leaves_map_ele_query( ctx->tower_leaves->map, &eqvoc_tower_blk->parent_slot, NULL, ctx->tower_leaves->pool ) /* added by another leaf */ ) ) { | ||
| fd_tower_leaf_t * leaf = fd_tower_leaves_pool_ele_acquire( ctx->tower_leaves->pool ); | ||
| leaf->slot = eqvoc_tower_blk->parent_slot; | ||
| fd_tower_leaves_map_ele_insert( ctx->tower_leaves->map, leaf, ctx->tower_leaves->pool ); | ||
| fd_tower_leaves_dlist_ele_push_tail( ctx->tower_leaves->dlist, leaf, ctx->tower_leaves->pool ); | ||
| eqvoc_tower_blk->parent_slot = slot_completed->parent_slot; | ||
| } | ||
| /* update the parent slot. Crucial to do this before tower_blocks_replayed*/ | ||
| tower_block->parent_slot = slot_completed->parent_slot; | ||
|
|
||
| ctx->metrics.slot_eqvoced_cnt++; | ||
| ctx->metrics.slot_eqvoced_gauge = slot_completed->slot; |
There was a problem hiding this comment.
Equivocation path assumes the existing tower block is already duplicate-confirmed (FD_TEST(eqvoc_tower_blk->confirmed)), but the first replayed version may not be confirmed yet. This will crash on the normal “first replay unconfirmed, second replay confirmed” flow described in the new fd_replay_slot_completed guarantee. Instead, on the second replay of the same slot, update the existing blk in-place to mark it confirmed and set confirmed_block_id (and any other per-slot metadata like parent_slot/bank_idx) based on slot_completed, rather than asserting it was already confirmed.
No description provided.