Skip to content

Commit 41fe03d

Browse files
committed
gossip: integration with full client topology
1 parent 9d50d17 commit 41fe03d

File tree

5 files changed

+97
-61
lines changed

5 files changed

+97
-61
lines changed

src/app/firedancer/topology.c

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "../../choreo/fd_choreo_base.h"
44
#include "../../discof/reasm/fd_reasm.h"
55
#include "../../discof/replay/fd_replay_notif.h"
6+
#include "../../discof/gossip/fd_gossip_tile.h"
67
#include "../../disco/net/fd_net_tile.h"
78
#include "../../disco/quic/fd_tpu.h"
89
#include "../../disco/tiles.h"
@@ -12,6 +13,7 @@
1213
#include "../../util/tile/fd_tile_private.h"
1314
#include "../../discof/restore/utils/fd_ssmsg.h"
1415
#include "../../flamenco/runtime/fd_runtime.h"
16+
#include "../../flamenco/gossip/fd_gossip.h"
1517

1618
#include <sys/random.h>
1719
#include <sys/types.h>
@@ -193,6 +195,7 @@ setup_snapshots( config_t * config,
193195
void
194196
fd_topo_initialize( config_t * config ) {
195197
resolve_gossip_entrypoints( config );
198+
config->gossip.boot_timestamp_nanos = fd_log_wallclock();
196199

197200
ulong net_tile_cnt = config->layout.net_tile_count;
198201
ulong shred_tile_cnt = config->layout.shred_tile_count;
@@ -201,6 +204,7 @@ fd_topo_initialize( config_t * config ) {
201204
ulong bank_tile_cnt = config->layout.bank_tile_count;
202205
ulong exec_tile_cnt = config->firedancer.layout.exec_tile_count;
203206
ulong writer_tile_cnt = config->firedancer.layout.writer_tile_count;
207+
ulong gossvf_tile_cnt = config->firedancer.layout.gossvf_tile_count;
204208
ulong resolv_tile_cnt = config->layout.resolv_tile_count;
205209
ulong sign_tile_cnt = config->firedancer.layout.sign_tile_count;
206210

@@ -212,7 +216,7 @@ fd_topo_initialize( config_t * config ) {
212216
/* topo, name */
213217
fd_topob_wksp( topo, "metric_in" );
214218
fd_topob_wksp( topo, "net_shred" );
215-
fd_topob_wksp( topo, "net_gossip" );
219+
fd_topob_wksp( topo, "gossip_net" );
216220
fd_topob_wksp( topo, "net_repair" );
217221
fd_topob_wksp( topo, "net_quic" );
218222
fd_topob_wksp( topo, "net_send" );
@@ -246,6 +250,9 @@ fd_topo_initialize( config_t * config ) {
246250
fd_topob_wksp( topo, "root_out" );
247251
fd_topob_wksp( topo, "ipecho_out" );
248252

253+
fd_topob_wksp( topo, "gossvf_gossi" );
254+
fd_topob_wksp( topo, "gossip_gossv" );
255+
249256
fd_topob_wksp( topo, "repair_sign" );
250257

251258
fd_topob_wksp( topo, "repair_repla" );
@@ -263,6 +270,7 @@ fd_topo_initialize( config_t * config ) {
263270
fd_topob_wksp( topo, "sign" );
264271
fd_topob_wksp( topo, "repair" );
265272
fd_topob_wksp( topo, "ipecho" );
273+
fd_topob_wksp( topo, "gossvf" );
266274
fd_topob_wksp( topo, "gossip" );
267275
fd_topob_wksp( topo, "metric" );
268276
fd_topob_wksp( topo, "replay" );
@@ -330,16 +338,15 @@ fd_topo_initialize( config_t * config ) {
330338

331339
FOR(exec_tile_cnt) fd_topob_link( topo, "exec_writer", "exec_writer", 128UL, FD_EXEC_WRITER_MTU, 1UL );
332340
333-
/**/ fd_topob_link( topo, "gossip_out", "gossip_out", 65536UL, 2048UL, 1UL );
341+
/**/ fd_topob_link( topo, "gossip_out", "gossip_out", 65536UL*4UL, sizeof(fd_gossip_update_message_t), 1UL );
334342
/**/ fd_topob_link( topo, "replay_out", "replay_out", 128UL, sizeof(fd_replay_out_t), 1UL );
335343
/**/ fd_topob_link( topo, "root_out", "root_out", 128UL, sizeof(fd_block_id_t), 1UL );
336344
/**/ fd_topob_link( topo, "ipecho_out", "ipecho_out", 4UL, 0UL, 1UL );
337345

338-
/**/ fd_topob_link( topo, "crds_shred", "crds_shred", 128UL, 8UL + 40200UL * 38UL, 1UL );
339-
/**/ fd_topob_link( topo, "gossip_repai", "gossip_repai", 128UL, 40200UL * 38UL, 1UL );
340-
/**/ fd_topob_link( topo, "gossip_send", "gossip_send", 128UL, USHORT_MAX, 25UL );
346+
FOR(gossvf_tile_cnt) fd_topob_link( topo, "gossvf_gossi", "gossvf_gossi", config->net.ingress_buffer_size, sizeof(fd_gossip_view_t)+FD_NET_MTU, 1UL );
347+
/**/ fd_topob_link( topo, "gossip_gossv", "gossip_gossv", 65536UL*4UL, sizeof(fd_gossip_ping_update_t), 1UL );
341348

342-
/**/ fd_topob_link( topo, "gossip_net", "net_gossip", config->net.ingress_buffer_size, FD_NET_MTU, 1UL );
349+
/**/ fd_topob_link( topo, "gossip_net", "gossip_net", 65536*4UL, FD_NET_MTU, 1UL );
343350
/**/ fd_topob_link( topo, "send_net", "net_send", config->net.ingress_buffer_size, FD_NET_MTU, 2UL );
344351

345352
/**/ fd_topob_link( topo, "repair_net", "net_repair", config->net.ingress_buffer_size, FD_NET_MTU, 1UL );
@@ -402,7 +409,7 @@ fd_topo_initialize( config_t * config ) {
402409

403410
fd_topos_net_tiles( topo, net_tile_cnt, &config->net, config->tiles.netlink.max_routes, config->tiles.netlink.max_peer_routes, config->tiles.netlink.max_neighbors, tile_to_cpu );
404411

405-
FOR(net_tile_cnt) fd_topos_net_rx_link( topo, "net_gossip", i, config->net.ingress_buffer_size );
412+
FOR(net_tile_cnt) fd_topos_net_rx_link( topo, "net_gossvf", i, config->net.ingress_buffer_size );
406413
FOR(net_tile_cnt) fd_topos_net_rx_link( topo, "net_repair", i, config->net.ingress_buffer_size );
407414
FOR(net_tile_cnt) fd_topos_net_rx_link( topo, "net_quic", i, config->net.ingress_buffer_size );
408415
FOR(net_tile_cnt) fd_topos_net_rx_link( topo, "net_shred", i, config->net.ingress_buffer_size );
@@ -418,6 +425,7 @@ fd_topo_initialize( config_t * config ) {
418425
/**/ fd_topob_tile( topo, "metric", "metric", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
419426
fd_topo_tile_t * pack_tile = fd_topob_tile( topo, "pack", "pack", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
420427
/**/ fd_topob_tile( topo, "poh", "poh", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
428+
FOR(gossvf_tile_cnt) fd_topob_tile( topo, "gossvf", "gossvf", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
421429
/**/ fd_topob_tile( topo, "gossip", "gossip", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
422430
/**/ fd_topob_tile( topo, "ipecho", "ipecho", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
423431
fd_topo_tile_t * repair_tile = fd_topob_tile( topo, "repair", "repair", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
@@ -614,12 +622,21 @@ fd_topo_initialize( config_t * config ) {
614622
/**/ fd_topob_tile_out( topo, "sign", 0UL, "sign_shred", i );
615623
}
616624

617-
FOR(net_tile_cnt) fd_topob_tile_in ( topo, "gossip", 0UL, "metric_in", "net_gossip", i, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED ); /* No reliable consumers of networking fragments, may be dropped or overrun */
618-
/**/ fd_topob_tile_in ( topo, "gossip", 0UL, "metric_in", "stake_out", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
619-
/**/ fd_topob_tile_out( topo, "gossip", 0UL, "gossip_out", 0UL );
625+
FOR(gossvf_tile_cnt) for( ulong j=0UL; j<net_tile_cnt; j++ )
626+
fd_topob_tile_in ( topo, "gossvf", i, "metric_in", "net_gossvf", j, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED ); /* No reliable consumers of networking fragments, may be dropped or overrun */
627+
FOR(gossvf_tile_cnt) fd_topob_tile_out( topo, "gossvf", i, "gossvf_gossi", i );
628+
FOR(gossvf_tile_cnt) fd_topob_tile_in ( topo, "gossvf", i, "metric_in", "gossip_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
629+
FOR(gossvf_tile_cnt) fd_topob_tile_in ( topo, "gossvf", i, "metric_in", "gossip_gossv", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
630+
FOR(gossvf_tile_cnt) fd_topob_tile_in ( topo, "gossvf", i, "metric_in", "ipecho_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
631+
632+
/**/ fd_topob_tile_in ( topo, "gossip", 0UL, "metric_in", "stake_out", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
633+
/**/ fd_topob_tile_out( topo, "gossip", 0UL, "gossip_out", 0UL );
620634
/**/ fd_topob_tile_out( topo, "gossip", 0UL, "gossip_net", 0UL );
621635
/**/ fd_topob_tile_in ( topo, "sign", 0UL, "metric_in", "gossip_sign", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
622636
/**/ fd_topob_tile_out( topo, "gossip", 0UL, "gossip_sign", 0UL );
637+
/**/ fd_topob_tile_in ( topo, "gossip", 0UL, "metric_in", "ipecho_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
638+
FOR(gossvf_tile_cnt) fd_topob_tile_in ( topo, "gossip", 0UL, "metric_in", "gossvf_gossi", i, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
639+
/**/ fd_topob_tile_out( topo, "gossip", 0UL, "gossip_gossv", 0UL );
623640
/**/ fd_topob_tile_in ( topo, "gossip", 0UL, "metric_in", "sign_gossip", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_UNPOLLED );
624641
/**/ fd_topob_tile_out( topo, "sign", 0UL, "sign_gossip", 0UL );
625642

@@ -761,18 +778,15 @@ fd_topo_initialize( config_t * config ) {
761778

762779
/**/ fd_topob_link( topo, "plugin_out", "plugin_out", 128UL, 8UL+40200UL*(58UL+12UL*34UL), 1UL );
763780
/**/ fd_topob_link( topo, "replay_plugi", "plugin_in", 128UL, 4098*8UL, 1UL );
764-
/**/ fd_topob_link( topo, "gossip_plugi", "plugin_in", 128UL, 8UL+40200UL*(58UL+12UL*34UL), 1UL );
765781
/**/ fd_topob_link( topo, "votes_plugin", "plugin_in", 128UL, 8UL+40200UL*(58UL+12UL*34UL), 1UL );
766782

767783
/**/ fd_topob_tile( topo, "plugin", "plugin", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
768784

769785
/**/ fd_topob_tile_out( topo, "replay", 0UL, "replay_plugi", 0UL );
770786
/**/ fd_topob_tile_out( topo, "replay", 0UL, "votes_plugin", 0UL );
771-
/**/ fd_topob_tile_out( topo, "gossip", 0UL, "gossip_plugi", 0UL );
772787
/**/ fd_topob_tile_out( topo, "plugin", 0UL, "plugin_out", 0UL );
773788

774789
/**/ fd_topob_tile_in( topo, "plugin", 0UL, "metric_in", "replay_plugi", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
775-
/**/ fd_topob_tile_in( topo, "plugin", 0UL, "metric_in", "gossip_plugi", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
776790
/**/ fd_topob_tile_in( topo, "plugin", 0UL, "metric_in", "stake_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
777791
/**/ fd_topob_tile_in( topo, "plugin", 0UL, "metric_in", "votes_plugin", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
778792
}
@@ -875,8 +889,9 @@ fd_topo_configure_tile( fd_topo_tile_t * tile,
875889
tile->gossip.ip_addr = config->net.ip_addr;
876890
}
877891
strncpy( tile->gossip.identity_key_path, config->paths.identity_key, sizeof(tile->gossip.identity_key_path) );
878-
tile->gossip.shred_version = config->consensus.expected_shred_version;
879-
tile->gossip.max_entries = config->tiles.gossip.max_entries;
892+
tile->gossip.shred_version = config->consensus.expected_shred_version;
893+
tile->gossip.max_entries = config->tiles.gossip.max_entries;
894+
tile->gossip.boot_timesamp_nanos = config->gossip.boot_timestamp_nanos;
880895

881896
tile->gossip.ip_addr = config->net.ip_addr;
882897

@@ -889,6 +904,16 @@ fd_topo_configure_tile( fd_topo_tile_t * tile,
889904
tile->gossip.entrypoints_cnt = config->gossip.entrypoints_cnt;
890905
fd_memcpy( tile->gossip.entrypoints, config->gossip.resolved_entrypoints, tile->gossip.entrypoints_cnt * sizeof(fd_ip4_port_t) );
891906

907+
} else if( FD_UNLIKELY( !strcmp( tile->name, "gossvf") ) ) {
908+
strncpy( tile->gossvf.identity_key_path, config->paths.identity_key, sizeof(tile->gossvf.identity_key_path) );
909+
tile->gossvf.tcache_depth = 1<<22UL; /* TODO: user defined option */
910+
tile->gossvf.shred_version = 0U;
911+
tile->gossvf.allow_private_address = config->development.gossip.allow_private_address;
912+
tile->gossvf.boot_timesamp_nanos = config->gossip.boot_timestamp_nanos;
913+
914+
tile->gossvf.entrypoints_cnt = config->gossip.entrypoints_cnt;
915+
fd_memcpy( tile->gossvf.entrypoints, config->gossip.resolved_entrypoints, tile->gossvf.entrypoints_cnt * sizeof(fd_ip4_port_t) );
916+
892917
} else if( FD_UNLIKELY( !strcmp( tile->name, "ipecho") ) ) {
893918
tile->ipecho.expected_shred_version = config->consensus.expected_shred_version;
894919
tile->ipecho.bind_address = config->net.ip_addr;

src/app/shared/fd_config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ struct fd_config {
240240

241241
ushort port;
242242
char host[ 256 ];
243+
244+
long boot_timestamp_nanos;
243245
} gossip;
244246

245247
struct {

src/disco/shred/fd_shred_tile.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,9 +1330,9 @@ unprivileged_init( fd_topo_t * topo,
13301330
}
13311331
else if( FD_LIKELY( !strcmp( link->name, "gossip_out" ) ) ) { ctx->in_kind[ i ] = IN_KIND_GOSSIP;
13321332
if( FD_UNLIKELY( has_contact_info_in ) ) FD_LOG_ERR(( "shred tile has multiple contact info in link types, can only be either gossip_out or crds_shred" ));
1333-
has_contact_info_in = 1;
1333+
has_contact_info_in = 1;
13341334
}
1335-
1335+
13361336
else FD_LOG_ERR(( "shred tile has unexpected input link %lu %s", i, link->name ));
13371337

13381338
if( FD_LIKELY( !!link->mtu ) ) {

0 commit comments

Comments
 (0)