Skip to content

Commit 84de436

Browse files
committed
feat(choreo): dup handling, gossip int, bug fixes, missing logic
1 parent 5fbc37d commit 84de436

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+3694
-4693
lines changed

book/api/metrics-generated.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,3 +1116,20 @@
11161116
| <span class="metrics-name">benchs_&#8203;transactions_&#8203;sent</span> | counter | Number of benchmark packets sent |
11171117

11181118
</div>
1119+
1120+
## Tower Tile
1121+
1122+
<div class="metrics">
1123+
1124+
| Metric | Type | Description |
1125+
|--------|------|-------------|
1126+
| <span class="metrics-name">tower_&#8203;ancestor_&#8203;rollback</span> | counter | Rollback to an ancestor of our prev vote (can't vote) |
1127+
| <span class="metrics-name">tower_&#8203;sibling_&#8203;confirmed</span> | counter | Duplicate sibling got confirmed (can't vote) |
1128+
| <span class="metrics-name">tower_&#8203;same_&#8203;fork</span> | counter | Same fork as prev vote (can vote) |
1129+
| <span class="metrics-name">tower_&#8203;switch_&#8203;pass</span> | counter | Prev vote was on a different fork, but we are allowed to switch (can vote) |
1130+
| <span class="metrics-name">tower_&#8203;switch_&#8203;fail</span> | counter | Prev vote was on a different fork, and we are not allowed to switch (can't vote) |
1131+
| <span class="metrics-name">tower_&#8203;lockout_&#8203;fail</span> | counter | Locked out (can't vote) |
1132+
| <span class="metrics-name">tower_&#8203;threshold_&#8203;fail</span> | counter | Did not pass threshold check (can't vote) |
1133+
| <span class="metrics-name">tower_&#8203;propagated_&#8203;fail</span> | counter | Prev leader block did not propagate (can't vote) |
1134+
1135+
</div>

src/app/firedancer-dev/commands/send_test/send_test_helpers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ encode_vote( send_test_ctx_t * ctx, fd_tower_slot_done_t * slot_done ) {
215215
/* Create minimal mock tower with one vote */
216216
uchar tower_mem[ FD_TOWER_FOOTPRINT ] __attribute__((aligned(FD_TOWER_ALIGN)));
217217
fd_tower_t * tower = fd_tower_join( fd_tower_new( tower_mem ) );
218-
fd_tower_votes_push_tail( tower, (fd_tower_vote_t){ .slot = vote_slot, .conf = 1 } );
218+
fd_tower_push_tail( tower, (fd_tower_vote_t){ .slot = vote_slot, .conf = 1 } );
219219

220220
/* Mock values */
221221
fd_lockout_offset_t lockouts_scratch[1];

src/app/firedancer/config/default.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,15 @@ user = ""
472472
# abort with an error.
473473
expected_genesis_hash = ""
474474

475+
# Firedancer can process at most this many slots without rooting in
476+
# the consensus rules before it must begin evicting.
477+
#
478+
# This is an estimate and should be set as generously as possible to
479+
# allow for brief anomalies such as the validator disconnecting from
480+
# part of the cluster due to data center issues. Roughly, at 400 ms
481+
# per slot, the default allows for 30 minutes without rooting.
482+
max_unrooted_slots = 4096
483+
475484
# This section configures the "funk" account database. Currently, funk
476485
# stores all Solana accounts. In future versions of Firedancer, most
477486
# accounts will be offloaded to the "groove" database.

src/app/firedancer/topology.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "topology.h"
22

33
#include "../../ballet/lthash/fd_lthash.h"
4+
#include "../../choreo/fd_choreo_base.h"
45
#include "../../discof/reasm/fd_reasm.h"
56
#include "../../discof/poh/fd_poh.h"
67
#include "../../discof/replay/fd_exec.h"
@@ -383,6 +384,7 @@ fd_topo_initialize( config_t * config ) {
383384

384385
/* TODO: Explain this .... USHORT_MAX is not dcache max */
385386
ulong pending_fec_shreds_depth = fd_ulong_min( fd_ulong_pow2_up( config->tiles.shred.max_pending_shred_sets * FD_REEDSOL_DATA_SHREDS_MAX ), USHORT_MAX + 1 /* dcache max */ );
387+
ulong max_unrooted_slots = config->firedancer.consensus.max_unrooted_slots;
386388

387389
/* topo, link_name, wksp_name, depth, mtu, burst */
388390
/**/ fd_topob_link( topo, "gossip_net", "net_gossip", 32768UL, FD_NET_MTU, 1UL );
@@ -445,7 +447,7 @@ fd_topo_initialize( config_t * config ) {
445447

446448
FOR(shred_tile_cnt) fd_topob_link( topo, "shred_out", "shred_out", pending_fec_shreds_depth, FD_SHRED_OUT_MTU, 3UL ); /* TODO: Pretty sure burst of 3 is incorrect here */
447449
FOR(shred_tile_cnt) fd_topob_link( topo, "repair_shred", "shred_out", pending_fec_shreds_depth, sizeof(fd_ed25519_sig_t), 1UL ); /* TODO: Also pending_fec_shreds_depth? Seems wrong */
448-
/**/ fd_topob_link( topo, "tower_out", "tower_out", 1024UL, sizeof(fd_tower_slot_done_t), 1UL );
450+
/**/ fd_topob_link( topo, "tower_out", "tower_out", max_unrooted_slots, sizeof(fd_tower_msg_t), 1UL );
449451
/**/ fd_topob_link( topo, "send_out", "send_out", 128UL, FD_TPU_RAW_MTU, 1UL );
450452

451453
fd_topob_link( topo, "replay_exec", "replay_exec", 16384UL, sizeof(fd_exec_task_msg_t), 1UL );
@@ -604,6 +606,7 @@ fd_topo_initialize( config_t * config ) {
604606
/**/ fd_topob_tile_in( topo, "replay", 0UL, "metric_in", "poh_replay", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
605607
FOR(exec_tile_cnt) fd_topob_tile_in( topo, "exec", i, "metric_in", "replay_exec", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
606608
/**/ fd_topob_tile_in ( topo, "tower", 0UL, "metric_in", "genesi_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
609+
/**/ fd_topob_tile_in ( topo, "tower", 0UL, "metric_in", "gossip_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
607610
/**/ fd_topob_tile_in ( topo, "tower", 0UL, "metric_in", "replay_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
608611
if( snapshots_enabled ) {
609612
fd_topob_tile_in ( topo, "tower", 0UL, "metric_in", "snapin_manif", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
@@ -1130,9 +1133,10 @@ fd_topo_configure_tile( fd_topo_tile_t * tile,
11301133

11311134
} else if( FD_UNLIKELY( !strcmp( tile->name, "tower" ) ) ) {
11321135

1133-
strncpy( tile->tower.identity_key_path, config->paths.identity_key, sizeof(tile->tower.identity_key_path) );
1134-
strncpy( tile->tower.vote_acc_path, config->paths.vote_account, sizeof(tile->tower.vote_acc_path) );
1135-
strncpy( tile->tower.ledger_path, config->paths.base, sizeof(tile->tower.ledger_path) );
1136+
tile->tower.slot_max = config->firedancer.consensus.max_unrooted_slots;
1137+
strncpy( tile->tower.identity_key, config->paths.identity_key, sizeof(tile->tower.identity_key) );
1138+
strncpy( tile->tower.vote_account, config->paths.vote_account, sizeof(tile->tower.vote_account) );
1139+
strncpy( tile->tower.base_path, config->paths.base, sizeof(tile->tower.base_path) );
11361140

11371141
} else if( FD_UNLIKELY( !strcmp( tile->name, "send" ) ) ) {
11381142

src/app/shared/fd_config.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ struct fd_configf {
130130
char host[ 256 ];
131131
} gossip;
132132

133+
struct {
134+
ulong max_unrooted_slots;
135+
} consensus;
136+
133137
struct {
134138
struct {
135139
uint max_local_full_effective_age;

src/app/shared/fd_config_parse.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ fd_config_extract_podf( uchar * pod,
8080
fd_configf_t * config ) {
8181
CFG_POP ( cstr, gossip.host );
8282

83+
CFG_POP ( ulong, consensus.max_unrooted_slots );
84+
8385
CFG_POP ( uint, layout.exec_tile_count );
8486
CFG_POP ( uint, layout.sign_tile_count );
8587
CFG_POP ( uint, layout.gossvf_tile_count );

src/app/shared_dev/commands/dev.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,6 @@ update_config_for_dev( fd_config_t * config ) {
109109
shred->shred.expected_shred_version = shred_version;
110110
}
111111
}
112-
ulong store_id = fd_topo_find_tile( &config->topo, "storei", 0 );
113-
if( FD_UNLIKELY( store_id!=ULONG_MAX ) ) {
114-
fd_topo_tile_t * storei = &config->topo.tiles[ store_id ];
115-
if( FD_LIKELY( storei->store_int.expected_shred_version==(ushort)0 ) ) {
116-
storei->store_int.expected_shred_version = shred_version;
117-
}
118-
}
119112
}
120113

121114
/* Run Firedancer entirely in a single process for development and

src/choreo/epoch/Local.mk

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/choreo/epoch/fd_epoch.c

Lines changed: 0 additions & 146 deletions
This file was deleted.

0 commit comments

Comments
 (0)