-
Notifications
You must be signed in to change notification settings - Fork 253
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
@@ -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" |
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 needed by the header, only add include to the .h file if the header uses it, this should be in the .c
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.
both headers are needed here for types (fd_rng_t
and fd_ip4_port_t
respectively)
|
||
static int | ||
rx_prune( fd_gossip_t * gossip, | ||
fd_gossip_prune_t const * prune, | ||
long now ) { | ||
if( FD_UNLIKELY( now-500L*1000L*1000L>prune->data->wallclock ) ) return FD_GOSSIP_RX_ERR_PRUNE_TIMEOUT; | ||
else if( FD_UNLIKELY( !memcmp( gossip->identity_pubkey, prune->data->destination, 32UL ) ) ) return FD_GOSSIP_RX_ERR_PRUNE_DESTINATION; | ||
if( FD_UNLIKELY( now-500L*1000L*1000L>(long)prune->wallclock ) ) return FD_GOSSIP_RX_PRUNE_ERR_TIMEOUT; |
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.
prune wallclock should already be a long, and unitize to nanos, I'd rename wallclock_nanos
&peer_pubkey, | ||
&peer_address, | ||
&ping_token ) ) { | ||
fd_gossip_message_t * message = new_outgoing( gossip ); |
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.
No need to construct this message, this is just additional copies, you can serialize directly from the components.
#define FD_GOSSIP_CLIENT_FD (2) | ||
#define FD_GOSSIP_CLIENT_AGAVE (3) | ||
|
||
struct fd_gossip_contact_info { |
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 would namespace these,
struct fd_gossip_contact_info { | |
struct fd_gossip_message_contact_info { |
fd_ping_tracker_hash_ping_token( ping->token, message->piong->hash ); | ||
gossip->sign_fn( gossip->sign_ctx, message->piong->hash, 32UL, message->piong->signature ); | ||
|
||
fd_ping_tracker_track( gossip->ping_tracker, |
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.
No need to call track here, we are just responding to someone else. Also don't do the memcpys, just serialize directly into buffer.