-
Notifications
You must be signed in to change notification settings - Fork 258
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
base: mmcgee/gossip2
Are you sure you want to change the base?
Conversation
ravyu-jump
commented
May 16, 2025
- setup type defs and fn defintions for parsing
- parsers for ping and pong
- progress
- rx ping/pong, tx ping, ping/pong serializers, helper functions, coalesce ping and pong into one type
src/flamenco/gossip/fd_crds_value.h
Outdated
} version; | ||
|
||
struct { | ||
/* WARNING: in gossip contact info message, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not useful comment, fd_ip4_port_t is clearly host order
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fd_ip4_port_t is clearly host order
The fd_ip4_port_t
type def has comments saying network order
src/flamenco/gossip/fd_crds_value.h
Outdated
|
||
struct fd_gossip_crds_vote { | ||
ulong slot; | ||
uchar vote_tower_index; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this already stored in the key? vote_index
?
Assumes both token and hash are the starting address of a 32byte region of | ||
memory */ | ||
void | ||
fd_ping_tracker_hash_ping_token( uchar * hash, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits: would flip the argument order, and name out_hash
, out args are usually last by convention
void | ||
fd_ping_tracker_hash_ping_token( uchar * hash, | ||
uchar const * token ) { | ||
fd_sha256_t sha[1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably needs a ping_tracker const * ping_tracker
arg, and to use ping_tracker->sha
fd_gossip_tile_ctx_t * gossip_ctx = (fd_gossip_tile_ctx_t *)ctx; | ||
|
||
ulong packet_sz = payload_sz + sizeof(fd_ip4_udp_hdrs_t); | ||
gossip_ctx->net_out->chunk = fd_dcache_compact_next( gossip_ctx->net_out->chunk, packet_sz, gossip_ctx->net_out->chunk0, gossip_ctx->net_out->wmark ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do this at the end after fd_stem_publish
(by convention, incase we return early etc)
/* TODO: ip4 net_id? */ | ||
|
||
/* Inject payload */ | ||
fd_memcpy( packet + sizeof(fd_ip4_udp_hdrs_t), payload, payload_sz ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not good. Payload should already be constructed in the right place.
|
||
/* Publish fragment */ | ||
ulong tspub = fd_frag_meta_ts_comp( fd_tickcount() ); | ||
ulong sig = fd_disco_netmux_sig( peer_address->addr, peer_address->port, peer_address->addr, DST_PROTO_OUTGOING, sizeof(fd_ip4_udp_hdrs_t) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last arg is ignored, should probably be set to 0.
src/flamenco/gossip/fd_crds_value.h
Outdated
|
||
FD_PROTOTYPES_BEGIN | ||
long | ||
fd_crds_value_wallclock( fd_crds_value_t const * value ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these functions needed? Looks like it's trivial to access the value
src/flamenco/gossip/fd_gossip_msg.c
Outdated
#include "fd_gossip_msg.h" | ||
#include "fd_gossip_types.h" | ||
void | ||
fd_gossip_msg_init( fd_gossip_message_t * msg ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? Should never need to call this
@@ -121,6 +144,8 @@ fd_gossip_set_identity( fd_gossip_t * gossip, | |||
periodically rotated, with one new peer entering and one old peer | |||
leaving, based on stake weights. | |||
|
|||
now is the current time in nanoseconds. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dupe comment
src/flamenco/gossip/fd_gossip_msg.h
Outdated
|
||
/* For CRDS composites, this holds information about the CRDS values necessary | ||
to perform an insertion into the CRDS and signature verification */ | ||
ulong crds_cnt; /* number of CRDS values in the message, if any */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a bit confused. Why are the CRDS lifted out from the union to the parent type here? A ping/pong does not have CRDS.
src/flamenco/gossip/fd_crds.c
Outdated
|
||
/* value data ... */ | ||
/* Pool fields. Not in use when pool element is acquired */ | ||
ulong pool_next; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ulong pool_next; | |
struct { | |
ulong next; | |
} pool; | |
ulong num_duplicates; |
src/flamenco/gossip/fd_crds.c
Outdated
lookup_map_t * lookup_map; | ||
evict_treap_t * evict_treap; | ||
staked_expire_dlist_t * staked_expire_dlist; | ||
unstaked_expire_dlist_t *unstaked_expire_dlist; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unstaked_expire_dlist_t *unstaked_expire_dlist; | |
unstaked_expire_dlist_t * unstaked_expire_dlist; |
fd_crds_acquire( fd_crds_t * crds ) { | ||
if( FD_UNLIKELY( !crds_pool_free( crds->pool )==0UL ) ) { | ||
evict_treap_fwd_iter_t head = evict_treap_fwd_iter_init( crds->evict_treap ); | ||
if( FD_UNLIKELY( crds_pool_free( crds->pool )==0UL ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if( FD_UNLIKELY( crds_pool_free( crds->pool )==0UL ) ) { | |
if( FD_UNLIKELY( !crds_pool_free( crds->pool ) ) ) { |
if( FD_LIKELY( candidate->wallclock>value->wallclock ) ) return 1; | ||
else if( FD_LIKELY( candidate->wallclock<value->wallclock ) ) return 0; | ||
if( FD_UNLIKELY( cand_wc>val_wc ) ) return 1; | ||
else if( FD_UNLIKELY( cand_wc<val_wc ) ) return 0; | ||
else return !!candidate->hash.hash<value->hash.hash; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else return !!candidate->hash.hash<value->hash.hash; | |
else return !!(candidate->hash.hash<value->hash.hash); |
FD_FN_CONST ulong | ||
fd_crds_align( void ); | ||
|
||
FD_FN_CONST ulong | ||
fd_crds_footprint( ulong ele_max ); | ||
fd_crds_footprint( ulong ele_max, ulong purged_max ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fd_crds_footprint( ulong ele_max, ulong purged_max ); | |
fd_crds_footprint( ulong ele_max, | |
ulong purged_max ); |