Skip to content

WIP: changes to merge gossip2 branch #5154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: mmcgee/gossip2
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions src/discof/gossip/fd_gossip_tile.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ struct fd_gossip_tile_ctx {

fd_gossip_out_ctx_t net_out[ 1 ];
fd_gossip_out_ctx_t gossip_out[ 1 ];
fd_gossip_out_ctx_t sign_out[ 1 ];

fd_keyguard_client_t keyguard_client[ 1 ];
fd_keyswitch_t * keyswitch;
Expand Down Expand Up @@ -157,7 +158,8 @@ privileged_init( fd_topo_t * topo,
static inline fd_gossip_out_ctx_t
out1( fd_topo_t const * topo,
fd_topo_tile_t const * tile,
char const * name ) {
char const * name,
ulong * opt_tile_out_idx ) {
ulong idx = ULONG_MAX;

for( ulong i=0UL; i<tile->out_cnt; i++ ) {
Expand All @@ -169,6 +171,7 @@ out1( fd_topo_t const * topo,
}

if( FD_UNLIKELY( idx==ULONG_MAX ) ) FD_LOG_ERR(( "tile %s:%lu had no output link named %s", tile->name, tile->kind_id, name ));
if( opt_tile_out_idx ) *opt_tile_out_idx = idx;

void * mem = topo->workspaces[ topo->objs[ topo->links[ tile->out_link_id[ idx ] ].dcache_obj_id ].wksp_id ].wksp;
ulong chunk0 = fd_dcache_compact_chunk0( mem, topo->links[ tile->out_link_id[ idx ] ].dcache );
Expand Down Expand Up @@ -210,7 +213,8 @@ unprivileged_init( fd_topo_t * topo,
ctx->ticks_per_ns = fd_tempo_tick_per_ns( NULL );
ctx->last_wallclock = fd_log_wallclock();
ctx->last_tickcount = fd_tickcount();


ulong sign_in_tile_idx = ULONG_MAX;
for( ulong i=0UL; i<tile->in_cnt; i++ ) {
fd_topo_link_t * link = &topo->links[ tile->in_link_id[ i ] ];
fd_topo_wksp_t * link_wksp = &topo->workspaces[ topo->objs[ link->dcache_obj_id ].wksp_id ];
Expand All @@ -223,13 +227,29 @@ unprivileged_init( fd_topo_t * topo,
ctx->in_kind[ i ] = IN_KIND_SHRED_VERSION;
} else if( FD_UNLIKELY( !strcmp( link->name, "net_gossip" ) ) ) {
ctx->in_kind[ i ] = IN_KIND_NET;
} else if( FD_UNLIKELY( !strcmp( link->name, "sign_gossip" ) ) ) {
ctx->in_kind[ i ] = IN_KIND_SIGN;
sign_in_tile_idx = i;
} else {
FD_LOG_ERR(( "unexpected input link name %s", link->name ));
}
}

*ctx->net_out = out1( topo, tile, "gossip_net" );
*ctx->gossip_out = out1( topo, tile, "gossip_out" );
*ctx->net_out = out1( topo, tile, "gossip_net", NULL );
*ctx->gossip_out = out1( topo, tile, "gossip_out", NULL );

ulong sign_out_tile_idx = ULONG_MAX;
*ctx->sign_out = out1( topo, tile, "gossip_sign", &sign_out_tile_idx );

fd_topo_link_t * sign_in = &topo->links[ tile->in_link_id [ sign_in_tile_idx ] ];
fd_topo_link_t * sign_out = &topo->links[ tile->out_link_id[ sign_out_tile_idx ] ];
if( fd_keyguard_client_join( fd_keyguard_client_new( ctx->keyguard_client,
sign_out->mcache,
sign_out->dcache,
sign_in->mcache,
sign_in->dcache ) ) ){
FD_LOG_ERR(( "failed to join keyguard client" ));
}

ulong scratch_top = FD_SCRATCH_ALLOC_FINI( l, 1UL );
if( FD_UNLIKELY( scratch_top > (ulong)scratch + scratch_footprint( tile ) ) )
Expand Down
3 changes: 2 additions & 1 deletion src/flamenco/gossip/fd_crds.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define HEADER_fd_src_flamenco_gossip_fd_crds_h

#include "../../util/fd_util.h"
#include "../../util/net/fd_net_headers.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed by the header, only add include to the .h file if the header uses it, this should be in the .c

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both headers are needed here for types (fd_rng_t and fd_ip4_port_t respectively)


struct fd_crds_value_private;
typedef struct fd_crds_value_private fd_crds_value_t;
Expand Down Expand Up @@ -101,7 +102,7 @@ fd_crds_release( fd_crds_t * crds,
/* fd_crds_upserts checks if inserting the value into the CRDS would
succeed. An insert will fail if the value is already present in the
CRDS with a newer timestamp, or if the value is not present. */

int
fd_crds_upserts( fd_crds_t * crds,
fd_crds_value_t * value );

Expand Down
60 changes: 60 additions & 0 deletions src/flamenco/gossip/fd_crds_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,65 @@
#define HEADER_fd_src_flamenco_gossip_fd_crds_value_h

#include "../../util/fd_util.h"
#include "../../util/net/fd_net_headers.h"

#define FD_GOSSIP_CONTACT_INFO_SOCKET_GOSSIP ( 0)
#define FD_GOSSIP_CONTACT_INFO_SOCKET_SERVE_REPAIR_QUIC ( 1)
#define FD_GOSSIP_CONTACT_INFO_SOCKET_RPC ( 2)
#define FD_GOSSIP_CONTACT_INFO_SOCKET_RPC_PUBSUB ( 3)
#define FD_GOSSIP_CONTACT_INFO_SOCKET_SERVE_REPAIR ( 4)
#define FD_GOSSIP_CONTACT_INFO_SOCKET_TPU ( 5)
#define FD_GOSSIP_CONTACT_INFO_SOCKET_TPU_FORWARDS ( 6)
#define FD_GOSSIP_CONTACT_INFO_SOCKET_TPU_FORWARDS_QUIC ( 7)
#define FD_GOSSIP_CONTACT_INFO_SOCKET_TPU_QUIC ( 8)
#define FD_GOSSIP_CONTACT_INFO_SOCKET_TPU_VOTE ( 9)
#define FD_GOSSIP_CONTACT_INFO_SOCKET_TVU (10)
#define FD_GOSSIP_CONTACT_INFO_SOCKET_TVU_QUIC (11)
#define FD_GOSSIP_CONTACT_INFO_SOCKET_TPU_VOTE_QUIC (12)

#define FD_GOSSIP_CLIENT_SOLANA (0)
#define FD_GOSSIP_CLIENT_JITO (1)
#define FD_GOSSIP_CLIENT_FD (2)
#define FD_GOSSIP_CLIENT_AGAVE (3)

struct fd_gossip_contact_info {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would namespace these,

Suggested change
struct fd_gossip_contact_info {
struct fd_gossip_message_contact_info {

long instance_creation_wallclock_nanos;
ushort shred_version;

struct {
uchar client;

ushort major;
ushort minor;
ushort patch;

int has_commit;
uint commit;
uint feature_set;
} version;

struct {
/* WARNING: in gossip contact info message,
ports are encoded in host form. The parser will
perform the conversion */
fd_ip4_port_t addr;
} sockets[ 13UL ];
};

typedef struct fd_gossip_contact_info fd_gossip_contact_info_t;

struct fd_gossip_vote {
ulong slot;
uchar vote_tower_index;
uchar txn[ 1232UL ];
};

typedef struct fd_gossip_vote fd_gossip_vote_t;

struct fd_gossip_crds_value {
uchar signature[ 64UL ];
// fd_gossip_crds_data_t data[ ];
};
typedef struct fd_gossip_crds_value fd_gossip_crds_value_t;

#endif /* HEADER_fd_src_flamenco_gossip_fd_crds_value_h */
Loading
Loading