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

Conversation

ravyu-jump
Copy link
Contributor

  • 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

@ravyu-jump ravyu-jump changed the title WIP: gossip2 branch WIP: changes to merge gossip2 branch May 16, 2025
@@ -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)


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;
Copy link
Contributor

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 );
Copy link
Contributor

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 {
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 {

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,
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants